widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #00860
[Merge] lp:~sirius-in4matiker/widelands/spectator-fix into lp:widelands
Johannes E has proposed merging lp:~sirius-in4matiker/widelands/spectator-fix into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1024549 in widelands: "Crash in Build Cost Preview in Observer Mode"
https://bugs.launchpad.net/widelands/+bug/1024549
For more details, see:
https://code.launchpad.net/~sirius-in4matiker/widelands/spectator-fix/+merge/114945
Fix bug 1024549 by not instantiating the build resource preview window in observer mode.
This changes the m_buildcostPrev member of FieldActionWindow to be a pointer initialized to 0. If a player is given, it is initialized to the correct tribe. A delete m_buildcostPrev is added in the destructor.
--
https://code.launchpad.net/~sirius-in4matiker/widelands/spectator-fix/+merge/114945
Your team Widelands Developers is requested to review the proposed merge of lp:~sirius-in4matiker/widelands/spectator-fix into lp:widelands.
=== modified file 'src/wui/fieldaction.cc'
--- src/wui/fieldaction.cc 2012-06-25 14:22:58 +0000
+++ src/wui/fieldaction.cc 2012-07-13 21:14:21 +0000
@@ -223,7 +223,7 @@
Widelands::FCoords m_node;
UI::Box m_box;
- WaresMapDisplay m_buildcostPrev;
+ WaresMapDisplay * m_buildcostPrev;
UI::Tab_Panel m_tabpanel;
bool m_fastclick; // if true, put the mouse over first button in first tab
uint32_t m_best_tab;
@@ -285,7 +285,7 @@
m_overlay_manager(*m_map->get_overlay_manager()),
m_node(ib->get_sel_pos().node, &(*m_map)[ib->get_sel_pos().node]),
m_box(this, 0, 0, UI::Box::Vertical),
- m_buildcostPrev(&m_box, 0, 0, 6, m_plr->tribe(), NULL),
+ m_buildcostPrev(0),
m_tabpanel(&m_box, 0, 0, g_gr->get_picture(PicMod_UI, "pics/but1.png")),
m_fastclick(true),
m_best_tab(0),
@@ -294,8 +294,13 @@
{
ib->set_sel_freeze(true);
+
m_box.add(&m_tabpanel, UI::Box::AlignCenter);
- m_box.add(&m_buildcostPrev, UI::Box::AlignLeft);
+ if (m_plr) {
+ m_buildcostPrev = new WaresMapDisplay(&m_box, 0, 0, 6, m_plr->tribe(), NULL);
+ m_box.add(m_buildcostPrev, UI::Box::AlignLeft);
+ }
+
set_center_panel(&m_box);
char filename[] = "pics/workarea0cumulative.png";
@@ -313,6 +318,7 @@
m_overlay_manager.remove_overlay(m_workarea_preview_job_id);
ibase().set_sel_freeze(false);
delete m_attack_box;
+ delete m_buildcostPrev;
}
@@ -838,7 +844,7 @@
void FieldActionWindow::building_icon_mouse_out
(Widelands::Building_Index::value_t)
{
- m_buildcostPrev.set_map(NULL);
+ m_buildcostPrev->set_map(NULL);
if (m_workarea_preview_job_id) {
m_overlay_manager.remove_overlay(m_workarea_preview_job_id);
m_workarea_preview_job_id = Overlay_Manager::Job_Id::Null();
@@ -849,7 +855,7 @@
void FieldActionWindow::building_icon_mouse_in
(Widelands::Building_Index::value_t const idx)
{
- m_buildcostPrev.set_map
+ m_buildcostPrev->set_map
(&m_plr->tribe().get_building_descr(Widelands::Building_Index(idx))->buildcost());
if (ibase().m_show_workarea_preview and not m_workarea_preview_job_id) {
Follow ups