diff --git a/.gitignore b/.gitignore index 49c215b..5c8a6ca 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ !src/ !.editorconfig +!openttd.cfg !.gitattributes !.gitignore !v.mod diff --git a/openttd.cfg b/openttd.cfg new file mode 100644 index 0000000..2d18ce2 --- /dev/null +++ b/openttd.cfg @@ -0,0 +1,487 @@ + +[version] +version_string = 13.0 +version_number = 1D086D64 +ini_version = 2 + +[network] +commands_per_frame = 2 +max_commands_in_queue = 16 +bytes_per_frame = 8 +bytes_per_frame_burst = 256 +;max_init_time = 100 +;max_join_time = 500 +;max_download_time = 1000 +;max_password_time = 2000 +;max_lag_time = 500 +pause_on_join = true +server_port = 3979 +server_admin_port = 3977 +server_admin_chat = true +server_game_type = local +autoclean_companies = false +autoclean_unprotected = 12 +autoclean_protected = 36 +autoclean_novehicles = 0 +max_companies = 15 +max_clients = 25 +restart_game_year = 0 +min_active_clients = 0 +reload_cfg = false +no_http_content_downloads = false +use_relay_service = ask + +[misc] +display_opt = SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|FULL_DETAIL|WAYPOINTS|SHOW_COMPETITOR_SIGNS +fullscreen = false +video_hw_accel = true +video_vsync = true +support8bpp = no +graphicsset = +soundsset = "OpenSFX" +musicset = "OpenMSX" +videodriver = +musicdriver = +sounddriver = +blitter = +language = english_US.lng +resolution = 1920,1005 +screenshot_format = +savegame_format = +rightclick_emulate = false +small_font = Arial +medium_font = Arial +large_font = Arial +mono_font = +small_size = 7 +medium_size = 8 +large_size = 16 +mono_size = 0 +small_aa = false +medium_aa = false +large_aa = false +mono_aa = false +sprite_cache_size_px = 128 +player_face = 0 +transparency_options = 511 +transparency_locks = 0 +invisibility_options = 6 +keyboard = +keyboard_caps = +last_newgrf_count = 16 +gui_scale = 175 + +[difficulty] +max_no_competitors = 0 +number_towns = 2 +industry_density = 4 +max_loan = 250000 +initial_interest = 2 +vehicle_costs = 1 +competitor_speed = 2 +vehicle_breakdowns = 1 +subsidy_multiplier = 2 +subsidy_duration = 1 +construction_cost = 0 +terrain_type = 4 +quantity_sea_lakes = 3 +economy = false +line_reverse_mode = false +disasters = false +town_council_tolerance = 0 + +[economy] +town_layout = 3 +allow_town_roads = true +found_town = 1 +allow_town_level_crossings = true +town_cargogen_mode = 1 +station_noise_level = false +inflation = false +multiple_industry_per_town = true +bribe = true +exclusive_rights = true +fund_buildings = true +fund_roads = true +give_money = true +type = 1 +allow_shares = false +min_years_for_shares = 6 +feeder_payment_share = 75 +town_growth_rate = 2 +larger_towns = 4 +initial_city_size = 4 +mod_road_rebuild = true +dist_local_authority = 20 +town_noise_population[0] = 800 +town_noise_population[1] = 2000 +town_noise_population[2] = 4000 +town_noise_population[3] = 400 +infrastructure_maintenance = false + +[order] +no_servicing_if_no_breakdowns = true +improved_load = true +selectgoods = true +serviceathelipad = true +gradual_loading = true + +[station] +never_expire_airports = true +station_spread = 12 +modified_catchment = true +serve_neutral_industries = true +adjacent_stations = true +distant_join_stations = true + +[vehicle] +road_side = right +train_acceleration_model = 1 +roadveh_acceleration_model = 1 +train_slope_steepness = 3 +roadveh_slope_steepness = 7 +max_train_length = 64 +smoke_amount = 1 +never_expire_vehicles = false +max_trains = 500 +max_roadveh = 500 +max_aircraft = 200 +max_ships = 300 +wagon_speed_limits = true +disable_elrails = false +freight_trains = 1 +plane_speed = 4 +dynamic_engines = true +plane_crashes = 2 +extend_vehicle_life = 0 +servint_ispercent = false +servint_trains = 150 +servint_roadveh = 150 +servint_ships = 360 +servint_aircraft = 100 + +[gui] +autosave = yearly +threaded_saves = true +date_format_in_default_names = long +show_finances = true +auto_scrolling = 0 +scroll_mode = 0 +smooth_scroll = true +right_mouse_wnd_close = false +measure_tooltip = true +errmsg_duration = 4 +hover_delay_ms = 200 +osk_activation = disabled +toolbar_pos = 1 +statusbar_pos = 1 +window_snap_radius = 10 +window_soft_limit = 20 +zoom_min = 0 +zoom_max = 5 +sprite_zoom_min = 0 +population_in_label = true +link_terraform_toolbar = true +smallmap_land_colour = 0 +linkgraph_colours = 0 +liveries = 2 +starting_colour = 16 +auto_remove_signals = false +prefer_teamchat = false +scrollwheel_scrolling = 0 +scrollwheel_multiplier = 5 +pause_on_newgame = true +advanced_vehicle_list = 1 +timetable_in_ticks = false +timetable_arrival_departure = true +quick_goto = true +loading_indicators = 2 +default_rail_type = 0 +signal_gui_mode = 0 +default_signal_type = 5 +coloured_news_year = 2000 +cycle_signal_types = 0 +drag_signals_density = 4 +drag_signals_fixed_distance = false +semaphore_build_before = 0 +vehicle_income_warn = true +order_review_system = 2 +lost_vehicle_warn = true +new_nonstop = true +stop_location = 2 +keep_all_autosave = false +autosave_on_exit = false +autosave_on_network_disconnect = true +max_num_autosaves = 16 +auto_euro = true +news_message_timeout = 2 +show_track_reservation = true +station_numtracks = 1 +station_platlength = 5 +station_dragdrop = true +station_show_coverage = true +persistent_buildingtools = true +station_gui_group_order = 0 +station_gui_sort_by = 0 +station_gui_sort_order = 0 +missing_strings_threshold = 25 +graph_line_thickness = 3 +show_newgrf_name = false +show_cargo_in_vehicle_lists = true +show_date_in_logs = false +settings_restriction_mode = 2 +developer = 1 +newgrf_developer_tools = false +ai_developer_tools = false +scenario_developer = false +newgrf_show_old_versions = false +newgrf_default_palette = 1 +console_backlog_timeout = 100 +console_backlog_length = 100 +refresh_rate = 60 +fast_forward_speed_limit = 2500 +network_chat_box_width_pct = 40 +network_chat_box_height = 25 +network_chat_timeout = 20 +scale_bevels = true + +[linkgraph] +recalc_interval = 4 +recalc_time = 10 +distribution_pax = 2 +distribution_mail = 1 +distribution_armoured = 1 +distribution_default = 0 +accuracy = 16 +demand_distance = 100 +demand_size = 100 +short_path_saturation = 80 + +[locale] +currency = USD +units_velocity = metric +units_power = metric +units_weight = metric +units_volume = metric +units_force = si +units_height = metric +digit_group_separator = +digit_group_separator_currency = +digit_decimal_separator = + +[sound] +news_ticker = true +news_full = true +new_year = true +confirm = true +click_beep = true +disaster = true +vehicle = true +ambient = true + +[music] +playlist = 0 +music_vol = 50 +effect_vol = 100 +custom_1 = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +custom_2 = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +playing = true +shuffle = false + +[news_display] +arrival_player = full +arrival_other = summarized +accident = full +accident_other = full +company_info = full +open = summarized +close = summarized +economy = full +production_player = summarized +production_other = summarized +production_nobody = off +advice = full +new_vehicles = full +acceptance = full +subsidies = full +general = full + +[pf] +forbid_90_deg = true +roadveh_queue = true +pathfinder_for_trains = 2 +pathfinder_for_roadvehs = 2 +pathfinder_for_ships = 2 +reverse_at_signals = false +wait_oneway_signal = 15 +wait_twoway_signal = 41 +wait_for_pbs_path = 30 +reserve_paths = false +path_backoff_interval = 20 +npf.npf_max_search_nodes = 10000 +npf.npf_rail_firstred_penalty = 1000 +npf.npf_rail_firstred_exit_penalty = 10000 +npf.npf_rail_lastred_penalty = 1000 +npf.npf_rail_station_penalty = 100 +npf.npf_rail_slope_penalty = 100 +npf.npf_rail_curve_penalty = 100 +npf.npf_rail_depot_reverse_penalty = 5000 +npf.npf_rail_pbs_cross_penalty = 300 +npf.npf_rail_pbs_signal_back_penalty = 1500 +npf.npf_buoy_penalty = 200 +npf.npf_water_curve_penalty = 100 +npf.npf_road_curve_penalty = 100 +npf.npf_crossing_penalty = 300 +npf.npf_road_drive_through_penalty = 800 +npf.npf_road_dt_occupied_penalty = 800 +npf.npf_road_bay_occupied_penalty = 1500 +npf.maximum_go_to_depot_penalty = 2000 +yapf.disable_node_optimization = false +yapf.max_search_nodes = 10000 +yapf.rail_firstred_twoway_eol = true +yapf.rail_firstred_penalty = 1000 +yapf.rail_firstred_exit_penalty = 10000 +yapf.rail_lastred_penalty = 1000 +yapf.rail_lastred_exit_penalty = 10000 +yapf.rail_station_penalty = 1000 +yapf.rail_slope_penalty = 200 +yapf.rail_curve45_penalty = 100 +yapf.rail_curve90_penalty = 600 +yapf.rail_depot_reverse_penalty = 5000 +yapf.rail_crossing_penalty = 300 +yapf.rail_look_ahead_max_signals = 10 +yapf.rail_look_ahead_signal_p0 = 500 +yapf.rail_look_ahead_signal_p1 = -100 +yapf.rail_look_ahead_signal_p2 = 5 +yapf.rail_pbs_cross_penalty = 300 +yapf.rail_pbs_station_penalty = 800 +yapf.rail_pbs_signal_back_penalty = 1500 +yapf.rail_doubleslip_penalty = 100 +yapf.rail_longer_platform_penalty = 800 +yapf.rail_longer_platform_per_tile_penalty = 0 +yapf.rail_shorter_platform_penalty = 4000 +yapf.rail_shorter_platform_per_tile_penalty = 0 +yapf.road_slope_penalty = 200 +yapf.road_curve_penalty = 100 +yapf.road_crossing_penalty = 300 +yapf.road_stop_penalty = 800 +yapf.road_stop_occupied_penalty = 800 +yapf.road_stop_bay_occupied_penalty = 1500 +yapf.maximum_go_to_depot_penalty = 2000 +yapf.ship_curve45_penalty = 100 +yapf.ship_curve90_penalty = 600 + +[script] +settings_profile = easy +script_max_opcode_till_suspend = 10000 +script_max_memory_megabytes = 1024 + +[ai] +ai_in_multiplayer = false +ai_disable_veh_train = false +ai_disable_veh_roadveh = false +ai_disable_veh_aircraft = false +ai_disable_veh_ship = false + +[game_creation] +town_name = 21 +landscape = tropic +heightmap_height = 30 +snow_line_height = 10 +snow_coverage = 50 +desert_coverage = 50 +starting_year = 1950 +ending_year = 0 +land_generator = 1 +oil_refinery_limit = 32 +tgen_smoothness = 2 +variety = 4 +generation_seed = 3624841968 +tree_placer = 2 +heightmap_rotation = 0 +se_flat_world_height = 1 +map_x = 11 +map_y = 11 +water_borders = 16 +custom_town_number = 1 +custom_industry_number = 1 +custom_terrain_type = 30 +custom_sea_level = 1 +min_river_length = 16 +river_route_random = 5 +amount_of_rivers = 3 + +[construction] +map_height_limit = 0 +build_on_slopes = true +command_pause_level = 1 +terraform_per_64k_frames = 4194304 +terraform_frame_burst = 4096 +clear_per_64k_frames = 4194304 +clear_frame_burst = 4096 +tree_per_64k_frames = 4194304 +tree_frame_burst = 4096 +build_object_per_64k_frames = 2097152 +build_object_frame_burst = 2048 +autoslope = true +extra_dynamite = true +max_bridge_length = 128 +max_bridge_height = 32 +max_tunnel_length = 256 +train_signal_side = 2 +road_stop_on_town_road = true +road_stop_on_competitor_road = true +raw_industry_construction = 2 +industry_platform = 1 +freeform_edges = true +extra_tree_placement = 2 + +[currency] +rate = 1 +separator = "." +to_euro = 0 +prefix = +suffix = " credits" + +[company] +engine_renew = true +engine_renew_months = 6 +engine_renew_money = 100000 +renew_keep_length = false + +[ai_players] +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 +none = start_date=730 + +[game_scripts] +none = + +[newgrf] +544D0101|05E8B3FA4ED62F1AEBF14B7554E0C635|2cc_trainsinnml-3.1/2ccts.grf = 4 4 1 1 1 1 1 1 1 1 1 1 1 +4A595001|BBA9F50E894D063E20773A66E15B8FAD|2cc_bus_set-v10/2ccbusset.grf = 4 3 3 7 6 7 +41570101|2D09741F074782C9B8C132A2BCD68153|2cc_cargo_trams-0.8r/2cc-trams-cargo-v0.8r-2021-03-24.grf = +FBFB0010|910E27FA08080A404B80EA7E9A888B95|2cc_trams-0.9c/2cc-trams-v0.9c-2020-10-24.grf = 1 0 +4A430002|93EAC5F5396584B92D4C5F0AAAF3F6C5|industrial_stations_renewal-1.0.2/indstatr.grf = 0 0 +52455400|1600687C50C5AB1E72EDD487CAD50E2A|coded_by_aegir._artwork_by_aegir-1/ae_cityw.grf = +52455300|37C0B839B13C4B18051580C81EEDF427|suburban_stations-1/ae_subuw.grf = +52455200|0E5A9C5ACD2BCAF7FA0658C3F905A660|rural_stations-1/ae_ruraw.grf = +F1250008|6A2E778BFF67AB76437696ED1C3C780A|firs_industry_replacement_set_4-4.15.1/firs.grf = 3 0 0 0 0 0 20 150 80 300 1 +56430001|2AD089EE6B73F25D79F286AD43765914|total_town_replacement_set-3.14/ttrs3w.grf = 1 0 2 1 +74677462|1D2A4E03D9F30922788C166254C27619|total_bridge_renewal_set-1.2/total_bridges.grf = +46724E00|A9B0DA055A35907BFBCD2D2F3CA80C39|funny_english_town_names-1.4.1/funengnames.grf = +454E2301|8E8621425BA455298B01CCDA22A0D2C6|north_korean_faces-1/dprkface.grf = + +[newgrf-static] diff --git a/src/mappings.v b/src/mappings.v new file mode 100644 index 0000000..4e9fad5 --- /dev/null +++ b/src/mappings.v @@ -0,0 +1,65 @@ +module main + +type MappingValue = Comment | Field + +[params] +struct Field { + // The name of the field in openttd.cfg file. + // This is the thing OpenTTD seees. + name string [required] + // The docs for the field. + docs string [required] + // The value of the field. + value string [required] + // Transforms the value. + transformer fn (string) string = fn (s string) string { + return s + } +} + +type Comment = string + +fn field(f Field) MappingValue { + return f +} + +fn comment(c Comment) MappingValue { + return c +} + +fn seconds_to_ticks(s string) string { + return (s.int() * 1000 / 30).str() +} + +const mappings = { + 'time_limits.maximum_initialization_time': field( + name: 'network.max_init_time' + docs: 'The time the client has to initialize the game in seconds.' + value: '5' + transformer: seconds_to_ticks + ) + 'time_limits.maximum_join_time': field( + name: 'network.max_join_time' + docs: 'The time the client has to join the server in seconds.' + value: '20' + transformer: seconds_to_ticks + ) + 'time_limits.maximum_download_time': field( + name: 'network.max_download_time' + docs: 'The time the client has to download the map in seconds.' + value: '300' + transformer: seconds_to_ticks + ) + 'time_limits.maximum_password_time': field( + name: 'network.max_password_time' + docs: 'The time the client has to enter the server password in seconds.' + value: '600' + transformer: seconds_to_ticks + ) + 'time_limits.maximum_lag_time': field( + name: 'network.max_lag_time' + docs: 'The time the client can lag behind the server in seconds.' + value: '20' + transformer: seconds_to_ticks + ) +}