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 | 77a20eae43dd5363d3ee3ab2a51fedb14d2cebba (patch) | |
tree | 6c5a5243498379b394b19b373c516e012b67aab8 | |
parent | 9556623281832d25d73b2f65ff6a66f4680ed866 (diff) | |
download | openttd-77a20eae43dd5363d3ee3ab2a51fedb14d2cebba.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; } |