00001 /* $Id: settings_type.h 23606 2011-12-19 20:55:56Z truebrain $ */ 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 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 /* ENABLE_NETWORK */ 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 water_borders; 00224 uint16 custom_town_number; 00225 byte variety; 00226 byte custom_sea_level; 00227 byte min_river_length; 00228 byte river_route_random; 00229 byte amount_of_rivers; 00230 }; 00231 00233 struct ConstructionSettings { 00234 bool build_on_slopes; 00235 bool autoslope; 00236 uint16 max_bridge_length; 00237 uint16 max_tunnel_length; 00238 bool signal_side; 00239 bool extra_dynamite; 00240 bool road_stop_on_town_road; 00241 bool road_stop_on_competitor_road; 00242 uint8 raw_industry_construction; 00243 uint8 industry_platform; 00244 bool freeform_edges; 00245 uint8 extra_tree_placement; 00246 uint8 command_pause_level; 00247 00248 uint32 terraform_per_64k_frames; 00249 uint16 terraform_frame_burst; 00250 uint32 clear_per_64k_frames; 00251 uint16 clear_frame_burst; 00252 }; 00253 00255 struct AISettings { 00256 bool ai_in_multiplayer; 00257 bool ai_disable_veh_train; 00258 bool ai_disable_veh_roadveh; 00259 bool ai_disable_veh_aircraft; 00260 bool ai_disable_veh_ship; 00261 }; 00262 00264 struct ScriptSettings { 00265 uint32 script_max_opcode_till_suspend; 00266 }; 00267 00269 struct OPFSettings { 00270 uint16 pf_maxlength; 00271 byte pf_maxdepth; 00272 }; 00273 00275 struct NPFSettings { 00281 uint32 npf_max_search_nodes; 00282 uint32 maximum_go_to_depot_penalty; 00283 00284 uint32 npf_rail_firstred_penalty; 00285 uint32 npf_rail_firstred_exit_penalty; 00286 uint32 npf_rail_lastred_penalty; 00287 uint32 npf_rail_station_penalty; 00288 uint32 npf_rail_slope_penalty; 00289 uint32 npf_rail_curve_penalty; 00290 uint32 npf_rail_depot_reverse_penalty; 00291 uint32 npf_rail_pbs_cross_penalty; 00292 uint32 npf_rail_pbs_signal_back_penalty; 00293 uint32 npf_buoy_penalty; 00294 uint32 npf_water_curve_penalty; 00295 uint32 npf_road_curve_penalty; 00296 uint32 npf_crossing_penalty; 00297 uint32 npf_road_drive_through_penalty; 00298 uint32 npf_road_dt_occupied_penalty; 00299 uint32 npf_road_bay_occupied_penalty; 00300 }; 00301 00303 struct YAPFSettings { 00304 bool disable_node_optimization; 00305 uint32 max_search_nodes; 00306 uint32 maximum_go_to_depot_penalty; 00307 bool ship_use_yapf; 00308 bool road_use_yapf; 00309 bool rail_use_yapf; 00310 uint32 road_slope_penalty; 00311 uint32 road_curve_penalty; 00312 uint32 road_crossing_penalty; 00313 uint32 road_stop_penalty; 00314 uint32 road_stop_occupied_penalty; 00315 uint32 road_stop_bay_occupied_penalty; 00316 bool rail_firstred_twoway_eol; 00317 uint32 rail_firstred_penalty; 00318 uint32 rail_firstred_exit_penalty; 00319 uint32 rail_lastred_penalty; 00320 uint32 rail_lastred_exit_penalty; 00321 uint32 rail_station_penalty; 00322 uint32 rail_slope_penalty; 00323 uint32 rail_curve45_penalty; 00324 uint32 rail_curve90_penalty; 00325 uint32 rail_depot_reverse_penalty; 00326 uint32 rail_crossing_penalty; 00327 uint32 rail_look_ahead_max_signals; 00328 int32 rail_look_ahead_signal_p0; 00329 int32 rail_look_ahead_signal_p1; 00330 int32 rail_look_ahead_signal_p2; 00331 uint32 rail_pbs_cross_penalty; 00332 uint32 rail_pbs_station_penalty; 00333 uint32 rail_pbs_signal_back_penalty; 00334 uint32 rail_doubleslip_penalty; 00335 00336 uint32 rail_longer_platform_penalty; 00337 uint32 rail_longer_platform_per_tile_penalty; 00338 uint32 rail_shorter_platform_penalty; 00339 uint32 rail_shorter_platform_per_tile_penalty; 00340 }; 00341 00343 struct PathfinderSettings { 00344 uint8 pathfinder_for_trains; 00345 uint8 pathfinder_for_roadvehs; 00346 uint8 pathfinder_for_ships; 00347 bool new_pathfinding_all; 00348 00349 bool roadveh_queue; 00350 bool forbid_90_deg; 00351 00352 bool reverse_at_signals; 00353 byte wait_oneway_signal; 00354 byte wait_twoway_signal; 00355 00356 bool reserve_paths; 00357 byte wait_for_pbs_path; 00358 byte path_backoff_interval; 00359 00360 OPFSettings opf; 00361 NPFSettings npf; 00362 YAPFSettings yapf; 00363 }; 00364 00366 struct OrderSettings { 00367 bool improved_load; 00368 bool gradual_loading; 00369 bool selectgoods; 00370 bool no_servicing_if_no_breakdowns; 00371 bool serviceathelipad; 00372 }; 00373 00375 struct VehicleSettings { 00376 uint8 max_train_length; 00377 uint8 smoke_amount; 00378 uint8 train_acceleration_model; 00379 uint8 roadveh_acceleration_model; 00380 uint8 train_slope_steepness; 00381 uint8 roadveh_slope_steepness; 00382 bool wagon_speed_limits; 00383 bool disable_elrails; 00384 UnitID max_trains; 00385 UnitID max_roadveh; 00386 UnitID max_aircraft; 00387 UnitID max_ships; 00388 uint8 plane_speed; 00389 uint8 freight_trains; 00390 bool dynamic_engines; 00391 bool never_expire_vehicles; 00392 byte extend_vehicle_life; 00393 byte road_side; 00394 uint8 plane_crashes; 00395 }; 00396 00398 struct EconomySettings { 00399 bool inflation; 00400 bool bribe; 00401 bool smooth_economy; 00402 bool allow_shares; 00403 uint8 feeder_payment_share; 00404 byte dist_local_authority; 00405 bool exclusive_rights; 00406 bool fund_buildings; 00407 bool fund_roads; 00408 bool give_money; 00409 bool mod_road_rebuild; 00410 bool multiple_industry_per_town; 00411 uint8 town_growth_rate; 00412 uint8 larger_towns; 00413 uint8 initial_city_size; 00414 TownLayoutByte town_layout; 00415 bool allow_town_roads; 00416 TownFoundingByte found_town; 00417 bool station_noise_level; 00418 uint16 town_noise_population[3]; 00419 bool allow_town_level_crossings; 00420 bool infrastructure_maintenance; 00421 }; 00422 00424 struct StationSettings { 00425 bool modified_catchment; 00426 bool adjacent_stations; 00427 bool distant_join_stations; 00428 bool never_expire_airports; 00429 byte station_spread; 00430 }; 00431 00433 struct VehicleDefaultSettings { 00434 bool servint_ispercent; 00435 uint16 servint_trains; 00436 uint16 servint_roadveh; 00437 uint16 servint_aircraft; 00438 uint16 servint_ships; 00439 }; 00440 00442 struct CompanySettings { 00443 bool engine_renew; 00444 int16 engine_renew_months; 00445 uint32 engine_renew_money; 00446 bool renew_keep_length; 00447 VehicleDefaultSettings vehicle; 00448 }; 00449 00451 struct GameSettings { 00452 DifficultySettings difficulty; 00453 GameCreationSettings game_creation; 00454 ConstructionSettings construction; 00455 AISettings ai; 00456 ScriptSettings script; 00457 class AIConfig *ai_config[MAX_COMPANIES]; 00458 class GameConfig *game_config; 00459 PathfinderSettings pf; 00460 OrderSettings order; 00461 VehicleSettings vehicle; 00462 EconomySettings economy; 00463 StationSettings station; 00464 LocaleSettings locale; 00465 }; 00466 00468 struct ClientSettings { 00469 GUISettings gui; 00470 NetworkSettings network; 00471 CompanySettings company; 00472 MusicSettings music; 00473 }; 00474 00476 extern ClientSettings _settings_client; 00477 00479 extern GameSettings _settings_game; 00480 00482 extern GameSettings _settings_newgame; 00483 00485 extern VehicleDefaultSettings _old_vds; 00486 00491 static inline GameSettings &GetGameSettings() 00492 { 00493 return (_game_mode == GM_MENU) ? _settings_newgame : _settings_game; 00494 } 00495 00496 #endif /* SETTINGS_TYPE_H */