1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

- fixed uninitialized access into modHander

- fixed  
This commit is contained in:
Ivan Savenko 2013-04-28 15:06:14 +00:00
parent 9776fa9f18
commit b20f8fd3d4
6 changed files with 12 additions and 6 deletions

@ -5254,7 +5254,7 @@ CPuzzleWindow::CPuzzleWindow(const int3 &GrailPos, double discoveredRatio):
auto piece = new CPicture(info.filename, info.x, info.y);
//piece that will slowly disappear
if(info.whenUncovered < GameConstants::PUZZLE_MAP_PIECES * discoveredRatio)
if(info.whenUncovered <= GameConstants::PUZZLE_MAP_PIECES * discoveredRatio)
{
piecesToRemove.push_back(piece);
piece->needRefresh = true;

@ -954,13 +954,13 @@ void CGameState::init(StartInfo * si)
if(!map->grailRadious) //radius not given -> anywhere on map
map->grailRadious = map->width * 2;
std::vector<int3> allowedPos;
static const int BORDER_WIDTH = 9; // grail must be at least 9 tiles away from border
// add all not blocked tiles in range
for (int i = 0; i < map->width ; i++)
for (int i = BORDER_WIDTH; i < map->width - BORDER_WIDTH ; i++)
{
for (int j = 0; j < map->height ; j++)
for (int j = BORDER_WIDTH; j < map->height - BORDER_WIDTH; j++)
{
for (int k = 0; k < (map->twoLevel ? 2 : 1); k++)
{

@ -511,10 +511,13 @@ void CModHandler::handleData(Handler handler, const JsonNode & source, std::stri
}
}
void CModHandler::loadGameContent()
void CModHandler::beforeLoad()
{
loadConfigFromFile("defaultMods.json");
}
void CModHandler::loadGameContent()
{
CStopWatch timer, totalTime;
CContentHandler content;

@ -169,6 +169,7 @@ public:
CModInfo & getModData(TModID modId);
/// load content from all available mods
void beforeLoad();
void loadGameContent();
/// actions that should be triggered on map restart

@ -91,6 +91,8 @@ void LibClasses::init()
{
CStopWatch pomtime, totalTime;
modh->beforeLoad();
createHandler(bth, "Bonus type", pomtime);
createHandler(generaltexth, "General text", pomtime);

@ -148,7 +148,7 @@ CMapHeader::~CMapHeader()
}
CMap::CMap() : checksum(0), grailRadious(0), terrain(nullptr)
CMap::CMap() : checksum(0), grailPos(-1, -1, -1), grailRadious(0), terrain(nullptr)
{
allowedAbilities = VLC->heroh->getDefaultAllowedAbilities();
allowedArtifact = VLC->arth->getDefaultAllowed();