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

Fixed crash on casting spell. Fixed giving resources from towns. Version set to 0.74c. Incremented save format version.

Disabled adventure AI. Will be released as dev build.
This commit is contained in:
Michał W. Urbańczyk
2009-11-28 01:42:08 +00:00
parent 82faf7538e
commit 7f97a56a28
8 changed files with 95 additions and 85 deletions

View File

@ -42,12 +42,12 @@ DLL_EXPORT void SetResource::applyGs( CGameState *gs )
gs->getPlayer(player)->resources[resid] = val;
}
DLL_EXPORT void SetResources::applyGs( CGameState *gs )
{
assert(player < PLAYER_LIMIT);
for(int i=0;i<res.size();i++)
gs->getPlayer(player)->resources[i] = res[i];
}
DLL_EXPORT void SetResources::applyGs( CGameState *gs )
{
assert(player < PLAYER_LIMIT);
for(int i=0;i<res.size();i++)
gs->getPlayer(player)->resources[i] = res[i];
}
DLL_EXPORT void SetPrimSkill::applyGs( CGameState *gs )
{
@ -546,8 +546,13 @@ DLL_EXPORT void NewTurn::applyGs( CGameState *gs )
hero->mana = h.mana;
}
BOOST_FOREACH(SetResources h, res) //give resources
h.applyGs(gs);
for(std::map<ui8, std::vector<si32> >::iterator i = res.begin(); i != res.end(); i++)
{
assert(i->first < PLAYER_LIMIT);
std::vector<si32> &playerRes = gs->getPlayer(i->first)->resources;
for(int j = 0; j < i->second.size(); j++)
playerRes[j] = i->second[j];
}
BOOST_FOREACH(SetAvailableCreatures h, cres) //set available creatures in towns
h.applyGs(gs);
@ -748,7 +753,8 @@ DLL_EXPORT void StartAction::applyGs( CGameState *gs )
break;
}
st->state -= WAITING; //if stack was waiting it has made move, so it won't be "waiting" anymore (if the action was WAIT, then we have returned)
if(st)
st->state -= WAITING; //if stack was waiting it has made move, so it won't be "waiting" anymore (if the action was WAIT, then we have returned)
}
DLL_EXPORT void SpellCast::applyGs( CGameState *gs )