Skip to content

Commit

Permalink
Message preview archiving enhancements (CB #4735 / GH #6372)
Browse files Browse the repository at this point in the history
Co-authored-by: Benedikt Straub <nordfriese@noreply.codeberg.org>
Co-committed-by: Benedikt Straub <nordfriese@noreply.codeberg.org>
  • Loading branch information
Benedikt Straub authored and The Widelands Bunny Bot committed Apr 21, 2024
1 parent 1907f67 commit 19e25ba
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/wui/info_panel.cc
Expand Up @@ -26,6 +26,7 @@
#include "graphic/font_handler.h"
#include "graphic/text_layout.h"
#include "logic/message_queue.h"
#include "logic/playercommand.h"
#include "wlapplication_options.h"
#include "wui/interactive_player.h"
#include "wui/toolbar.h"
Expand Down Expand Up @@ -62,7 +63,8 @@ MessagePreview::MessagePreview(InfoPanel* i, const Widelands::Message* m, Widela

inline bool MessagePreview::message_still_exists() const {
return !(id_.operator bool()) || (owner_.message_queue_ == nullptr) ||
(owner_.message_queue_->count(id_.value()) != 0u);
(owner_.message_queue_->count(id_.value()) != 0u &&
message_->status() != Widelands::Message::Status::kArchived);
}

void MessagePreview::think() {
Expand Down Expand Up @@ -112,7 +114,11 @@ bool MessagePreview::handle_mousepress(const uint8_t button, int32_t /* x */, in
message_->position(), MapView::Transition::Smooth);
}
break;
case SDL_BUTTON_MIDDLE: // hide message
case SDL_BUTTON_MIDDLE: // hide and delete message
if (owner_.iplayer_ != nullptr && message_ != nullptr) {
owner_.iplayer_->game().send_player_command(new Widelands::CmdMessageSetStatusArchived(
owner_.iplayer_->game().get_gametime(), owner_.iplayer_->player_number(), id_));
}
owner_.pop_message(this);
break;
case SDL_BUTTON_RIGHT: { // open message menu
Expand Down

0 comments on commit 19e25ba

Please sign in to comment.