Skip to content

Commit

Permalink
Fix compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ldpl committed Apr 25, 2024
1 parent 02f7b3f commit 9da446f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/citymania/cm_bitstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BitOStream {
};

class BitIStreamUnexpectedEnd: public std::exception {
virtual const char* what() const throw() {
const char* what() const noexcept override {
return "Unexpected end of bit input stream";
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/citymania/cm_console_cmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static void IConsoleHelp(const char *str)
IConsolePrint(CC_WARNING, "- {}", str);
}

bool ConExport(byte argc, char *argv[]) {
bool ConExport(byte argc, [[maybe_unused]] char *argv[]) {
if (argc == 0) {
IConsoleHelp("Exports various game data in json format to openttd.json file");
return true;
Expand Down
6 changes: 1 addition & 5 deletions src/citymania/cm_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,7 @@ void WriteHouseSpecInfo(JsonWriter &j) {

void WriteCargoSpecInfo(JsonWriter &j) {
j.begin_list_with_key("cargo_specs");
const CargoSpec *cs;
char buffer[128];
char cargo_label[16];
bool first = true;
SetDParam(0, 123);
for (const CargoSpec *cs : CargoSpec::Iterate()) {
j.begin_dict();
Expand Down Expand Up @@ -242,12 +239,11 @@ void WritePaletteInfo(JsonWriter &j) {
j.f << "]";
}
j.end_list();
const byte *remap = GetNonSprite(GB(PALETTE_TO_RED, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1;
// const byte *remap = GetNonSprite(GB(PALETTE_TO_RED, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1;
}

void WriteEngineInfo(JsonWriter &j) {
j.begin_list_with_key("engines");
const Engine *e;
for (const Engine *e : Engine::Iterate()) {
if (e->type != VEH_TRAIN) continue;
j.begin_dict();
Expand Down
10 changes: 5 additions & 5 deletions src/citymania/cm_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Game::Game() {
this->towns_growth_tiles.clear();
});

this->events.listen<event::TownBuilt>(event::Slot::GAME, [this] (const event::TownBuilt &event) {
this->events.listen<event::TownBuilt>(event::Slot::GAME, [] (const event::TownBuilt &event) {
auto t = event.town;
t->cm.hs_total = t->cm.hs_last_month = t->cm.hs_this_month = 0;
t->cm.cs_total = t->cm.cs_last_month = t->cm.cs_this_month = 0;
Expand Down Expand Up @@ -68,13 +68,13 @@ Game::Game() {
this->set_town_growth_tile(event.town, event.tile, TownGrowthTileState::NEW_HOUSE);
});

this->events.listen<event::HouseCleared>(event::Slot::GAME, [this] (const event::HouseCleared &event) {
this->events.listen<event::HouseCleared>(event::Slot::GAME, [] (const event::HouseCleared &event) {
if (!event.was_completed)
event.town->cm.houses_constructing--;
event.town->cm.real_population -= event.house_spec->population;
});

this->events.listen<event::HouseCompleted>(event::Slot::GAME, [this] (const event::HouseCompleted &event) {
this->events.listen<event::HouseCompleted>(event::Slot::GAME, [] (const event::HouseCompleted &event) {
event.town->cm.houses_constructing--;
});

Expand All @@ -86,7 +86,7 @@ Game::Game() {
}
});

this->events.listen<event::TownCachesRebuilt>(event::Slot::GAME, [this] (const event::TownCachesRebuilt &event) {
this->events.listen<event::TownCachesRebuilt>(event::Slot::GAME, [this] (const event::TownCachesRebuilt&) {
this->towns_growth_tiles.clear();
this->towns_growth_tiles_last_month.clear();
for (Town *town : Town::Iterate()) {
Expand All @@ -109,7 +109,7 @@ Game::Game() {
}
});

this->events.listen<event::CargoAccepted>(event::Slot::GAME, [this] (const event::CargoAccepted &event) {
this->events.listen<event::CargoAccepted>(event::Slot::GAME, [] (const event::CargoAccepted &event) {
event.company->cur_economy.cm.cargo_income[event.cargo_type] += event.profit;
});
}
Expand Down

0 comments on commit 9da446f

Please sign in to comment.