diff options
author | bjarni <bjarni@openttd.org> | 2008-01-16 01:27:24 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2008-01-16 01:27:24 +0000 |
commit | 48c2669185f467dcfccafa704890431278efb052 (patch) | |
tree | 6c5a5243498379b394b19b373c516e012b67aab8 | |
parent | 61e40b1aa5f1b7137d0fc56d42c8221d9146e40a (diff) | |
download | openttd-48c2669185f467dcfccafa704890431278efb052.tar.xz |
(svn r11872) -Fix (r9874): EngineHasReplacementForPlayer() didn't look in ALL_GROUP
-rw-r--r-- | src/engine.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 94574b492..90fd63f77 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -507,6 +507,10 @@ void RemoveAllEngineReplacement(EngineRenewList *erl) EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group) { const EngineRenew *er = GetEngineReplacement(erl, engine, group); + if (er == NULL && (group == DEFAULT_GROUP || (IsValidGroupID(group) && !GetGroup(group)->replace_protection))) { + /* We didn't find anything useful in the vehicle's own group so we will try ALL_GROUP */ + er = GetEngineReplacement(erl, engine, ALL_GROUP); + } return er == NULL ? INVALID_ENGINE : er->to; } |