summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-09-13 17:33:12 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-09-13 17:33:12 (GMT)
commita11cd592cb9b985298dd16be78dec10226bf3e47 (patch)
treec63a5d172970c4d5f28587c6263c689aca8fae95 /src
parentf7f51d5045a25a331b4cec3844f98584934d827e (diff)
downloadpowder-a11cd592cb9b985298dd16be78dec10226bf3e47.zip
powder-a11cd592cb9b985298dd16be78dec10226bf3e47.tar.gz
Show version info in update prompt. Fixes #177
Diffstat (limited to 'src')
-rw-r--r--src/dialogues/ConfirmPrompt.cpp2
-rw-r--r--src/game/GameController.cpp19
-rw-r--r--src/interface/Engine.h1
-rw-r--r--src/interface/Label.cpp13
4 files changed, 32 insertions, 3 deletions
diff --git a/src/dialogues/ConfirmPrompt.cpp b/src/dialogues/ConfirmPrompt.cpp
index 312d98c..493ddc3 100644
--- a/src/dialogues/ConfirmPrompt.cpp
+++ b/src/dialogues/ConfirmPrompt.cpp
@@ -12,7 +12,7 @@
#include "PowderToy.h"
ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDialogueCallback * callback_):
- ui::Window(ui::Point(-1, -1), ui::Point(250, 50)),
+ ui::Window(ui::Point(-1, -1), ui::Point(250, 35)),
callback(callback_)
{
int width, height;
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index d2580b0..4aceec7 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -1226,7 +1226,24 @@ void GameController::NotifyUpdateAvailable(Client * sender)
virtual void Action()
{
- new ConfirmPrompt("Run Updater", "Are you sure you want to run the updater, please save any changes before updating", new UpdateConfirmation(c));
+ std::string currentVersion, newVersion;
+#ifdef BETA
+ currentVersion = MTOS(SAVE_VERSION) "." MTOS(MINOR_VERSION) " Beta, Build " MTOS(BUILD_NUM);
+#elif defined(SNAPSHOT)
+ currentVersion = "Snapshot " MTOS(SNAPSHOT_ID);
+#else
+ currentVersion = MTOS(SAVE_VERSION) "." MTOS(MINOR_VERSION) " Stable, Build " MTOS(BUILD_NUM);
+#endif
+
+ UpdateInfo info = Client::Ref().GetUpdateInfo();
+ if(info.Type == UpdateInfo::Beta)
+ newVersion = format::NumberToString<int>(info.Major) + " " + format::NumberToString<int>(info.Minor) + " Beta, Build " + format::NumberToString<int>(info.Build);
+ else if(info.Type == UpdateInfo::Snapshot)
+ newVersion = "Snapshot " + format::NumberToString<int>(info.Time);
+ else if(info.Type == UpdateInfo::Stable)
+ newVersion = format::NumberToString<int>(info.Major) + " " + format::NumberToString<int>(info.Minor) + " Stable, Build " + format::NumberToString<int>(info.Build);
+
+ new ConfirmPrompt("Run Updater", "Are you sure you want to run the updater, please save any changes before updating.\n\nCurrent version:\n " + currentVersion + "\nNew version:\n " + newVersion, new UpdateConfirmation(c));
}
};
diff --git a/src/interface/Engine.h b/src/interface/Engine.h
index bcf10e6..960069c 100644
--- a/src/interface/Engine.h
+++ b/src/interface/Engine.h
@@ -79,6 +79,7 @@ namespace ui
pixel * lastBuffer;
std::stack<pixel*> prevBuffers;
std::stack<Window*> windows;
+ std::stack<Point> mousePositions;
//Window* statequeued_;
Window* state_;
Point windowTargetPosition;
diff --git a/src/interface/Label.cpp b/src/interface/Label.cpp
index e19b6b8..96a8520 100644
--- a/src/interface/Label.cpp
+++ b/src/interface/Label.cpp
@@ -80,11 +80,17 @@ void Label::updateMultiline()
char * lastSpace = NULL;
char * currentWord = rawText;
char * nextSpace;
+ char oldChar;
while(true)
{
nextSpace = strchr(currentWord+1, ' ');
+ if(nextSpace > strchr(currentWord+1, '\n'))
+ nextSpace = strchr(currentWord+1, '\n');
if(nextSpace)
+ {
+ oldChar = nextSpace[0];
nextSpace[0] = 0;
+ }
int width = Graphics::textwidth(currentWord);
if(width+currentWidth >= Size.X-(Appearance.Margin.Left+Appearance.Margin.Right))
{
@@ -95,10 +101,15 @@ void Label::updateMultiline()
lines++;
}
}
+ else if(oldChar == '\n')
+ {
+ currentWidth = width;
+ lines++;
+ }
else
currentWidth += width;
if(nextSpace)
- nextSpace[0] = ' ';
+ nextSpace[0] = oldChar;
if(!currentWord[0] || !currentWord[1] || !(currentWord = strchr(currentWord+1, ' ')))
break;
}