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