src/economy.cpp
branchnoai
changeset 9625 3301b1b3889c
parent 9624 b71483f2330f
child 9626 79f2b5a0cdd7
equal deleted inserted replaced
9624:b71483f2330f 9625:3301b1b3889c
   115 		bool min_profit_first = true;
   115 		bool min_profit_first = true;
   116 		uint num = 0;
   116 		uint num = 0;
   117 
   117 
   118 		FOR_ALL_VEHICLES(v) {
   118 		FOR_ALL_VEHICLES(v) {
   119 			if (v->owner != owner) continue;
   119 			if (v->owner != owner) continue;
   120 			if ((v->type == VEH_TRAIN && IsFrontEngine(v)) ||
   120 			if (IsPlayerBuildableVehicleType(v->type) && v->IsPrimaryVehicle()) {
   121 					 v->type == VEH_ROAD ||
       
   122 					(v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) ||
       
   123 					 v->type == VEH_SHIP) {
       
   124 				num++;
   121 				num++;
   125 				if (v->age > 730) {
   122 				if (v->age > 730) {
   126 					/* Find the vehicle with the lowest amount of profit */
   123 					/* Find the vehicle with the lowest amount of profit */
   127 					if (min_profit_first == true) {
   124 					if (min_profit_first == true) {
   128 						min_profit = v->profit_last_year;
   125 						min_profit = v->profit_last_year;
  1579 		if (count != 0 &&
  1576 		if (count != 0 &&
  1580 				(cap = v->cargo_cap - v->cargo_count) != 0) {
  1577 				(cap = v->cargo_cap - v->cargo_count) != 0) {
  1581 
  1578 
  1582 			/* Skip loading this vehicle if another train/vehicle is already handling
  1579 			/* Skip loading this vehicle if another train/vehicle is already handling
  1583 			 * the same cargo type at this station */
  1580 			 * the same cargo type at this station */
  1584 			if (_patches.improved_load && cargo_left[v->cargo_type] < 0) {
  1581 			if (_patches.improved_load && cargo_left[v->cargo_type] <= 0) {
  1585 				SETBIT(cargo_not_full, v->cargo_type);
  1582 				SETBIT(cargo_not_full, v->cargo_type);
  1586 				continue;
  1583 				continue;
  1587 			}
  1584 			}
  1588 
  1585 
  1589 			if (cap > count) cap = count;
  1586 			if (cap > count) cap = count;