mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-01 11:59:26 +00:00
(svn r20908) -Fix [FS#4156]: assertion when the buy menu graphics callback accessed a variable that needs a tile index
This commit is contained in:
parent
969e3a9e45
commit
322e4ab86f
@ -241,6 +241,7 @@ static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byt
|
|||||||
/* Allow these, but find the closest town. */
|
/* Allow these, but find the closest town. */
|
||||||
case 0x45:
|
case 0x45:
|
||||||
case 0x46:
|
case 0x46:
|
||||||
|
if (!IsValidTile(tile)) goto unhandled;
|
||||||
t = ClosestTownFromTile(tile, UINT_MAX);
|
t = ClosestTownFromTile(tile, UINT_MAX);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -257,11 +258,11 @@ static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byt
|
|||||||
* 0x63: Animation counter of nearby tile, see above.
|
* 0x63: Animation counter of nearby tile, see above.
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
DEBUG(grf, 1, "Unhandled object property 0x%X", variable);
|
goto unhandled;
|
||||||
|
|
||||||
*available = false;
|
|
||||||
return UINT_MAX;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If there's an invalid tile, then we don't have enough information at all. */
|
||||||
|
if (!IsValidTile(tile)) goto unhandled;
|
||||||
} else {
|
} else {
|
||||||
t = o->town;
|
t = o->town;
|
||||||
}
|
}
|
||||||
@ -313,6 +314,7 @@ static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byt
|
|||||||
case 0x64: return GetCountAndDistanceOfClosestInstance(parameter, object->grffile->grfid, tile, o);
|
case 0x64: return GetCountAndDistanceOfClosestInstance(parameter, object->grffile->grfid, tile, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unhandled:
|
||||||
DEBUG(grf, 1, "Unhandled object property 0x%X", variable);
|
DEBUG(grf, 1, "Unhandled object property 0x%X", variable);
|
||||||
|
|
||||||
*available = false;
|
*available = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user