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