src/main_gui.cpp
branchgamebalance
changeset 9909 dce9a6923bb7
parent 9908 0fa543611bbe
child 9910 0b2aebc8283e
--- a/src/main_gui.cpp	Tue Jun 12 11:56:35 2007 +0000
+++ b/src/main_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
@@ -51,7 +51,7 @@
 
 static byte _terraform_size = 1;
 RailType _last_built_railtype;
-static int _scengen_town_size = 2; // depress medium-sized towns per default
+static int _scengen_town_size = 1; // depress medium-sized towns per default
 
 extern void GenerateIndustries();
 extern bool GenerateTowns();
@@ -1247,7 +1247,8 @@
 
 
 /** Callback function for the scenario editor 'reset landscape' confirmation window
- * @param yes_clicked boolean value, true when yes was clicked, false otherwise */
+ * @param w Window unused
+ * @param confirmed boolean value, true when yes was clicked, false otherwise */
 static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed)
 {
 	if (confirmed) {
@@ -1405,7 +1406,9 @@
 
 static void PlaceProc_Town(TileIndex tile)
 {
-	DoCommandP(tile, _scengen_town_size, 0, CcBuildTown, CMD_BUILD_TOWN | CMD_MSG(STR_0236_CAN_T_BUILD_TOWN_HERE));
+	uint32 size = min(_scengen_town_size, (int)TSM_CITY);
+	uint32 mode = _scengen_town_size > TSM_CITY ? TSM_CITY : TSM_FIXED;
+	DoCommandP(tile, size, mode, CcBuildTown, CMD_BUILD_TOWN | CMD_MSG(STR_0236_CAN_T_BUILD_TOWN_HERE));
 }
 
 
@@ -1413,13 +1416,14 @@
 {   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                 STR_018B_CLOSE_WINDOW},
 {    WWT_CAPTION,   RESIZE_NONE,     7,    11,   147,     0,    13, STR_0233_TOWN_GENERATION, STR_018C_WINDOW_TITLE_DRAG_THIS},
 {  WWT_STICKYBOX,   RESIZE_NONE,     7,   148,   159,     0,    13, 0x0,                      STR_STICKY_BUTTON},
-{      WWT_PANEL,   RESIZE_NONE,     7,     0,   159,    14,    81, 0x0,                      STR_NULL},
+{      WWT_PANEL,   RESIZE_NONE,     7,     0,   159,    14,    94, 0x0,                      STR_NULL},
 {    WWT_TEXTBTN,   RESIZE_NONE,    14,     2,   157,    16,    27, STR_0234_NEW_TOWN,        STR_0235_CONSTRUCT_NEW_TOWN},
 {    WWT_TEXTBTN,   RESIZE_NONE,    14,     2,   157,    29,    40, STR_023D_RANDOM_TOWN,     STR_023E_BUILD_TOWN_IN_RANDOM_LOCATION},
 {    WWT_TEXTBTN,   RESIZE_NONE,    14,     2,   157,    42,    53, STR_MANY_RANDOM_TOWNS,    STR_RANDOM_TOWNS_TIP},
 {    WWT_TEXTBTN,   RESIZE_NONE,    14,     2,    53,    68,    79, STR_02A1_SMALL,           STR_02A4_SELECT_TOWN_SIZE},
 {    WWT_TEXTBTN,   RESIZE_NONE,    14,    54,   105,    68,    79, STR_02A2_MEDIUM,          STR_02A4_SELECT_TOWN_SIZE},
 {    WWT_TEXTBTN,   RESIZE_NONE,    14,   106,   157,    68,    79, STR_02A3_LARGE,           STR_02A4_SELECT_TOWN_SIZE},
+{    WWT_TEXTBTN,   RESIZE_NONE,    14,     2,   157,    81,    92, STR_SCENARIO_EDITOR_CITY, STR_02A4_SELECT_TOWN_SIZE},
 {      WWT_LABEL,   RESIZE_NONE,     7,     0,   147,    54,    67, STR_02A5_TOWN_SIZE,       STR_NULL},
 {   WIDGETS_END},
 };
@@ -1432,7 +1436,7 @@
 		break;
 
 	case WE_CREATE:
-		LowerWindowWidget(w, (_scengen_town_size - 1)+ 7);
+		LowerWindowWidget(w, _scengen_town_size + 7);
 		break;
 
 	case WE_CLICK:
@@ -1442,10 +1446,12 @@
 			break;
 		case 5: {// random town
 			Town *t;
+			uint size = min(_scengen_town_size, (int)TSM_CITY);
+			TownSizeMode mode = _scengen_town_size > TSM_CITY ? TSM_CITY : TSM_FIXED;
 
 			HandleButtonClick(w, 5);
 			_generating_world = true;
-			t = CreateRandomTown(20, _scengen_town_size);
+			t = CreateRandomTown(20, mode, size);
 			_generating_world = false;
 
 			if (t == NULL) {
@@ -1465,10 +1471,10 @@
 			break;
 		}
 
-		case 7: case 8: case 9:
-			RaiseWindowWidget(w, (_scengen_town_size - 1) + 7);
-			_scengen_town_size = (e->we.click.widget - 7) + 1;
-			LowerWindowWidget(w, (_scengen_town_size - 1) + 7);
+		case 7: case 8: case 9: case 10:
+			RaiseWindowWidget(w, _scengen_town_size + 7);
+			_scengen_town_size = e->we.click.widget - 7;
+			LowerWindowWidget(w, _scengen_town_size + 7);
 			SetWindowDirty(w);
 			break;
 		}
@@ -1484,14 +1490,14 @@
 		break;
 	case WE_ABORT_PLACE_OBJ:
 		RaiseWindowButtons(w);
-		LowerWindowWidget(w, (_scengen_town_size - 1) + 7);
+		LowerWindowWidget(w, _scengen_town_size + 7);
 		SetWindowDirty(w);
 		break;
 	}
 }
 
 static const WindowDesc _scen_edit_town_gen_desc = {
-	WDP_AUTO, WDP_AUTO, 160, 82,
+	WDP_AUTO, WDP_AUTO, 160, 95,
 	WC_SCEN_TOWN_GEN, WC_NONE,
 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
 	_scen_edit_town_gen_widgets,