Changeset - r6560:567212480250
[Not reviewed]
master
0 7 0
belugas - 17 years ago 2007-05-01 17:16:51
belugas@openttd.org
(svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
Based on FS#289, by pitt2
7 files changed with 25 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/genworld_gui.cpp
Show inline comments
 
@@ -210,14 +210,14 @@ static void GenerateLandscapeWndProc(Win
 
	static const StringID elevations[]  = {STR_682A_VERY_FLAT, STR_682B_FLAT, STR_682C_HILLY, STR_682D_MOUNTAINOUS, INVALID_STRING_ID};
 
	static const StringID sea_lakes[]   = {STR_VERY_LOW, STR_6820_LOW, STR_6821_MEDIUM, STR_6822_HIGH, INVALID_STRING_ID};
 
	static const StringID smoothness[]  = {STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN_SMOOTH, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN_ROUGH, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN_VERY_ROUGH, INVALID_STRING_ID};
 
	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;
 
	static char _genseed_buffer[11];
 

	
 
	glwp_modes mode = (glwp_modes)w->window_number;
src/industry_cmd.cpp
Show inline comments
 
@@ -1538,15 +1538,16 @@ Industry *CreateNewIndustry(TileIndex ti
 
	const IndustrySpec *indspec = GetIndustrySpec(type);
 
	const IndustryTileTable *it = indspec->table[RandomRange(indspec->num_table)];
 

	
 
	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
 
};
 

	
 
/** This function is the one who really do the creation work
src/lang/english.txt
Show inline comments
 
@@ -2035,12 +2035,13 @@ STR_6813_ECONOMY                        
 
STR_6814_TRAIN_REVERSING                                        :{LTBLUE}Train reversing: {ORANGE}{STRING}
 
STR_6815_DISASTERS                                              :{LTBLUE}Disasters: {ORANGE}{STRING}
 
STR_16816_CITY_APPROVAL                                         :{LTBLUE}City council's attitude towards area restructuring: {ORANGE}{STRING}
 
############ 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
 
STR_6819                                                        :{BLACK}{SMALLLEFTARROW}
 
STR_681A                                                        :{BLACK}{SMALLRIGHTARROW}
 
STR_681B_VERY_SLOW                                              :Very Slow
src/openttd.cpp
Show inline comments
 
@@ -1935,12 +1935,23 @@ bool AfterLoadGame()
 
					v->current_order.type == OT_LOADING) {         // loading
 
				GetStation(v->last_station_visited)->loading_vehicles.push_back(v);
 
			}
 
		}
 
	}
 

	
 
	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;
 
}
 

	
 
/** Reload all NewGRF files during a running game. This is a cut-down
 
 * version of AfterLoadGame().
 
 * XXX - We need to reset the vehicle position hash because with a non-empty
src/saveload.cpp
Show inline comments
 
@@ -26,13 +26,13 @@
 
#include "saveload.h"
 
#include "network/network.h"
 
#include "variables.h"
 
#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!
 

	
 
typedef void WriterProc(uint len);
 
typedef uint ReaderProc();
 

	
src/settings_gui.cpp
Show inline comments
 
@@ -306,14 +306,14 @@ struct GameSettingData {
 
	StringID str;
 
};
 

	
 
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},
 
	{  0,   4,  1, STR_681B_VERY_SLOW},
 
	{  0,   2,  1, STR_6820_LOW},
 
	{  0,   2,  1, STR_6823_NONE},
 
@@ -327,14 +327,14 @@ static const GameSettingData _game_setti
 
	{  0,   2,  1, STR_6839_PERMISSIVE},
 
};
 

	
 
/*
 
 * 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)
 
 * H: construction speed of competitors (0 = very slow, 4 = very fast)
 
 * I: intelligence (0-2)
 
 * J: breakdowns (0 = off, 2 = normal)
 
@@ -346,15 +346,15 @@ static const GameSettingData _game_setti
 
 * P: Train reversing (0 = end of line + stations, 1 = end of line)
 
 * Q: disasters
 
 * R: area restructuring (0 = permissive, 2 = hostile)
 
 */
 
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)
 
{
 
	int i;
 
	assert(mode <= 3);
src/town_cmd.cpp
Show inline comments
 
@@ -1248,13 +1248,13 @@ Town *CreateRandomTown(uint attempts, To
 
		DoCreateTown(t, tile, townnameparts, mode, size);
 
		return t;
 
	} while (--attempts);
 
	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()
 
{
 
	uint num = 0;
 
	uint n = ScaleByMapSize(_num_initial_towns[_opt.diff.number_towns] + (Random() & 7));
 
	uint num_cities = _patches.larger_towns == 0 ? 0 : n / _patches.larger_towns;
0 comments (0 inline, 0 general)