← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/mapobject_cleanup_misc into lp:widelands

 

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

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1341082 in widelands: "Building help: clean up name, descname"
  https://bugs.launchpad.net/widelands/+bug/1341082

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/mapobject_cleanup_misc/+merge/226756

MapObject cleanup for misc objects
-- 
https://code.launchpad.net/~widelands-dev/widelands/mapobject_cleanup_misc/+merge/226756
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/mapobject_cleanup_misc into lp:widelands.
=== modified file 'src/economy/fleet.cc'
--- src/economy/fleet.cc	2014-07-05 12:17:03 +0000
+++ src/economy/fleet.cc	2014-07-14 22:50:41 +0000
@@ -661,7 +661,7 @@
 				// Check if ship has currently a different destination
 				if (dst && dst != &pd)
 					continue;
-				if (ship.get_nritems() >= ship.get_capacity())
+				if (ship.get_nritems() >= ship.descr().get_capacity())
 					continue;
 
 				molog("... ship %u takes care of it\n", ship.serial());

=== modified file 'src/economy/portdock.cc'
--- src/economy/portdock.cc	2014-07-05 12:17:03 +0000
+++ src/economy/portdock.cc	2014-07-14 22:50:41 +0000
@@ -349,8 +349,8 @@
 		}
 	}
 
-	if (ship.get_nritems() < ship.get_capacity() && !m_waiting.empty()) {
-		uint32_t nrload = std::min<uint32_t>(m_waiting.size(), ship.get_capacity() - ship.get_nritems());
+	if (ship.get_nritems() < ship.descr().get_capacity() && !m_waiting.empty()) {
+		uint32_t nrload = std::min<uint32_t>(m_waiting.size(), ship.descr().get_capacity() - ship.get_nritems());
 
 		while (nrload--) {
 			// Check if the item has still a valid destination

=== modified file 'src/logic/bob.cc'
--- src/logic/bob.cc	2014-07-03 19:26:30 +0000
+++ src/logic/bob.cc	2014-07-14 22:50:41 +0000
@@ -936,12 +936,12 @@
 void Bob::set_owner(Player * const player)
 {
 	if (m_owner && m_position.field)
-		m_owner->unsee_area(Area<FCoords>(get_position(), vision_range()));
+		m_owner->unsee_area(Area<FCoords>(get_position(), descr().vision_range()));
 
 	m_owner = player;
 
 	if (m_owner != nullptr && m_position.field)
-		m_owner->see_area(Area<FCoords>(get_position(), vision_range()));
+		m_owner->see_area(Area<FCoords>(get_position(), descr().vision_range()));
 }
 
 
@@ -970,10 +970,10 @@
 	*m_linkpprev = this;
 
 	if (m_owner != nullptr) {
-		m_owner->see_area(Area<FCoords>(get_position(), vision_range()));
+		m_owner->see_area(Area<FCoords>(get_position(), descr().vision_range()));
 
 		if (oldposition.field)
-			m_owner->unsee_area(Area<FCoords>(oldposition, vision_range()));
+			m_owner->unsee_area(Area<FCoords>(oldposition, descr().vision_range()));
 	}
 
 	// Since pretty much everything in Widelands eventually results in the

=== modified file 'src/logic/bob.h'
--- src/logic/bob.h	2014-07-05 16:41:51 +0000
+++ src/logic/bob.h	2014-07-14 22:50:41 +0000
@@ -244,8 +244,6 @@
 	const FCoords & get_position() const {return m_position;}
 	Bob * get_next_bob() const {return m_linknext;}
 
-	uint32_t vision_range() const {return descr().vision_range();}
-
 	/// Check whether this bob should be able to move onto the given node.
 	///
 	/// \param commit indicates whether this function is called from the

=== modified file 'src/logic/immovable.cc'
--- src/logic/immovable.cc	2014-07-08 05:04:53 +0000
+++ src/logic/immovable.cc	2014-07-14 22:50:41 +0000
@@ -729,7 +729,7 @@
 	fw.Unsigned8(header_Immovable);
 	fw.Unsigned8(IMMOVABLE_SAVEGAME_VERSION);
 
-	if (const Tribe_Descr * const tribe = get_owner_tribe())
+	if (const Tribe_Descr * const tribe = descr().get_owner_tribe())
 		fw.String(tribe->name());
 	else
 		fw.CString("world");

=== modified file 'src/logic/immovable.h'
--- src/logic/immovable.h	2014-07-06 08:17:24 +0000
+++ src/logic/immovable.h	2014-07-14 22:50:41 +0000
@@ -183,10 +183,6 @@
 	bool construct_ware(Game & game, Ware_Index index);
 	bool construct_remaining_buildcost(Game & game, Buildcost * buildcost);
 
-	Tribe_Descr const * get_owner_tribe() const {
-		return descr().get_owner_tribe();
-	}
-
 	bool is_reserved_by_worker() const;
 	void set_reserved_by_worker(bool reserve);
 

=== modified file 'src/logic/ship.cc'
--- src/logic/ship.cc	2014-07-14 07:31:18 +0000
+++ src/logic/ship.cc	2014-07-14 22:50:41 +0000
@@ -352,7 +352,7 @@
 	if (m_ship_state == EXP_SCOUTING) {
 		// Check surrounding fields for port buildspaces
 		std::unique_ptr<std::list<Coords> > temp_port_buildspaces(new std::list<Coords>());
-		MapRegion<Area<Coords> > mr(map, Area<Coords>(position, vision_range()));
+		MapRegion<Area<Coords> > mr(map, Area<Coords>(position, descr().vision_range()));
 		bool new_port_space = false;
 		do {
 			if (map.is_port_space(mr.location())) {

=== modified file 'src/logic/ship.h'
--- src/logic/ship.h	2014-07-05 16:41:51 +0000
+++ src/logic/ship.h	2014-07-14 22:50:41 +0000
@@ -97,8 +97,6 @@
 
 	virtual void log_general_info(const Editor_Game_Base &) override;
 
-	uint32_t get_capacity() const {return descr().get_capacity();}
-	virtual uint32_t vision_range() const {return descr().vision_range();}
 	uint32_t get_nritems() const {return m_items.size();}
 	const ShippingItem & get_item(uint32_t idx) const {return m_items[idx];}
 

=== modified file 'src/logic/soldier.cc'
--- src/logic/soldier.cc	2014-07-05 12:48:58 +0000
+++ src/logic/soldier.cc	2014-07-14 22:50:41 +0000
@@ -926,7 +926,7 @@
 				// Try to find our land
 				Map* map = game.get_map();
 				std::vector<Coords> coords;
-				uint32_t maxdist = vision_range() * 2;
+				uint32_t maxdist = descr().vision_range() * 2;
 				Area<FCoords> area(map->get_fcoords(get_position()), maxdist);
 				if
 					(map->find_reachable_fields

=== modified file 'src/logic/worker.cc'
--- src/logic/worker.cc	2014-07-06 08:17:24 +0000
+++ src/logic/worker.cc	2014-07-14 22:50:41 +0000
@@ -2563,7 +2563,7 @@
 	// We always have a high probability to see flags within our vision range,
 	// but with some luck we see flags that are even further away.
 	std::vector<ImmovableFound> flags;
-	int32_t vision = vision_range();
+	int32_t vision = descr().vision_range();
 	int32_t maxdist = 4 * vision;
 	if
 		(map.find_immovables
@@ -2625,7 +2625,7 @@
 	if
 		(start_task_movepath
 		 	(game,
-		 	 game.random_location(get_position(), vision_range()),
+		 	 game.random_location(get_position(), descr().vision_range()),
 		 	 4,
 		 	 descr().get_right_walk_anims(does_carry_ware())))
 		return;

=== modified file 'src/wui/shipwindow.cc'
--- src/wui/shipwindow.cc	2014-07-03 19:26:30 +0000
+++ src/wui/shipwindow.cc	2014-07-14 22:50:41 +0000
@@ -99,7 +99,7 @@
 	UI::Box * vbox = new UI::Box(this, 0, 0, UI::Box::Vertical);
 
 	m_display = new ItemWaresDisplay(vbox, *ship.get_owner());
-	m_display->set_capacity(ship.get_capacity());
+	m_display->set_capacity(ship.descr().get_capacity());
 	vbox->add(m_display, UI::Box::AlignCenter, false);
 
 	// Expedition buttons


Follow ups