src/command.cpp
branchcpp_gui
changeset 6308 646711c5feaa
parent 6307 f40e88cff863
equal deleted inserted replaced
6307:f40e88cff863 6308:646711c5feaa
   405 
   405 
   406 /* toplevel network safe docommand function for the current player. must not be called recursively.
   406 /* toplevel network safe docommand function for the current player. must not be called recursively.
   407  * the callback is called when the command succeeded or failed. */
   407  * the callback is called when the command succeeded or failed. */
   408 bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd)
   408 bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd)
   409 {
   409 {
   410 	int32 res = 0,res2;
   410 	int32 res = 0, res2;
   411 	CommandProc *proc;
   411 	CommandProc *proc;
   412 	uint32 flags;
   412 	uint32 flags;
   413 	bool notest;
   413 	bool notest;
   414 	StringID error_part1;
   414 	StringID error_part1;
   415 
   415 
   542 
   542 
   543 	if (IsLocalPlayer() && _game_mode != GM_EDITOR) {
   543 	if (IsLocalPlayer() && _game_mode != GM_EDITOR) {
   544 		if (res2 != 0) ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
   544 		if (res2 != 0) ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
   545 		if (_additional_cash_required) {
   545 		if (_additional_cash_required) {
   546 			SetDParam(0, _additional_cash_required);
   546 			SetDParam(0, _additional_cash_required);
   547 			ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x,y);
   547 			ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x, y);
   548 			if (res2 == 0) goto callb_err;
   548 			if (res2 == 0) goto callb_err;
   549 		}
   549 		}
   550 	}
   550 	}
   551 
   551 
   552 	_docommand_recursive = 0;
   552 	_docommand_recursive = 0;
   556 	return true;
   556 	return true;
   557 
   557 
   558 show_error:
   558 show_error:
   559 	/* show error message if the command fails? */
   559 	/* show error message if the command fails? */
   560 	if (IsLocalPlayer() && error_part1 != 0) {
   560 	if (IsLocalPlayer() && error_part1 != 0) {
   561 		ShowErrorMessage(_error_message, error_part1, x,y);
   561 		ShowErrorMessage(_error_message, error_part1, x, y);
   562 	}
   562 	}
   563 
   563 
   564 callb_err:
   564 callb_err:
   565 	_docommand_recursive = 0;
   565 	_docommand_recursive = 0;
   566 
   566