src/economy.cpp
branchcpp_gui
changeset 6308 646711c5feaa
parent 6307 f40e88cff863
equal deleted inserted replaced
6307:f40e88cff863 6308:646711c5feaa
  1329  * v = vehicle to load, u = GetFirstInChain(v)
  1329  * v = vehicle to load, u = GetFirstInChain(v)
  1330  */
  1330  */
  1331 static bool LoadWait(const Vehicle* v, const Vehicle* u)
  1331 static bool LoadWait(const Vehicle* v, const Vehicle* u)
  1332 {
  1332 {
  1333 	const Vehicle *w;
  1333 	const Vehicle *w;
  1334 	const Vehicle *x;
       
  1335 	bool has_any_cargo = false;
  1334 	bool has_any_cargo = false;
  1336 
  1335 
  1337 	if (!(u->current_order.flags & OF_FULL_LOAD)) return false;
  1336 	if (!(u->current_order.flags & OF_FULL_LOAD)) return false;
  1338 
  1337 
  1339 	for (w = u; w != NULL; w = w->next) {
  1338 	for (w = u; w != NULL; w = w->next) {
  1344 			}
  1343 			}
  1345 			has_any_cargo = true;
  1344 			has_any_cargo = true;
  1346 		}
  1345 		}
  1347 	}
  1346 	}
  1348 
  1347 
  1349 	FOR_ALL_VEHICLES(x) {
  1348 	const Station *st = GetStation(u->last_station_visited);
  1350 		if ((x->type != VEH_TRAIN || IsFrontEngine(x)) && // for all locs
  1349 	std::list<Vehicle *>::const_iterator iter;
  1351 				u->last_station_visited == x->last_station_visited && // at the same station
  1350 	for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
  1352 				!(x->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
  1351 		const Vehicle *x = *iter;
  1353 				x->current_order.type == OT_LOADING && // loading
  1352 		if (!(x->vehstatus & (VS_STOPPED | VS_CRASHED)) && u != x) {
  1354 				u != x) { // not itself
       
  1355 			bool other_has_any_cargo = false;
  1353 			bool other_has_any_cargo = false;
  1356 			bool has_space_for_same_type = false;
  1354 			bool has_space_for_same_type = false;
  1357 			bool other_has_same_type = false;
  1355 			bool other_has_same_type = false;
  1358 
  1356 
  1359 			for (w = x; w != NULL; w = w->next) {
  1357 			for (w = x; w != NULL; w = w->next) {
  1824 }
  1822 }
  1825 
  1823 
  1826 /** Cargo payment rates */
  1824 /** Cargo payment rates */
  1827 static void SaveLoad_CAPR()
  1825 static void SaveLoad_CAPR()
  1828 {
  1826 {
  1829 	SlArray(&_cargo_payment_rates,      NUM_CARGO, SLE_INT32);
  1827 	uint num_cargo = CheckSavegameVersion(55) ? 12 : NUM_CARGO;
  1830 	SlArray(&_cargo_payment_rates_frac, NUM_CARGO, SLE_UINT16);
  1828 	SlArray(&_cargo_payment_rates,      num_cargo, SLE_INT32);
       
  1829 	SlArray(&_cargo_payment_rates_frac, num_cargo, SLE_UINT16);
  1831 }
  1830 }
  1832 
  1831 
  1833 static const SaveLoad _economy_desc[] = {
  1832 static const SaveLoad _economy_desc[] = {
  1834 	SLE_VAR(Economy, max_loan,         SLE_INT32),
  1833 	SLE_VAR(Economy, max_loan,         SLE_INT32),
  1835 	SLE_VAR(Economy, max_loan_unround, SLE_INT32),
  1834 	SLE_VAR(Economy, max_loan_unround, SLE_INT32),