mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
Workaround for hero & town issue. Game still crashes elsewhere, though.
This commit is contained in:
@ -23,8 +23,8 @@ void CMapGenerator::foreach_neighbour(const int3 &pos, std::function<void(int3&
|
||||
}
|
||||
|
||||
|
||||
CMapGenerator::CMapGenerator(shared_ptr<CMapGenOptions> mapGenOptions, int randomSeed /*= std::time(nullptr)*/) :
|
||||
mapGenOptions(mapGenOptions), randomSeed(randomSeed), monolithIndex(0)
|
||||
CMapGenerator::CMapGenerator(shared_ptr<CMapGenOptions> mapGenOptions, int RandomSeed /*= std::time(nullptr)*/) :
|
||||
mapGenOptions(mapGenOptions), randomSeed(RandomSeed), monolithIndex(0)
|
||||
{
|
||||
rand.setSeed(randomSeed);
|
||||
}
|
||||
@ -50,12 +50,13 @@ void CMapGenerator::initTiles()
|
||||
|
||||
CMapGenerator::~CMapGenerator()
|
||||
{
|
||||
//FIXME: what if map is not present anymore?
|
||||
if (tiles && map)
|
||||
if (tiles)
|
||||
{
|
||||
for (int i=0; i < map->width; i++)
|
||||
int width = mapGenOptions->getWidth();
|
||||
int height = mapGenOptions->getHeight();
|
||||
for (int i=0; i < width; i++)
|
||||
{
|
||||
for(int j=0; j < map->height; j++)
|
||||
for(int j=0; j < height; j++)
|
||||
{
|
||||
delete [] tiles[i][j];
|
||||
}
|
||||
@ -80,6 +81,7 @@ std::unique_ptr<CMap> CMapGenerator::generate()
|
||||
genZones();
|
||||
map->calculateGuardingGreaturePositions(); //clear map so that all tiles are unguarded
|
||||
fillZones();
|
||||
//updated fuarded tiles will be calculated in CGameState::initMapObjects()
|
||||
}
|
||||
catch (rmgException &e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user