1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

- fixed uninitialized pointer

This commit is contained in:
Ivan Savenko 2013-04-21 14:08:46 +00:00
parent c6cc6e6301
commit 2ea1051395
2 changed files with 33 additions and 0 deletions

View File

@ -56,6 +56,30 @@ si32 CBuilding::getDistance(BuildingID buildID) const
return -1;
}
CFaction::CFaction()
{
}
CFaction::~CFaction()
{
delete town;
}
CTown::CTown()
{
}
CTown::~CTown()
{
BOOST_FOREACH(auto build, buildings)
build.second.dellNull();
BOOST_FOREACH(CStructure * str, clientInfo.structures)
delete str;
}
CTownHandler::CTownHandler()
{
VLC->townh = this;
@ -554,6 +578,9 @@ CFaction * CTownHandler::loadFromJson(const JsonNode &source)
faction->town->faction = faction;
loadTown(*faction->town, source["town"]);
}
else
faction->town = nullptr;
if (!source["puzzleMap"].isNull())
loadPuzzle(*faction, source["puzzleMap"]);

View File

@ -97,6 +97,9 @@ struct DLL_LINKAGE SPuzzleInfo
class CFaction
{
public:
CFaction();
~CFaction();
std::string name; //town name, by default - from TownName.txt
TFaction index;
@ -122,6 +125,9 @@ public:
class DLL_LINKAGE CTown
{
public:
CTown();
~CTown();
CFaction * faction;
std::vector<std::string> names; //names of the town instances