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   uint8  newgrf_default_palette;           
00129 
00134   bool UserIsAllowedToChangeNewGRFs() const
00135   {
00136     return this->scenario_developer || this->newgrf_developer_tools;
00137   }
00138 };
00139 
00141 struct MusicSettings {
00142   byte playlist;     
00143   byte music_vol;    
00144   byte effect_vol;   
00145   byte custom_1[33]; 
00146   byte custom_2[33]; 
00147   bool playing;      
00148   bool shuffle;      
00149 };
00150 
00152 struct LocaleSettings {
00153   byte   currency;                         
00154   byte   units;                            
00155   char  *digit_group_separator;            
00156   char  *digit_group_separator_currency;   
00157   char  *digit_decimal_separator;          
00158 };
00159 
00161 struct NetworkSettings {
00162 #ifdef ENABLE_NETWORK
00163   uint16 sync_freq;                                     
00164   uint8  frame_freq;                                    
00165   uint16 commands_per_frame;                            
00166   uint16 max_commands_in_queue;                         
00167   uint16 bytes_per_frame;                               
00168   uint16 bytes_per_frame_burst;                         
00169   uint16 max_join_time;                                 
00170   bool   pause_on_join;                                 
00171   uint16 server_port;                                   
00172   uint16 server_admin_port;                             
00173   bool   server_admin_chat;                             
00174   char   server_name[NETWORK_NAME_LENGTH];              
00175   char   server_password[NETWORK_PASSWORD_LENGTH];      
00176   char   rcon_password[NETWORK_PASSWORD_LENGTH];        
00177   char   admin_password[NETWORK_PASSWORD_LENGTH];       
00178   bool   server_advertise;                              
00179   uint8  lan_internet;                                  
00180   char   client_name[NETWORK_CLIENT_NAME_LENGTH];       
00181   char   default_company_pass[NETWORK_PASSWORD_LENGTH]; 
00182   char   connect_to_ip[NETWORK_HOSTNAME_LENGTH];        
00183   char   network_id[NETWORK_SERVER_ID_LENGTH];          
00184   bool   autoclean_companies;                           
00185   uint8  autoclean_unprotected;                         
00186   uint8  autoclean_protected;                           
00187   uint8  autoclean_novehicles;                          
00188   uint8  max_companies;                                 
00189   uint8  max_clients;                                   
00190   uint8  max_spectators;                                
00191   Year   restart_game_year;                             
00192   uint8  min_active_clients;                            
00193   uint8  server_lang;                                   
00194   bool   reload_cfg;                                    
00195   char   last_host[NETWORK_HOSTNAME_LENGTH];            
00196   uint16 last_port;                                     
00197   bool   no_http_content_downloads;                     
00198 #else /* ENABLE_NETWORK */
00199 #endif
00200 };
00201 
00203 struct GameCreationSettings {
00204   uint32 generation_seed;                  
00205   Year   starting_year;                    
00206   uint8  map_x;                            
00207   uint8  map_y;                            
00208   byte   land_generator;                   
00209   byte   oil_refinery_limit;               
00210   byte   snow_line_height;                 
00211   byte   tgen_smoothness;                  
00212   byte   tree_placer;                      
00213   byte   heightmap_rotation;               
00214   byte   se_flat_world_height;             
00215   byte   town_name;                        
00216   byte   landscape;                        
00217   byte   snow_line;                        
00218   byte   water_borders;                    
00219   uint16 custom_town_number;               
00220   byte   variety;                          
00221   byte   custom_sea_level;                 
00222 };
00223 
00225 struct ConstructionSettings {
00226   bool   build_on_slopes;                  
00227   bool   autoslope;                        
00228   uint16 max_bridge_length;                
00229   uint16 max_tunnel_length;                
00230   bool   signal_side;                      
00231   bool   extra_dynamite;                   
00232   bool   road_stop_on_town_road;           
00233   bool   road_stop_on_competitor_road;     
00234   uint8  raw_industry_construction;        
00235   uint8  industry_platform;                
00236   bool   freeform_edges;                   
00237   uint8  extra_tree_placement;             
00238   uint8  command_pause_level;              
00239 
00240   uint32 terraform_per_64k_frames;         
00241   uint16 terraform_frame_burst;            
00242   uint32 clear_per_64k_frames;             
00243   uint16 clear_frame_burst;                
00244 };
00245 
00247 struct AISettings {
00248   bool   ai_in_multiplayer;                
00249   bool   ai_disable_veh_train;             
00250   bool   ai_disable_veh_roadveh;           
00251   bool   ai_disable_veh_aircraft;          
00252   bool   ai_disable_veh_ship;              
00253   uint32 ai_max_opcode_till_suspend;       
00254 };
00255 
00257 struct OPFSettings {
00258   uint16 pf_maxlength;                     
00259   byte   pf_maxdepth;                      
00260 };
00261 
00263 struct NPFSettings {
00269   uint32 npf_max_search_nodes;
00270   uint32 maximum_go_to_depot_penalty;      
00271 
00272   uint32 npf_rail_firstred_penalty;        
00273   uint32 npf_rail_firstred_exit_penalty;   
00274   uint32 npf_rail_lastred_penalty;         
00275   uint32 npf_rail_station_penalty;         
00276   uint32 npf_rail_slope_penalty;           
00277   uint32 npf_rail_curve_penalty;           
00278   uint32 npf_rail_depot_reverse_penalty;   
00279   uint32 npf_rail_pbs_cross_penalty;       
00280   uint32 npf_rail_pbs_signal_back_penalty; 
00281   uint32 npf_buoy_penalty;                 
00282   uint32 npf_water_curve_penalty;          
00283   uint32 npf_road_curve_penalty;           
00284   uint32 npf_crossing_penalty;             
00285   uint32 npf_road_drive_through_penalty;   
00286   uint32 npf_road_dt_occupied_penalty;     
00287   uint32 npf_road_bay_occupied_penalty;    
00288 };
00289 
00291 struct YAPFSettings {
00292   bool   disable_node_optimization;        
00293   uint32 max_search_nodes;                 
00294   uint32 maximum_go_to_depot_penalty;      
00295   bool   ship_use_yapf;                    
00296   bool   road_use_yapf;                    
00297   bool   rail_use_yapf;                    
00298   uint32 road_slope_penalty;               
00299   uint32 road_curve_penalty;               
00300   uint32 road_crossing_penalty;            
00301   uint32 road_stop_penalty;                
00302   uint32 road_stop_occupied_penalty;       
00303   uint32 road_stop_bay_occupied_penalty;   
00304   bool   rail_firstred_twoway_eol;         
00305   uint32 rail_firstred_penalty;            
00306   uint32 rail_firstred_exit_penalty;       
00307   uint32 rail_lastred_penalty;             
00308   uint32 rail_lastred_exit_penalty;        
00309   uint32 rail_station_penalty;             
00310   uint32 rail_slope_penalty;               
00311   uint32 rail_curve45_penalty;             
00312   uint32 rail_curve90_penalty;             
00313   uint32 rail_depot_reverse_penalty;       
00314   uint32 rail_crossing_penalty;            
00315   uint32 rail_look_ahead_max_signals;      
00316   int32  rail_look_ahead_signal_p0;        
00317   int32  rail_look_ahead_signal_p1;        
00318   int32  rail_look_ahead_signal_p2;        
00319   uint32 rail_pbs_cross_penalty;           
00320   uint32 rail_pbs_station_penalty;         
00321   uint32 rail_pbs_signal_back_penalty;     
00322   uint32 rail_doubleslip_penalty;          
00323 
00324   uint32 rail_longer_platform_penalty;           
00325   uint32 rail_longer_platform_per_tile_penalty;  
00326   uint32 rail_shorter_platform_penalty;          
00327   uint32 rail_shorter_platform_per_tile_penalty; 
00328 
00329   uint32 route_transfer_cost;              
00330   uint32 route_max_transfers;              
00331   uint16 route_distance_factor;            
00332   uint16 route_travel_time_factor;         
00333   uint16 route_station_last_veh_factor;    
00334   uint16 route_station_waiting_factor;     
00335   byte   route_mode_cost_factor[4];        
00336 };
00337 
00339 struct PathfinderSettings {
00340   uint8  pathfinder_for_trains;            
00341   uint8  pathfinder_for_roadvehs;          
00342   uint8  pathfinder_for_ships;             
00343   bool   new_pathfinding_all;              
00344 
00345   bool   roadveh_queue;                    
00346   bool   forbid_90_deg;                    
00347 
00348   bool   reverse_at_signals;               
00349   byte   wait_oneway_signal;               
00350   byte   wait_twoway_signal;               
00351 
00352   bool   reserve_paths;                    
00353   byte   wait_for_pbs_path;                
00354   byte   path_backoff_interval;            
00355 
00356   OPFSettings  opf;                        
00357   NPFSettings  npf;                        
00358   YAPFSettings yapf;                       
00359 };
00360 
00362 struct OrderSettings {
00363   bool   improved_load;                    
00364   bool   gradual_loading;                  
00365   bool   selectgoods;                      
00366   bool   no_servicing_if_no_breakdowns;    
00367   bool   serviceathelipad;                 
00368 };
00369 
00371 struct VehicleSettings {
00372   uint8  max_train_length;                 
00373   uint8  smoke_amount;                     
00374   uint8  train_acceleration_model;         
00375   uint8  roadveh_acceleration_model;       
00376   uint8  train_slope_steepness;            
00377   uint8  roadveh_slope_steepness;          
00378   bool   wagon_speed_limits;               
00379   bool   disable_elrails;                  
00380   UnitID max_trains;                       
00381   UnitID max_roadveh;                      
00382   UnitID max_aircraft;                     
00383   UnitID max_ships;                        
00384   uint8  plane_speed;                      
00385   uint8  freight_trains;                   
00386   bool   dynamic_engines;                  
00387   bool   never_expire_vehicles;            
00388   byte   extend_vehicle_life;              
00389   byte   road_side;                        
00390   uint8  plane_crashes;                    
00391 };
00392 
00394 struct CargodestSettings {
00395   uint8  mode_pax_mail;                    
00396   uint8  mode_town_cargo;                  
00397   uint8  mode_others;                      
00398   uint8  base_town_links[2];               
00399   uint8  base_ind_links[3];                
00400   uint8  city_town_links;                  
00401   uint8  town_chances_town[4];             
00402   uint8  town_chances_city[4];             
00403   uint8  ind_chances[3];                   
00404   uint8  random_dest_chance;               
00405   uint32 big_town_pop[2];                  
00406   uint16 pop_scale_town[4];                
00407   uint16 cargo_scale_ind[2];               
00408   uint16 min_weight_town[2];               
00409   uint16 min_weight_ind;                   
00410   uint16 weight_scale_town[4];             
00411   uint16 weight_scale_ind[2];              
00412   uint32 town_nearby_dist;                 
00413   uint32 ind_nearby_dist;                  
00414   uint16 max_route_age;                    
00415   uint16 route_recalc_delay;               
00416   uint16 route_recalc_chunk;               
00417   uint16 max_route_penalty[2];             
00418 };
00419 
00421 struct EconomySettings {
00422   bool   inflation;                        
00423   bool   bribe;                            
00424   bool   smooth_economy;                   
00425   bool   allow_shares;                     
00426   uint8  feeder_payment_share;             
00427   byte   dist_local_authority;             
00428   bool   exclusive_rights;                 
00429   bool   fund_roads;                       
00430   bool   give_money;                       
00431   bool   mod_road_rebuild;                 
00432   bool   multiple_industry_per_town;       
00433   uint8  town_growth_rate;                 
00434   uint8  larger_towns;                     
00435   uint8  initial_city_size;                
00436   TownLayoutByte town_layout;              
00437   bool   allow_town_roads;                 
00438   TownFoundingByte found_town;             
00439   bool   station_noise_level;              
00440   uint16 town_noise_population[3];         
00441   bool   allow_town_level_crossings;       
00442 
00443   CargodestSettings cargodest;             
00444 };
00445 
00447 struct StationSettings {
00448   bool   modified_catchment;               
00449   bool   adjacent_stations;                
00450   bool   distant_join_stations;            
00451   bool   never_expire_airports;            
00452   byte   station_spread;                   
00453 };
00454 
00456 struct VehicleDefaultSettings {
00457   bool   servint_ispercent;                
00458   uint16 servint_trains;                   
00459   uint16 servint_roadveh;                  
00460   uint16 servint_aircraft;                 
00461   uint16 servint_ships;                    
00462 };
00463 
00465 struct CompanySettings {
00466   bool engine_renew;                       
00467   int16 engine_renew_months;               
00468   uint32 engine_renew_money;               
00469   bool renew_keep_length;                  
00470   VehicleDefaultSettings vehicle;          
00471 };
00472 
00474 struct GameSettings {
00475   DifficultySettings   difficulty;         
00476   GameCreationSettings game_creation;      
00477   ConstructionSettings construction;       
00478   AISettings           ai;                 
00479   class AIConfig      *ai_config[MAX_COMPANIES]; 
00480   PathfinderSettings   pf;                 
00481   OrderSettings        order;              
00482   VehicleSettings      vehicle;            
00483   EconomySettings      economy;            
00484   StationSettings      station;            
00485   LocaleSettings       locale;             
00486 };
00487 
00489 struct ClientSettings {
00490   GUISettings          gui;                
00491   NetworkSettings      network;            
00492   CompanySettings      company;            
00493   MusicSettings        music;              
00494 };
00495 
00497 extern ClientSettings _settings_client;
00498 
00500 extern GameSettings _settings_game;
00501 
00503 extern GameSettings _settings_newgame;
00504 
00509 static inline GameSettings &GetGameSettings()
00510 {
00511   return (_game_mode == GM_MENU) ? _settings_newgame : _settings_game;
00512 }
00513 
00514 #endif /* SETTINGS_TYPE_H */

Generated on Sun May 8 07:30:19 2011 for OpenTTD by  doxygen 1.6.1