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