src/economy.cpp
branchNewGRF_ports
changeset 6878 7d1ff2f621c7
parent 6877 889301acc299
child 10184 fcf5fb2548eb
--- a/src/economy.cpp	Sun Feb 03 20:34:26 2008 +0000
+++ b/src/economy.cpp	Mon Mar 10 15:26:39 2008 +0000
@@ -163,16 +163,16 @@
 				num++;
 				if (v->age > 730) {
 					/* Find the vehicle with the lowest amount of profit */
-					if (min_profit_first == true) {
+					if (min_profit_first || min_profit > v->profit_last_year) {
 						min_profit = v->profit_last_year;
 						min_profit_first = false;
-					} else if (min_profit > v->profit_last_year) {
-						min_profit = v->profit_last_year;
 					}
 				}
 			}
 		}
 
+		min_profit >>= 8; // remove the fract part
+
 		_score_part[owner][SCORE_VEHICLES] = num;
 		/* Don't allow negative min_profit to show */
 		if (min_profit > 0)
@@ -846,9 +846,9 @@
 	     55, ///< remove_dock
 	   1600, ///< remove_house
 	     40, ///< remove_road
-	   5600, ///< running_rail[0] railroad
-	   5200, ///< running_rail[1] monorail
-	   4800, ///< running_rail[2] maglev
+	   5600, ///< running_rail[0] steam
+	   5200, ///< running_rail[1] diesel
+	   4800, ///< running_rail[2] electric
 	   9600, ///< aircraft_running
 	   1600, ///< roadveh_running
 	   5600, ///< ship_running
@@ -914,6 +914,15 @@
 	_economy.fluct = GB(Random(), 0, 8) + 168;
 }
 
+
+Money GetPriceByIndex(uint8 index)
+{
+	if (index > NUM_PRICES) return 0;
+
+	return ((Money*)&_price)[index];
+}
+
+
 Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode)
 {
 	TileIndex tile;
@@ -1505,7 +1514,7 @@
 						cp->days_in_transit,
 						v->cargo_type);
 
-					front_v->profit_this_year += profit;
+					front_v->profit_this_year += profit << 8;
 					virtual_profit   += profit; // accumulate transfer profits for whole vehicle
 					cp->feeder_share += profit; // account for the (virtual) profit already made for the cargo packet
 					cp->paid_for      = true;   // record that the cargo has been paid for to eliminate double counting
@@ -1523,7 +1532,7 @@
 	}
 
 	if (route_profit != 0) {
-		front_v->profit_this_year += vehicle_profit;
+		front_v->profit_this_year += vehicle_profit << 8;
 		SubtractMoneyFromPlayer(CommandCost(front_v->GetExpenseType(true), -route_profit));
 
 		if (IsLocalPlayer() && !PlayVehicleSound(front_v, VSE_LOAD_UNLOAD)) {