1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Entities redesign and a few ERM features

* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
This commit is contained in:
AlexVinS
2018-03-17 17:58:30 +03:00
committed by AlexVinS
parent 11bb46780a
commit ecaa9f5d0b
475 changed files with 22491 additions and 7123 deletions

View File

@ -114,9 +114,9 @@ int CTradeWindow::CTradeableItem::getIndex()
case ARTIFACT_TYPE:
case ARTIFACT_INSTANCE:
case ARTIFACT_PLACEHOLDER:
return VLC->arth->artifacts[id]->iconIndex;
return CGI->artifacts()->getByIndex(id)->getIconIndex();
case CREATURE:
return VLC->creh->creatures[id]->iconIndex;
return CGI->creatures()->getByIndex(id)->getIconIndex();
default:
return -1;
}
@ -244,13 +244,13 @@ void CTradeWindow::CTradeableItem::hover(bool on)
{
case CREATURE:
case CREATURE_PLACEHOLDER:
GH.statusbar->setText(boost::str(boost::format(CGI->generaltexth->allTexts[481]) % CGI->creh->creatures[id]->namePl));
GH.statusbar->setText(boost::str(boost::format(CGI->generaltexth->allTexts[481]) % CGI->creh->objects[id]->namePl));
break;
case ARTIFACT_PLACEHOLDER:
if(id < 0)
GH.statusbar->setText(CGI->generaltexth->zelp[582].first);
else
GH.statusbar->setText(CGI->arth->artifacts[id]->Name());
GH.statusbar->setText(CGI->artifacts()->getByIndex(id)->getName());
break;
}
}
@ -263,13 +263,13 @@ void CTradeWindow::CTradeableItem::clickRight(tribool down, bool previousState)
{
case CREATURE:
case CREATURE_PLACEHOLDER:
//GH.statusbar->print(boost::str(boost::format(CGI->generaltexth->allTexts[481]) % CGI->creh->creatures[id]->namePl));
//GH.statusbar->print(boost::str(boost::format(CGI->generaltexth->allTexts[481]) % CGI->creh->objects[id]->namePl));
break;
case ARTIFACT_TYPE:
case ARTIFACT_PLACEHOLDER:
//TODO: it's would be better for market to contain actual CArtifactInstance and not just ids of certain artifact type so we can use getEffectiveDescription.
if(id >= 0)
adventureInt->handleRightClick(CGI->arth->artifacts[id]->Description(), down);
adventureInt->handleRightClick(CGI->artifacts()->getByIndex(id)->getDescription(), down);
break;
}
}
@ -285,14 +285,14 @@ std::string CTradeWindow::CTradeableItem::getName(int number) const
return CGI->generaltexth->restypes[id];
case CREATURE:
if(number == 1)
return CGI->creh->creatures[id]->nameSing;
return CGI->creh->objects[id]->nameSing;
else
return CGI->creh->creatures[id]->namePl;
return CGI->creh->objects[id]->namePl;
case ARTIFACT_TYPE:
case ARTIFACT_INSTANCE:
return CGI->arth->artifacts[id]->Name();
return CGI->artifacts()->getByIndex(id)->getName();
}
assert(0);
logGlobal->error("Invalid trade item type: %d", (int)type);
return "";
}
@ -668,14 +668,14 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket * Market, const CGHeroInsta
switch (mode)
{
case EMarketMode::CREATURE_RESOURCE:
title = CGI->townh->factions[ETownType::STRONGHOLD]->town->buildings[BuildingID::FREELANCERS_GUILD]->Name();
title = (*CGI->townh)[ETownType::STRONGHOLD]->town->buildings[BuildingID::FREELANCERS_GUILD]->Name();
break;
case EMarketMode::RESOURCE_ARTIFACT:
title = CGI->townh->factions[market->o->subID]->town->buildings[BuildingID::ARTIFACT_MERCHANT]->Name();
title = (*CGI->townh)[market->o->subID]->town->buildings[BuildingID::ARTIFACT_MERCHANT]->Name();
sliderNeeded = false;
break;
case EMarketMode::ARTIFACT_RESOURCE:
title = CGI->townh->factions[market->o->subID]->town->buildings[BuildingID::ARTIFACT_MERCHANT]->Name();
title = (*CGI->townh)[market->o->subID]->town->buildings[BuildingID::ARTIFACT_MERCHANT]->Name();
sliderNeeded = false;
break;
default: