diff --git a/charselect.cpp b/charselect.cpp index 959a364..822ea78 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 3dce5f8..19ae7bb 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(total_loading_size)) * 100); w_lobby->set_loading_value(loading_value); } - w_courtroom->character_loading_finished(); send_server_packet(new AOPacket("RM#%")); }