(svn r14672) -Fix [FS#2444]: Property 7 and callback 12 were broken for aircraft.
authorfrosch
Sat, 13 Dec 2008 18:25:42 +0000
changeset 10419 d9a1fa739477
parent 10418 faf551975df7
child 10420 553508015907
(svn r14672) -Fix [FS#2444]: Property 7 and callback 12 were broken for aircraft.
Now callback 12 is properly called also for 'mail'.
If the callback is not used, 'mail' uses 1/4 of property 7 (rounded up).
src/aircraft_cmd.cpp
src/economy.cpp
src/openttd.cpp
--- a/src/aircraft_cmd.cpp	Sat Dec 13 18:19:44 2008 +0000
+++ b/src/aircraft_cmd.cpp	Sat Dec 13 18:25:42 2008 +0000
@@ -342,6 +342,7 @@
 		v->max_speed = avi->max_speed;
 		v->acceleration = avi->acceleration;
 		v->engine_type = p1;
+		u->engine_type = p1;
 
 		v->subtype = (avi->subtype & AIR_CTOL ? AIR_AIRCRAFT : AIR_HELICOPTER);
 		v->UpdateDeltaXY(INVALID_DIR);
@@ -427,6 +428,7 @@
 			Vehicle *w = vl[2];
 
 			w = new (w) Aircraft();
+			w->engine_type = p1;
 			w->direction = DIR_N;
 			w->owner = _current_company;
 			w->x_pos = v->x_pos;
--- a/src/economy.cpp	Sat Dec 13 18:19:44 2008 +0000
+++ b/src/economy.cpp	Sat Dec 13 18:25:42 2008 +0000
@@ -1603,6 +1603,10 @@
 		if (v->cargo_cap == 0) continue;
 
 		byte load_amount = EngInfo(v->engine_type)->load_amount;
+
+		/* The default loadamount for mail is 1/4 of the load amount for passengers */
+		if (v->type == VEH_AIRCRAFT && !IsNormalAircraft(v)) load_amount = (load_amount + 3) / 4;
+
 		if (_settings_game.order.gradual_loading && HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) {
 			uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
 			if (cb_load_amount != CALLBACK_FAILED && GB(cb_load_amount, 0, 8) != 0) load_amount = GB(cb_load_amount, 0, 8);
--- a/src/openttd.cpp	Sat Dec 13 18:19:44 2008 +0000
+++ b/src/openttd.cpp	Sat Dec 13 18:25:42 2008 +0000
@@ -2593,6 +2593,16 @@
 		}
 	}
 
+	if (CheckSavegameVersion(103)) {
+		Vehicle *v;
+		FOR_ALL_VEHICLES(v) {
+			/* Set engine_type of shadow and rotor */
+			if (v->type == VEH_AIRCRAFT && !IsNormalAircraft(v)) {
+				v->engine_type = v->First()->engine_type;
+			}
+		}
+	}
+
 	GamelogPrintDebug(1);
 
 	return InitializeWindowsAndCaches();