mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
First part of support for victory & loss conditions.
Implemented and tested are victory: Defeat hero Capture town Defeat monster Flag dwellings Flag mines Lose: Loss hero Time expire ** Some others may work but not has been tested yet. I've added a new page in VCMI Status spreadsheet with status of various victory/loss conditions.
This commit is contained in:
@@ -219,6 +219,12 @@ DLL_EXPORT void ChangeObjPos::applyGs( CGameState *gs )
|
||||
gs->map->addBlockVisTiles(obj);
|
||||
}
|
||||
|
||||
DLL_EXPORT void PlayerEndsGame::applyGs( CGameState *gs )
|
||||
{
|
||||
PlayerState *p = gs->getPlayer(player);
|
||||
p->status = victory ? 2 : 1;
|
||||
}
|
||||
|
||||
DLL_EXPORT void RemoveObject::applyGs( CGameState *gs )
|
||||
{
|
||||
CGObjectInstance *obj = gs->map->objects[id];
|
||||
@@ -230,6 +236,8 @@ DLL_EXPORT void RemoveObject::applyGs( CGameState *gs )
|
||||
int player = h->tempOwner;
|
||||
nitr = std::find(gs->getPlayer(player)->heroes.begin(), gs->getPlayer(player)->heroes.end(), h);
|
||||
gs->getPlayer(player)->heroes.erase(nitr);
|
||||
h->tempOwner = 255; //no one owns beaten hero
|
||||
|
||||
if(h->visitedTown)
|
||||
{
|
||||
if(h->inTownGarrison)
|
||||
|
||||
Reference in New Issue
Block a user