misc_cmd.c
changeset 1500 a66721629bc0
parent 1328 eacd8225ed42
child 1728 ea7210a31593
equal deleted inserted replaced
1499:4d141d000000 1500:a66721629bc0
     1 
       
     2 #include "stdafx.h"
     1 #include "stdafx.h"
     3 #include "ttd.h"
     2 #include "ttd.h"
     4 #include "string.h"
     3 #include "string.h"
     5 #include "table/strings.h"
     4 #include "table/strings.h"
     6 #include "command.h"
     5 #include "command.h"
     7 #include "player.h"
     6 #include "player.h"
     8 #include "gfx.h"
     7 #include "gfx.h"
     9 #include "window.h"
     8 #include "window.h"
       
     9 #include "gui.h"
    10 #include "saveload.h"
    10 #include "saveload.h"
    11 #include "economy.h"
    11 #include "economy.h"
    12 #include "network.h"
    12 #include "network.h"
    13 
    13 
    14 /* p1 = player
    14 /* p1 = player
   220 
   220 
   221 int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   221 int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   222 {
   222 {
   223 	if (flags & DC_EXEC) {
   223 	if (flags & DC_EXEC) {
   224 		if (p1 != (uint32)-1L) {
   224 		if (p1 != (uint32)-1L) {
   225 			((int*)&_opt_mod_ptr->diff)[p1] = p2;
   225 			((int*)&_opt_ptr->diff)[p1] = p2;
   226 			_opt_mod_ptr->diff_level = 3;
   226 			_opt_ptr->diff_level = 3;
   227 		} else {
   227 		} else
   228 			_opt_mod_ptr->diff_level = p2;
   228 			_opt_ptr->diff_level = p2;
   229 		}
   229 
   230 		// If we are a network-client, update the difficult setting (if it is open)
   230 		// If we are a network-client, update the difficult setting (if it is open)
   231 		if (_networking && !_network_server && FindWindowById(WC_GAME_OPTIONS, 0) != NULL)
   231 		if (_networking && !_network_server && FindWindowById(WC_GAME_OPTIONS, 0) != NULL)
   232 			memcpy(&_opt_mod_temp, _opt_mod_ptr, sizeof(GameOptions));
   232 			ShowGameDifficulty();
   233 		InvalidateWindow(WC_GAME_OPTIONS, 0);
   233 	}
   234 	}
   234 	return 0;
   235 	return 0;
   235 }
   236 }