# settings_type.h

Go to the documentation of this file.

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