← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1344350 into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1344350 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1344350 in widelands: "Constructionsites/dismantlesites only show a dot instead of building image"
  https://bugs.launchpad.net/widelands/+bug/1344350

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1344350/+merge/228379

Fixed image for partially constructed building
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1344350/+merge/228379
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1344350 into lp:widelands.
=== modified file 'src/logic/building.cc'
--- src/logic/building.cc	2014-07-25 20:40:51 +0000
+++ src/logic/building.cc	2014-07-25 22:22:19 +0000
@@ -909,7 +909,7 @@
 	// animations of buildings so that the messages can still be displayed, even
 	// after reload.
 	const std::string& img = g_gr->animations().get_animation
-		(descr().get_ui_anim()).representative_image_from_disk().hash();
+		(get_ui_anim()).representative_image_from_disk().hash();
 	std::string rt_description;
 	rt_description.reserve
 		(strlen("<rt image=") + img.size() + 1 +

=== modified file 'src/logic/building.h'
--- src/logic/building.h	2014-07-20 13:00:05 +0000
+++ src/logic/building.h	2014-07-25 22:22:19 +0000
@@ -188,6 +188,10 @@
 	virtual int32_t  get_size    () const override;
 	virtual bool get_passable() const override;
 
+	//Return the animation ID that is used for the building in UI items
+	//(the building UI, messages, etc..)
+	virtual uint32_t get_ui_anim() const {return descr().get_ui_anim();}
+
 	virtual Flag & base_flag() override;
 	virtual uint32_t get_playercaps() const;
 

=== modified file 'src/logic/partially_finished_building.cc'
--- src/logic/partially_finished_building.cc	2014-07-24 20:39:56 +0000
+++ src/logic/partially_finished_building.cc	2014-07-25 22:22:19 +0000
@@ -141,6 +141,17 @@
 	return caps;
 }
 
+/*
+===============
+Return the animation for the building that is in construction, as this
+should be more useful to the player.
+===============
+*/
+uint32_t Partially_Finished_Building::get_ui_anim() const
+{
+	return m_building->get_animation("idle");
+}
+
 
 /*
 ===============

=== modified file 'src/logic/partially_finished_building.h'
--- src/logic/partially_finished_building.h	2014-07-15 10:55:02 +0000
+++ src/logic/partially_finished_building.h	2014-07-25 22:22:19 +0000
@@ -49,6 +49,8 @@
 	virtual int32_t get_size() const override;
 	virtual uint32_t get_playercaps() const override;
 
+	virtual uint32_t get_ui_anim() const override;
+
 	virtual void set_economy(Economy *) override;
 
 	uint32_t get_nrwaresqueues() {return m_wares.size();}

=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc	2014-07-25 13:45:18 +0000
+++ src/wui/buildingwindow.cc	2014-07-25 22:22:19 +0000
@@ -115,7 +115,7 @@
 {
 	UI::Window::draw(dst);
 
-	const Animation& anim = g_gr->animations().get_animation(building().descr().get_ui_anim());
+	const Animation& anim = g_gr->animations().get_animation(building().get_ui_anim());
 
 	const Image* dark_frame = ImageTransformations::change_luminosity
 		(&anim.representative_image(building().owner().get_playercolor()), 1.22, true);


Follow ups