settings_type.h

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

Generated on Fri Feb 4 20:53:47 2011 for OpenTTD by  doxygen 1.6.1