src/station.cpp
changeset 5721 fa4e587f59f5
parent 5718 ce37296bb03c
child 5835 7ef65a4a70ef
--- a/src/station.cpp	Wed Jan 17 23:25:19 2007 +0000
+++ b/src/station.cpp	Thu Jan 18 09:34:44 2007 +0000
@@ -50,7 +50,7 @@
 
 	last_vehicle_type = VEH_Invalid;
 
-	random_bits = Random();
+	random_bits = 0; // Random() must be called when station is really built (DC_EXEC)
 	waiting_triggers = 0;
 }
 
@@ -105,6 +105,19 @@
 {
 }
 
+/** Called when new facility is built on the station. If it is the first facility
+	* it initializes also 'xy' and 'random_bits' members */
+void Station::AddFacility(byte new_facility_bit, TileIndex facil_xy)
+{
+	if (facilities == 0) {
+		xy = facil_xy;
+		random_bits = Random();
+	}
+	facilities |= new_facility_bit;
+	owner = _current_player;
+	build_date = _date;
+}
+
 void Station::MarkDirty() const
 {
 	if (sign.width_1 != 0) {