tron@2186: /* $Id$ */ tron@2186: rubidium@8208: /** @file settings_type.h Types related to global configuration settings. */ belugas@6423: rubidium@8208: #ifndef SETTINGS_TYPE_H rubidium@8208: #define SETTINGS_TYPE_H truelight@0: rubidium@8140: #include "date_type.h" rubidium@8213: #include "town_type.h" rubidium@9126: #include "transport_type.h" rubidium@9420: #include "network/core/config.h" KUDr@3900: rubidium@9358: /** Settings related to the difficulty of the game */ rubidium@9358: struct DifficultySettings { rubidium@9359: byte max_no_competitors; ///< the number of competitors (AIs) rubidium@9359: byte competitor_start_time; ///< how long to wait for the first competitors (AIs) rubidium@9359: byte number_towns; ///< the amount of towns rubidium@9359: byte number_industries; ///< the amount of industries rubidium@9359: uint32 max_loan; ///< the maximum initial loan rubidium@9359: byte initial_interest; ///< amount of interest (to pay over the loan) rubidium@9359: byte vehicle_costs; ///< amount of money spent on vehicle running cost rubidium@9359: byte competitor_speed; ///< the speed at which the AI builds rubidium@9359: byte competitor_intelligence; ///< the competior's (AI) intelligence rubidium@9359: byte vehicle_breakdowns; ///< likelihood of vehicles breaking down rubidium@9359: byte subsidy_multiplier; ///< amount of subsidy rubidium@9359: byte construction_cost; ///< how expensive is building rubidium@9359: byte terrain_type; ///< the mountainousness of the landscape rubidium@9359: byte quantity_sea_lakes; ///< the amount of seas/lakes rubidium@9359: byte economy; ///< how volatile is the economy rubidium@9359: byte line_reverse_mode; ///< reversing at stations or not rubidium@9359: byte disasters; ///< are disasters enabled rubidium@9359: byte town_council_tolerance; ///< minimum required town ratings to be allowed to demolish stuff rubidium@9359: byte diff_level; ///< the difficulty level rubidium@8268: }; rubidium@8268: rubidium@9354: /** Settings related to the GUI and other stuff that is not saved in the savegame. */ rubidium@9354: struct GUISettings { rubidium@9354: bool vehicle_speed; ///< show vehicle speed rubidium@9354: bool sg_full_load_any; ///< new full load calculation, any cargo must be full read from pre v93 savegames rubidium@9354: bool lost_train_warn; ///< if a train can't find its destination, show a warning rubidium@9354: uint8 order_review_system; ///< perform order reviews on vehicles rubidium@9354: bool train_income_warn; ///< if train is generating little income, show a warning rubidium@9354: bool status_long_date; ///< always show long date in status bar rubidium@9354: bool show_finances; ///< show finances at end of year rubidium@9354: bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames rubidium@9354: bool new_nonstop; ///< ttdpatch compatible nonstop handling rubidium@9354: bool autoscroll; ///< scroll when moving mouse to the edge rubidium@9354: byte errmsg_duration; ///< duration of error message rubidium@9354: bool link_terraform_toolbar; ///< display terraform toolbar when displaying rail, road, water and airport toolbars rubidium@9354: bool reverse_scroll; ///< right-Click-Scrolling scrolls in the opposite direction rubidium@9354: bool smooth_scroll; ///< smooth scroll viewports rubidium@9354: bool measure_tooltip; ///< show a permanent tooltip when dragging tools rubidium@9354: byte liveries; ///< options for displaying company liveries, 0=none, 1=self, 2=all rubidium@10207: bool prefer_teamchat; ///< choose the chat message target with , true=all clients, false=your team rubidium@9354: uint8 advanced_vehicle_list; ///< use the "advanced" vehicle list rubidium@9354: uint8 loading_indicators; ///< show loading indicators rubidium@9354: uint8 default_rail_type; ///< the default rail type for the rail GUI rubidium@9354: uint8 toolbar_pos; ///< position of toolbars, 0=left, 1=center, 2=right rubidium@9354: uint8 window_snap_radius; ///< windows snap at each other if closer than this rubidium@9354: bool always_build_infrastructure; ///< always allow building of infrastructure, even when you do not have the vehicles for it rubidium@9358: byte autosave; ///< how often should we do autosaves? rubidium@9354: bool keep_all_autosave; ///< name the autosave in a different way rubidium@9354: bool autosave_on_exit; ///< save an autosave when you quit the game, but do not ask "Do you really want to quit?" rubidium@9354: byte max_num_autosaves; ///< controls how many autosavegames are made before the game starts to overwrite (names them 0 to max_num_autosaves - 1) rubidium@9354: bool population_in_label; ///< show the population of a town in his label? rubidium@9354: uint8 right_mouse_btn_emulation; ///< should we emulate right mouse clicking? rubidium@9354: uint8 scrollwheel_scrolling; ///< scrolling using the scroll wheel? rubidium@9354: uint8 scrollwheel_multiplier; ///< how much 'wheel' per incoming event from the OS? rubidium@9354: bool pause_on_newgame; ///< whether to start new games paused or not rubidium@9354: bool enable_signal_gui; ///< show the signal GUI when the signal button is pressed rubidium@9354: Year ending_year; ///< end of the game (just show highscore) rubidium@9354: Year colored_news_year; ///< when does newspaper become colored? rubidium@9354: bool timetable_in_ticks; ///< whether to show the timetable in ticks rather than days rubidium@9354: bool bridge_pillars; ///< show bridge pillars for high bridges rubidium@9354: bool auto_euro; ///< automatically switch to euro in 2002 rubidium@9354: byte drag_signals_density; ///< many signals density rubidium@9354: Year semaphore_build_before; ///< build semaphore signals automatically before this year rubidium@9354: bool autorenew; ///< should autorenew be enabled for new companies? rubidium@9354: int16 autorenew_months; ///< how many months from EOL of vehicles should autorenew trigger for new companies? rubidium@9354: int32 autorenew_money; ///< how much money before autorenewing for new companies? rubidium@9466: byte news_message_timeout; ///< how much longer than the news message "age" should we keep the message in the history rubidium@9785: bool show_track_reservation; ///< highlight reserved tracks. rubidium@9793: uint8 default_signal_type; ///< the signal type to build by default. rubidium@9793: uint8 cycle_signal_types; ///< what signal types to cycle with the build signal tool. rubidium@9906: rubidium@9906: uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity. rubidium@9906: uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed. rubidium@9902: #ifdef ENABLE_NETWORK rubidium@9902: uint16 network_chat_box_width; ///< width of the chat box in pixels rubidium@9902: uint8 network_chat_box_height; ///< height of the chat box in lines rubidium@9902: #endif rubidium@9466: }; rubidium@9466: rubidium@9466: /** Settings related to currency/unit systems. */ rubidium@9466: struct LocaleSettings { rubidium@9358: byte currency; ///< currency we currently use rubidium@9358: byte units; ///< unit system we show everything rubidium@9354: }; truelight@0: rubidium@9420: /** All settings related to the network. */ rubidium@9420: struct NetworkSettings { rubidium@9420: #ifdef ENABLE_NETWORK rubidium@9423: uint16 sync_freq; ///< how often do we check whether we are still in-sync rubidium@9423: uint8 frame_freq; ///< how often do we send commands to the clients rubidium@9423: uint16 max_join_time; ///< maximum amount of time, in game ticks, a client may take to join rubidium@9423: bool pause_on_join; ///< pause the game when people join rubidium@9423: char server_bind_ip[NETWORK_HOSTNAME_LENGTH]; ///< IP address the server binds to rubidium@9423: uint16 server_port; ///< port the server listens on rubidium@9423: char server_name[NETWORK_NAME_LENGTH]; ///< name of the server rubidium@9423: char server_password[NETWORK_PASSWORD_LENGTH]; ///< passowrd for joining this server rubidium@9423: char rcon_password[NETWORK_PASSWORD_LENGTH]; ///< passowrd for rconsole (server side) rubidium@9423: bool server_advertise; ///< advertise the server to the masterserver rubidium@9423: uint8 lan_internet; ///< search on the LAN or internet for servers rubidium@10207: char client_name[NETWORK_NAME_LENGTH]; ///< name of the player (as client) rubidium@9423: char default_company_pass[NETWORK_PASSWORD_LENGTH]; ///< default password for new companies in encrypted form rubidium@9423: char connect_to_ip[NETWORK_HOSTNAME_LENGTH]; ///< default for the "Add server" query rubidium@9423: char network_id[NETWORK_UNIQUE_ID_LENGTH]; ///< semi-unique ID of the client rubidium@9423: bool autoclean_companies; ///< automatically remove companies that are not in use rubidium@9423: uint8 autoclean_unprotected; ///< remove passwordless companies after this many months rubidium@9423: uint8 autoclean_protected; ///< remove the password from passworded companies after this many months rubidium@9423: uint8 max_companies; ///< maximum amount of companies rubidium@9423: uint8 max_clients; ///< maximum amount of clients rubidium@9423: uint8 max_spectators; ///< maximum amount of spectators rubidium@9423: Year restart_game_year; ///< year the server restarts rubidium@10207: uint8 min_active_clients; ///< minimum amount of active clients to unpause the game rubidium@9423: uint8 server_lang; ///< language of the server rubidium@9423: bool reload_cfg; ///< reload the config file before restarting rubidium@9423: char last_host[NETWORK_HOSTNAME_LENGTH]; ///< IP address of the last joined server rubidium@9423: uint16 last_port; ///< port of the last joined server rubidium@9420: #else /* ENABLE_NETWORK */ rubidium@9420: #endif rubidium@9420: }; rubidium@9420: rubidium@9354: /** Settings related to the creation of games. */ rubidium@9354: struct GameCreationSettings { rubidium@9354: uint32 generation_seed; ///< noise seed for world generation rubidium@9354: Year starting_year; ///< starting date rubidium@9354: uint8 map_x; ///< X size of map rubidium@9354: uint8 map_y; ///< Y size of map rubidium@9354: byte land_generator; ///< the landscape generator rubidium@9354: byte oil_refinery_limit; ///< distance oil refineries allowed from map edge rubidium@9354: byte snow_line_height; ///< a number 0-15 that configured snow line height rubidium@9354: byte tgen_smoothness; ///< how rough is the terrain from 0-3 rubidium@9354: byte tree_placer; ///< the tree placer algorithm rubidium@9354: byte heightmap_rotation; ///< rotation director for the heightmap rubidium@9354: byte se_flat_world_height; ///< land height a flat world gets in SE rubidium@9358: byte town_name; ///< the town name generator used for town names rubidium@9358: byte landscape; ///< the landscape we're currently in rubidium@9358: byte snow_line; ///< the snowline level in this game rubidium@9354: }; truelight@0: rubidium@9354: /** Settings related to construction in-game */ rubidium@9354: struct ConstructionSettings { rubidium@9354: bool build_on_slopes; ///< allow building on slopes rubidium@9354: bool autoslope; ///< allow terraforming under things rubidium@9354: bool longbridges; ///< allow 100 tile long bridges rubidium@9354: bool signal_side; ///< show signals on right side rubidium@9354: bool extra_dynamite; ///< extra dynamite rubidium@9354: bool road_stop_on_town_road; ///< allow building of drive-through road stops on town owned roads rubidium@9354: uint8 raw_industry_construction; ///< type of (raw) industry construction (none, "normal", prospecting) rubidium@9354: }; belugas@8464: rubidium@9354: /** Settings related to the AI. */ rubidium@9354: struct AISettings { rubidium@9354: bool ainew_active; ///< is the new AI active? rubidium@9354: bool ai_in_multiplayer; ///< so we allow AIs in multiplayer rubidium@9354: bool ai_disable_veh_train; ///< disable types for AI rubidium@9354: bool ai_disable_veh_roadveh; ///< disable types for AI rubidium@9354: bool ai_disable_veh_aircraft; ///< disable types for AI rubidium@9354: bool ai_disable_veh_ship; ///< disable types for AI rubidium@9354: }; belugas@8464: rubidium@9354: /** Settings related to the old pathfinder. */ rubidium@9354: struct OPFSettings { rubidium@9354: uint16 pf_maxlength; ///< maximum length when searching for a train route for new pathfinder rubidium@9354: byte pf_maxdepth; ///< maximum recursion depth when searching for a train route for new pathfinder rubidium@9354: }; tron@1218: rubidium@9354: /** Settings related to the new pathfinder. */ rubidium@9354: struct NPFSettings { matthijs@1700: /** rubidium@4549: * The maximum amount of search nodes a single NPF run should take. This rubidium@4549: * limit should make sure performance stays at acceptable levels at the cost rubidium@9354: * of not being perfect anymore. rubidium@4549: */ matthijs@1700: uint32 npf_max_search_nodes; matthijs@1700: rubidium@9354: uint32 npf_rail_firstred_penalty; ///< the penalty for when the first signal is red (and it is not an exit or combo signal) rubidium@9354: uint32 npf_rail_firstred_exit_penalty; ///< the penalty for when the first signal is red (and it is an exit or combo signal) rubidium@9354: uint32 npf_rail_lastred_penalty; ///< the penalty for when the last signal is red rubidium@9354: uint32 npf_rail_station_penalty; ///< the penalty for station tiles rubidium@9354: uint32 npf_rail_slope_penalty; ///< the penalty for sloping upwards rubidium@9354: uint32 npf_rail_curve_penalty; ///< the penalty for curves rubidium@9354: uint32 npf_rail_depot_reverse_penalty; ///< the penalty for reversing in depots rubidium@9805: uint32 npf_rail_pbs_cross_penalty; ///< the penalty for crossing a reserved rail track rubidium@9805: uint32 npf_rail_pbs_signal_back_penalty; ///< the penalty for passing a pbs signal from the backside rubidium@9354: uint32 npf_buoy_penalty; ///< the penalty for going over (through) a buoy rubidium@9354: uint32 npf_water_curve_penalty; ///< the penalty for curves rubidium@9354: uint32 npf_road_curve_penalty; ///< the penalty for curves rubidium@9354: uint32 npf_crossing_penalty; ///< the penalty for level crossings rubidium@9354: uint32 npf_road_drive_through_penalty; ///< the penalty for going through a drive-through road stop rubidium@6248: }; truelight@0: rubidium@9354: /** Settings related to the yet another pathfinder. */ rubidium@9354: struct YAPFSettings { rubidium@9354: bool disable_node_optimization; ///< whether to use exit-dir instead of trackdir in node key rubidium@9354: uint32 max_search_nodes; ///< stop path-finding when this number of nodes visited rubidium@9354: bool ship_use_yapf; ///< use YAPF for ships rubidium@9354: bool road_use_yapf; ///< use YAPF for road rubidium@9354: bool rail_use_yapf; ///< use YAPF for rail rubidium@9354: uint32 road_slope_penalty; ///< penalty for up-hill slope rubidium@9354: uint32 road_curve_penalty; ///< penalty for curves rubidium@9354: uint32 road_crossing_penalty; ///< penalty for level crossing rubidium@9354: uint32 road_stop_penalty; ///< penalty for going through a drive-through road stop rubidium@9354: bool rail_firstred_twoway_eol; ///< treat first red two-way signal as dead end rubidium@9354: uint32 rail_firstred_penalty; ///< penalty for first red signal rubidium@9354: uint32 rail_firstred_exit_penalty; ///< penalty for first red exit signal rubidium@9354: uint32 rail_lastred_penalty; ///< penalty for last red signal rubidium@9354: uint32 rail_lastred_exit_penalty; ///< penalty for last red exit signal rubidium@9354: uint32 rail_station_penalty; ///< penalty for non-target station tile rubidium@9354: uint32 rail_slope_penalty; ///< penalty for up-hill slope rubidium@9354: uint32 rail_curve45_penalty; ///< penalty for curve rubidium@9354: uint32 rail_curve90_penalty; ///< penalty for 90-deg curve rubidium@9354: uint32 rail_depot_reverse_penalty; ///< penalty for reversing in the depot rubidium@9354: uint32 rail_crossing_penalty; ///< penalty for level crossing rubidium@9354: uint32 rail_look_ahead_max_signals; ///< max. number of signals taken into consideration in look-ahead load balancer rubidium@9354: int32 rail_look_ahead_signal_p0; ///< constant in polynomial penalty function rubidium@9354: int32 rail_look_ahead_signal_p1; ///< constant in polynomial penalty function rubidium@9354: int32 rail_look_ahead_signal_p2; ///< constant in polynomial penalty function rubidium@9799: uint32 rail_pbs_cross_penalty; ///< penalty for crossing a reserved tile rubidium@9801: uint32 rail_pbs_station_penalty; ///< penalty for crossing a reserved station tile rubidium@9799: uint32 rail_pbs_signal_back_penalty; ///< penalty for passing a pbs signal from the backside rubidium@9800: uint32 rail_doubleslip_penalty; ///< penalty for passing a double slip switch rubidium@9354: rubidium@9354: uint32 rail_longer_platform_penalty; ///< penalty for longer station platform than train rubidium@9354: uint32 rail_longer_platform_per_tile_penalty; ///< penalty for longer station platform than train (per tile) rubidium@9354: uint32 rail_shorter_platform_penalty; ///< penalty for shorter station platform than train rubidium@9354: uint32 rail_shorter_platform_per_tile_penalty; ///< penalty for shorter station platform than train (per tile) rubidium@9354: }; rubidium@9354: rubidium@9354: /** Settings related to all pathfinders. */ rubidium@9354: struct PathfinderSettings { rubidium@9354: uint8 pathfinder_for_trains; ///< the pathfinder to use for trains rubidium@9354: uint8 pathfinder_for_roadvehs; ///< the pathfinder to use for roadvehicles rubidium@9354: uint8 pathfinder_for_ships; ///< the pathfinder to use for ships rubidium@9354: bool new_pathfinding_all; ///< use the newest pathfinding algorithm for all rubidium@9354: rubidium@9354: bool roadveh_queue; ///< buggy road vehicle queueing rubidium@9354: bool forbid_90_deg; ///< forbid trains to make 90 deg turns rubidium@9354: rubidium@9354: byte wait_oneway_signal; ///< waitingtime in days before a oneway signal rubidium@9354: byte wait_twoway_signal; ///< waitingtime in days before a twoway signal rubidium@9354: rubidium@9810: bool reserve_paths; ///< always reserve paths regardless of signal type. rubidium@9810: byte wait_for_pbs_path; ///< how long to wait for a path reservation. rubidium@9810: byte path_backoff_interval; ///< ticks between checks for a free path. rubidium@9810: rubidium@9354: OPFSettings opf; ///< pathfinder settings for the old pathfinder rubidium@9354: NPFSettings npf; ///< pathfinder settings for the new pathfinder rubidium@9354: YAPFSettings yapf; ///< pathfinder settings for the yet another pathfinder rubidium@9354: }; rubidium@9354: rubidium@9354: /** Settings related to orders. */ rubidium@9354: struct OrderSettings { rubidium@9354: bool improved_load; ///< improved loading algorithm rubidium@9354: bool gradual_loading; ///< load vehicles gradually rubidium@9354: bool selectgoods; ///< only send the goods to station if a train has been there rubidium@9354: bool gotodepot; ///< allow goto depot in orders rubidium@9354: bool no_servicing_if_no_breakdowns; ///< dont send vehicles to depot when breakdowns are disabled rubidium@9354: bool timetabling; ///< whether to allow timetabling rubidium@9354: bool serviceathelipad; ///< service helicopters at helipads automatically (no need to send to depot) rubidium@9354: }; rubidium@9354: rubidium@9354: /** Settings related to vehicles. */ rubidium@9354: struct VehicleSettings { rubidium@9354: bool mammoth_trains; ///< allow very long trains rubidium@9354: bool realistic_acceleration; ///< realistic acceleration for trains rubidium@9354: bool wagon_speed_limits; ///< enable wagon speed limits rubidium@9354: bool disable_elrails; ///< when true, the elrails are disabled rubidium@10207: UnitID max_trains; ///< max trains in game per company rubidium@10207: UnitID max_roadveh; ///< max trucks in game per company rubidium@10207: UnitID max_aircraft; ///< max planes in game per company rubidium@10207: UnitID max_ships; ///< max ships in game per company rubidium@9354: bool servint_ispercent; ///< service intervals are in percents rubidium@9354: uint16 servint_trains; ///< service interval for trains rubidium@9354: uint16 servint_roadveh; ///< service interval for road vehicles rubidium@9354: uint16 servint_aircraft; ///< service interval for aircraft rubidium@9354: uint16 servint_ships; ///< service interval for ships rubidium@9354: uint8 plane_speed; ///< divisor for speed of aircraft rubidium@9354: uint8 freight_trains; ///< value to multiply the weight of cargo by rubidium@9354: bool dynamic_engines; ///< enable dynamic allocation of engine data rubidium@9354: bool never_expire_vehicles; ///< never expire vehicles rubidium@9354: byte extend_vehicle_life; ///< extend vehicle life by this many years rubidium@9358: byte road_side; ///< the side of the road vehicles drive on rubidium@9354: }; rubidium@9354: rubidium@9354: /** Settings related to the economy. */ rubidium@9354: struct EconomySettings { rubidium@9354: bool inflation; ///< disable inflation rubidium@9354: bool bribe; ///< enable bribing the local authority rubidium@9354: bool smooth_economy; ///< smooth economy rubidium@9354: bool allow_shares; ///< allow the buying/selling of shares rubidium@9354: byte dist_local_authority; ///< distance for town local authority, default 20 rubidium@9354: bool exclusive_rights; ///< allow buying exclusive rights rubidium@10207: bool give_money; ///< allow giving other companies money rubidium@9354: bool mod_road_rebuild; ///< roadworks remove unneccesary RoadBits rubidium@9354: bool multiple_industry_per_town; ///< allow many industries of the same type per town rubidium@9354: bool same_industry_close; ///< allow same type industries to be built close to each other rubidium@9354: uint8 town_growth_rate; ///< town growth rate rubidium@9354: uint8 larger_towns; ///< the number of cities to build. These start off larger and grow twice as fast rubidium@9354: uint8 initial_city_size; ///< multiplier for the initial size of the cities compared to towns rubidium@9354: TownLayoutByte town_layout; ///< select town layout rubidium@9354: bool station_noise_level; ///< build new airports when the town noise level is still within accepted limits rubidium@9354: uint16 town_noise_population[3]; ///< population to base decision on noise evaluation (@see town_council_tolerance) rubidium@9354: }; rubidium@9354: rubidium@9354: /** Settings related to stations. */ rubidium@9354: struct StationSettings { rubidium@9354: bool modified_catchment; ///< different-size catchment areas rubidium@9354: bool join_stations; ///< allow joining of train stations rubidium@9354: bool nonuniform_stations; ///< allow nonuniform train stations rubidium@9354: bool adjacent_stations; ///< allow stations to be built directly adjacent to other stations rubidium@9354: bool always_small_airport; ///< always allow small airports rubidium@9354: byte station_spread; ///< amount a station may spread rubidium@9354: }; rubidium@9354: rubidium@9413: /** All settings together for the game. */ rubidium@9413: struct GameSettings { rubidium@9358: DifficultySettings difficulty; ///< settings related to the difficulty rubidium@9354: GameCreationSettings game_creation; ///< settings used during the creation of a game (map) rubidium@9354: ConstructionSettings construction; ///< construction of things in-game rubidium@9354: AISettings ai; ///< what may the AI do? rubidium@9354: PathfinderSettings pf; ///< settings for all pathfinders rubidium@9354: OrderSettings order; ///< settings related to orders rubidium@9354: VehicleSettings vehicle; ///< options for vehicles rubidium@9354: EconomySettings economy; ///< settings to change the economy rubidium@9354: StationSettings station; ///< settings related to station management rubidium@9466: LocaleSettings locale; ///< settings related to used currency/unit system in the current game rubidium@9354: }; rubidium@9354: rubidium@9413: /** All settings that are only important for the local client. */ rubidium@9413: struct ClientSettings { rubidium@9413: GUISettings gui; ///< settings related to the GUI rubidium@9420: NetworkSettings network; ///< settings related to the network rubidium@9413: }; truelight@0: rubidium@9413: /** The current settings for this game. */ rubidium@9413: extern ClientSettings _settings_client; rubidium@9413: rubidium@9413: /** The current settings for this game. */ rubidium@9413: extern GameSettings _settings_game; rubidium@9413: rubidium@9413: /** The settings values that are used for new games and/or modified in config file. */ rubidium@9413: extern GameSettings _settings_newgame; truelight@0: rubidium@8208: #endif /* SETTINGS_TYPE_H */