Add ugly workaround for buggy maps created by the map editor, where the number of terrain
are apparently larger than the maximum. Reported by gronlund on IRC. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5836 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
ebecb854b1
commit
1f806cbb2e
12
src/game.c
12
src/game.c
|
@ -9519,15 +9519,13 @@ BOOL loadTerrainTypeMap(const char *pFileData, UDWORD filesize)
|
|||
// Load the terrain type mapping
|
||||
pType = (UWORD *)(pFileData + TILETYPE_HEADER_SIZE);
|
||||
endian_uword(pType);
|
||||
if (psHeader->quantity >= MAX_TILE_TEXTURES)
|
||||
{
|
||||
// Workaround for fugly map editor bug, since we can't fix the map editor
|
||||
psHeader->quantity = MAX_TILE_TEXTURES - 1;
|
||||
}
|
||||
for(i = 0; i < psHeader->quantity; i++)
|
||||
{
|
||||
if (i >= MAX_TILE_TEXTURES)
|
||||
{
|
||||
debug( LOG_ERROR, "loadTerrainTypeMap: too many types" );
|
||||
abort();
|
||||
return false;
|
||||
|
||||
}
|
||||
if (*pType > TER_MAX)
|
||||
{
|
||||
debug( LOG_ERROR, "loadTerrainTypeMap: terrain type out of range" );
|
||||
|
|
Loading…
Reference in New Issue