mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fixed crash on the new month when there are no creatures that can get double growth. (#1219, possibly #1217)
The list of double growth creatures will be serialized. Bumped format. MSVC: silenced that stupid C4275 warning. (senseless when using STL)
This commit is contained in:
@@ -12,6 +12,9 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
</Link>
|
</Link>
|
||||||
|
<ClCompile>
|
||||||
|
<DisableSpecificWarnings>4275</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
</Project>
|
</Project>
|
@@ -176,7 +176,7 @@ public:
|
|||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
//TODO: should be optimized, not all these informations needs to be serialized (same for ccreature)
|
//TODO: should be optimized, not all these informations needs to be serialized (same for ccreature)
|
||||||
h & notUsedMonsters & creatures;
|
h & notUsedMonsters & doubledCreatures & creatures;
|
||||||
h & stackBonuses & expRanks & maxExpPerBattle & expAfterUpgrade;
|
h & stackBonuses & expRanks & maxExpPerBattle & expAfterUpgrade;
|
||||||
h & skillLevels & skillRequirements & commanderLevelPremy;
|
h & skillLevels & skillRequirements & commanderLevelPremy;
|
||||||
h & allCreatures;
|
h & allCreatures;
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include "CObjectHandler.h" //for CArmedInstance
|
#include "CObjectHandler.h" //for CArmedInstance
|
||||||
#include "Mapping/CCampaignHandler.h" //for CCampaignState
|
#include "Mapping/CCampaignHandler.h" //for CCampaignState
|
||||||
|
|
||||||
const ui32 version = 738;
|
const ui32 version = 739;
|
||||||
|
|
||||||
class CConnection;
|
class CConnection;
|
||||||
class CGObjectInstance;
|
class CGObjectInstance;
|
||||||
|
@@ -1209,12 +1209,17 @@ void CGameHandler::newTurn()
|
|||||||
std::pair<int,CreatureID> newMonster(54, VLC->creh->pickRandomMonster(boost::ref(rand)));
|
std::pair<int,CreatureID> newMonster(54, VLC->creh->pickRandomMonster(boost::ref(rand)));
|
||||||
n.creatureid = newMonster.second;
|
n.creatureid = newMonster.second;
|
||||||
}
|
}
|
||||||
else
|
else if(VLC->creh->doubledCreatures.size())
|
||||||
{
|
{
|
||||||
auto it = VLC->creh->doubledCreatures.cbegin();
|
auto it = VLC->creh->doubledCreatures.cbegin();
|
||||||
std::advance (it, rand() % VLC->creh->doubledCreatures.size()); //picking random element of set is tiring
|
std::advance (it, rand() % VLC->creh->doubledCreatures.size()); //picking random element of set is tiring
|
||||||
n.creatureid = *it;
|
n.creatureid = *it;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
complain("Cannot find creature that can be spawned!");
|
||||||
|
n.specialWeek = NewTurn::NORMAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (monthType < 50)
|
else if (monthType < 50)
|
||||||
n.specialWeek = NewTurn::PLAGUE;
|
n.specialWeek = NewTurn::PLAGUE;
|
||||||
|
Reference in New Issue
Block a user