summaryrefslogtreecommitdiff
path: root/settings_gui.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-05-12 00:18:30 +0000
committerDarkvater <Darkvater@openttd.org>2005-05-12 00:18:30 +0000
commiteb4233e8e9e1e6f4b9ce4eb3a7182b1282985f26 (patch)
treed790be3fa8129c0c0146ef2a1e78c42a8d13bbf2 /settings_gui.c
parent562a32c3ee7b1c3ebf87968bd57163dada00d941 (diff)
downloadopenttd-eb4233e8e9e1e6f4b9ce4eb3a7182b1282985f26.tar.xz
(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.
Diffstat (limited to 'settings_gui.c')
-rw-r--r--settings_gui.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/settings_gui.c b/settings_gui.c
index 5ef7d8770..f6af41354 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -176,8 +176,10 @@ static void GameOptionsWndProc(Window *w, WindowEvent *e)
}
break;
case 14: /* Town names */
- if (_game_mode == GM_MENU)
- DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_TOWN_NAME_TYPE | CMD_MSG(STR_EMPTY));
+ if (_game_mode == GM_MENU) {
+ _opt_ptr->town_name = e->dropdown.index;
+ InvalidateWindow(WC_GAME_OPTIONS, 0);
+ }
break;
case 17: /* Autosave options */
_opt_ptr->autosave = e->dropdown.index;
@@ -205,25 +207,23 @@ 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)
{
- if (flags & DC_EXEC) {
- _opt_ptr->road_side = p1;
- InvalidateWindow(WC_GAME_OPTIONS,0);
- }
- return 0;
-}
+ /* Check boundaries and you can only change this if NO vehicles have been built yet */
+ if (p1 > 1 || RoadVehiclesAreBuilt()) return CMD_ERROR;
-int32 CmdSetTownNameType(int x, int y, uint32 flags, uint32 p1, uint32 p2)
-{
if (flags & DC_EXEC) {
- _opt_ptr->town_name = p1;
+ _opt_ptr->road_side = p1;
InvalidateWindow(WC_GAME_OPTIONS,0);
}
return 0;
}
-
static const Widget _game_options_widgets[] = {
{ 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},
@@ -369,24 +369,24 @@ static GameOptions _opt_mod_temp;
static void GameDifficultyWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
- 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
+ case WE_CREATE: /* Setup disabled buttons when creating window */
// 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);
- if (_game_mode == GM_EDITOR)
- SETBIT(w->disabled_state, 7);
+ if (_game_mode == GM_EDITOR) SETBIT(w->disabled_state, 7);
if (_networking) {
SETBIT(w->disabled_state, 7); // disable highscore chart in multiplayer
if (!_network_server)
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);
click_a = _difficulty_click_a;