Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs affecting blabber of *BSD #2133

Merged
merged 4 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions client/audio/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,11 @@ void audio_set_volume(double volume)
*/
void audio_shutdown()
{
// Already shut down
if (selected_plugin < 0) {
return;
}

// avoid infinite loop at end of game
audio_stop();

Expand All @@ -624,6 +629,9 @@ void audio_shutdown()
secfile_destroy(ms_tagfile);
ms_tagfile = nullptr;
}

// Mark shutdown
selected_plugin = -1;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions client/client_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,8 @@ void client_exit()
options_save(log_option_save_msg);
}

audio_shutdown();

overview_free();
tileset_free(tileset);

Expand Down
4 changes: 2 additions & 2 deletions client/listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@
{
// If you get an error here, your listener likely doesn't inherit from the
// listener<> correctly. See the class documentation.
instances.insert(static_cast<type_t *>(this));
instances.insert(dynamic_cast<type_t *>(this));
}

/***************************************************************************
Destructor
***************************************************************************/
template <class _type_> listener<_type_>::~listener()
{
instances.erase(static_cast<type_t *>(this));
instances.erase(dynamic_cast<type_t *>(this));

Check warning on line 151 in client/listener.h

View workflow job for this annotation

GitHub Actions / macOS

instantiation of variable 'listener<freeciv::map_updates_handler>::instances' required here, but no definition is available [-Wundefined-var-template]
}

/***************************************************************************
Expand Down
11 changes: 4 additions & 7 deletions server/advisors/advdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ struct adv_data *adv_data_get(struct player *pplayer, bool *caller_closes)
}

/**
Allocate memory for advisor data. Save to call multiple times.
Allocate memory for advisor data. Safe to call multiple times.
*/
void adv_data_init(struct player *pplayer)
{
Expand All @@ -691,7 +691,7 @@ void adv_data_init(struct player *pplayer)
}
adv = pplayer->server.adv;

adv->government_want = nullptr;
adv->government_want.clear();

adv->dipl.adv_dipl_slots = new adv_dipl *[MAX_NUM_PLAYER_SLOTS]();
player_slots_iterate(pslot)
Expand Down Expand Up @@ -724,9 +724,7 @@ void adv_data_default(struct player *pplayer)
fc_assert_ret(adv != nullptr);

adv->govt_reeval = 0;
if (!adv->government_want) {
adv->government_want = new adv_want[government_count() + 1]();
}
adv->government_want.resize(government_count());

adv->wonder_city = 0;

Expand All @@ -746,8 +744,7 @@ void adv_data_close(struct player *pplayer)

adv_data_phase_done(pplayer);

delete[] adv->government_want;
adv->government_want = nullptr;
adv->government_want.clear();
if (adv->dipl.adv_dipl_slots != nullptr) {
players_iterate(aplayer)
{
Expand Down
2 changes: 1 addition & 1 deletion server/advisors/advdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ struct adv_data {
int infra_priority;

// Government data
adv_want *government_want;
std::vector<adv_want> government_want;
short govt_reeval;

// Goals
Expand Down
4 changes: 2 additions & 2 deletions tools/fcmp/mpdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ void create_mpdb(const char *filename, bool scenario_db)

if (ret == SQLITE_OK) {
ret = mpdb_query(*handle,
"create table modpacks (name VARCHAR(60) NOT nullptr, "
"type VARCHAR(32), version VARCHAR(32) NOT nullptr);");
"create table modpacks (name VARCHAR(60) NOT null, "
"type VARCHAR(32), version VARCHAR(32) NOT null);");
}

if (ret == SQLITE_OK) {
Expand Down
Loading