File diff r7741:93702189eccf → r7742:13aaf7ce450a
src/misc_cmd.cpp
Show inline comments
 
@@ -371,25 +371,25 @@ CommandCost CmdGiveMoney(TileIndex tile,
 
 * @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();