economy.c
changeset 2676 2ba71e034d97
parent 2642 cb99ff2e49a7
child 2684 8aba54c245cc
equal deleted inserted replaced
2675:269c38d892f9 2676:2ba71e034d97
    24 #include "engine.h"
    24 #include "engine.h"
    25 #include "network_data.h"
    25 #include "network_data.h"
    26 #include "variables.h"
    26 #include "variables.h"
    27 #include "vehicle_gui.h"
    27 #include "vehicle_gui.h"
    28 #include "ai/ai.h"
    28 #include "ai/ai.h"
       
    29 #include "train.h"
    29 
    30 
    30 // Score info
    31 // Score info
    31 const ScoreInfo _score_info[] = {
    32 const ScoreInfo _score_info[] = {
    32     {SCORE_VEHICLES,		120, 			100},
    33     {SCORE_VEHICLES,		120, 			100},
    33     {SCORE_STATIONS,		80, 			100},
    34     {SCORE_STATIONS,		80, 			100},
   127 		uint num = 0;
   128 		uint num = 0;
   128 
   129 
   129 		FOR_ALL_VEHICLES(v) {
   130 		FOR_ALL_VEHICLES(v) {
   130 			if (v->owner != owner)
   131 			if (v->owner != owner)
   131 				continue;
   132 				continue;
   132 			if ((v->type == VEH_Train && v->subtype == TS_Front_Engine) ||
   133 			if ((v->type == VEH_Train && IsFrontEngine(v)) ||
   133 					v->type == VEH_Road ||
   134 					v->type == VEH_Road ||
   134 					(v->type == VEH_Aircraft && v->subtype<=2) ||
   135 					(v->type == VEH_Aircraft && v->subtype<=2) ||
   135 					v->type == VEH_Ship) {
   136 					v->type == VEH_Ship) {
   136 				num++;
   137 				num++;
   137 				if (v->age > 730) {
   138 				if (v->age > 730) {
   311 		// Determine Ids for the new vehicles
   312 		// Determine Ids for the new vehicles
   312 		FOR_ALL_VEHICLES(v) {
   313 		FOR_ALL_VEHICLES(v) {
   313 			if (v->owner == new_player) {
   314 			if (v->owner == new_player) {
   314 				switch (v->type) {
   315 				switch (v->type) {
   315 					case VEH_Train:
   316 					case VEH_Train:
   316 						if (v->subtype == TS_Front_Engine) num_train++;
   317 						if (IsFrontEngine(v)) num_train++;
   317 						break;
   318 						break;
   318 					case VEH_Road:
   319 					case VEH_Road:
   319 						num_road++;
   320 						num_road++;
   320 						break;
   321 						break;
   321 					case VEH_Ship:
   322 					case VEH_Ship:
   336 					DeleteWindowById(WC_VEHICLE_DETAILS, v->index);
   337 					DeleteWindowById(WC_VEHICLE_DETAILS, v->index);
   337 					DeleteWindowById(WC_VEHICLE_ORDERS, v->index);
   338 					DeleteWindowById(WC_VEHICLE_ORDERS, v->index);
   338 					DeleteVehicle(v);
   339 					DeleteVehicle(v);
   339 				} else {
   340 				} else {
   340 					v->owner = new_player;
   341 					v->owner = new_player;
   341 					if (v->type == VEH_Train && v->subtype == TS_Front_Engine)
   342 					if (v->type == VEH_Train && IsFrontEngine(v))
   342 						v->unitnumber = ++num_train;
   343 						v->unitnumber = ++num_train;
   343 					else if (v->type == VEH_Road)
   344 					else if (v->type == VEH_Road)
   344 						v->unitnumber = ++num_road;
   345 						v->unitnumber = ++num_road;
   345 					else if (v->type == VEH_Ship)
   346 					else if (v->type == VEH_Ship)
   346 						v->unitnumber = ++num_ship;
   347 						v->unitnumber = ++num_ship;
  1287 			has_any_cargo = true;
  1288 			has_any_cargo = true;
  1288 		}
  1289 		}
  1289 	}
  1290 	}
  1290 
  1291 
  1291 	FOR_ALL_VEHICLES(x) {
  1292 	FOR_ALL_VEHICLES(x) {
  1292 		if ((x->type != VEH_Train || x->subtype == TS_Front_Engine) && // for all locs
  1293 		if ((x->type != VEH_Train || IsFrontEngine(x)) && // for all locs
  1293 				u->last_station_visited == x->last_station_visited && // at the same station
  1294 				u->last_station_visited == x->last_station_visited && // at the same station
  1294 				!(x->vehstatus & VS_STOPPED) && // not stopped
  1295 				!(x->vehstatus & VS_STOPPED) && // not stopped
  1295 				x->current_order.type == OT_LOADING && // loading
  1296 				x->current_order.type == OT_LOADING && // loading
  1296 				u != x) { // not itself
  1297 				u != x) { // not itself
  1297 			bool other_has_any_cargo = false;
  1298 			bool other_has_any_cargo = false;