# settings_type.h

Go to the documentation of this file.

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