Fix platv values outside map size being saved as 67372036

If the map size was less than 20x20, platv values outside the map would
end up being saved as 67372036.

This happens because SDL_memset() operates on the byte level, and not
the multi-byte level. So it takes only the lower 8 bits of 4 and repeats
it for each byte in each integer, creating 67372036.
This commit is contained in:
Misa 2021-09-10 16:55:27 -07:00
parent 07bbc5b2de
commit 6f499abef0
1 changed files with 4 additions and 1 deletions

View File

@ -1366,7 +1366,10 @@ bool customlevelclass::save(const std::string& _path)
msg = xml::update_element_delete_contents(data, "levelMetaData");
int temp_platv[numrooms];
SDL_memset(temp_platv, 4 /* default */, sizeof(temp_platv));
for (size_t i = 0; i < SDL_arraysize(temp_platv); ++i)
{
temp_platv[i] = 4; /* default */
}
if (mapwidth < maxwidth)
{