summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2008-01-16 01:27:24 +0000
committerbjarni <bjarni@openttd.org>2008-01-16 01:27:24 +0000
commit77a20eae43dd5363d3ee3ab2a51fedb14d2cebba (patch)
tree6c5a5243498379b394b19b373c516e012b67aab8 /src
parent9556623281832d25d73b2f65ff6a66f4680ed866 (diff)
downloadopenttd-77a20eae43dd5363d3ee3ab2a51fedb14d2cebba.tar.xz
(svn r11872) -Fix (r9874): EngineHasReplacementForPlayer() didn't look in ALL_GROUP
Diffstat (limited to 'src')
-rw-r--r--src/engine.cpp4
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;
}