diff --git a/dataobj/settings.cc b/dataobj/settings.cc index 391b6b0f2..454631c6f 100644 --- a/dataobj/settings.cc +++ b/dataobj/settings.cc @@ -61,6 +61,9 @@ settings_t::settings_t() : max_ship_convoi_length = 4; max_air_convoi_length = 1; + world_maximum_height = 32; + world_minimum_height = -12; + // default climate zones set_default_climates( ); winter_snowline = 7; // not mediterranean @@ -815,6 +818,10 @@ void settings_t::rdwr(loadsave_t *file) file->rdwr_byte(max_ship_convoi_length); file->rdwr_byte(max_air_convoi_length); } + if( file->get_version() > 120006 ) { + file->rdwr_byte(world_maximum_height); + file->rdwr_byte(world_minimum_height); + } // otherwise the default values of the last one will be used } } @@ -1423,6 +1430,9 @@ void settings_t::parse_simuconf(tabfile_t& simuconf, sint16& disp_width, sint16& max_ship_convoi_length = contents.get_int("max_ship_convoi_length",max_ship_convoi_length); max_air_convoi_length = contents.get_int("max_air_convoi_length",max_air_convoi_length); + world_maximum_height = contents.get_int("world_maximum_height",world_maximum_height); + world_maximum_height = contents.get_int("world_minimum_height",world_maximum_height); + // Default pak file path objfilename = ltrim(contents.get_string("pak_file_path", "" ) ); diff --git a/dataobj/settings.h b/dataobj/settings.h index 645fe19e9..abe837580 100644 --- a/dataobj/settings.h +++ b/dataobj/settings.h @@ -109,6 +109,12 @@ private: */ sint32 show_pax; + /** + * the maximum and minimum allowed world height. + */ + sint8 world_maximum_height; + sint8 world_minimum_height; + /** * waterlevel, climate borders, lowest snow in winter */ @@ -385,6 +391,9 @@ public: void set_show_pax(bool yesno) {show_pax=yesno;} bool get_show_pax() const {return show_pax != 0;} + sint8 get_maximumheight() const { return world_maximum_height; } + sint8 get_minimumheight() const { return world_minimum_height; } + sint16 get_groundwater() const {return groundwater;} double get_max_mountain_height() const {return max_mountain_height;} diff --git a/gui/karte.cc b/gui/karte.cc index 201dcef20..1750da84b 100644 --- a/gui/karte.cc +++ b/gui/karte.cc @@ -656,7 +656,18 @@ void reliefkarte_t::set_relief_farbe(koord k_, const PIXVAL color) */ PIXVAL reliefkarte_t::calc_hoehe_farbe(const sint16 hoehe, const sint16 groundwater) { - return color_idx_to_rgb(map_type_color[clamp( (hoehe-groundwater)+MAX_MAP_TYPE_WATER-1, 0, MAX_MAP_TYPE_WATER+MAX_MAP_TYPE_LAND-1 )]); + sint16 relative_index; + if( hoehe>groundwater ) { + // adjust index for world_maximum_height + relative_index = (hoehe-groundwater)*MAX_MAP_TYPE_LAND/welt->get_settings().get_maximumheight(); + if( (hoehe-groundwater)*MAX_MAP_TYPE_LAND%welt->get_settings().get_maximumheight()!=0 ) { + // to avoid relative_index==0 + relative_index += 1; + } + } else { + relative_index = hoehe-groundwater; + } + return color_idx_to_rgb(map_type_color[clamp( relative_index+MAX_MAP_TYPE_WATER-1, 0, MAX_MAP_TYPE_WATER+MAX_MAP_TYPE_LAND-1 )]); } diff --git a/gui/settings_stats.cc b/gui/settings_stats.cc index 31d1b6496..9ae6ba70a 100644 --- a/gui/settings_stats.cc +++ b/gui/settings_stats.cc @@ -120,6 +120,9 @@ void settings_general_stats_t::init(settings_t const* const sets) SEPERATOR INIT_NUM( "compass_map_position", env_t::compass_map_position, 0, 16, gui_numberinput_t::AUTOLINEAR, false ); INIT_NUM( "compass_screen_position", env_t::compass_screen_position, 0, 16, gui_numberinput_t::AUTOLINEAR, false ); + SEPERATOR + INIT_NUM( "world_maximum_height", sets->get_maximumheight(), 16, 127, gui_numberinput_t::AUTOLINEAR, false ); + INIT_NUM( "world_minimum_height", sets->get_minimumheight(), -127, -12, gui_numberinput_t::AUTOLINEAR, false ); clear_dirty(); height = ypos; @@ -162,6 +165,9 @@ void settings_general_stats_t::read(settings_t* const sets) READ_NUM_VALUE( env_t::compass_map_position ); READ_NUM_VALUE( env_t::compass_screen_position ); + + READ_NUM_VALUE( sets->world_maximum_height ); + READ_NUM_VALUE( sets->world_minimum_height ); } void settings_display_stats_t::init(settings_t const* const) @@ -513,7 +519,7 @@ void settings_climates_stats_t::init(settings_t* const sets) INIT_INIT INIT_NUM_NEW( "height_map_conversion_version", env_t::pak_height_conversion_factor, 1, 2, 0, false ); SEPERATOR - INIT_NUM_NEW( "Water level", sets->get_groundwater(), -10, 0, gui_numberinput_t::AUTOLINEAR, false ); + INIT_NUM_NEW( "Water level", sets->get_groundwater(), sets->get_minimumheight()+10, 0, gui_numberinput_t::AUTOLINEAR, false ); INIT_NUM_NEW( "Mountain height", mountain_height_start, 0, min(1000,100*(11-mountain_roughness_start)), 10, false ); INIT_NUM_NEW( "Map roughness", mountain_roughness_start, 0, min(10, 11-((mountain_height_start+99)/100)), gui_numberinput_t::AUTOLINEAR, false ); SEPERATOR diff --git a/simversion.h b/simversion.h index e288f1c93..31e5e919f 100644 --- a/simversion.h +++ b/simversion.h @@ -17,8 +17,8 @@ // Beware: SAVEGAME minor is often ahead of version minor when there were patches. // ==> These have no direct connection at all! -#define SIM_SAVE_MINOR 6 -#define SIM_SERVER_MINOR 6 +#define SIM_SAVE_MINOR 7 +#define SIM_SERVER_MINOR 7 // NOTE: increment before next release to enable save/load of new features #define MAKEOBJ_VERSION "60.1" diff --git a/simworld.cc b/simworld.cc index 4ff283a75..60061ed23 100644 --- a/simworld.cc +++ b/simworld.cc @@ -1252,6 +1252,8 @@ void karte_t::init(settings_t* const sets, sint8 const* const h_field) recalc_average_speed(); // resets timeline koord::locality_factor = settings.get_locality_factor( last_year ); + world_maximum_height = sets->get_maximumheight(); + world_minimum_height = sets->get_minimumheight(); groundwater = (sint8)sets->get_groundwater(); //29-Nov-01 Markus Weber Changed init_height_to_climate(); @@ -5228,6 +5230,9 @@ void karte_t::load(loadsave_t *file) goods_manager_t::set_multiplier( 1000 ); } + world_maximum_height = settings.get_maximumheight(); + world_minimum_height = settings.get_minimumheight(); + groundwater = (sint8)(settings.get_groundwater()); min_height = max_height = groundwater; DBG_DEBUG("karte_t::load()","groundwater %i",groundwater); diff --git a/simworld.h b/simworld.h index 089510d1a..b13572356 100644 --- a/simworld.h +++ b/simworld.h @@ -613,6 +613,16 @@ private: */ uint32 map_counter; + /** + * the maximum allowed world height. + */ + sint8 world_maximum_height; + + /** + * the minimum allowed world height. + */ + sint8 world_minimum_height; + /** * Recalculated speed bonus for different vehicles. */ @@ -1074,13 +1084,13 @@ public: /** * Returns the minimum allowed height on the map. */ - sint8 get_minimumheight() const { return groundwater-10; } + sint8 get_minimumheight() const { return world_minimum_height; } /** * Returns the maximum allowed world height. * @author Hj. Malthaner */ - sint8 get_maximumheight() const { return 32; } + sint8 get_maximumheight() const { return world_maximum_height; } /** * Returns the current snowline height.