From 73cdeac5a1d651773630e981c19ae7c6011a0269 Mon Sep 17 00:00:00 2001 From: dP Date: Mon, 30 Jun 2025 14:21:06 +0500 Subject: [PATCH] Fix compilation erorrs --- .ottdrev | 1 - src/citymania/cm_event.hpp | 10 +++++----- src/citymania/cm_export.cpp | 7 +++---- src/citymania/cm_settings.hpp | 6 +++--- src/economy.cpp | 2 +- src/rev.cpp.in | 8 ++++---- src/saveload/saveload.cpp | 8 ++++---- src/survey.cpp | 1 + src/table/settings/citymania_settings.ini | 7 ++++--- src/town_cmd.cpp | 2 +- 10 files changed, 26 insertions(+), 26 deletions(-) delete mode 100644 .ottdrev diff --git a/.ottdrev b/.ottdrev deleted file mode 100644 index dab280a505..0000000000 --- a/.ottdrev +++ /dev/null @@ -1 +0,0 @@ -15.0-beta1 20241224 0 cd0e1fc47de2095cc0642d73ad5d42db35a63d43 1 0 diff --git a/src/citymania/cm_event.hpp b/src/citymania/cm_event.hpp index 7e47f5844e..ac56ee037e 100644 --- a/src/citymania/cm_event.hpp +++ b/src/citymania/cm_event.hpp @@ -8,6 +8,7 @@ #include "../company_type.h" #include "../economy_type.h" #include "../industry_type.h" +#include "../source_type.h" #include "../station_type.h" #include "../town_type.h" @@ -80,25 +81,24 @@ struct CompanyEvent { struct CargoDeliveredToIndustry { Industry *industry; - CargoID cargo_type; + CargoType cargo_type; uint amount; const Station *station; }; struct CargoDeliveredToUnknown { - CargoID cargo_type; + CargoType cargo_type; uint amount; const Station *station; }; struct CargoAccepted { Company *company; - CargoID cargo_type; + CargoType cargo_type; uint amount; const Station *station; Money profit; - SourceType src_type; - SourceID src; + Source src; }; struct CompanyMoneyChanged { diff --git a/src/citymania/cm_export.cpp b/src/citymania/cm_export.cpp index c1d9903e49..158a3228f5 100644 --- a/src/citymania/cm_export.cpp +++ b/src/citymania/cm_export.cpp @@ -154,7 +154,7 @@ void WriteHouseSpecInfo(JsonWriter &j) { j.kv("removal_cost", hs->removal_cost); j.kv("name", hs->building_name); j.kv("mail_generation", hs->mail_generation); - j.kv("flags", hs->building_flags); + j.kv("flags", hs->building_flags.base()); j.kv("availability", hs->building_availability); j.kv("enabled", hs->enabled); j.end_dict(); @@ -181,7 +181,6 @@ void WriteHouseSpecInfo(JsonWriter &j) { void WriteCargoSpecInfo(JsonWriter &j) { j.begin_list_with_key("cargo_specs"); char cargo_label[16]; - SetDParam(0, 123); for (const CargoSpec *cs : CargoSpec::Iterate()) { j.begin_dict(); JKV(j, cs->initial_payment); @@ -249,7 +248,7 @@ void WriteEngineInfo(JsonWriter &j) { for (const Engine *e : Engine::Iterate()) { if (e->type != VEH_TRAIN) continue; j.begin_dict(); - JKV(j, e->index); + JKV(j, e->index.base()); j.kv("name", e->name); j.kv("cost", e->GetCost()); j.kv("running_cost", e->GetRunningCost()); @@ -257,7 +256,7 @@ void WriteEngineInfo(JsonWriter &j) { j.begin_dict_with_key("info"); JKV(j, e->info.cargo_type); JKV(j, e->info.cargo_age_period); - JKV(j, e->info.climates); + JKV(j, e->info.climates.base()); JKV(j, e->info.base_intro.base()); JKV(j, e->info.lifelength.base()); JKV(j, e->info.base_life.base()); diff --git a/src/citymania/cm_settings.hpp b/src/citymania/cm_settings.hpp index 57e974cdf6..d2c1f2d576 100644 --- a/src/citymania/cm_settings.hpp +++ b/src/citymania/cm_settings.hpp @@ -24,7 +24,7 @@ struct LimitsSettings { class CBRequirement { public: - CargoID cargo_id; + CargoType cargo_type; uint32_t from; uint32_t amount; uint8_t decay; @@ -34,9 +34,9 @@ public: static CBRequirement Parse(const char *name, const char *value, uint8_t index); - CBRequirement(CargoID cargo_id, uint32_t from, uint32_t amount, uint8_t decay, + CBRequirement(CargoType cargo_type, uint32_t from, uint32_t amount, uint8_t decay, uint8_t index, std::string name) - :cargo_id{cargo_id}, from{from}, amount{amount}, decay{decay}, + :cargo_type{cargo_type}, from{from}, amount{amount}, decay{decay}, index{index}, name{name}, has_storage{decay < 100} {} }; diff --git a/src/economy.cpp b/src/economy.cpp index 122768183a..8f7a08fc03 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1141,7 +1141,7 @@ static Money DeliverGoods(int num_pieces, CargoType cargo_type, StationID dest, if (accepted_total > 0) { if (accepted_ind != accepted_total) citymania::Emit(citymania::event::CargoDeliveredToUnknown{cargo_type, accepted_total - accepted_ind, st}); - citymania::Emit(citymania::event::CargoAccepted{company, cargo_type, accepted_total, st, profit, src_type, src}); + citymania::Emit(citymania::event::CargoAccepted{company, cargo_type, accepted_total, st, profit, src}); } return profit; diff --git a/src/rev.cpp.in b/src/rev.cpp.in index c2a6c3937a..672dbaa87a 100644 --- a/src/rev.cpp.in +++ b/src/rev.cpp.in @@ -7,11 +7,11 @@ /** @file rev.cpp Autogenerated file with the revision and such of OpenTTD. */ -#include "/home/dp/Downloads/openttd-15.0-beta2/src/stdafx.h" -#include "/home/dp/Downloads/openttd-15.0-beta2/src/core/bitmath_func.hpp" -#include "/home/dp/Downloads/openttd-15.0-beta2/src/rev.h" +#include "${CMAKE_SOURCE_DIR}/src/stdafx.h" +#include "${CMAKE_SOURCE_DIR}/src/core/bitmath_func.hpp" +#include "${CMAKE_SOURCE_DIR}/src/rev.h" -#include "/home/dp/Downloads/openttd-15.0-beta2/src/safeguards.h" +#include "${CMAKE_SOURCE_DIR}/src/safeguards.h" /** * Is this version of OpenTTD a release version? diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index dd8e736f52..5b775587e9 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -2946,16 +2946,16 @@ static std::optional ParseSavePreset(const std::string &str) if (level != Clamp(level, slf.min_compression, slf.max_compression)) { /* Invalid compression level, show the error and use default level */ - SetDParamStr(0, level_str.c_str()); - ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_LEVEL, WL_CRITICAL); + ShowErrorMessage(GetEncodedString(STR_CONFIG_ERROR), + GetEncodedString(STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_LEVEL, level_str), WL_CRITICAL); return SavePreset{&slf, slf.default_compression}; } return SavePreset{&slf, (uint8_t)level}; } } - SetDParamStr(0, str.c_str()); - ShowErrorMessage(STR_CONFIG_ERROR, STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_ALGORITHM, WL_CRITICAL); + ShowErrorMessage(GetEncodedString(STR_CONFIG_ERROR), + GetEncodedString(STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_ALGORITHM, str), WL_CRITICAL); return {}; } diff --git a/src/survey.cpp b/src/survey.cpp index 838a702fb1..7de151d4c6 100644 --- a/src/survey.cpp +++ b/src/survey.cpp @@ -130,6 +130,7 @@ static auto &GenericSettingTables() _pathfinding_settings, _script_settings, _world_settings, + citymania::_settings, }; return _generic_setting_tables; } diff --git a/src/table/settings/citymania_settings.ini b/src/table/settings/citymania_settings.ini index 94d255f3c5..2e7009c0e6 100644 --- a/src/table/settings/citymania_settings.ini +++ b/src/table/settings/citymania_settings.ini @@ -3,12 +3,12 @@ static const SettingVariant _citymania_settings_table[] = { [post-amble] }; [templates] -SDT_VAR = SDT_VAR(GameSettings, $var, $type, $flags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $str_cb, $help_cb, $val_cb, $def_cb, $from, $to, $cat, $extra, $startup), +SDT_VAR = SDT_VAR(GameSettings, $var, $type, SettingFlags({$flags}), $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $str_cb, $help_cb, $val_cb, $def_cb, $range_cb, $from, $to, $cat, $extra, $startup), [validation] -SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$var exceeds storage size"); +SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for citymania::Settings.$var exceeds storage size"); [defaults] -flags = SF_NONE +flags = interval = 0 str = STR_NULL strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT @@ -19,6 +19,7 @@ str_cb = nullptr help_cb = nullptr val_cb = nullptr def_cb = nullptr +range_cb = nullptr load = nullptr from = SL_MIN_VERSION to = SL_MAX_VERSION diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index eb0f924f4a..fd3acaf76f 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -516,7 +516,7 @@ static void AdvanceSingleHouseConstruction(TileIndex tile) ChangePopulation(Town::GetByTile(tile), hs->population); ResetHouseAge(tile); - if (hs->building_flags & BUILDING_HAS_1_TILE) + if (hs->building_flags.Any(BUILDING_HAS_1_TILE)) citymania::Emit(citymania::event::HouseCompleted{town, tile, house_id, hs}); } MarkTileDirtyByTile(tile);