(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:
bjarni
2008-04-19 17:47:56 +00:00
parent ad3ef0fb26
commit 01549e1574
2 changed files with 34 additions and 20 deletions

View File

@@ -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;
}