HarbourMasters / Shipwright

3.3k stars 494 forks source link

[V3] Fishsanity Cleanup #4380

Closed Malkierian closed 1 month ago

Malkierian commented 1 month ago

Fishsanity's flag set handler was using GetFishLocations() functions, which return a new vector, as separate begin() and end() iterators, causing binary_search to search across two different vector objects, resulting in out of range errors and crashes. This fixes that by checking for RCTYPE_FISH at the beginning of GetCheckType() as well as changing GetCheckType() to a switch structure on rc's Location::GetScene() and getting rid of binary_search altogether.

This also fixes some code formatting (one if block wasn't indented, several unbracketed single-line if blocks), and fixes typedef warnings in fishsanity.h where the enum name needs to be after the block of enum values instead of before.

Build Artifacts