Changeset - r23955:ab1c2d1fe834
[Not reviewed]
master
0 3 0
glx - 5 years ago 2019-12-15 16:10:46
glx@openttd.org
Codechange: Replace FOR_ALL_ENGINE_RENEWS with range-based for loops
3 files changed with 3 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_base.h
Show inline comments
 
@@ -41,7 +41,4 @@ struct EngineRenew : EngineRenewPool::Po
 
	~EngineRenew() {}
 
};
 

	
 
#define FOR_ALL_ENGINE_RENEWS_FROM(var, start) FOR_ALL_ITEMS_FROM(EngineRenew, enginerenew_index, var, start)
 
#define FOR_ALL_ENGINE_RENEWS(var) FOR_ALL_ENGINE_RENEWS_FROM(var, 0)
 

	
 
#endif /* AUTOREPLACE_BASE_H */
src/group_cmd.cpp
Show inline comments
 
@@ -384,10 +384,9 @@ CommandCost CmdDeleteGroup(TileIndex til
 
		/* If we set an autoreplace for the group we delete, remove it. */
 
		if (_current_company < MAX_COMPANIES) {
 
			Company *c;
 
			EngineRenew *er;
 

	
 
			c = Company::Get(_current_company);
 
			FOR_ALL_ENGINE_RENEWS(er) {
 
			for (EngineRenew *er : EngineRenew::Iterate()) {
 
				if (er->group_id == g->index) RemoveEngineReplacementForCompany(c, er->from, g->index, flags);
 
			}
 
		}
src/saveload/autoreplace_sl.cpp
Show inline comments
 
@@ -26,9 +26,7 @@ static const SaveLoad _engine_renew_desc
 

	
 
static void Save_ERNW()
 
{
 
	EngineRenew *er;
 

	
 
	FOR_ALL_ENGINE_RENEWS(er) {
 
	for (EngineRenew *er : EngineRenew::Iterate()) {
 
		SlSetArrayIndex(er->index);
 
		SlObject(er, _engine_renew_desc);
 
	}
 
@@ -53,9 +51,7 @@ static void Load_ERNW()
 

	
 
static void Ptrs_ERNW()
 
{
 
	EngineRenew *er;
 

	
 
	FOR_ALL_ENGINE_RENEWS(er) {
 
	for (EngineRenew *er : EngineRenew::Iterate()) {
 
		SlObject(er, _engine_renew_desc);
 
	}
 
}
0 comments (0 inline, 0 general)