Changeset - r26915:b0e277cd05e0
[Not reviewed]
master
0 2 0
Niels Martin Hansen - 5 years ago 2019-09-08 08:54:46
nielsm@indvikleren.dk
Add #7525: Allow autoreplace with same model vehicle
2 files changed with 12 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/autoreplace.cpp
Show inline comments
 
@@ -69,7 +69,18 @@ EngineID EngineReplacement(EngineRenewLi
 
		/* We didn't find anything useful in the vehicle's own group so we will try ALL_GROUP */
 
		er = GetEngineReplacement(erl, engine, ALL_GROUP);
 
	}
 
	if (replace_when_old != nullptr) *replace_when_old = er == nullptr ? false : er->replace_when_old;
 
	if (replace_when_old != nullptr) {
 
		if (er == nullptr) {
 
			/* Not replacing */
 
			*replace_when_old = false;
 
		} else if (er->to == engine) {
 
			/* When replacing with same model, only ever do it when old */
 
			*replace_when_old = true;
 
		} else {
 
			/* Use player setting */
 
			*replace_when_old = er->replace_when_old;
 
		}
 
	}
 
	return er == nullptr ? INVALID_ENGINE : er->to;
 
}
 

	
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -60,9 +60,6 @@ bool CheckAutoreplaceValidity(EngineID f
 
{
 
	assert(Engine::IsValidID(from) && Engine::IsValidID(to));
 

	
 
	/* we can't replace an engine into itself (that would be autorenew) */
 
	if (from == to) return false;
 

	
 
	const Engine *e_from = Engine::Get(from);
 
	const Engine *e_to = Engine::Get(to);
 
	VehicleType type = e_from->type;
0 comments (0 inline, 0 general)