VarAction2: Add extra DSG flag for early exit when executing CBs

For when some branches of a non CB switch DSG contain CB switches,
but some don't and so would end up on the graphics chain, as there is
no further CB switch to exit at
This commit is contained in:
Jonathan G Rennison
2023-12-07 17:53:13 +00:00
parent 92d14ac980
commit f532970014
3 changed files with 12 additions and 1 deletions

View File

@@ -253,6 +253,11 @@ static bool RangeHighComparator(const DeterministicSpriteGroupRange& range, uint
const SpriteGroup *DeterministicSpriteGroup::Resolve(ResolverObject &object) const
{
if ((this->sg_flags & SGF_SKIP_CB) != 0 && object.callback > 1) {
static CallbackResultSpriteGroup cbfail(CALLBACK_FAILED);
return &cbfail;
}
uint32 last_value = 0;
uint32 value = 0;
@@ -615,6 +620,7 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, const char *paddi
char extra_info[64] = "";
if (sg->sg_flags & SGF_ACTION6) strecat(extra_info, " (action 6 modified)", lastof(extra_info));
if (sg->sg_flags & SGF_SKIP_CB) strecat(extra_info, " (skip CB)", lastof(extra_info));
if (HasBit(_misc_debug_flags, MDF_NEWGRF_SG_DUMP_MORE_DETAIL)) {
if (sg->sg_flags & SGF_INLINING) strecat(extra_info, " (inlining)", lastof(extra_info));
}