174 DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_EMPTY)); |
174 DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_ROAD_DRIVE_SIDE | CMD_MSG(STR_EMPTY)); |
175 MarkWholeScreenDirty(); |
175 MarkWholeScreenDirty(); |
176 } |
176 } |
177 break; |
177 break; |
178 case 14: /* Town names */ |
178 case 14: /* Town names */ |
179 if (_game_mode == GM_MENU) |
179 if (_game_mode == GM_MENU) { |
180 DoCommandP(0, e->dropdown.index, 0, NULL, CMD_SET_TOWN_NAME_TYPE | CMD_MSG(STR_EMPTY)); |
180 _opt_ptr->town_name = e->dropdown.index; |
|
181 InvalidateWindow(WC_GAME_OPTIONS, 0); |
|
182 } |
181 break; |
183 break; |
182 case 17: /* Autosave options */ |
184 case 17: /* Autosave options */ |
183 _opt_ptr->autosave = e->dropdown.index; |
185 _opt_ptr->autosave = e->dropdown.index; |
184 SetWindowDirty(w); |
186 SetWindowDirty(w); |
185 break; |
187 break; |
203 break; |
205 break; |
204 } |
206 } |
205 |
207 |
206 } |
208 } |
207 |
209 |
|
210 /** Change the side of the road vehicles drive on (server only). |
|
211 * @param x,y unused |
|
212 * @param p1 the side of the road; 0 = left side and 1 = right side |
|
213 * @param p2 unused |
|
214 */ |
208 int32 CmdSetRoadDriveSide(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
215 int32 CmdSetRoadDriveSide(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
209 { |
216 { |
|
217 /* Check boundaries and you can only change this if NO vehicles have been built yet */ |
|
218 if (p1 > 1 || RoadVehiclesAreBuilt()) return CMD_ERROR; |
|
219 |
210 if (flags & DC_EXEC) { |
220 if (flags & DC_EXEC) { |
211 _opt_ptr->road_side = p1; |
221 _opt_ptr->road_side = p1; |
212 InvalidateWindow(WC_GAME_OPTIONS,0); |
222 InvalidateWindow(WC_GAME_OPTIONS,0); |
213 } |
223 } |
214 return 0; |
224 return 0; |
215 } |
225 } |
216 |
|
217 int32 CmdSetTownNameType(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
218 { |
|
219 if (flags & DC_EXEC) { |
|
220 _opt_ptr->town_name = p1; |
|
221 InvalidateWindow(WC_GAME_OPTIONS,0); |
|
222 } |
|
223 return 0; |
|
224 } |
|
225 |
|
226 |
226 |
227 static const Widget _game_options_widgets[] = { |
227 static const Widget _game_options_widgets[] = { |
228 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
228 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
229 { WWT_CAPTION, RESIZE_NONE, 14, 11, 369, 0, 13, STR_00B1_GAME_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
229 { WWT_CAPTION, RESIZE_NONE, 14, 11, 369, 0, 13, STR_00B1_GAME_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
230 { WWT_PANEL, RESIZE_NONE, 14, 0, 369, 14, 238, 0x0, STR_NULL}, |
230 { WWT_PANEL, RESIZE_NONE, 14, 0, 369, 14, 238, 0x0, STR_NULL}, |
367 #define DIFF_INGAME_DISABLED_BUTTONS 0x383E |
367 #define DIFF_INGAME_DISABLED_BUTTONS 0x383E |
368 |
368 |
369 static void GameDifficultyWndProc(Window *w, WindowEvent *e) |
369 static void GameDifficultyWndProc(Window *w, WindowEvent *e) |
370 { |
370 { |
371 switch (e->event) { |
371 switch (e->event) { |
|
372 case WE_CREATE: /* Setup disabled buttons when creating window */ |
|
373 // disable all other difficulty buttons during gameplay except for 'custom' |
|
374 w->disabled_state = (_game_mode != GM_NORMAL) ? 0 : (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6); |
|
375 |
|
376 if (_game_mode == GM_EDITOR) SETBIT(w->disabled_state, 7); |
|
377 |
|
378 if (_networking) { |
|
379 SETBIT(w->disabled_state, 7); // disable highscore chart in multiplayer |
|
380 if (!_network_server) |
|
381 SETBIT(w->disabled_state, 10); // Disable save-button in multiplayer (and if client) |
|
382 } |
|
383 break; |
372 case WE_PAINT: { |
384 case WE_PAINT: { |
373 uint32 click_a, click_b, disabled; |
385 uint32 click_a, click_b, disabled; |
374 int i; |
386 int i; |
375 int y, value; |
387 int y, value; |
376 |
388 |
377 w->click_state = (1 << 3) << _opt_mod_temp.diff_level; // have current difficulty button clicked |
389 w->click_state = (1 << 3) << _opt_mod_temp.diff_level; // have current difficulty button clicked |
378 // disable all other difficulty buttons during gameplay except for 'custom' |
|
379 w->disabled_state = (_game_mode != GM_NORMAL) ? 0 : (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6); |
|
380 |
|
381 if (_game_mode == GM_EDITOR) |
|
382 SETBIT(w->disabled_state, 7); |
|
383 |
|
384 if (_networking) { |
|
385 SETBIT(w->disabled_state, 7); // disable highscore chart in multiplayer |
|
386 if (!_network_server) |
|
387 SETBIT(w->disabled_state, 10); // Disable save-button in multiplayer (and if client) |
|
388 } |
|
389 |
|
390 DrawWindowWidgets(w); |
390 DrawWindowWidgets(w); |
391 |
391 |
392 click_a = _difficulty_click_a; |
392 click_a = _difficulty_click_a; |
393 click_b = _difficulty_click_b; |
393 click_b = _difficulty_click_b; |
394 |
394 |