HomeWildfire Games

Change internals of EntityMap to use an std::vector

Description

Change internals of EntityMap to use an std::vector

This generally makes this code cleaner and easier to maintain, while also being more modern and fully tested.

Looked at by: leper

Differential Revision: https://code.wildfiregames.com/D8

Event Timeline

wraitii added an auditor: Restricted Owners Package.Jan 6 2019, 2:01 PM
This commit now requires audit.Jan 6 2019, 2:01 PM

The reason for the crash is that find() didn't expect to be called with an entity below FIRST_VALID_ENTITY_ID, i.e. INVALID_ENTITY. This should return end() instead so I need to amend this code.

Inserting stuff before FIRST_VALID_ENTITY_ID should probably still crash so the ENSURE there should be fine.

vladislavbelov added inline comments.
/ps/trunk/source/simulation2/system/EntityMap.h
65

FYI.

The _ and __ prefixes are reserved for C++/STL, so we should avoid them.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf

17.6.4.3.2 Global names [global.names]

1 Certain sets of names and function signatures are always reserved to the implementation:
— Each name that contains a double underscore _ _ or begins with an underscore followed by an uppercase
letter (2.12) is reserved to the implementation for any use.
— Each name that begins with an underscore is reserved to the implementation for use as a name in the
global namespace.

Stan removed an auditor: Restricted Owners Package.Dec 5 2020, 5:25 PM
This commit no longer requires audit.Dec 5 2020, 5:25 PM