mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
- CodeChange: renamed CmdTrainGotoDepot() to CmdSendTrainToDepot() to be consistent with other depot commands. - CodeChange: 'newgame' console command now calls the unabused GenRandomNewGame(). For the server it still creates a new game, a client quits the game and continues in SP. - CodeChange: in the game-difficulty window, setup the disabled buttons on window creation, not every redraw.
This commit is contained in:
parent
921cc4e94a
commit
c626555f68
64
command.c
64
command.c
@ -63,7 +63,7 @@ DEF_COMMAND(CmdStartStopTrain);
|
|||||||
|
|
||||||
DEF_COMMAND(CmdSellRailWagon);
|
DEF_COMMAND(CmdSellRailWagon);
|
||||||
|
|
||||||
DEF_COMMAND(CmdTrainGotoDepot);
|
DEF_COMMAND(CmdSendTrainToDepot);
|
||||||
DEF_COMMAND(CmdForceTrainProceed);
|
DEF_COMMAND(CmdForceTrainProceed);
|
||||||
DEF_COMMAND(CmdReverseTrainDirection);
|
DEF_COMMAND(CmdReverseTrainDirection);
|
||||||
|
|
||||||
@ -123,7 +123,6 @@ DEF_COMMAND(CmdRenameTown);
|
|||||||
DEF_COMMAND(CmdDoTownAction);
|
DEF_COMMAND(CmdDoTownAction);
|
||||||
|
|
||||||
DEF_COMMAND(CmdSetRoadDriveSide);
|
DEF_COMMAND(CmdSetRoadDriveSide);
|
||||||
DEF_COMMAND(CmdSetTownNameType);
|
|
||||||
|
|
||||||
DEF_COMMAND(CmdChangeDifficultyLevel);
|
DEF_COMMAND(CmdChangeDifficultyLevel);
|
||||||
DEF_COMMAND(CmdChangePatchSetting);
|
DEF_COMMAND(CmdChangePatchSetting);
|
||||||
@ -135,13 +134,6 @@ DEF_COMMAND(CmdSendShipToDepot);
|
|||||||
DEF_COMMAND(CmdChangeShipServiceInt);
|
DEF_COMMAND(CmdChangeShipServiceInt);
|
||||||
DEF_COMMAND(CmdRefitShip);
|
DEF_COMMAND(CmdRefitShip);
|
||||||
|
|
||||||
|
|
||||||
DEF_COMMAND(CmdStartNewGame);
|
|
||||||
DEF_COMMAND(CmdCreateScenario);
|
|
||||||
|
|
||||||
DEF_COMMAND(CmdSetNewLandscapeType);
|
|
||||||
|
|
||||||
DEF_COMMAND(CmdGenRandomNewGame);
|
|
||||||
DEF_COMMAND(CmdCloneOrder);
|
DEF_COMMAND(CmdCloneOrder);
|
||||||
|
|
||||||
DEF_COMMAND(CmdClearArea);
|
DEF_COMMAND(CmdClearArea);
|
||||||
@ -205,7 +197,7 @@ static CommandProc * const _command_proc_table[] = {
|
|||||||
CmdStartStopTrain, /* 36 */
|
CmdStartStopTrain, /* 36 */
|
||||||
NULL, /* 37 */
|
NULL, /* 37 */
|
||||||
CmdSellRailWagon, /* 38 */
|
CmdSellRailWagon, /* 38 */
|
||||||
CmdTrainGotoDepot, /* 39 */
|
CmdSendTrainToDepot, /* 39 */
|
||||||
CmdForceTrainProceed, /* 40 */
|
CmdForceTrainProceed, /* 40 */
|
||||||
CmdReverseTrainDirection, /* 41 */
|
CmdReverseTrainDirection, /* 41 */
|
||||||
|
|
||||||
@ -236,11 +228,11 @@ static CommandProc * const _command_proc_table[] = {
|
|||||||
|
|
||||||
CmdSellAircraft, /* 59 */
|
CmdSellAircraft, /* 59 */
|
||||||
CmdStartStopAircraft, /* 60 */
|
CmdStartStopAircraft, /* 60 */
|
||||||
/***************************************************/
|
|
||||||
CmdBuildAircraft, /* 61 */
|
CmdBuildAircraft, /* 61 */
|
||||||
CmdSendAircraftToHangar, /* 62 */
|
CmdSendAircraftToHangar, /* 62 */
|
||||||
CmdChangeAircraftServiceInt, /* 63 */
|
CmdChangeAircraftServiceInt, /* 63 */
|
||||||
CmdRefitAircraft, /* 64 */
|
CmdRefitAircraft, /* 64 <-- Hackykid */
|
||||||
|
|
||||||
CmdPlaceSign, /* 65 */
|
CmdPlaceSign, /* 65 */
|
||||||
CmdRenameSign, /* 66 */
|
CmdRenameSign, /* 66 */
|
||||||
@ -252,60 +244,60 @@ static CommandProc * const _command_proc_table[] = {
|
|||||||
CmdTurnRoadVeh, /* 71 */
|
CmdTurnRoadVeh, /* 71 */
|
||||||
CmdChangeRoadVehServiceInt, /* 72 */
|
CmdChangeRoadVehServiceInt, /* 72 */
|
||||||
|
|
||||||
CmdPause, /* 73 */
|
CmdPause, /* 73 <-- TODO: check/enforce by server */
|
||||||
|
|
||||||
CmdBuyShareInCompany, /* 74 */
|
CmdBuyShareInCompany, /* 74 */
|
||||||
CmdSellShareInCompany, /* 75 */
|
CmdSellShareInCompany, /* 75 */
|
||||||
CmdBuyCompany, /* 76 */
|
CmdBuyCompany, /* 76 */
|
||||||
|
|
||||||
CmdBuildTown, /* 77 */
|
CmdBuildTown, /* 77 <-- offline / scenario only */
|
||||||
NULL, /* 78 */
|
NULL, /* 78 */
|
||||||
NULL, /* 79 */
|
NULL, /* 79 */
|
||||||
CmdRenameTown, /* 80 */
|
CmdRenameTown, /* 80 <-- TODO: check/enforce by server */
|
||||||
CmdDoTownAction, /* 81 */
|
CmdDoTownAction, /* 81 */
|
||||||
|
|
||||||
CmdSetRoadDriveSide, /* 82 */
|
CmdSetRoadDriveSide, /* 82 <-- TODO: check/enforce by server */
|
||||||
CmdSetTownNameType, /* 83 */
|
NULL, /* 83 */
|
||||||
NULL, /* 84 */
|
NULL, /* 84 */
|
||||||
CmdChangeDifficultyLevel, /* 85 */
|
CmdChangeDifficultyLevel, /* 85 <-- TODO: check/enforce by server */
|
||||||
|
|
||||||
CmdStartStopShip, /* 86 */
|
CmdStartStopShip, /* 86 */
|
||||||
CmdSellShip, /* 87 */
|
CmdSellShip, /* 87 */
|
||||||
CmdBuildShip, /* 88 */
|
CmdBuildShip, /* 88 */
|
||||||
CmdSendShipToDepot, /* 89 */
|
CmdSendShipToDepot, /* 89 */
|
||||||
CmdChangeShipServiceInt, /* 90 */
|
CmdChangeShipServiceInt, /* 90 */
|
||||||
CmdRefitShip, /* 91 */
|
CmdRefitShip, /* 91 <-- Hackykid */
|
||||||
|
|
||||||
CmdStartNewGame, /* 92 */
|
NULL, /* 92 */
|
||||||
NULL, /* 93 */
|
NULL, /* 93 */
|
||||||
CmdCreateScenario, /* 94 */
|
NULL, /* 94 */
|
||||||
NULL, /* 95 */
|
NULL, /* 95 */
|
||||||
NULL, /* 96 */
|
NULL, /* 96 */
|
||||||
CmdSetNewLandscapeType, /* 97 */
|
NULL, /* 97 */
|
||||||
|
|
||||||
CmdGenRandomNewGame, /* 98 */
|
NULL, /* 98 */
|
||||||
|
|
||||||
CmdCloneOrder, /* 99 */
|
CmdCloneOrder, /* 99 */
|
||||||
|
|
||||||
CmdClearArea, /* 100 */
|
CmdClearArea, /* 100 */
|
||||||
NULL, /* 101 */
|
NULL, /* 101 */
|
||||||
|
/***************************************************/
|
||||||
CmdMoneyCheat, /* 102 */
|
CmdMoneyCheat, /* 102 <-- offline only */
|
||||||
CmdBuildCanal, /* 103 */
|
CmdBuildCanal, /* 103 */
|
||||||
CmdPlayerCtrl, /* 104 */
|
CmdPlayerCtrl, /* 104 <-- TODO: check/enforce by server */
|
||||||
|
|
||||||
CmdLevelLand, /* 105 */
|
CmdLevelLand, /* 105 <-- Hackykid */
|
||||||
|
|
||||||
CmdRefitRailVehicle, /* 106 */
|
CmdRefitRailVehicle, /* 106 <-- Hackykid */
|
||||||
CmdRestoreOrderIndex, /* 107 */
|
CmdRestoreOrderIndex, /* 107 */
|
||||||
CmdBuildLock, /* 108 */
|
CmdBuildLock, /* 108 <-- Hackykid */
|
||||||
CmdStartScenario, /* 109 */
|
CmdStartScenario, /* 109 <-- UNNEEDED */
|
||||||
CmdBuildSignalTrack, /* 110 */
|
CmdBuildSignalTrack, /* 110 <-- Hackykid */
|
||||||
CmdRemoveSignalTrack, /* 111 */
|
CmdRemoveSignalTrack, /* 111 <-- Hackykid */
|
||||||
CmdDestroyCompanyHQ, /* 112 <-- done */
|
CmdDestroyCompanyHQ, /* 112 */
|
||||||
CmdGiveMoney, /* 113 */
|
CmdGiveMoney, /* 113 */
|
||||||
CmdChangePatchSetting, /* 114 */
|
CmdChangePatchSetting, /* 114 <-- TODO: check/enforce by server */
|
||||||
CmdReplaceVehicle, /* 115 */
|
CmdReplaceVehicle, /* 115 <-- Hackykid */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This function range-checks a cmd, and checks if the cmd is not NULL */
|
/* This function range-checks a cmd, and checks if the cmd is not NULL */
|
||||||
@ -386,7 +378,7 @@ error:
|
|||||||
|
|
||||||
int32 GetAvailableMoneyForCommand(void)
|
int32 GetAvailableMoneyForCommand(void)
|
||||||
{
|
{
|
||||||
uint pid = _current_player;
|
PlayerID pid = _current_player;
|
||||||
if (pid >= MAX_PLAYERS) return 0x7FFFFFFF; // max int
|
if (pid >= MAX_PLAYERS) return 0x7FFFFFFF; // max int
|
||||||
return DEREF_PLAYER(pid)->player_money;
|
return DEREF_PLAYER(pid)->player_money;
|
||||||
}
|
}
|
||||||
|
@ -712,15 +712,11 @@ DEF_CONSOLE_CMD(ConNewGame)
|
|||||||
{
|
{
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
IConsoleHelp("Start a new game. Usage: 'newgame'");
|
IConsoleHelp("Start a new game. Usage: 'newgame'");
|
||||||
|
IConsoleHelp("The server can force a new game using 'newgame', any client using it will part and start a single-player game");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_docommand_recursive = 0;
|
GenRandomNewGame(Random(), InteractiveRandom());
|
||||||
|
|
||||||
_random_seeds[0][0] = Random();
|
|
||||||
_random_seeds[0][1] = InteractiveRandom();
|
|
||||||
|
|
||||||
SwitchMode(SM_NEWGAME);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ static int DedicatedVideoMainLoop(void)
|
|||||||
/* If SwitchMode is SM_LOAD, it means that the user used the '-g' options */
|
/* If SwitchMode is SM_LOAD, it means that the user used the '-g' options */
|
||||||
if (_switch_mode != SM_LOAD) {
|
if (_switch_mode != SM_LOAD) {
|
||||||
_switch_mode = SM_NONE;
|
_switch_mode = SM_NONE;
|
||||||
DoCommandP(0, Random(), InteractiveRandom(), NULL, CMD_GEN_RANDOM_NEW_GAME);
|
GenRandomNewGame(Random(), InteractiveRandom());
|
||||||
} else {
|
} else {
|
||||||
_switch_mode = SM_NONE;
|
_switch_mode = SM_NONE;
|
||||||
/* First we need to test if the savegame can be loaded, else we will end up playing the
|
/* First we need to test if the savegame can be loaded, else we will end up playing the
|
||||||
|
@ -228,6 +228,7 @@ enum SaveOrLoadMode {
|
|||||||
int SaveOrLoad(const char *filename, int mode);
|
int SaveOrLoad(const char *filename, int mode);
|
||||||
|
|
||||||
void AfterLoadTown(void);
|
void AfterLoadTown(void);
|
||||||
|
void GenRandomNewGame(uint32 rnd1, uint32 rnd2);
|
||||||
void AskExitGame(void);
|
void AskExitGame(void);
|
||||||
void AskExitToGameMenu(void);
|
void AskExitToGameMenu(void);
|
||||||
|
|
||||||
|
68
intro_gui.c
68
intro_gui.c
@ -45,6 +45,14 @@ static const Widget _select_game_widgets[] = {
|
|||||||
extern void HandleOnEditText(WindowEvent *e);
|
extern void HandleOnEditText(WindowEvent *e);
|
||||||
extern void HandleOnEditTextCancel(void);
|
extern void HandleOnEditTextCancel(void);
|
||||||
|
|
||||||
|
static inline void CreateScenario(void) {_switch_mode = SM_EDITOR;}
|
||||||
|
|
||||||
|
static inline void SetNewLandscapeType(byte landscape)
|
||||||
|
{
|
||||||
|
_opt_newgame.landscape = landscape;
|
||||||
|
InvalidateWindowClasses(WC_SELECT_GAME);
|
||||||
|
}
|
||||||
|
|
||||||
static void SelectGameWndProc(Window *w, WindowEvent *e)
|
static void SelectGameWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
/* We do +/- 6 for the map_xy because 64 is 2^6, but it is the lowest available element */
|
/* We do +/- 6 for the map_xy because 64 is 2^6, but it is the lowest available element */
|
||||||
@ -64,13 +72,12 @@ static void SelectGameWndProc(Window *w, WindowEvent *e)
|
|||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch (e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 2: DoCommandP(0, 0, 0, NULL, CMD_START_NEW_GAME); break;
|
case 2: AskForNewGameToStart(); break;
|
||||||
case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
|
case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
|
||||||
case 4: DoCommandP(0, InteractiveRandom(), 0, NULL, CMD_CREATE_SCENARIO); break;
|
case 4: CreateScenario(); break;
|
||||||
case 5: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
|
case 5: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
|
||||||
case 6: case 7: case 8: case 9:
|
case 6: case 7: case 8: case 9:
|
||||||
// XXX: Useless usage of the CMD infrastructure?
|
SetNewLandscapeType(e->click.widget - 6);
|
||||||
DoCommandP(0, e->click.widget - 6, 0, NULL, CMD_SET_NEW_LANDSCAPE_TYPE);
|
|
||||||
break;
|
break;
|
||||||
case 10: case 11: /* Mapsize X */
|
case 10: case 11: /* Mapsize X */
|
||||||
ShowDropDownMenu(w, mapsizes, _patches.map_x - 6, 11, 0, 0);
|
ShowDropDownMenu(w, mapsizes, _patches.map_x - 6, 11, 0, 0);
|
||||||
@ -122,50 +129,12 @@ void ShowSelectGameWindow(void)
|
|||||||
AllocateWindowDesc(&_select_game_desc);
|
AllocateWindowDesc(&_select_game_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenRandomNewGame(uint32 rnd1, uint32 rnd2)
|
||||||
// p1 = mode
|
|
||||||
// 0 - start new game
|
|
||||||
// 1 - close new game dialog
|
|
||||||
|
|
||||||
int32 CmdStartNewGame(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|
||||||
{
|
{
|
||||||
if (!(flags & DC_EXEC))
|
_random_seeds[0][0] = rnd1;
|
||||||
return 0;
|
_random_seeds[0][1] = rnd2;
|
||||||
|
|
||||||
switch(p1) {
|
|
||||||
case 0: // show select game window
|
|
||||||
AskForNewGameToStart();
|
|
||||||
break;
|
|
||||||
case 1: // close select game window
|
|
||||||
DeleteWindowById(WC_SAVELOAD, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 CmdGenRandomNewGame(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|
||||||
{
|
|
||||||
if (!(flags & DC_EXEC))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// this forces stuff into test mode.
|
|
||||||
_docommand_recursive = 0;
|
|
||||||
|
|
||||||
_random_seeds[0][0] = p1;
|
|
||||||
_random_seeds[0][1] = p2;
|
|
||||||
|
|
||||||
SwitchMode(SM_NEWGAME);
|
SwitchMode(SM_NEWGAME);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 CmdCreateScenario(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|
||||||
{
|
|
||||||
if (!(flags & DC_EXEC))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
_switch_mode = SM_EDITOR;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 CmdStartScenario(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
int32 CmdStartScenario(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
@ -297,12 +266,3 @@ void AskExitToGameMenu(void)
|
|||||||
{
|
{
|
||||||
AllocateWindowDescFront(&_ask_quit_game_desc, 0);
|
AllocateWindowDescFront(&_ask_quit_game_desc, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 CmdSetNewLandscapeType(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|
||||||
{
|
|
||||||
if (flags & DC_EXEC) {
|
|
||||||
_opt_newgame.landscape = p1;
|
|
||||||
InvalidateWindowClasses(WC_SELECT_GAME);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@ -1481,7 +1481,7 @@ static void SelectScenarioWndProc(Window *w, WindowEvent *e) {
|
|||||||
|
|
||||||
case 6: /* Click the listbox */
|
case 6: /* Click the listbox */
|
||||||
if (e->click.pt.y < list_start)
|
if (e->click.pt.y < list_start)
|
||||||
DoCommandP(0, Random(), InteractiveRandom(), NULL, CMD_GEN_RANDOM_NEW_GAME);
|
GenRandomNewGame(Random(), InteractiveRandom());
|
||||||
else {
|
else {
|
||||||
char *name;
|
char *name;
|
||||||
int y = (e->click.pt.y - list_start) / 10;
|
int y = (e->click.pt.y - list_start) / 10;
|
||||||
|
@ -564,7 +564,7 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
|
|||||||
ttd_strlcpy(_network_server_name, WP(w, querystr_d).text.buf, sizeof(_network_server_name));
|
ttd_strlcpy(_network_server_name, WP(w, querystr_d).text.buf, sizeof(_network_server_name));
|
||||||
UpdateTextBufferSize(&WP(w, querystr_d).text);
|
UpdateTextBufferSize(&WP(w, querystr_d).text);
|
||||||
if (selected_map == NULL) { // start random new game
|
if (selected_map == NULL) { // start random new game
|
||||||
DoCommandP(0, Random(), InteractiveRandom(), NULL, CMD_GEN_RANDOM_NEW_GAME);
|
GenRandomNewGame(Random(), InteractiveRandom());
|
||||||
} else { // load a scenario
|
} else { // load a scenario
|
||||||
char *name;
|
char *name;
|
||||||
if ((name = FiosBrowseTo(selected_map)) != NULL) {
|
if ((name = FiosBrowseTo(selected_map)) != NULL) {
|
||||||
|
@ -176,8 +176,10 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 14: /* Town names */
|
case 14: /* Town names */
|
||||||
if (_game_mode == GM_MENU)
|
if (_game_mode == GM_MENU) {
|
||||||
DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_TOWN_NAME_TYPE | CMD_MSG(STR_EMPTY));
|
_opt_ptr->town_name = e->dropdown.index;
|
||||||
|
InvalidateWindow(WC_GAME_OPTIONS, 0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 17: /* Autosave options */
|
case 17: /* Autosave options */
|
||||||
_opt_ptr->autosave = e->dropdown.index;
|
_opt_ptr->autosave = e->dropdown.index;
|
||||||
@ -205,8 +207,16 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Change the side of the road vehicles drive on (server only).
|
||||||
|
* @param x,y unused
|
||||||
|
* @param p1 the side of the road; 0 = left side and 1 = right side
|
||||||
|
* @param p2 unused
|
||||||
|
*/
|
||||||
int32 CmdSetRoadDriveSide(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
int32 CmdSetRoadDriveSide(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
|
/* Check boundaries and you can only change this if NO vehicles have been built yet */
|
||||||
|
if (p1 > 1 || RoadVehiclesAreBuilt()) return CMD_ERROR;
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
_opt_ptr->road_side = p1;
|
_opt_ptr->road_side = p1;
|
||||||
InvalidateWindow(WC_GAME_OPTIONS,0);
|
InvalidateWindow(WC_GAME_OPTIONS,0);
|
||||||
@ -214,16 +224,6 @@ int32 CmdSetRoadDriveSide(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 CmdSetTownNameType(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|
||||||
{
|
|
||||||
if (flags & DC_EXEC) {
|
|
||||||
_opt_ptr->town_name = p1;
|
|
||||||
InvalidateWindow(WC_GAME_OPTIONS,0);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const Widget _game_options_widgets[] = {
|
static const Widget _game_options_widgets[] = {
|
||||||
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||||
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 369, 0, 13, STR_00B1_GAME_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 369, 0, 13, STR_00B1_GAME_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||||
@ -369,24 +369,24 @@ static GameOptions _opt_mod_temp;
|
|||||||
static void GameDifficultyWndProc(Window *w, WindowEvent *e)
|
static void GameDifficultyWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_CREATE: /* Setup disabled buttons when creating window */
|
||||||
uint32 click_a, click_b, disabled;
|
|
||||||
int i;
|
|
||||||
int y, value;
|
|
||||||
|
|
||||||
w->click_state = (1 << 3) << _opt_mod_temp.diff_level; // have current difficulty button clicked
|
|
||||||
// disable all other difficulty buttons during gameplay except for 'custom'
|
// disable all other difficulty buttons during gameplay except for 'custom'
|
||||||
w->disabled_state = (_game_mode != GM_NORMAL) ? 0 : (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
|
w->disabled_state = (_game_mode != GM_NORMAL) ? 0 : (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
|
||||||
|
|
||||||
if (_game_mode == GM_EDITOR)
|
if (_game_mode == GM_EDITOR) SETBIT(w->disabled_state, 7);
|
||||||
SETBIT(w->disabled_state, 7);
|
|
||||||
|
|
||||||
if (_networking) {
|
if (_networking) {
|
||||||
SETBIT(w->disabled_state, 7); // disable highscore chart in multiplayer
|
SETBIT(w->disabled_state, 7); // disable highscore chart in multiplayer
|
||||||
if (!_network_server)
|
if (!_network_server)
|
||||||
SETBIT(w->disabled_state, 10); // Disable save-button in multiplayer (and if client)
|
SETBIT(w->disabled_state, 10); // Disable save-button in multiplayer (and if client)
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case WE_PAINT: {
|
||||||
|
uint32 click_a, click_b, disabled;
|
||||||
|
int i;
|
||||||
|
int y, value;
|
||||||
|
|
||||||
|
w->click_state = (1 << 3) << _opt_mod_temp.diff_level; // have current difficulty button clicked
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
|
|
||||||
click_a = _difficulty_click_a;
|
click_a = _difficulty_click_a;
|
||||||
|
@ -1433,7 +1433,7 @@ static TrainFindDepotData FindClosestTrainDepot(Vehicle *v)
|
|||||||
* @param p1 train to send to the depot
|
* @param p1 train to send to the depot
|
||||||
* @param p2 unused
|
* @param p2 unused
|
||||||
*/
|
*/
|
||||||
int32 CmdTrainGotoDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
int32 CmdSendTrainToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
TrainFindDepotData tfdd;
|
TrainFindDepotData tfdd;
|
||||||
|
Loading…
Reference in New Issue
Block a user