Merge lp:~widelands-dev/widelands/wareslist_sizes into lp:widelands

Proposed by cghislai
Status: Merged
Merged at revision: 6697
Proposed branch: lp:~widelands-dev/widelands/wareslist_sizes
Merge into: lp:widelands
Diff against target: 176 lines (+28/-27)
5 files modified
src/logic/editor_game_base.cc (+4/-0)
src/ui_fsmenu/loadreplay.cc (+6/-7)
src/ui_fsmenu/loadreplay.h (+14/-12)
src/wlapplication.cc (+4/-4)
src/wui/waresdisplay.cc (+0/-4)
To merge this branch: bzr merge lp:~widelands-dev/widelands/wareslist_sizes
Reviewer Review Type Date Requested Status
SirVer Approve
Review via email: mp+178257@code.launchpad.net

Description of the change

This changes the max height for wares list wrapping so that it wraps nice at 800x600 in order to display all the whole ware statistics window. No wrapping occurs at 1024*768. I moved the code to do so from the ware display window to the tribe loading, as it makes much more sense imho.

I also added a small fix to not create a game object each time a replay as preloaded. Instead, the one created in wlapplication is passed in, similar to what is done in the load game menu.

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

Lgtm. Merged. Thanks for taking care of this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/editor_game_base.cc'
2--- src/logic/editor_game_base.cc 2013-07-31 17:00:28 +0000
3+++ src/logic/editor_game_base.cc 2013-08-02 14:23:27 +0000
4@@ -34,6 +34,7 @@
5 #include "logic/findimmovable.h"
6 #include "logic/game.h"
7 #include "logic/instances.h"
8+#include "logic/item_ware_descr.h"
9 #include "logic/mapregion.h"
10 #include "logic/player.h"
11 #include "logic/roadtype.h"
12@@ -166,6 +167,9 @@
13 map().load_world();
14 assert(map().get_world());
15 Tribe_Descr & result = *new Tribe_Descr(tribe, *this);
16+ //resize the configuration of our wares if they won't fit in the current window (12 = info label size)
17+ int number = (g_gr->get_yres() - 270) / (WARE_MENU_PIC_HEIGHT + WARE_MENU_PIC_PAD_Y + 12);
18+ result.resize_ware_orders(number);
19 m_tribes.push_back(&result);
20 return result;
21 }
22
23=== modified file 'src/ui_fsmenu/loadreplay.cc'
24--- src/ui_fsmenu/loadreplay.cc 2013-07-31 17:09:15 +0000
25+++ src/ui_fsmenu/loadreplay.cc 2013-08-02 14:23:27 +0000
26@@ -30,7 +30,7 @@
27 #include "timestring.h"
28 #include "ui_basic/messagebox.h"
29
30-Fullscreen_Menu_LoadReplay::Fullscreen_Menu_LoadReplay() :
31+Fullscreen_Menu_LoadReplay::Fullscreen_Menu_LoadReplay(Widelands::Game & g) :
32 Fullscreen_Menu_Base("choosemapmenu.jpg"),
33
34 // Values for alignment and size
35@@ -82,7 +82,8 @@
36 m_ta_players
37 (this, get_w() * 71 / 100, get_h() * 41 / 100),
38 m_ta_win_condition
39- (this, get_w() * 71 / 100, get_h() * 9 / 20)
40+ (this, get_w() * 71 / 100, get_h() * 9 / 20),
41+ m_game(g)
42 {
43 m_back.sigclicked.connect(boost::bind(&Fullscreen_Menu_LoadReplay::end_modal, boost::ref(*this), 0));
44 m_ok.sigclicked.connect(boost::bind(&Fullscreen_Menu_LoadReplay::clicked_ok, boost::ref(*this)));
45@@ -171,11 +172,10 @@
46
47 if (m_list.has_selection()) {
48 std::string name = m_list.get_selected() + WLGF_SUFFIX;
49- Widelands::Game game;
50 Widelands::Game_Preload_Data_Packet gpdp;
51
52 try {
53- Widelands::Game_Loader gl(name, game);
54+ Widelands::Game_Loader gl(name, m_game);
55 gl.preload_game(gpdp);
56 } catch (const _wexception & e) {
57 log("Replay '%s' must have changed from under us\nException: %s\n", name.c_str(), e.what());
58@@ -215,6 +215,7 @@
59
60 g_fs->FindFiles(REPLAY_DIR, "*" REPLAY_SUFFIX, &files, 1);
61
62+ Widelands::Game_Preload_Data_Packet gpdp;
63 for
64 (filenameset_t::iterator pname = files.begin();
65 pname != files.end();
66@@ -226,9 +227,7 @@
67 continue;
68
69 try {
70- Widelands::Game_Preload_Data_Packet gpdp;
71- Widelands::Game game;
72- Widelands::Game_Loader gl(savename, game);
73+ Widelands::Game_Loader gl(savename, m_game);
74 gl.preload_game(gpdp);
75
76 m_list.add
77
78=== modified file 'src/ui_fsmenu/loadreplay.h'
79--- src/ui_fsmenu/loadreplay.h 2013-07-26 20:19:36 +0000
80+++ src/ui_fsmenu/loadreplay.h 2013-08-02 14:23:27 +0000
81@@ -25,12 +25,13 @@
82 #include "ui_basic/listselect.h"
83 #include "ui_basic/textarea.h"
84
85-
86+namespace Widelands
87+{struct Game;}
88 /**
89 * Select a replay from a list of replays.
90 */
91 struct Fullscreen_Menu_LoadReplay : public Fullscreen_Menu_Base {
92- Fullscreen_Menu_LoadReplay();
93+ Fullscreen_Menu_LoadReplay(Widelands::Game &);
94
95 const std::string & filename() {return m_filename;}
96
97@@ -51,16 +52,17 @@
98 UI::Button m_back;
99 UI::Button m_ok;
100 UI::Button m_delete;
101- UI::Listselect<std::string> m_list;
102- UI::Textarea m_title;
103- UI::Textarea m_label_mapname;
104- UI::Textarea m_tamapname;
105- UI::Textarea m_label_gametime;
106- UI::Textarea m_tagametime;
107- UI::Textarea m_label_players;
108- UI::Textarea m_ta_players;
109- UI::Textarea m_ta_win_condition;
110- std::string m_filename;
111+ UI::Listselect<std::string> m_list;
112+ UI::Textarea m_title;
113+ UI::Textarea m_label_mapname;
114+ UI::Textarea m_tamapname;
115+ UI::Textarea m_label_gametime;
116+ UI::Textarea m_tagametime;
117+ UI::Textarea m_label_players;
118+ UI::Textarea m_ta_players;
119+ UI::Textarea m_ta_win_condition;
120+ std::string m_filename;
121+ Widelands::Game & m_game;
122 };
123
124
125
126=== modified file 'src/wlapplication.cc'
127--- src/wlapplication.cc 2013-07-30 08:58:02 +0000
128+++ src/wlapplication.cc 2013-08-02 14:23:27 +0000
129@@ -84,12 +84,12 @@
130 #include "wui/interactive_player.h"
131 #include "wui/interactive_spectator.h"
132
133-#ifndef NDEBUG
134+#ifndef NDEBUG
135 #ifndef _WIN32
136 int32_t WLApplication::pid_me = 0;
137 int32_t WLApplication::pid_peer = 0;
138 volatile int32_t WLApplication::may_run = 0;
139-#endif
140+#endif
141 #endif
142
143 #define MINIMUM_DISK_SPACE 250000000lu
144@@ -2204,15 +2204,15 @@
145 */
146 void WLApplication::replay()
147 {
148+ Widelands::Game game;
149 if (m_filename.empty()) {
150- Fullscreen_Menu_LoadReplay rm;
151+ Fullscreen_Menu_LoadReplay rm(game);
152 if (rm.run() <= 0)
153 return;
154
155 m_filename = rm.filename();
156 }
157
158- Widelands::Game game;
159 try {
160 UI::ProgressWindow loaderUI;
161 std::vector<std::string> tipstext;
162
163=== modified file 'src/wui/waresdisplay.cc'
164--- src/wui/waresdisplay.cc 2013-07-26 20:19:36 +0000
165+++ src/wui/waresdisplay.cc 2013-08-02 14:23:27 +0000
166@@ -72,10 +72,6 @@
167 m_selection_anchor(Widelands::Ware_Index::Null()),
168 m_callback_function(callback_function)
169 {
170- //resize the configuration of our wares if they won't fit in the current window
171- int number = (g_gr->get_yres() - 160) / (WARE_MENU_PIC_HEIGHT + WARE_MENU_INFO_SIZE + WARE_MENU_PIC_PAD_Y);
172- const_cast<Widelands::Tribe_Descr &>(m_tribe).resize_ware_orders(number);
173-
174 // Find out geometry from icons_order
175 unsigned int columns = icons_order().size();
176 unsigned int rows = 0;

Subscribers

People subscribed via source and target branches

to status/vote changes: