Mercurial > hg > openttd
changeset 8307:820c6cc79cf4 draft
(svn r11872) -Fix (r9874): EngineHasReplacementForPlayer() didn't look in ALL_GROUP
author | bjarni <bjarni@openttd.org> |
---|---|
date | Wed, 16 Jan 2008 01:27:24 +0000 |
parents | ea2c123b3655 |
children | e9042729a5c5 |
files | src/engine.cpp |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/engine.cpp +++ b/src/engine.cpp @@ -507,6 +507,10 @@ 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; }