Skip to content

Conversation

@aronwk-aaron
Copy link
Member

WIP

May not do the recursive restriction cause they aren't used in the live game
Comment on lines +590 to +611
switch(restriction.checkType) {
case eDeletionRestrictionsCheckType::INCLUDE_LOTS:
if (std::ranges::find(restriction.ids, item) != restriction.ids.end()) return false;
else return true;
case eDeletionRestrictionsCheckType::EXCLUDE_LOTS:
if (std::ranges::find(restriction.ids, item) != restriction.ids.end()) return true;
else return false;
case eDeletionRestrictionsCheckType::ANY_OF_THESE:
// TODO: Implement
return true;
case eDeletionRestrictionsCheckType::ALL_OF_THESE:
// TODO: Implement
return true;
case eDeletionRestrictionsCheckType::WHILE_IN_ZONE:
if (std::ranges::find(restriction.ids, Game::zoneManager->GetZoneID().GetMapID()) != restriction.ids.end()) return false;
else return true;
case eDeletionRestrictionsCheckType::ALWAYS_RESTRICTED:
return false;
case eDeletionRestrictionsCheckType::MAX:
default:
return true;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would consider instead a bool toReturn before the switch and a single return at the bottom of the function instead. This would also allow you to greatly simplify the logic in the loop

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, that would make too much sense /s

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of reasons for the verbose-ness of this currently is that I wanted to make sure I got the logic correct. now that I have, I will simplify it

void LoadValuesFromDatabase();
const CDDeletionRestriction& GetByID(uint32_t id);

static CDDeletionRestriction Default;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if this could be not public, and instead use a getter which returns a const reference to a default struct so this cannot be modified accidentally, alongside removing a static variable in place for a static function and an unnamed namespace member.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tell that to itemComponentTable

@EmosewaMC
Copy link
Collaborator

thank you for adding the new table! Let's try and clean it up a bit since I know our table reading in other places is quite messy and tends to spider web to other tables. Some extra feedback was left on the logic for the check as well :)

aronwk-aaron and others added 5 commits June 6, 2024 21:33
Co-authored-by: David Markowitz <[email protected]>
Co-authored-by: David Markowitz <[email protected]>
Co-authored-by: David Markowitz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants