economy.c
changeset 1067 3ba7987a004e
parent 1019 6bae6c11e865
child 1093 4fdc46eaf423
equal deleted inserted replaced
1066:eaef1465d3ab 1067:3ba7987a004e
   126 		uint num = 0;
   126 		uint num = 0;
   127 
   127 
   128 		FOR_ALL_VEHICLES(v) {
   128 		FOR_ALL_VEHICLES(v) {
   129 			if (v->owner != owner)
   129 			if (v->owner != owner)
   130 				continue;
   130 				continue;
   131 			if ((v->type == VEH_Train && v->subtype == 0) ||
   131 			if ((v->type == VEH_Train && v->subtype == TS_Front_Engine) ||
   132 					v->type == VEH_Road ||
   132 					v->type == VEH_Road ||
   133 					(v->type == VEH_Aircraft && v->subtype<=2) ||
   133 					(v->type == VEH_Aircraft && v->subtype<=2) ||
   134 					v->type == VEH_Ship) {
   134 					v->type == VEH_Ship) {
   135 				num++;
   135 				num++;
   136 				if (v->age > 730) {
   136 				if (v->age > 730) {
   308 		Vehicle *v;
   308 		Vehicle *v;
   309 
   309 
   310 		// Determine Ids for the new vehicles
   310 		// Determine Ids for the new vehicles
   311 		FOR_ALL_VEHICLES(v) {
   311 		FOR_ALL_VEHICLES(v) {
   312 			if (v->owner == new_player) {
   312 			if (v->owner == new_player) {
   313 				if (v->type == VEH_Train && v->subtype == 0)
   313 				if (v->type == VEH_Train && v->subtype == TS_Front_Engine)
   314 					num_train++;
   314 					num_train++;
   315 				else if (v->type == VEH_Road)
   315 				else if (v->type == VEH_Road)
   316 					num_road++;
   316 					num_road++;
   317 				else if (v->type == VEH_Ship)
   317 				else if (v->type == VEH_Ship)
   318 					num_ship++;
   318 					num_ship++;
   328 					DeleteWindowById(WC_VEHICLE_DETAILS, v->index);
   328 					DeleteWindowById(WC_VEHICLE_DETAILS, v->index);
   329 					DeleteWindowById(WC_VEHICLE_ORDERS, v->index);
   329 					DeleteWindowById(WC_VEHICLE_ORDERS, v->index);
   330 					DeleteVehicle(v);
   330 					DeleteVehicle(v);
   331 				} else {
   331 				} else {
   332 					v->owner = new_player;
   332 					v->owner = new_player;
   333 					if (v->type == VEH_Train && v->subtype == 0)
   333 					if (v->type == VEH_Train && v->subtype == TS_Front_Engine)
   334 						v->unitnumber = ++num_train;
   334 						v->unitnumber = ++num_train;
   335 					else if (v->type == VEH_Road)
   335 					else if (v->type == VEH_Road)
   336 						v->unitnumber = ++num_road;
   336 						v->unitnumber = ++num_road;
   337 					else if (v->type == VEH_Ship)
   337 					else if (v->type == VEH_Ship)
   338 						v->unitnumber = ++num_ship;
   338 						v->unitnumber = ++num_ship;
  1295 			has_any_cargo = true;
  1295 			has_any_cargo = true;
  1296 		}
  1296 		}
  1297 	}
  1297 	}
  1298 
  1298 
  1299 	FOR_ALL_VEHICLES(x) {
  1299 	FOR_ALL_VEHICLES(x) {
  1300 		if ((x->type != VEH_Train || x->subtype == 0) && // for all locs
  1300 		if ((x->type != VEH_Train || x->subtype == TS_Front_Engine) && // for all locs
  1301 				u->last_station_visited == x->last_station_visited && // at the same station
  1301 				u->last_station_visited == x->last_station_visited && // at the same station
  1302 				!(x->vehstatus & VS_STOPPED) && // not stopped
  1302 				!(x->vehstatus & VS_STOPPED) && // not stopped
  1303 				x->current_order.type == OT_LOADING && // loading
  1303 				x->current_order.type == OT_LOADING && // loading
  1304 				u != x) { // not itself
  1304 				u != x) { // not itself
  1305 			bool other_has_any_cargo = false;
  1305 			bool other_has_any_cargo = false;