src/settings_gui.cpp
branchnoai
changeset 10455 22c441f5adf9
parent 10249 58810805030e
child 10513 33cb70ff2f5d
--- a/src/settings_gui.cpp	Mon May 05 12:35:38 2008 +0000
+++ b/src/settings_gui.cpp	Wed May 07 21:09:51 2008 +0000
@@ -1,6 +1,6 @@
 /* $Id$ */
 
-/** @file settings_gui.cpp */
+/** @file settings_gui.cpp GUI for settings. */
 
 #include "stdafx.h"
 #include "openttd.h"
@@ -248,7 +248,7 @@
 						ShowErrorMessage(INVALID_STRING_ID, STR_FULLSCREEN_FAILED, 0, 0);
 					}
 					w->SetWidgetLoweredState(GAMEOPT_FULLSCREEN, _fullscreen);
-					SetWindowDirty(w);
+					w->SetDirty();
 					break;
 
 				case GAMEOPT_SCREENSHOT_BTN: /* Setup screenshot format dropdown */
@@ -296,7 +296,7 @@
 
 				case GAMEOPT_AUTOSAVE_BTN: /* Autosave options */
 					_opt.autosave = _opt_newgame.autosave = e->we.dropdown.index;
-					SetWindowDirty(w);
+					w->SetDirty();
 					break;
 
 				case GAMEOPT_LANG_BTN: /* Change interface language */
@@ -309,12 +309,12 @@
 
 				case GAMEOPT_RESOLUTION_BTN: /* Change resolution */
 					if (e->we.dropdown.index < _num_resolutions && ChangeResInGame(_resolutions[e->we.dropdown.index][0], _resolutions[e->we.dropdown.index][1]))
-						SetWindowDirty(w);
+						w->SetDirty();
 					break;
 
 				case GAMEOPT_SCREENSHOT_BTN: /* Change screenshot format */
 					SetScreenshotFormat(e->we.dropdown.index);
-					SetWindowDirty(w);
+					w->SetDirty();
 					break;
 			}
 			break;
@@ -423,7 +423,7 @@
 /*
  * A: competitors
  * B: start time in months / 3
- * C: town count (2 = high, 0 = very low)
+ * C: town count (3 = high, 0 = very low)
  * D: industry count (4 = high, 0 = none)
  * E: inital loan / 1000 (in GBP)
  * F: interest rate
@@ -442,9 +442,9 @@
  */
 static const GDType _default_game_diff[3][GAME_DIFFICULTY_NUM] = { /*
 	 A, B, C, D,   E, F, G, H, I, J, K, L, M, N, O, P, Q, R*/
-	{2, 2, 1, 4, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, ///< easy
-	{4, 1, 1, 3, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, ///< medium
-	{7, 0, 0, 2, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, ///< hard
+	{2, 2, 2, 4, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, ///< easy
+	{4, 1, 2, 3, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, ///< medium
+	{7, 0, 3, 3, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, ///< hard
 };
 
 void SetDifficultyLevel(int mode, GameOptions *gm_opt)
@@ -615,7 +615,7 @@
 					w->RaiseWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level);
 					SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom
 					w->LowerWidget(GDW_LVL_CUSTOM);
-					SetWindowDirty(w);
+					w->SetDirty();
 				} break;
 
 				case GDW_LVL_EASY:
@@ -626,7 +626,7 @@
 					w->RaiseWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level);
 					SetDifficultyLevel(e->we.click.widget - GDW_LVL_EASY, &_opt_mod_temp);
 					w->LowerWidget(GDW_LVL_EASY + _opt_mod_temp.diff_level);
-					SetWindowDirty(w);
+					w->SetDirty();
 					break;
 
 				case GDW_HIGHSCORE: // Highscore Table
@@ -642,7 +642,7 @@
 							DoCommandP(0, btn, val, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
 					}
 					DoCommandP(0, UINT_MAX, _opt_mod_temp.diff_level, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
-					DeleteWindow(w);
+					delete w;
 					/* If we are in the editor, we should reload the economy.
 					 * This way when you load a game, the max loan and interest rate
 					 * are loaded correctly. */
@@ -651,7 +651,7 @@
 				}
 
 				case GDW_CANCEL: // Cancel button - close window, abandon changes
-					DeleteWindow(w);
+					delete w;
 					break;
 			} break;
 
@@ -659,7 +659,7 @@
 			if (diffic_d->timeout != 0) {
 				diffic_d->timeout--;
 				if (diffic_d->timeout == 0) diffic_d->clicked_button = NO_SETTINGS_BUTTON;
-				SetWindowDirty(w);
+				w->SetDirty();
 			}
 			break;
 	}
@@ -818,6 +818,7 @@
 	"freight_trains",
 	"plane_speed",
 	"timetabling",
+	"dynamic_engines",
 };
 
 struct PatchEntry {
@@ -1025,7 +1026,7 @@
 
 						if (value != oldvalue) {
 							SetPatchValue(page->entries[btn].index, patches_ptr, value);
-							SetWindowDirty(w);
+							w->SetDirty();
 						}
 					} else {
 						/* only open editbox for types that its sensible for */
@@ -1046,14 +1047,14 @@
 					WP(w, def_d).data_1 = e->we.click.widget - PATCHSEL_INTERFACE;
 					w->LowerWidget(WP(w, def_d).data_1 + PATCHSEL_INTERFACE);
 					DeleteWindowById(WC_QUERY_STRING, 0);
-					SetWindowDirty(w);
+					w->SetDirty();
 					break;
 			}
 			break;
 
 		case WE_TIMEOUT:
 			WP(w, def_d).data_2 = 0;
-			SetWindowDirty(w);
+			w->SetDirty();
 			break;
 
 		case WE_ON_EDIT_TEXT:
@@ -1066,7 +1067,7 @@
 				if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate;
 
 				SetPatchValue(pe->index, patches_ptr, value);
-				SetWindowDirty(w);
+				w->SetDirty();
 			}
 			break;
 
@@ -1265,7 +1266,7 @@
 			}
 
 			w->flags4 |= 5 << WF_TIMEOUT_SHL;
-			SetWindowDirty(w);
+			w->SetDirty();
 		} break;
 
 		case WE_ON_EDIT_TEXT: {
@@ -1301,7 +1302,7 @@
 
 		case WE_TIMEOUT:
 			WP(w, def_d).data_1 = 0;
-			SetWindowDirty(w);
+			w->SetDirty();
 			break;
 
 		case WE_DESTROY: