Changeset - r23958:f9b8707c677f
[Not reviewed]
master
0 3 0
glx - 5 years ago 2019-12-15 17:14:51
glx@openttd.org
Codechange: Replace FOR_ALL_CARGO_PAYMENTS with range-based for loops
3 files changed with 3 insertions and 19 deletions:
0 comments (0 inline, 0 general)
src/economy_base.h
Show inline comments
 
@@ -47,17 +47,4 @@ struct CargoPayment : CargoPaymentPool::
 
	void SetCargo(CargoID ct) { this->ct = ct; }
 
};
 

	
 
/**
 
 * Iterate over all cargo payments from a given start position.
 
 * @param var The variable used for iterating.
 
 * @param start The start of the iteration.
 
 */
 
#define FOR_ALL_CARGO_PAYMENTS_FROM(var, start) FOR_ALL_ITEMS_FROM(CargoPayment, cargo_payment_index, var, start)
 

	
 
/**
 
 * Iterate over all cargo payments.
 
 * @param var The variable used for iterating.
 
 */
 
#define FOR_ALL_CARGO_PAYMENTS(var) FOR_ALL_CARGO_PAYMENTS_FROM(var, 0)
 

	
 
#endif /* ECONOMY_BASE_H */
src/saveload/afterload.cpp
Show inline comments
 
@@ -822,8 +822,7 @@ bool AfterLoadGame()
 
	}
 

	
 
	/* Fix the cache for cargo payments. */
 
	CargoPayment *cp;
 
	FOR_ALL_CARGO_PAYMENTS(cp) {
 
	for (CargoPayment *cp : CargoPayment::Iterate()) {
 
		cp->front->cargo_payment = cp;
 
		cp->current_station = cp->front->last_station_visited;
 
	}
src/saveload/economy_sl.cpp
Show inline comments
 
@@ -72,8 +72,7 @@ static const SaveLoad _cargopayment_desc
 

	
 
static void Save_CAPY()
 
{
 
	CargoPayment *cp;
 
	FOR_ALL_CARGO_PAYMENTS(cp) {
 
	for (CargoPayment *cp : CargoPayment::Iterate()) {
 
		SlSetArrayIndex(cp->index);
 
		SlObject(cp, _cargopayment_desc);
 
	}
 
@@ -91,8 +90,7 @@ static void Load_CAPY()
 

	
 
static void Ptrs_CAPY()
 
{
 
	CargoPayment *cp;
 
	FOR_ALL_CARGO_PAYMENTS(cp) {
 
	for (CargoPayment *cp : CargoPayment::Iterate()) {
 
		SlObject(cp, _cargopayment_desc);
 
	}
 
}
0 comments (0 inline, 0 general)