Fix wmMapIdxToName

This commit is contained in:
Alexander Batalov 2022-12-09 00:52:03 +03:00
parent 6de4ac87df
commit b0b69bd780
3 changed files with 4 additions and 4 deletions

View File

@ -799,7 +799,7 @@ int mapLoadById(int map)
scriptSetFixedParam(gMapSid, map);
char name[16];
if (wmMapIdxToName(map, name) == -1) {
if (wmMapIdxToName(map, name, sizeof(name)) == -1) {
return -1;
}

View File

@ -2761,14 +2761,14 @@ int wmMapMaxCount()
}
// 0x4BF974
int wmMapIdxToName(int mapIdx, char* dest)
int wmMapIdxToName(int mapIdx, char* dest, size_t size)
{
if (mapIdx == -1 || mapIdx > wmMaxMapNum) {
dest[0] = '\0';
return -1;
}
snprintf(dest, sizeof(dest), "%s.MAP", wmMapInfoList[mapIdx].mapFileName);
snprintf(dest, size, "%s.MAP", wmMapInfoList[mapIdx].mapFileName);
return 0;
}

View File

@ -237,7 +237,7 @@ int wmWorldMap_reset();
int wmWorldMap_save(File* stream);
int wmWorldMap_load(File* stream);
int wmMapMaxCount();
int wmMapIdxToName(int mapIdx, char* dest);
int wmMapIdxToName(int mapIdx, char* dest, size_t size);
int wmMapMatchNameToIdx(char* name);
bool wmMapIdxIsSaveable(int mapIdx);
bool wmMapIsSaveable();