From 2329f98f0af9dffda5375aca7b05f9e76a84d06a Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 17 Jul 2012 16:57:12 +0100 Subject: [PATCH] Varying update notifications --- src/game/GameController.cpp | 13 ++++++++++++- src/game/GameView.cpp | 10 ++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index 8ece34b9d..260d99a9c 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -681,7 +681,18 @@ void GameController::NotifyUpdateAvailable(Client * sender) } }; - gameModel->AddNotification(new UpdateNotification(this, "A new version is available - click here to download")); + switch(sender->GetUpdateInfo().Type) + { + case UpdateInfo::Snapshot: + gameModel->AddNotification(new UpdateNotification(this, std::string("A new snapshot is available - click here to update"))); + break; + case UpdateInfo::Stable: + gameModel->AddNotification(new UpdateNotification(this, std::string("A new version is available - click here to update"))); + break; + case UpdateInfo::Beta: + gameModel->AddNotification(new UpdateNotification(this, std::string("A new beta is available - click here to update"))); + break; + } } void GameController::RemoveNotification(Notification * notification) diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index dd03987e2..8adb9e124 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -975,16 +975,18 @@ void GameView::NotifyNotificationsChanged(GameModel * sender) } }; - for(std::vector::iterator iter = notificationComponents.begin(); iter != notificationComponents.end(); ++iter) { - RemoveComponent(*iter); - delete *iter; + for(std::vector::const_iterator iter = notificationComponents.begin(), end = notificationComponents.end(); iter != end; ++iter) { + ui::Component * cNotification = *iter; + RemoveComponent(cNotification); + delete cNotification; } notificationComponents.clear(); + std::vector notifications = sender->GetNotifications(); int currentY = YRES-17; - for(std::vector::iterator iter = notifications.begin(); iter != notifications.end(); ++iter) + for(std::vector::iterator iter = notifications.begin(), end = notifications.end(); iter != end; ++iter) { int width = (Graphics::textwidth((*iter)->Message.c_str()))+8; ui::Button * tempButton = new ui::Button(ui::Point(XRES-width-22, currentY), ui::Point(width, 15), (*iter)->Message);