1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Added range checks to values read from h3m.

Fixes reading of morale/luck values (-3..3) as unsigned leading to
overflow.
This commit is contained in:
Ivan Savenko
2024-02-05 21:27:55 +02:00
parent 4af4d1a75e
commit 87059be67b
13 changed files with 154 additions and 141 deletions

View File

@@ -177,7 +177,7 @@ void RandomMapTab::updateMapInfoByHost()
mapInfo->mapHeader->version = EMapFormat::VCMI;
mapInfo->mapHeader->name.appendLocalString(EMetaText::GENERAL_TXT, 740);
mapInfo->mapHeader->description.appendLocalString(EMetaText::GENERAL_TXT, 741);
mapInfo->mapHeader->difficulty = 1; // Normal
mapInfo->mapHeader->difficulty = EMapDifficulty::NORMAL;
mapInfo->mapHeader->height = mapGenOptions->getHeight();
mapInfo->mapHeader->width = mapGenOptions->getWidth();
mapInfo->mapHeader->twoLevel = mapGenOptions->getHasTwoLevels();