← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~borim/widelands/bug1022267 into lp:widelands

 

Borim has proposed merging lp:~borim/widelands/bug1022267 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1022267 in widelands: "stock chart counts wares in every building"
  https://bugs.launchpad.net/widelands/+bug/1022267

For more details, see:
https://code.launchpad.net/~borim/widelands/bug1022267/+merge/114014

* change ware counting for the stock over time chart (only consider wares inside of warehouses)
* improve doc of the economy class
-- 
https://code.launchpad.net/~borim/widelands/bug1022267/+merge/114014
Your team Widelands Developers is requested to review the proposed merge of lp:~borim/widelands/bug1022267 into lp:widelands.
=== modified file 'src/economy/economy.h'
--- src/economy/economy.h	2012-02-15 21:25:34 +0000
+++ src/economy/economy.h	2012-07-09 17:32:34 +0000
@@ -31,9 +31,6 @@
 #include "logic/wareworker.h"
 
 
-/**
- * Economy represents a network of Flag through which wares can be transported.
- */
 namespace Widelands {
 struct Player;
 struct Game;
@@ -45,6 +42,16 @@
 struct Supply;
 struct Router;
 
+/**
+ * Each Economy represents all building and flags, which are connected over the same
+ * street network. In general a player can own multiple Economys, which
+ * operate independent from each other.
+ * During the game Economy objects can be merged or splitted due to
+ * new roads or destroyed ones.
+ *
+ * Every Economy tracks the amount of wares inside of it and how high the
+ * demand for each ware is.
+ */
 struct Economy {
 	friend class EconomyDataPacket;
 

=== modified file 'src/logic/player.cc'
--- src/logic/player.cc	2012-07-07 17:09:03 +0000
+++ src/logic/player.cc	2012-07-09 17:32:34 +0000
@@ -1075,9 +1075,9 @@
 			 it != warehouses.end();
 			 ++it)
 		{
+			Widelands::WareList const & wares = (*it)->get_wares();
 			for (uint32_t id = 0; id < stocks.size(); ++id) {
-				stocks[id] += (*it)->get_economy()->stock_ware
-					(Ware_Index(static_cast<size_t>(id)));
+				stocks[id] += wares.stock(Ware_Index(static_cast<size_t>(id)));
 			}
 		}
 	}


Follow ups