Changeset - r1776:9e87ba31e2cb
[Not reviewed]
master
0 1 0
Darkvater - 19 years ago 2005-05-07 10:26:45
darkvater@openttd.org
(svn r2280) - Fix: Check if the passed tile to DoCommand is within the current mapsize
1 file changed with 7 insertions and 0 deletions:
0 comments (0 inline, 0 general)
command.c
Show inline comments
 
@@ -177,6 +177,7 @@ static CommandProc * const _command_proc
 
	CmdBuildSingleSignal,					/* 8  */
 
	CmdRemoveSingleSignal,				/* 9  */
 
	CmdTerraformLand,							/* 10 */
 
	/***************************************************/
 
	CmdPurchaseLandArea,					/* 11 */
 
	CmdSellLandArea,							/* 12 */
 
	CmdBuildTunnel,								/* 13 */
 
@@ -331,6 +332,9 @@ int32 DoCommand(int x, int y, uint32 p1,
 
	int32 res;
 
	CommandProc *proc;
 

	
 
	/* Do not even think about executing out-of-bounds tile-commands */
 
	if (TILE_FROM_XY(x,y) > MapSize()) return CMD_ERROR;
 

	
 
	proc = _command_proc_table[procc];
 

	
 
	if (_docommand_recursive == 0) {
 
@@ -399,6 +403,9 @@ bool DoCommandP(TileIndex tile, uint32 p
 
	int x = TileX(tile) * 16;
 
	int y = TileY(tile) * 16;
 

	
 
	/* Do not even think about executing out-of-bounds tile-commands */
 
	if (tile > MapSize()) return false;
 

	
 
	assert(_docommand_recursive == 0);
 

	
 
	_error_message = INVALID_STRING_ID;
0 comments (0 inline, 0 general)