aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCerapter <cerap@protonmail.com>2018-08-14 16:33:35 +0200
committerCerapter <cerap@protonmail.com>2018-08-14 16:33:35 +0200
commitf81a9adc99cb03c63fc05689697dfac7f287dc07 (patch)
tree913b6f25f788b2e841b4f4eaab6d04bf2c3bf227
parentb99e9c18b272d625ff6749c8924fd7b1c56821ce (diff)
Fixed a bug where the character selection screen would pile up charicons.
- Also fixed the loading bar showing wrong values.
-rw-r--r--charselect.cpp9
-rw-r--r--packet_distribution.cpp2
2 files changed, 10 insertions, 1 deletions
diff --git a/charselect.cpp b/charselect.cpp
index 959a3649..822ea78b 100644
--- a/charselect.cpp
+++ b/charselect.cpp
@@ -175,6 +175,15 @@ void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
void Courtroom::character_loading_finished()
{
+ // Zeroeth, we'll clear any leftover characters from previous server visits.
+ if (ui_char_button_list.size() > 0)
+ {
+ foreach (AOCharButton* item, ui_char_button_list) {
+ delete item;
+ }
+ ui_char_button_list.clear();
+ }
+
// First, we'll make all the character buttons in the very beginning.
// We also hide them all, so they can't be accidentally clicked.
// Later on, we'll be revealing buttons as we need them.
diff --git a/packet_distribution.cpp b/packet_distribution.cpp
index 3dce5f87..19ae7bb9 100644
--- a/packet_distribution.cpp
+++ b/packet_distribution.cpp
@@ -218,6 +218,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
loaded_chars = 0;
loaded_evidence = 0;
loaded_music = 0;
+ generated_chars = 0;
destruct_courtroom();
construct_courtroom();
@@ -419,7 +420,6 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
w_lobby->set_loading_value(loading_value);
}
- w_courtroom->character_loading_finished();
send_server_packet(new AOPacket("RM#%"));
}