(svn r12792) -Codechange: [autoreplace] added a function to figure out if a replacement is needed and if so, to which EngineID
It's designed to save a bit of CPU time, specially if the replacement isn't buildable (think autorenew of old vehicle)
This commit is contained in:
@@ -106,6 +106,7 @@ bool Vehicle::NeedsAutorenewing(const Player *p) const
|
||||
|
||||
if (!p->engine_renew) return false;
|
||||
if (this->age - this->max_age < (p->engine_renew_months * 30)) return false;
|
||||
if (this->age == 0) return false; // rail cars don't age and lacks a max age
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user