1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

* Probably fixed #655.

* Fixed #736, #737.
* Fixed crash on loss/victory.
* Fixed crash on loading some AB maps.
* Fixed crash on loading map where victory/loss condition objective hero was placed inside the town.
* Fixed crash on loading map when neutral Dungeon has built Portal of Summoning.
* Mutex protecting GS will be used to prevent changes in GS when GUI might read it.
* Little more securities around moving hero and ending turn, still needed more.
This commit is contained in:
Michał W. Urbańczyk
2011-05-29 23:49:25 +00:00
parent 936005aa1c
commit 2d61fab7e9
13 changed files with 109 additions and 43 deletions

View File

@@ -769,6 +769,12 @@ static bool evntCmp(const CMapEvent *a, const CMapEvent *b)
void CGameHandler::setPortalDwelling(const CGTownInstance * town, bool forced=false, bool clear = false)
{// bool forced = true - if creature should be replaced, if false - only if no creature was set
const PlayerState *p = gs->getPlayer(town->tempOwner);
if(!p)
{
tlog3 << "There is no player owner of town " << town->name << " at " << town->pos << std::endl;
return;
}
if (forced || town->creatures[CREATURES_PER_TOWN].second.empty())//we need to change creature
{
@@ -777,7 +783,7 @@ void CGameHandler::setPortalDwelling(const CGTownInstance * town, bool forced=fa
ssi.creatures = town->creatures;
ssi.creatures[CREATURES_PER_TOWN].second.clear();//remove old one
const std::vector<ConstTransitivePtr<CGDwelling> > &dwellings = gs->getPlayer(town->tempOwner)->dwellings;
const std::vector<ConstTransitivePtr<CGDwelling> > &dwellings = p->dwellings;
if (dwellings.empty())//no dwellings - just remove
{
sendAndApply(&ssi);