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