Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef SETTINGS_TYPE_H
00013 #define SETTINGS_TYPE_H
00014
00015 #include "date_type.h"
00016 #include "town_type.h"
00017 #include "transport_type.h"
00018 #include "network/core/config.h"
00019 #include "company_type.h"
00020 #include "cargotype.h"
00021 #include "linkgraph/linkgraph_type.h"
00022 #include "zoom_type.h"
00023 #include "openttd.h"
00024
00026 enum IndustryDensity {
00027 ID_FUND_ONLY,
00028 ID_MINIMAL,
00029 ID_VERY_LOW,
00030 ID_LOW,
00031 ID_NORMAL,
00032 ID_HIGH,
00033
00034 ID_END,
00035 };
00036
00038 struct DifficultySettings {
00039 byte max_no_competitors;
00040 byte number_towns;
00041 byte industry_density;
00042 uint32 max_loan;
00043 byte initial_interest;
00044 byte vehicle_costs;
00045 byte competitor_speed;
00046 byte vehicle_breakdowns;
00047 byte subsidy_multiplier;
00048 byte construction_cost;
00049 byte terrain_type;
00050 byte quantity_sea_lakes;
00051 byte economy;
00052 byte line_reverse_mode;
00053 byte disasters;
00054 byte town_council_tolerance;
00055 byte diff_level;
00056 };
00057
00059 struct GUISettings {
00060 bool sg_full_load_any;
00061 bool lost_vehicle_warn;
00062 uint8 order_review_system;
00063 bool vehicle_income_warn;
00064 bool show_finances;
00065 bool sg_new_nonstop;
00066 bool new_nonstop;
00067 uint8 stop_location;
00068 uint8 auto_scrolling;
00069 byte errmsg_duration;
00070 byte hover_delay;
00071 bool link_terraform_toolbar;
00072 uint8 smallmap_land_colour;
00073 bool reverse_scroll;
00074 bool smooth_scroll;
00075 bool measure_tooltip;
00076 byte liveries;
00077 bool prefer_teamchat;
00078 uint8 advanced_vehicle_list;
00079 uint8 loading_indicators;
00080 uint8 default_rail_type;
00081 uint8 toolbar_pos;
00082 uint8 statusbar_pos;
00083 uint8 window_snap_radius;
00084 uint8 window_soft_limit;
00085 ZoomLevelByte zoom_min;
00086 ZoomLevelByte zoom_max;
00087 bool disable_unsuitable_building;
00088 byte autosave;
00089 bool threaded_saves;
00090 bool keep_all_autosave;
00091 bool autosave_on_exit;
00092 uint8 date_format_in_default_names;
00093 byte max_num_autosaves;
00094 bool population_in_label;
00095 uint8 right_mouse_btn_emulation;
00096 uint8 scrollwheel_scrolling;
00097 uint8 scrollwheel_multiplier;
00098 bool timetable_arrival_departure;
00099 bool left_mouse_btn_scrolling;
00100 bool pause_on_newgame;
00101 bool enable_signal_gui;
00102 Year coloured_news_year;
00103 bool timetable_in_ticks;
00104 bool quick_goto;
00105 bool auto_euro;
00106 byte drag_signals_density;
00107 bool drag_signals_fixed_distance;
00108 Year semaphore_build_before;
00109 byte news_message_timeout;
00110 bool show_track_reservation;
00111 uint8 default_signal_type;
00112 uint8 cycle_signal_types;
00113 byte station_numtracks;
00114 byte station_platlength;
00115 bool station_dragdrop;
00116 bool station_show_coverage;
00117 bool persistent_buildingtools;
00118 bool expenses_layout;
00119 uint32 last_newgrf_count;
00120 byte missing_strings_threshold;
00121 uint8 graph_line_thickness;
00122
00123 uint16 console_backlog_timeout;
00124 uint16 console_backlog_length;
00125
00126 uint8 station_gui_group_order;
00127 uint8 station_gui_sort_by;
00128 uint8 station_gui_sort_order;
00129 #ifdef ENABLE_NETWORK
00130 uint16 network_chat_box_width;
00131 uint8 network_chat_box_height;
00132 uint16 network_chat_timeout;
00133 #endif
00134
00135 uint8 developer;
00136 bool show_date_in_logs;
00137 bool newgrf_developer_tools;
00138 bool ai_developer_tools;
00139 bool scenario_developer;
00140 uint8 settings_restriction_mode;
00141 bool newgrf_show_old_versions;
00142 uint8 newgrf_default_palette;
00143
00148 bool UserIsAllowedToChangeNewGRFs() const
00149 {
00150 return this->scenario_developer || this->newgrf_developer_tools;
00151 }
00152 };
00153
00155 struct MusicSettings {
00156 byte playlist;
00157 byte music_vol;
00158 byte effect_vol;
00159 byte custom_1[33];
00160 byte custom_2[33];
00161 bool playing;
00162 bool shuffle;
00163 };
00164
00166 struct LocaleSettings {
00167 byte currency;
00168 byte units;
00169 char *digit_group_separator;
00170 char *digit_group_separator_currency;
00171 char *digit_decimal_separator;
00172 };
00173
00175 struct NetworkSettings {
00176 #ifdef ENABLE_NETWORK
00177 uint16 sync_freq;
00178 uint8 frame_freq;
00179 uint16 commands_per_frame;
00180 uint16 max_commands_in_queue;
00181 uint16 bytes_per_frame;
00182 uint16 bytes_per_frame_burst;
00183 uint16 max_init_time;
00184 uint16 max_join_time;
00185 uint16 max_download_time;
00186 uint16 max_password_time;
00187 uint16 max_lag_time;
00188 bool pause_on_join;
00189 uint16 server_port;
00190 uint16 server_admin_port;
00191 bool server_admin_chat;
00192 char server_name[NETWORK_NAME_LENGTH];
00193 char server_password[NETWORK_PASSWORD_LENGTH];
00194 char rcon_password[NETWORK_PASSWORD_LENGTH];
00195 char admin_password[NETWORK_PASSWORD_LENGTH];
00196 bool server_advertise;
00197 uint8 lan_internet;
00198 char client_name[NETWORK_CLIENT_NAME_LENGTH];
00199 char default_company_pass[NETWORK_PASSWORD_LENGTH];
00200 char connect_to_ip[NETWORK_HOSTNAME_LENGTH];
00201 char network_id[NETWORK_SERVER_ID_LENGTH];
00202 bool autoclean_companies;
00203 uint8 autoclean_unprotected;
00204 uint8 autoclean_protected;
00205 uint8 autoclean_novehicles;
00206 uint8 max_companies;
00207 uint8 max_clients;
00208 uint8 max_spectators;
00209 Year restart_game_year;
00210 uint8 min_active_clients;
00211 uint8 server_lang;
00212 bool reload_cfg;
00213 char last_host[NETWORK_HOSTNAME_LENGTH];
00214 uint16 last_port;
00215 bool no_http_content_downloads;
00216 #else
00217 #endif
00218 };
00219
00221 struct GameCreationSettings {
00222 uint32 generation_seed;
00223 Year starting_year;
00224 uint8 map_x;
00225 uint8 map_y;
00226 byte land_generator;
00227 byte oil_refinery_limit;
00228 byte snow_line_height;
00229 byte tgen_smoothness;
00230 byte tree_placer;
00231 byte heightmap_rotation;
00232 byte se_flat_world_height;
00233 byte town_name;
00234 byte landscape;
00235 byte water_borders;
00236 uint16 custom_town_number;
00237 byte variety;
00238 byte custom_sea_level;
00239 byte min_river_length;
00240 byte river_route_random;
00241 byte amount_of_rivers;
00242 };
00243
00245 struct ConstructionSettings {
00246 bool build_on_slopes;
00247 bool autoslope;
00248 uint16 max_bridge_length;
00249 uint16 max_tunnel_length;
00250 byte train_signal_side;
00251 bool extra_dynamite;
00252 bool road_stop_on_town_road;
00253 bool road_stop_on_competitor_road;
00254 uint8 raw_industry_construction;
00255 uint8 industry_platform;
00256 bool freeform_edges;
00257 uint8 extra_tree_placement;
00258 uint8 command_pause_level;
00259
00260 uint32 terraform_per_64k_frames;
00261 uint16 terraform_frame_burst;
00262 uint32 clear_per_64k_frames;
00263 uint16 clear_frame_burst;
00264 uint32 tree_per_64k_frames;
00265 uint16 tree_frame_burst;
00266 };
00267
00269 struct AISettings {
00270 bool ai_in_multiplayer;
00271 bool ai_disable_veh_train;
00272 bool ai_disable_veh_roadveh;
00273 bool ai_disable_veh_aircraft;
00274 bool ai_disable_veh_ship;
00275 };
00276
00278 struct ScriptSettings {
00279 uint32 script_max_opcode_till_suspend;
00280 };
00281
00283 struct OPFSettings {
00284 uint16 pf_maxlength;
00285 byte pf_maxdepth;
00286 };
00287
00289 struct NPFSettings {
00295 uint32 npf_max_search_nodes;
00296 uint32 maximum_go_to_depot_penalty;
00297
00298 uint32 npf_rail_firstred_penalty;
00299 uint32 npf_rail_firstred_exit_penalty;
00300 uint32 npf_rail_lastred_penalty;
00301 uint32 npf_rail_station_penalty;
00302 uint32 npf_rail_slope_penalty;
00303 uint32 npf_rail_curve_penalty;
00304 uint32 npf_rail_depot_reverse_penalty;
00305 uint32 npf_rail_pbs_cross_penalty;
00306 uint32 npf_rail_pbs_signal_back_penalty;
00307 uint32 npf_buoy_penalty;
00308 uint32 npf_water_curve_penalty;
00309 uint32 npf_road_curve_penalty;
00310 uint32 npf_crossing_penalty;
00311 uint32 npf_road_drive_through_penalty;
00312 uint32 npf_road_dt_occupied_penalty;
00313 uint32 npf_road_bay_occupied_penalty;
00314 };
00315
00317 struct YAPFSettings {
00318 bool disable_node_optimization;
00319 uint32 max_search_nodes;
00320 uint32 maximum_go_to_depot_penalty;
00321 bool ship_use_yapf;
00322 bool road_use_yapf;
00323 bool rail_use_yapf;
00324 uint32 road_slope_penalty;
00325 uint32 road_curve_penalty;
00326 uint32 road_crossing_penalty;
00327 uint32 road_stop_penalty;
00328 uint32 road_stop_occupied_penalty;
00329 uint32 road_stop_bay_occupied_penalty;
00330 bool rail_firstred_twoway_eol;
00331 uint32 rail_firstred_penalty;
00332 uint32 rail_firstred_exit_penalty;
00333 uint32 rail_lastred_penalty;
00334 uint32 rail_lastred_exit_penalty;
00335 uint32 rail_station_penalty;
00336 uint32 rail_slope_penalty;
00337 uint32 rail_curve45_penalty;
00338 uint32 rail_curve90_penalty;
00339 uint32 rail_depot_reverse_penalty;
00340 uint32 rail_crossing_penalty;
00341 uint32 rail_look_ahead_max_signals;
00342 int32 rail_look_ahead_signal_p0;
00343 int32 rail_look_ahead_signal_p1;
00344 int32 rail_look_ahead_signal_p2;
00345 uint32 rail_pbs_cross_penalty;
00346 uint32 rail_pbs_station_penalty;
00347 uint32 rail_pbs_signal_back_penalty;
00348 uint32 rail_doubleslip_penalty;
00349
00350 uint32 rail_longer_platform_penalty;
00351 uint32 rail_longer_platform_per_tile_penalty;
00352 uint32 rail_shorter_platform_penalty;
00353 uint32 rail_shorter_platform_per_tile_penalty;
00354 };
00355
00357 struct PathfinderSettings {
00358 uint8 pathfinder_for_trains;
00359 uint8 pathfinder_for_roadvehs;
00360 uint8 pathfinder_for_ships;
00361 bool new_pathfinding_all;
00362
00363 bool roadveh_queue;
00364 bool forbid_90_deg;
00365
00366 bool reverse_at_signals;
00367 byte wait_oneway_signal;
00368 byte wait_twoway_signal;
00369
00370 bool reserve_paths;
00371 byte wait_for_pbs_path;
00372 byte path_backoff_interval;
00373
00374 OPFSettings opf;
00375 NPFSettings npf;
00376 YAPFSettings yapf;
00377 };
00378
00380 struct OrderSettings {
00381 bool improved_load;
00382 bool gradual_loading;
00383 bool selectgoods;
00384 bool no_servicing_if_no_breakdowns;
00385 bool serviceathelipad;
00386 };
00387
00389 struct VehicleSettings {
00390 uint8 max_train_length;
00391 uint8 smoke_amount;
00392 uint8 train_acceleration_model;
00393 uint8 roadveh_acceleration_model;
00394 uint8 train_slope_steepness;
00395 uint8 roadveh_slope_steepness;
00396 bool wagon_speed_limits;
00397 bool disable_elrails;
00398 UnitID max_trains;
00399 UnitID max_roadveh;
00400 UnitID max_aircraft;
00401 UnitID max_ships;
00402 uint8 plane_speed;
00403 uint8 freight_trains;
00404 bool dynamic_engines;
00405 bool never_expire_vehicles;
00406 byte extend_vehicle_life;
00407 byte road_side;
00408 uint8 plane_crashes;
00409 };
00410
00412 struct EconomySettings {
00413 bool inflation;
00414 bool bribe;
00415 bool smooth_economy;
00416 bool allow_shares;
00417 uint8 feeder_payment_share;
00418 byte dist_local_authority;
00419 bool exclusive_rights;
00420 bool fund_buildings;
00421 bool fund_roads;
00422 bool give_money;
00423 bool mod_road_rebuild;
00424 bool multiple_industry_per_town;
00425 uint8 town_growth_rate;
00426 uint8 larger_towns;
00427 uint8 initial_city_size;
00428 TownLayoutByte town_layout;
00429 bool allow_town_roads;
00430 TownFoundingByte found_town;
00431 bool station_noise_level;
00432 uint16 town_noise_population[3];
00433 bool allow_town_level_crossings;
00434 bool infrastructure_maintenance;
00435 };
00436
00437 struct LinkGraphSettings {
00438 uint16 recalc_interval;
00439 DistributionTypeByte distribution_pax;
00440 DistributionTypeByte distribution_mail;
00441 DistributionTypeByte distribution_armoured;
00442 DistributionTypeByte distribution_default;
00443 uint8 accuracy;
00444 uint8 demand_size;
00445 uint8 demand_distance;
00446 uint8 short_path_saturation;
00447
00448 inline DistributionType GetDistributionType(CargoID cargo) const {
00449 if (IsCargoInClass(cargo, CC_PASSENGERS)) {
00450 return this->distribution_pax;
00451 } else if (IsCargoInClass(cargo, CC_MAIL)) {
00452 return this->distribution_mail;
00453 } else if (IsCargoInClass(cargo, CC_ARMOURED)) {
00454 return this->distribution_armoured;
00455 } else {
00456 return this->distribution_default;
00457 }
00458 }
00459 };
00460
00462 struct StationSettings {
00463 bool modified_catchment;
00464 bool adjacent_stations;
00465 bool distant_join_stations;
00466 bool never_expire_airports;
00467 byte station_spread;
00468 };
00469
00471 struct VehicleDefaultSettings {
00472 bool servint_ispercent;
00473 uint16 servint_trains;
00474 uint16 servint_roadveh;
00475 uint16 servint_aircraft;
00476 uint16 servint_ships;
00477 };
00478
00480 struct CompanySettings {
00481 bool engine_renew;
00482 int16 engine_renew_months;
00483 uint32 engine_renew_money;
00484 bool renew_keep_length;
00485 VehicleDefaultSettings vehicle;
00486 };
00487
00489 struct GameSettings {
00490 DifficultySettings difficulty;
00491 GameCreationSettings game_creation;
00492 ConstructionSettings construction;
00493 AISettings ai;
00494 ScriptSettings script;
00495 class AIConfig *ai_config[MAX_COMPANIES];
00496 class GameConfig *game_config;
00497 PathfinderSettings pf;
00498 OrderSettings order;
00499 VehicleSettings vehicle;
00500 EconomySettings economy;
00501 LinkGraphSettings linkgraph;
00502 StationSettings station;
00503 LocaleSettings locale;
00504 };
00505
00507 struct ClientSettings {
00508 GUISettings gui;
00509 NetworkSettings network;
00510 CompanySettings company;
00511 MusicSettings music;
00512 };
00513
00515 extern ClientSettings _settings_client;
00516
00518 extern GameSettings _settings_game;
00519
00521 extern GameSettings _settings_newgame;
00522
00524 extern VehicleDefaultSettings _old_vds;
00525
00530 static inline GameSettings &GetGameSettings()
00531 {
00532 return (_game_mode == GM_MENU) ? _settings_newgame : _settings_game;
00533 }
00534
00535 #endif