Patch: making stops public also transfer goods
When joining with public halts, the goods at the public halts get lost. This patch fixes this.
Index: simhalt.cc
===================================================================
--- simhalt.cc (revision 2489)
+++ simhalt.cc (working copy)
@@ -1772,6 +1772,9 @@
add_grund(gr);
// and check for existence
if(!halt->existiert_in_welt()) {
+ // transfer goods from halt to self
+ halt->transfer_goods(self);
+
destroy(halt);
}
}
@@ -1780,6 +1783,23 @@
recalc_station_type();
}
+void haltestelle_t::transfer_goods(halthandle_t halt)
+{
+ if (!self.is_bound() || !halt.is_bound()) {
+ return;
+ }
+ // transfer goods
+ for(uint8 i=0; i<warenbauer_t::get_max_catg_index(); i++) {
+ vector_tpl<ware_t> * warray = waren[i];
+ if (warray) {
+ for(uint32 j=0; j<warray->get_count(); j++) {
+ halt->add_ware_to_halt( (*warray)[j] );
+ }
+ delete waren[i];
+ waren[i] = NULL;
+ }
+ }
+}
/*
Index: simhalt.h
===================================================================
--- simhalt.h (revision 2489)
+++ simhalt.h (working copy)
@@ -478,6 +478,13 @@
uint32 liefere_an(ware_t ware);
uint32 starte_mit_route(ware_t ware);
+ /*
+ * transfers all goods to given station
+ *
+ * @author Dwachs
+ */
+ void transfer_goods(halthandle_t halt);
+
/**
* wird von Fahrzeug aufgerufen, wenn dieses an der Haltestelle
* gehalten hat.