Conversation
May not do the recursive restriction cause they aren't used in the live game
dDatabase/CDClientDatabase/CDClientTables/CDDeletionRestrictionsTable.cpp
Outdated
Show resolved
Hide resolved
dDatabase/CDClientDatabase/CDClientTables/CDDeletionRestrictionsTable.cpp
Outdated
Show resolved
Hide resolved
dDatabase/CDClientDatabase/CDClientTables/CDDeletionRestrictionsTable.cpp
Outdated
Show resolved
Hide resolved
| 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; | ||
| } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
no, that would make too much sense /s
There was a problem hiding this comment.
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
dDatabase/CDClientDatabase/CDClientTables/CDDeletionRestrictionsTable.cpp
Outdated
Show resolved
Hide resolved
| void LoadValuesFromDatabase(); | ||
| const CDDeletionRestriction& GetByID(uint32_t id); | ||
|
|
||
| static CDDeletionRestriction Default; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Tell that to itemComponentTable
|
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 :) |
Co-authored-by: David Markowitz <39972741+EmosewaMC@users.noreply.github.com>
Co-authored-by: David Markowitz <39972741+EmosewaMC@users.noreply.github.com>
WIP