(svn r8130) Provide struct GoodsEntry with a constructor
authortron
Sun, 14 Jan 2007 20:00:25 +0000
changeset 5670 1e0f505996dc
parent 5669 631901f52707
child 5671 c7b6e63f1996
(svn r8130) Provide struct GoodsEntry with a constructor
src/station.cpp
src/station.h
--- a/src/station.cpp	Sun Jan 14 19:59:25 2007 +0000
+++ b/src/station.cpp	Sun Jan 14 20:00:25 2007 +0000
@@ -52,16 +52,6 @@
 
 	last_vehicle_type = VEH_Invalid;
 
-	for (GoodsEntry *ge = goods; ge != endof(goods); ge++) {
-		ge->waiting_acceptance = 0;
-		ge->days_since_pickup = 0;
-		ge->enroute_from = INVALID_STATION;
-		ge->rating = 175;
-		ge->last_speed = 0;
-		ge->last_age = 0xFF;
-		ge->feeder_profit = 0;
-	}
-
 	random_bits = Random();
 	waiting_triggers = 0;
 
--- a/src/station.h	Sun Jan 14 19:59:25 2007 +0000
+++ b/src/station.h	Sun Jan 14 20:00:25 2007 +0000
@@ -10,7 +10,19 @@
 #include "tile.h"
 #include "newgrf_station.h"
 
+static const StationID INVALID_STATION = 0xFFFF;
+
 typedef struct GoodsEntry {
+	GoodsEntry() :
+		waiting_acceptance(0),
+		days_since_pickup(0),
+		rating(175),
+		enroute_from(INVALID_STATION),
+		last_speed(0),
+		last_age(255),
+		feeder_profit(0)
+	{}
+
 	uint16 waiting_acceptance;
 	byte days_since_pickup;
 	byte rating;
@@ -30,8 +42,6 @@
 	ROAD_STOP_LIMIT = 16,
 };
 
-static const StationID INVALID_STATION = 0xFFFF;
-
 typedef struct RoadStop {
 	TileIndex xy;
 	bool used;