Fix compilation errors
This commit is contained in:
@@ -16,8 +16,8 @@ static void IConsoleHelp(const char *str)
|
||||
IConsolePrint(CC_WARNING, "- {}", str);
|
||||
}
|
||||
|
||||
bool ConExport(uint8_t argc, [[maybe_unused]] char *argv[]) {
|
||||
if (argc == 0) {
|
||||
bool ConExport(std::span<std::string_view> argv) {
|
||||
if (argv.empty()) {
|
||||
IConsoleHelp("Exports various game data in json format to openttd.json file");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace citymania {
|
||||
|
||||
bool ConExport(uint8_t argc, char *argv[]);
|
||||
bool ConExport(std::span<std::string_view> argv);
|
||||
|
||||
} // namespace citymania
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ void WriteHouseSpecInfo(JsonWriter &j) {
|
||||
j.kv("name", hs->building_name);
|
||||
j.kv("mail_generation", hs->mail_generation);
|
||||
j.kv("flags", hs->building_flags.base());
|
||||
j.kv("availability", hs->building_availability);
|
||||
j.kv("availability", hs->building_availability.base());
|
||||
j.kv("enabled", hs->enabled);
|
||||
j.end_dict();
|
||||
}
|
||||
@@ -167,11 +167,11 @@ void WriteHouseSpecInfo(JsonWriter &j) {
|
||||
j.kv("ground_pal", d.ground.pal);
|
||||
j.kv("building_sprite", d.building.sprite);
|
||||
j.kv("building_pal", d.building.pal);
|
||||
j.kv("subtile_x", d.subtile_x);
|
||||
j.kv("subtile_y", d.subtile_y);
|
||||
j.kv("width", d.width);
|
||||
j.kv("height", d.height);
|
||||
j.kv("dz", d.dz);
|
||||
j.kv("origin_x", d.origin.x);
|
||||
j.kv("origin_y", d.origin.y);
|
||||
j.kv("extent_x", d.extent.x);
|
||||
j.kv("extent_y", d.extent.y);
|
||||
j.kv("extent_z", d.extent.z);
|
||||
j.kv("draw_proc", d.draw_proc);
|
||||
j.end_dict();
|
||||
}
|
||||
@@ -190,8 +190,8 @@ void WriteCargoSpecInfo(JsonWriter &j) {
|
||||
JKV(j, cs->weight);
|
||||
JKV(j, cs->multiplier);
|
||||
JKV(j, cs->is_freight);
|
||||
JKV(j, cs->legend_colour);
|
||||
JKV(j, cs->rating_colour);
|
||||
JKV(j, cs->legend_colour.p);
|
||||
JKV(j, cs->rating_colour.p);
|
||||
JKV(j, cs->sprite);
|
||||
j.ks("name", cs->name);
|
||||
j.ks("name_single", cs->name_single);
|
||||
@@ -235,7 +235,7 @@ void WritePaletteInfo(JsonWriter &j) {
|
||||
j.f << std::endl << "[";
|
||||
for (auto k = 0; k < 8; k++) {
|
||||
if (k != 0) j.f << ", ";
|
||||
j.f << (int)GetColourGradient((Colours)i, (ColourShade)k) << " ";
|
||||
j.f << GetColourGradient((Colours)i, (ColourShade)k).p << " ";
|
||||
}
|
||||
j.f << "]";
|
||||
}
|
||||
|
||||
@@ -2967,13 +2967,8 @@ static std::optional<SavePreset> ParseSavePreset(const std::string &str)
|
||||
if (delimiter_pos == std::string::npos) return SavePreset{&slf, slf.default_compression};
|
||||
|
||||
auto level_str = str.substr(delimiter_pos + 1);
|
||||
int level;
|
||||
try{
|
||||
level = stoi(level_str);
|
||||
} catch(const std::exception &e) {
|
||||
/* Can't parse compression level, set it out ouf bounds to fail later */
|
||||
level = (int)slf.max_compression + 1;
|
||||
}
|
||||
/* If can't parse compression level, set it out ouf bounds to fail later */
|
||||
int level = ParseInteger<int>(level_str).value_or((int)slf.max_compression + 1);
|
||||
|
||||
if (level != Clamp<int>(level, slf.min_compression, slf.max_compression)) {
|
||||
/* Invalid compression level, show the error and use default level */
|
||||
|
||||
Reference in New Issue
Block a user