File diff r7741:93702189eccf → r7742:13aaf7ce450a
src/misc_cmd.cpp
Show inline comments
 
@@ -359,38 +359,38 @@ CommandCost CmdGiveMoney(TileIndex tile,
 
		SubtractMoneyFromPlayer(CommandCost(-amount.GetCost()));
 
		_current_player = old_cp;
 
	}
 

	
 
	/* Subtract money from local-player */
 
	return amount;
 
}
 

	
 
/** Change difficulty level/settings (server-only).
 
 * We cannot really check for valid values of p2 (too much work mostly); stored
 
 * in file 'settings_gui.c' _game_setting_info[]; we'll just trust the server it knows
 
 * what to do and does this correctly
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 the difficulty setting being changed. If it is -1, the difficulty level
 
 *           itself is changed. The new value is inside p2
 
 * @param p2 new value for a difficulty setting or difficulty level
 
 */
 
CommandCost CmdChangeDifficultyLevel(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 
{
 
	if (p1 != (uint32)-1L && ((int32)p1 >= GAME_DIFFICULTY_NUM || (int32)p1 < 0)) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
		if (p1 != (uint32)-1L) {
 
			((int*)&_opt_ptr->diff)[p1] = p2;
 
			((GDType*)&_opt_ptr->diff)[p1] = p2;
 
			_opt_ptr->diff_level = 3; // custom difficulty level
 
		} else {
 
			_opt_ptr->diff_level = p2;
 
		}
 

	
 
		/* If we are a network-client, update the difficult setting (if it is open).
 
		 * Use this instead of just dirtying the window because we need to load in
 
		 * the new difficulty settings */
 
		if (_networking && !_network_server && FindWindowById(WC_GAME_OPTIONS, 0) != NULL)
 
			ShowGameDifficulty();
 
	}
 
	return CommandCost();
 
}