(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
authorbelugas
Tue, 01 May 2007 17:16:51 +0000
changeset 6560 24106d85dcf5
parent 6559 354d355736ab
child 6561 073e48516812
(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
Based on FS#289, by pitt2
src/genworld_gui.cpp
src/industry_cmd.cpp
src/lang/english.txt
src/openttd.cpp
src/saveload.cpp
src/settings_gui.cpp
src/town_cmd.cpp
--- a/src/genworld_gui.cpp	Tue May 01 16:45:03 2007 +0000
+++ b/src/genworld_gui.cpp	Tue May 01 17:16:51 2007 +0000
@@ -213,8 +213,8 @@
 	static const StringID tree_placer[] = {STR_CONFIG_PATCHES_TREE_PLACER_NONE, STR_CONFIG_PATCHES_TREE_PLACER_ORIGINAL, STR_CONFIG_PATCHES_TREE_PLACER_IMPROVED, INVALID_STRING_ID};
 	static const StringID rotation[]    = {STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_CLOCKWISE, INVALID_STRING_ID};
 	static const StringID landscape[]   = {STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL, STR_CONFIG_PATCHES_LAND_GENERATOR_TERRA_GENESIS, INVALID_STRING_ID};
-	static const StringID num_towns[]   = {STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID};
-	static const StringID num_inds[]    = {STR_26816_NONE, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID};
+	static const StringID num_towns[]   = {STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID};
+	static const StringID num_inds[]    = {STR_26816_NONE, STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID};
 
 	/* Data used for the generate seed edit box */
 	static querystr_d _genseed_query;
--- a/src/industry_cmd.cpp	Tue May 01 16:45:03 2007 +0000
+++ b/src/industry_cmd.cpp	Tue May 01 17:16:51 2007 +0000
@@ -1541,9 +1541,10 @@
 	return CreateNewIndustryHelper(tile, type, DC_EXEC, indspec, it);
 }
 
-static const byte _numof_industry_table[4][12] = {
+static const byte _numof_industry_table[5][12] = {
 	/* difficulty settings for number of industries */
 	{0, 0, 0, 0, 0, 0, 0, 0,  0,  0,  0},   //none
+	{0, 1, 1, 1, 1, 1, 1, 1,  1,  1,  1},   //very low
 	{0, 1, 1, 1, 2, 2, 3, 3,  4,  4,  5},   //low
 	{0, 1, 2, 3, 4, 5, 6, 7,  8,  9, 10},   //normal
 	{0, 2, 3, 4, 6, 7, 8, 9, 10, 10, 10},   //high
--- a/src/lang/english.txt	Tue May 01 16:45:03 2007 +0000
+++ b/src/lang/english.txt	Tue May 01 17:16:51 2007 +0000
@@ -2038,6 +2038,7 @@
 ############ range for difficulty settings ends
 
 STR_26816_NONE                                                  :None
+STR_NUM_VERY_LOW                                                :Very low
 STR_6816_LOW                                                    :Low
 STR_6817_NORMAL                                                 :Normal
 STR_6818_HIGH                                                   :High
--- a/src/openttd.cpp	Tue May 01 16:45:03 2007 +0000
+++ b/src/openttd.cpp	Tue May 01 17:16:51 2007 +0000
@@ -1938,6 +1938,17 @@
 		}
 	}
 
+	if (CheckSavegameVersion(58)) {
+		/* patch difficulty number_industries other then zero get bumped to +1
+		 * since a new option (very low at position1) has been added */
+		if (_opt.diff.number_industries > 0) {
+			_opt.diff.number_industries++;
+		}
+
+		/* Same goes for number of towns, although no test is needed, just an increment */
+		_opt.diff.number_towns++;
+	}
+
 	return true;
 }
 
--- a/src/saveload.cpp	Tue May 01 16:45:03 2007 +0000
+++ b/src/saveload.cpp	Tue May 01 17:16:51 2007 +0000
@@ -29,7 +29,7 @@
 #include <setjmp.h>
 #include <list>
 
-extern const uint16 SAVEGAME_VERSION = 57;
+extern const uint16 SAVEGAME_VERSION = 58;
 uint16 _sl_version;       ///< the major savegame version identifier
 byte   _sl_minor_version; ///< the minor savegame version, DO NOT USE!
 
--- a/src/settings_gui.cpp	Tue May 01 16:45:03 2007 +0000
+++ b/src/settings_gui.cpp	Tue May 01 17:16:51 2007 +0000
@@ -309,8 +309,8 @@
 static const GameSettingData _game_setting_info[] = {
 	{  0,   7,  1, STR_NULL},
 	{  0,   3,  1, STR_6830_IMMEDIATE},
-	{  0,   2,  1, STR_6816_LOW},
-	{  0,   3,  1, STR_26816_NONE},
+	{  0,   3,  1, STR_NUM_VERY_LOW},
+	{  0,   4,  1, STR_26816_NONE},
 	{100, 500, 50, STR_NULL},
 	{  2,   4,  1, STR_NULL},
 	{  0,   2,  1, STR_6820_LOW},
@@ -330,8 +330,8 @@
 /*
  * A: competitors
  * B: start time in months / 3
- * C: town count (2 = high, 0 = low)
- * D: industry count (3 = high, 0 = none)
+ * C: town count (2 = high, 0 = very low)
+ * D: industry count (4 = high, 0 = none)
  * E: inital loan / 1000 (in GBP)
  * F: interest rate
  * G: running costs (0 = low, 2 = high)
@@ -349,9 +349,9 @@
  */
 static const int16 _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, 3, 300, 2, 0, 2, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0}, ///< easy
-	{4, 1, 1, 2, 150, 3, 1, 3, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1}, ///< medium
-	{7, 0, 2, 2, 100, 4, 1, 3, 2, 2, 0, 2, 3, 2, 1, 1, 1, 2}, ///< hard
+	{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
 };
 
 void SetDifficultyLevel(int mode, GameOptions *gm_opt)
--- a/src/town_cmd.cpp	Tue May 01 16:45:03 2007 +0000
+++ b/src/town_cmd.cpp	Tue May 01 17:16:51 2007 +0000
@@ -1251,7 +1251,7 @@
 	return NULL;
 }
 
-static const byte _num_initial_towns[3] = {11, 23, 46};
+static const byte _num_initial_towns[4] = {5, 11, 23, 46};
 
 bool GenerateTowns()
 {