1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-21 00:19:29 +02:00

Refactoring of hoverText from objects:

- removed hoverText field
- split getHoverText() method into 3:
- - getObjectName() for generic name
- - getHoverText(Player) for player-specific text
- - getHoverText(Hero) for hero-specific strings
This commit is contained in:
Ivan Savenko
2014-06-24 20:39:36 +03:00
parent ad632d1e8a
commit a0689fa377
37 changed files with 212 additions and 251 deletions

View File

@ -302,7 +302,7 @@ DLL_LINKAGE void RemoveObject::applyGs( CGameState *gs )
{
CGObjectInstance *obj = gs->getObjInstance(id);
logGlobal->debugStream() << "removing object id=" << id << "; address=" << (intptr_t)obj << "; name=" << obj->getHoverText();
logGlobal->debugStream() << "removing object id=" << id << "; address=" << (intptr_t)obj << "; name=" << obj->getObjectName();
//unblock tiles
gs->map->removeBlockVisTiles(obj);
@ -608,14 +608,13 @@ DLL_LINKAGE void NewObject::applyGs( CGameState *gs )
const TerrainTile &t = gs->map->getTile(pos);
o->appearance = VLC->objtypeh->getHandlerFor(o->ID, o->subID)->getTemplates(t.terType).front();
id = o->id = ObjectInstanceID(gs->map->objects.size());
o->hoverName = VLC->objtypeh->getObjectName(ID);
gs->map->objects.push_back(o);
gs->map->addBlockVisTiles(o);
o->initObj();
gs->map->calculateGuardingGreaturePositions();
logGlobal->debugStream() << "added object id=" << id << "; address=" << (intptr_t)o << "; name=" << o->getHoverText();
logGlobal->debugStream() << "added object id=" << id << "; address=" << (intptr_t)o << "; name=" << o->getObjectName();
}
DLL_LINKAGE void NewArtifact::applyGs( CGameState *gs )
@ -1012,11 +1011,6 @@ DLL_LINKAGE void SetObjectProperty::applyGs( CGameState *gs )
}
}
DLL_LINKAGE void SetHoverName::applyGs( CGameState *gs )
{
name.toString(gs->getObj(id)->hoverName);
}
DLL_LINKAGE void HeroLevelUp::applyGs( CGameState *gs )
{
CGHeroInstance * h = gs->getHero(hero->id);