00001 /* $Id: settings_type.h 23764 2012-01-06 21:49:06Z rubidium $ */ 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 Year semaphore_build_before; 00106 byte news_message_timeout; 00107 bool show_track_reservation; 00108 uint8 default_signal_type; 00109 uint8 cycle_signal_types; 00110 byte station_numtracks; 00111 byte station_platlength; 00112 bool station_dragdrop; 00113 bool station_show_coverage; 00114 bool persistent_buildingtools; 00115 bool expenses_layout; 00116 uint32 last_newgrf_count; 00117 byte missing_strings_threshold; 00118 uint8 graph_line_thickness; 00119 00120 uint16 console_backlog_timeout; 00121 uint16 console_backlog_length; 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 uint16 max_download_time; 00177 uint16 max_password_time; 00178 bool pause_on_join; 00179 uint16 server_port; 00180 uint16 server_admin_port; 00181 bool server_admin_chat; 00182 char server_name[NETWORK_NAME_LENGTH]; 00183 char server_password[NETWORK_PASSWORD_LENGTH]; 00184 char rcon_password[NETWORK_PASSWORD_LENGTH]; 00185 char admin_password[NETWORK_PASSWORD_LENGTH]; 00186 bool server_advertise; 00187 uint8 lan_internet; 00188 char client_name[NETWORK_CLIENT_NAME_LENGTH]; 00189 char default_company_pass[NETWORK_PASSWORD_LENGTH]; 00190 char connect_to_ip[NETWORK_HOSTNAME_LENGTH]; 00191 char network_id[NETWORK_SERVER_ID_LENGTH]; 00192 bool autoclean_companies; 00193 uint8 autoclean_unprotected; 00194 uint8 autoclean_protected; 00195 uint8 autoclean_novehicles; 00196 uint8 max_companies; 00197 uint8 max_clients; 00198 uint8 max_spectators; 00199 Year restart_game_year; 00200 uint8 min_active_clients; 00201 uint8 server_lang; 00202 bool reload_cfg; 00203 char last_host[NETWORK_HOSTNAME_LENGTH]; 00204 uint16 last_port; 00205 bool no_http_content_downloads; 00206 #else /* ENABLE_NETWORK */ 00207 #endif 00208 }; 00209 00211 struct GameCreationSettings { 00212 uint32 generation_seed; 00213 Year starting_year; 00214 uint8 map_x; 00215 uint8 map_y; 00216 byte land_generator; 00217 byte oil_refinery_limit; 00218 byte snow_line_height; 00219 byte tgen_smoothness; 00220 byte tree_placer; 00221 byte heightmap_rotation; 00222 byte se_flat_world_height; 00223 byte town_name; 00224 byte landscape; 00225 byte water_borders; 00226 uint16 custom_town_number; 00227 byte variety; 00228 byte custom_sea_level; 00229 byte min_river_length; 00230 byte river_route_random; 00231 byte amount_of_rivers; 00232 }; 00233 00235 struct ConstructionSettings { 00236 bool build_on_slopes; 00237 bool autoslope; 00238 uint16 max_bridge_length; 00239 uint16 max_tunnel_length; 00240 bool signal_side; 00241 bool extra_dynamite; 00242 bool road_stop_on_town_road; 00243 bool road_stop_on_competitor_road; 00244 uint8 raw_industry_construction; 00245 uint8 industry_platform; 00246 bool freeform_edges; 00247 uint8 extra_tree_placement; 00248 uint8 command_pause_level; 00249 00250 uint32 terraform_per_64k_frames; 00251 uint16 terraform_frame_burst; 00252 uint32 clear_per_64k_frames; 00253 uint16 clear_frame_burst; 00254 }; 00255 00257 struct AISettings { 00258 bool ai_in_multiplayer; 00259 bool ai_disable_veh_train; 00260 bool ai_disable_veh_roadveh; 00261 bool ai_disable_veh_aircraft; 00262 bool ai_disable_veh_ship; 00263 }; 00264 00266 struct ScriptSettings { 00267 uint32 script_max_opcode_till_suspend; 00268 }; 00269 00271 struct OPFSettings { 00272 uint16 pf_maxlength; 00273 byte pf_maxdepth; 00274 }; 00275 00277 struct NPFSettings { 00283 uint32 npf_max_search_nodes; 00284 uint32 maximum_go_to_depot_penalty; 00285 00286 uint32 npf_rail_firstred_penalty; 00287 uint32 npf_rail_firstred_exit_penalty; 00288 uint32 npf_rail_lastred_penalty; 00289 uint32 npf_rail_station_penalty; 00290 uint32 npf_rail_slope_penalty; 00291 uint32 npf_rail_curve_penalty; 00292 uint32 npf_rail_depot_reverse_penalty; 00293 uint32 npf_rail_pbs_cross_penalty; 00294 uint32 npf_rail_pbs_signal_back_penalty; 00295 uint32 npf_buoy_penalty; 00296 uint32 npf_water_curve_penalty; 00297 uint32 npf_road_curve_penalty; 00298 uint32 npf_crossing_penalty; 00299 uint32 npf_road_drive_through_penalty; 00300 uint32 npf_road_dt_occupied_penalty; 00301 uint32 npf_road_bay_occupied_penalty; 00302 }; 00303 00305 struct YAPFSettings { 00306 bool disable_node_optimization; 00307 uint32 max_search_nodes; 00308 uint32 maximum_go_to_depot_penalty; 00309 bool ship_use_yapf; 00310 bool road_use_yapf; 00311 bool rail_use_yapf; 00312 uint32 road_slope_penalty; 00313 uint32 road_curve_penalty; 00314 uint32 road_crossing_penalty; 00315 uint32 road_stop_penalty; 00316 uint32 road_stop_occupied_penalty; 00317 uint32 road_stop_bay_occupied_penalty; 00318 bool rail_firstred_twoway_eol; 00319 uint32 rail_firstred_penalty; 00320 uint32 rail_firstred_exit_penalty; 00321 uint32 rail_lastred_penalty; 00322 uint32 rail_lastred_exit_penalty; 00323 uint32 rail_station_penalty; 00324 uint32 rail_slope_penalty; 00325 uint32 rail_curve45_penalty; 00326 uint32 rail_curve90_penalty; 00327 uint32 rail_depot_reverse_penalty; 00328 uint32 rail_crossing_penalty; 00329 uint32 rail_look_ahead_max_signals; 00330 int32 rail_look_ahead_signal_p0; 00331 int32 rail_look_ahead_signal_p1; 00332 int32 rail_look_ahead_signal_p2; 00333 uint32 rail_pbs_cross_penalty; 00334 uint32 rail_pbs_station_penalty; 00335 uint32 rail_pbs_signal_back_penalty; 00336 uint32 rail_doubleslip_penalty; 00337 00338 uint32 rail_longer_platform_penalty; 00339 uint32 rail_longer_platform_per_tile_penalty; 00340 uint32 rail_shorter_platform_penalty; 00341 uint32 rail_shorter_platform_per_tile_penalty; 00342 }; 00343 00345 struct PathfinderSettings { 00346 uint8 pathfinder_for_trains; 00347 uint8 pathfinder_for_roadvehs; 00348 uint8 pathfinder_for_ships; 00349 bool new_pathfinding_all; 00350 00351 bool roadveh_queue; 00352 bool forbid_90_deg; 00353 00354 bool reverse_at_signals; 00355 byte wait_oneway_signal; 00356 byte wait_twoway_signal; 00357 00358 bool reserve_paths; 00359 byte wait_for_pbs_path; 00360 byte path_backoff_interval; 00361 00362 OPFSettings opf; 00363 NPFSettings npf; 00364 YAPFSettings yapf; 00365 }; 00366 00368 struct OrderSettings { 00369 bool improved_load; 00370 bool gradual_loading; 00371 bool selectgoods; 00372 bool no_servicing_if_no_breakdowns; 00373 bool serviceathelipad; 00374 }; 00375 00377 struct VehicleSettings { 00378 uint8 max_train_length; 00379 uint8 smoke_amount; 00380 uint8 train_acceleration_model; 00381 uint8 roadveh_acceleration_model; 00382 uint8 train_slope_steepness; 00383 uint8 roadveh_slope_steepness; 00384 bool wagon_speed_limits; 00385 bool disable_elrails; 00386 UnitID max_trains; 00387 UnitID max_roadveh; 00388 UnitID max_aircraft; 00389 UnitID max_ships; 00390 uint8 plane_speed; 00391 uint8 freight_trains; 00392 bool dynamic_engines; 00393 bool never_expire_vehicles; 00394 byte extend_vehicle_life; 00395 byte road_side; 00396 uint8 plane_crashes; 00397 }; 00398 00400 struct EconomySettings { 00401 bool inflation; 00402 bool bribe; 00403 bool smooth_economy; 00404 bool allow_shares; 00405 uint8 feeder_payment_share; 00406 byte dist_local_authority; 00407 bool exclusive_rights; 00408 bool fund_buildings; 00409 bool fund_roads; 00410 bool give_money; 00411 bool mod_road_rebuild; 00412 bool multiple_industry_per_town; 00413 uint8 town_growth_rate; 00414 uint8 larger_towns; 00415 uint8 initial_city_size; 00416 TownLayoutByte town_layout; 00417 bool allow_town_roads; 00418 TownFoundingByte found_town; 00419 bool station_noise_level; 00420 uint16 town_noise_population[3]; 00421 bool allow_town_level_crossings; 00422 bool infrastructure_maintenance; 00423 }; 00424 00426 struct StationSettings { 00427 bool modified_catchment; 00428 bool adjacent_stations; 00429 bool distant_join_stations; 00430 bool never_expire_airports; 00431 byte station_spread; 00432 }; 00433 00435 struct VehicleDefaultSettings { 00436 bool servint_ispercent; 00437 uint16 servint_trains; 00438 uint16 servint_roadveh; 00439 uint16 servint_aircraft; 00440 uint16 servint_ships; 00441 }; 00442 00444 struct CompanySettings { 00445 bool engine_renew; 00446 int16 engine_renew_months; 00447 uint32 engine_renew_money; 00448 bool renew_keep_length; 00449 VehicleDefaultSettings vehicle; 00450 }; 00451 00453 struct GameSettings { 00454 DifficultySettings difficulty; 00455 GameCreationSettings game_creation; 00456 ConstructionSettings construction; 00457 AISettings ai; 00458 ScriptSettings script; 00459 class AIConfig *ai_config[MAX_COMPANIES]; 00460 class GameConfig *game_config; 00461 PathfinderSettings pf; 00462 OrderSettings order; 00463 VehicleSettings vehicle; 00464 EconomySettings economy; 00465 StationSettings station; 00466 LocaleSettings locale; 00467 }; 00468 00470 struct ClientSettings { 00471 GUISettings gui; 00472 NetworkSettings network; 00473 CompanySettings company; 00474 MusicSettings music; 00475 }; 00476 00478 extern ClientSettings _settings_client; 00479 00481 extern GameSettings _settings_game; 00482 00484 extern GameSettings _settings_newgame; 00485 00487 extern VehicleDefaultSettings _old_vds; 00488 00493 static inline GameSettings &GetGameSettings() 00494 { 00495 return (_game_mode == GM_MENU) ? _settings_newgame : _settings_game; 00496 } 00497 00498 #endif /* SETTINGS_TYPE_H */