Merge lp:~widelands-dev/widelands/bug-998544 into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7465
Proposed branch: lp:~widelands-dev/widelands/bug-998544
Merge into: lp:widelands
Diff against target: 191 lines (+32/-6)
6 files modified
src/game_io/game_preload_packet.cc (+5/-1)
src/game_io/game_preload_packet.h (+2/-0)
src/ui_fsmenu/campaign_select.cc (+0/-2)
src/ui_fsmenu/loadgame.cc (+22/-2)
src/ui_fsmenu/loadgame.h (+3/-0)
src/ui_fsmenu/mapselect.cc (+0/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-998544
Reviewer Review Type Date Requested Status
TiborB Approve
Review via email: mp+251947@code.launchpad.net

Description of the change

Added Widelands version to game preload packet and load game/replay screens.

To post a comment you must log in.
Revision history for this message
TiborB (tiborb95) wrote :

When first time testing this I run into this "issue": https://bugs.launchpad.net/widelands/+bug/998544/+attachment/4387009/+files/broken_replay_open.jpg

But otherwise it looks good to me

review: Needs Fixing
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed :)

Is this ready now?

Revision history for this message
TiborB (tiborb95) wrote :

No problems during testing, so it can go

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/game_io/game_preload_packet.cc'
2--- src/game_io/game_preload_packet.cc 2015-01-31 16:03:59 +0000
3+++ src/game_io/game_preload_packet.cc 2015-05-10 14:48:08 +0000
4@@ -24,6 +24,7 @@
5
6 #include <boost/format.hpp>
7
8+#include "build_info.h"
9 #include "base/time_string.h"
10 #include "graphic/graphic.h"
11 #include "graphic/minimap_renderer.h"
12@@ -42,7 +43,7 @@
13
14 namespace Widelands {
15
16-#define CURRENT_PACKET_VERSION 5
17+#define CURRENT_PACKET_VERSION 6
18 #define PLAYERS_AMOUNT_KEY_V4 "player_amount"
19 #define MINIMAP_FILENAME "minimap.png"
20
21@@ -64,6 +65,8 @@
22 m_player_nr = s.get_safe_int("player_nr");
23 m_win_condition = s.get_safe_string("win_condition");
24 m_number_of_players = s.get_safe_int(PLAYERS_AMOUNT_KEY_V4);
25+ m_version= s.get_safe_string("widelands_version");
26+
27 if (fs.file_exists(MINIMAP_FILENAME)) {
28 m_minimap_path = MINIMAP_FILENAME;
29 }
30@@ -108,6 +111,7 @@
31 }
32 }
33 s.set_int(PLAYERS_AMOUNT_KEY_V4, game.player_manager()->get_number_of_players());
34+ s.set_string("widelands_version", build_id());
35
36 s.set_string("background", map.get_background());
37 s.set_string("win_condition", game.get_win_condition_displayname());
38
39=== modified file 'src/game_io/game_preload_packet.h'
40--- src/game_io/game_preload_packet.h 2014-11-07 19:41:27 +0000
41+++ src/game_io/game_preload_packet.h 2015-05-10 14:48:08 +0000
42@@ -44,6 +44,7 @@
43 std::string get_win_condition() {return m_win_condition;}
44 uint32_t get_gametime() {return m_gametime;}
45 uint8_t get_player_nr() {return m_player_nr;}
46+ std::string get_version() {return m_version;}
47
48 uint8_t get_number_of_players() {return m_number_of_players;}
49 std::string get_minimap_path() {return m_minimap_path;}
50@@ -59,6 +60,7 @@
51 uint32_t m_gametime;
52 uint8_t m_player_nr; // The local player idx
53 uint8_t m_number_of_players;
54+ std::string m_version;
55 time_t m_savetimestamp;
56 GameController::GameType m_gametype;
57 };
58
59=== modified file 'src/ui_fsmenu/campaign_select.cc'
60--- src/ui_fsmenu/campaign_select.cc 2014-12-11 10:27:30 +0000
61+++ src/ui_fsmenu/campaign_select.cc 2015-05-10 14:48:08 +0000
62@@ -260,7 +260,6 @@
63 if (m_table.size()) {
64 m_table.select(0);
65 }
66- set_has_selection();
67 }
68
69 bool FullscreenMenuCampaignSelect::compare_difficulty
70@@ -516,5 +515,4 @@
71 if (m_table.size()) {
72 m_table.select(0);
73 }
74- set_has_selection();
75 }
76
77=== modified file 'src/ui_fsmenu/loadgame.cc'
78--- src/ui_fsmenu/loadgame.cc 2015-01-30 23:10:35 +0000
79+++ src/ui_fsmenu/loadgame.cc 2015-05-10 14:48:08 +0000
80@@ -110,8 +110,15 @@
81 m_right_column_tab, m_label_players.get_y(),
82 get_right_column_w(m_right_column_tab), m_label_height),
83
84+ m_label_version
85+ (this, m_right_column_x, get_y_from_preceding(m_ta_players),
86+ "",
87+ UI::Align_Left),
88+ m_ta_version(this,
89+ m_right_column_tab, m_label_version.get_y(), "", UI::Align_Left),
90+
91 m_label_win_condition
92- (this, m_right_column_x, get_y_from_preceding(m_ta_players) + 3 * m_padding,
93+ (this, m_right_column_x, get_y_from_preceding(m_ta_version) + 3 * m_padding,
94 "",
95 UI::Align_Left),
96 m_ta_win_condition(this,
97@@ -147,6 +154,7 @@
98 m_title.set_textstyle(UI::TextStyle::ui_big());
99 m_ta_gametime.set_tooltip(_("The time that elapsed inside this game"));
100 m_ta_players.set_tooltip(_("The number of players"));
101+ m_ta_version.set_tooltip(_("The version of Widelands that this game was played under"));
102 m_ta_win_condition.set_tooltip(_("The win condition that was set for this game"));
103
104 if (m_is_replay) {
105@@ -294,11 +302,13 @@
106 m_label_mapname .set_text(std::string());
107 m_label_gametime.set_text(std::string());
108 m_label_players.set_text(std::string());
109+ m_label_version.set_text(std::string());
110 m_label_win_condition.set_text(std::string());
111
112 m_ta_mapname .set_text(std::string());
113 m_ta_gametime.set_text(std::string());
114 m_ta_players.set_text(std::string());
115+ m_ta_version.set_text(std::string());
116 m_ta_win_condition.set_text(std::string());
117 m_minimap_icon.set_icon(nullptr);
118 m_minimap_icon.set_visible(false);
119@@ -334,6 +344,14 @@
120 m_ta_players.set_text("");
121 }
122
123+ if (gamedata.version.empty()) {
124+ m_label_version.set_text("");
125+ m_ta_version.set_text("");
126+ } else {
127+ m_label_version.set_text(_("Widelands Version:"));
128+ m_ta_version.set_text(gamedata.version);
129+ }
130+
131 m_ta_win_condition.set_text(gamedata.wincondition);
132
133 std::string minimap_path = gamedata.minimap_path;
134@@ -387,6 +405,8 @@
135 m_ta_gametime.set_text("");
136 m_label_players.set_text("");
137 m_ta_players.set_text("");
138+ m_label_version.set_text("");
139+ m_ta_version.set_text("");
140 m_label_win_condition.set_text("");
141 m_ta_win_condition.set_text("");
142
143@@ -470,6 +490,7 @@
144 gamedata->mapname = gpdp.get_mapname();
145 gamedata->gametime = gpdp.get_gametime();
146 gamedata->nrplayers = gpdp.get_number_of_players();
147+ gamedata->version = gpdp.get_version();
148
149 gamedata->savetimestamp = gpdp.get_savetimestamp();
150 time_t t;
151@@ -598,7 +619,6 @@
152 if (m_table.size()) {
153 m_table.select(0);
154 }
155- set_has_selection();
156 }
157
158 bool FullscreenMenuLoadGame::handle_key(bool down, SDL_Keysym code)
159
160=== modified file 'src/ui_fsmenu/loadgame.h'
161--- src/ui_fsmenu/loadgame.h 2015-04-18 11:20:53 +0000
162+++ src/ui_fsmenu/loadgame.h 2015-05-10 14:48:08 +0000
163@@ -58,6 +58,7 @@
164
165 uint32_t gametime;
166 uint32_t nrplayers;
167+ std::string version;
168 time_t savetimestamp;
169 GameController::GameType gametype;
170
171@@ -100,6 +101,8 @@
172 UI::MultilineTextarea m_ta_gametime; // Multiline because we want tooltips
173 UI::Textarea m_label_players;
174 UI::MultilineTextarea m_ta_players;
175+ UI::Textarea m_label_version;
176+ UI::Textarea m_ta_version;
177 UI::Textarea m_label_win_condition;
178 UI::MultilineTextarea m_ta_win_condition;
179
180
181=== modified file 'src/ui_fsmenu/mapselect.cc'
182--- src/ui_fsmenu/mapselect.cc 2014-12-06 12:22:35 +0000
183+++ src/ui_fsmenu/mapselect.cc 2015-05-10 14:48:08 +0000
184@@ -606,7 +606,6 @@
185 if (m_table.size()) {
186 m_table.select(0);
187 }
188- set_has_selection();
189 }
190
191 /*

Subscribers

People subscribed via source and target branches

to status/vote changes: