X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fscene.h;fp=nageru%2Fscene.h;h=b659429fbd5a8ef9a1ef54ec55cdc3175924739a;hb=e9b906258a07b55ad62738552130df51dd872482;hp=bf23fbd1f2bb789d1fb350393fadf84ff2c5629c;hpb=14b28982a33cb9bea818446217e69fdf4de13dab;p=nageru diff --git a/nageru/scene.h b/nageru/scene.h index bf23fbd..b659429 100644 --- a/nageru/scene.h +++ b/nageru/scene.h @@ -76,6 +76,11 @@ struct Block { // (B_i is alternatives.size().) Not set before finalize() has run. size_t cardinality_base = 0; + // Find the chosen alternative for this block in a given instance. + size_t chosen_alternative(size_t chain_idx) const { + return (chain_idx / cardinality_base) % alternatives.size(); + } + std::vector alternatives; // Must all have the same amount of inputs. Pointers to make things easier for Lua. std::vector inputs; // One for each input of alternatives[0] (ie., typically 0 or 1, occasionally 2). int currently_chosen_alternative = 0;