VarAction2: Move cb_result_found to a flags var in AnalyseCallbackOperation
This commit is contained in:
@@ -311,9 +311,9 @@ void DeterministicSpriteGroup::AnalyseCallbacks(AnalyseCallbackOperation &op) co
|
|||||||
|
|
||||||
if (op.mode == ACOM_FIND_CB_RESULT) {
|
if (op.mode == ACOM_FIND_CB_RESULT) {
|
||||||
if (this->calculated_result) {
|
if (this->calculated_result) {
|
||||||
op.cb_result_found = true;
|
op.result_flags |= ACORF_CB_RESULT_FOUND;
|
||||||
return;
|
return;
|
||||||
} else if (!op.cb_result_found) {
|
} else if (!(op.result_flags & ACORF_CB_RESULT_FOUND)) {
|
||||||
if (check_1A_range()) return;
|
if (check_1A_range()) return;
|
||||||
auto check_var_filter = [&](uint8 var, uint value) -> bool {
|
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)) {
|
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.mode = ACOM_FIND_CB_RESULT;
|
||||||
cbr_op.data.cb_result = data;
|
cbr_op.data.cb_result = data;
|
||||||
group->AnalyseCallbacks(cbr_op);
|
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)) {
|
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
|
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
|
const SpriteGroup *RandomizedSpriteGroup::Resolve(ResolverObject &object) const
|
||||||
|
@@ -59,6 +59,12 @@ enum AnalyseCallbackOperationMode {
|
|||||||
|
|
||||||
struct AnalyseCallbackOperationIndustryTileData;
|
struct AnalyseCallbackOperationIndustryTileData;
|
||||||
|
|
||||||
|
enum AnalyseCallbackOperationResultFlags {
|
||||||
|
ACORF_NONE = 0,
|
||||||
|
ACORF_CB_RESULT_FOUND = 1 << 0,
|
||||||
|
};
|
||||||
|
DECLARE_ENUM_AS_BIT_SET(AnalyseCallbackOperationResultFlags)
|
||||||
|
|
||||||
struct AnalyseCallbackOperation {
|
struct AnalyseCallbackOperation {
|
||||||
struct FindCBResultData {
|
struct FindCBResultData {
|
||||||
uint16 callback;
|
uint16 callback;
|
||||||
@@ -69,8 +75,8 @@ struct AnalyseCallbackOperation {
|
|||||||
btree::btree_set<const SpriteGroup *> seen;
|
btree::btree_set<const SpriteGroup *> seen;
|
||||||
AnalyseCallbackOperationMode mode = ACOM_CB_VAR;
|
AnalyseCallbackOperationMode mode = ACOM_CB_VAR;
|
||||||
SpriteGroupCallbacksUsed callbacks_used = SGCU_NONE;
|
SpriteGroupCallbacksUsed callbacks_used = SGCU_NONE;
|
||||||
|
AnalyseCallbackOperationResultFlags result_flags = ACORF_NONE;
|
||||||
uint64 properties_used = 0;
|
uint64 properties_used = 0;
|
||||||
bool cb_result_found = false;
|
|
||||||
union {
|
union {
|
||||||
FindCBResultData cb_result;
|
FindCBResultData cb_result;
|
||||||
AnalyseCallbackOperationIndustryTileData *indtile;
|
AnalyseCallbackOperationIndustryTileData *indtile;
|
||||||
|
Reference in New Issue
Block a user