mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Heroes will be properly marked as visited on visiting
This commit is contained in:
@@ -251,9 +251,9 @@ DLL_LINKAGE void GiveBonus::applyGs( CGameState *gs )
|
||||
{
|
||||
bdescr.toString(descr);
|
||||
}
|
||||
// Some of(?) versions of H3 use %s here instead of %d. Try to replace both of them
|
||||
boost::replace_first(descr,"%d",boost::lexical_cast<std::string>(std::abs(bonus.val)));
|
||||
boost::replace_first(descr,"%s",boost::lexical_cast<std::string>(std::abs(bonus.val)));
|
||||
// Some of(?) versions of H3 use %s here instead of %d. Try to replace both of them
|
||||
boost::replace_first(descr,"%d",boost::lexical_cast<std::string>(std::abs(bonus.val)));
|
||||
boost::replace_first(descr,"%s",boost::lexical_cast<std::string>(std::abs(bonus.val)));
|
||||
}
|
||||
|
||||
DLL_LINKAGE void ChangeObjPos::applyGs( CGameState *gs )
|
||||
@@ -269,6 +269,23 @@ DLL_LINKAGE void ChangeObjPos::applyGs( CGameState *gs )
|
||||
gs->map->addBlockVisTiles(obj);
|
||||
}
|
||||
|
||||
DLL_LINKAGE void ChangeObjectVisitors::applyGs( CGameState *gs )
|
||||
{
|
||||
switch (mode) {
|
||||
case VISITOR_ADD:
|
||||
gs->getHero(hero)->visitedObjects.insert(object);
|
||||
gs->getPlayer(gs->getHero(hero)->tempOwner)->visitedObjects.insert(object);
|
||||
break;
|
||||
case VISITOR_CLEAR:
|
||||
for (CGHeroInstance * hero : gs->map->allHeroes)
|
||||
hero->visitedObjects.erase(object); // remove visit info from all heroes, including those that are not present on map
|
||||
break;
|
||||
case VISITOR_REMOVE:
|
||||
gs->getHero(hero)->visitedObjects.erase(object);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DLL_LINKAGE void PlayerEndsGame::applyGs( CGameState *gs )
|
||||
{
|
||||
PlayerState *p = gs->getPlayer(player);
|
||||
|
||||
Reference in New Issue
Block a user