VarAction2: Move cb_result_found to a flags var in AnalyseCallbackOperation

pull/393/head
Jonathan G Rennison 2 years ago
parent f5f48e89dc
commit a9ca89d0f8

@ -311,9 +311,9 @@ void DeterministicSpriteGroup::AnalyseCallbacks(AnalyseCallbackOperation &op) co
if (op.mode == ACOM_FIND_CB_RESULT) {
if (this->calculated_result) {
op.cb_result_found = true;
op.result_flags |= ACORF_CB_RESULT_FOUND;
return;
} else if (!op.cb_result_found) {
} else if (!(op.result_flags & ACORF_CB_RESULT_FOUND)) {
if (check_1A_range()) return;
auto check_var_filter = [&](uint8 var, uint value) -> bool {
if (this->adjusts.size() == 1 && this->adjusts[0].variable == var && (this->adjusts[0].operation == DSGA_OP_ADD || this->adjusts[0].operation == DSGA_OP_RST)) {
@ -349,7 +349,7 @@ void DeterministicSpriteGroup::AnalyseCallbacks(AnalyseCallbackOperation &op) co
cbr_op.mode = ACOM_FIND_CB_RESULT;
cbr_op.data.cb_result = data;
group->AnalyseCallbacks(cbr_op);
return cbr_op.cb_result_found;
return (cbr_op.result_flags & ACORF_CB_RESULT_FOUND);
};
if (this->adjusts.size() == 1 && !this->calculated_result && (this->adjusts[0].operation == DSGA_OP_ADD || this->adjusts[0].operation == DSGA_OP_RST)) {
@ -546,7 +546,7 @@ bool DeterministicSpriteGroup::GroupMayBeBypassed() const
void CallbackResultSpriteGroup::AnalyseCallbacks(AnalyseCallbackOperation &op) const
{
if (op.mode == ACOM_FIND_CB_RESULT) op.cb_result_found = true;
if (op.mode == ACOM_FIND_CB_RESULT) op.result_flags |= ACORF_CB_RESULT_FOUND;
}
const SpriteGroup *RandomizedSpriteGroup::Resolve(ResolverObject &object) const

@ -59,6 +59,12 @@ enum AnalyseCallbackOperationMode {
struct AnalyseCallbackOperationIndustryTileData;
enum AnalyseCallbackOperationResultFlags {
ACORF_NONE = 0,
ACORF_CB_RESULT_FOUND = 1 << 0,
};
DECLARE_ENUM_AS_BIT_SET(AnalyseCallbackOperationResultFlags)
struct AnalyseCallbackOperation {
struct FindCBResultData {
uint16 callback;
@ -69,8 +75,8 @@ struct AnalyseCallbackOperation {
btree::btree_set<const SpriteGroup *> seen;
AnalyseCallbackOperationMode mode = ACOM_CB_VAR;
SpriteGroupCallbacksUsed callbacks_used = SGCU_NONE;
AnalyseCallbackOperationResultFlags result_flags = ACORF_NONE;
uint64 properties_used = 0;
bool cb_result_found = false;
union {
FindCBResultData cb_result;
AnalyseCallbackOperationIndustryTileData *indtile;

Loading…
Cancel
Save