Heroes will be properly marked as visited on visiting

This commit is contained in:
Ivan Savenko committed 2014-04-07 20:32:15 +03:00
1 parent 8beea4ec6a
commit dab9fd7148
3 files changed
+64 -24

No files matched your search

+20 -3
View File
@@ -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);