(svn r12230) -Codechange: [autoreplace] made a function to detect if a vehicle needs autorenewing

This will remove duplicated code and ensure that the check is consistent
This commit is contained in:
bjarni
2008-02-23 22:01:55 +00:00
parent 4e90a42f0c
commit 973d1fd6ad
3 changed files with 14 additions and 3 deletions

View File

@@ -1574,7 +1574,7 @@ static inline bool CheckSendAircraftToHangarForReplacement(const Vehicle *v)
/* There is no autoreplace assigned to this EngineID so we will set it to renew to the same type if needed */
new_engine = v->engine_type;
if(!p->engine_renew || (v->age - v->max_age) < p->engine_renew_months * 30) {
if (!v->NeedsAutorenewing(p)) {
/* No need to replace the aircraft */
return false;
}