Commit graph

104 commits

Author SHA1 Message Date
506b027655 Fix bug with duplicate signatures
Fixed bug where if forMatchingSignatures and forMatchingSignaturesPtr
was called with some signatures in the TypeList being duplicates, then
only the first duplicate and function pair would be called, and all
other functions paired with other duplicate signatures would not be
called.
2017-11-15 15:36:04 +09:00
6b0e950c84 Improve efficiency of stored function calling
Previously, every called function iterated through all entities for
calling the function on matching entities.

Now, callForMatchingFunctions iterates through all entities once,
stores matching entities for each function, then calls the functions on
the matching entities.
2017-11-14 13:51:24 +09:00
248cf2676a Add ptr versions of forMatchingSignature fns 2017-11-14 13:11:32 +09:00
648e47aae9 Fix crash bug, improve Unit Test
Crash bug from improperly implemented std::lock_guard for multi-threaded
usage of forMatchingSignatures fixed.
2017-11-10 13:19:50 +09:00
0dba6874ad Implement forMatchingSignatures for efficiency
EC::Manager::forMatchingSignatures is different from
EC::Manager::forMatchingSignature in that it takes multiple signatures
and functions and iterates through all entities once. The trade-off is
that a vector of vectors is created to store matching entities.
This function can be called to use multiple threads as well, similar
to the "non-plural" version of this function.

See the doxygen-style documentation in src/EC/Manager.hpp for
forMatchingSignatures (or the generated doxygen html) for how to use.
Usage example is in the last unit test function in src/test/ECTest.hpp .
2017-11-09 21:17:40 +09:00
d809d34716 Add getCurrentSize and getCurrentCapacity 2017-11-03 17:11:20 +09:00
16fd8e9ec3 Fix minor typo 2017-10-31 14:10:21 +09:00
1d2fbf7b52 Fix cleanup function's return value
Unordered map does not preserve order in which items were inserted.
This is a problem because an entity id relocated to a previously deleted
one could be read as deleted when iterating through the unordered map.
Thus, it has been replaced with a queue.
2017-10-31 13:25:27 +09:00
2523831097 Fix unit test 2017-10-06 14:35:37 +09:00
ab580a5565 Replace variable length arrays with std::vector 2017-10-06 12:58:49 +09:00
a08b1575d6 Implement multithreading for function calls
Each of the EC::Manager's function calls over entities can now be
multi-threaded.
2017-10-06 12:47:05 +09:00
aad97d6d42 Add feature to cleanup function in manager
ECManager's cleanup function now returns a map detailing info on all
entities changed by cleanup.
2017-09-28 16:05:05 +09:00
396ede1c76 Add const fns to Manager, obey 80 char line limit 2017-09-20 17:18:29 +09:00
bc70089822 Add a test to unit tests 2017-08-29 15:27:58 +09:00
d700b023b3 Fixed keepSomeMatchingFunctions
Previous implementation would fail if functionIndex had wrapped around
2017-07-13 17:28:45 +09:00
1f052154ad Changed clearSomeMatchingFunctions, line lengths
clearSomeMatchingFunctions removed for
keepSomeMatchingFunctions and removeSomeMatchingFunctions to
avoid confusion.

Lines now respect 80 column limit.
2017-07-13 16:13:37 +09:00
49ae172c3a Added two new functions
Added "removeForMatchingFunction" and "callForMatchingFunction".
The former deletes a specific function and the latter calls a specific
function.
2017-07-12 22:02:02 +09:00
09a7546509 Changed implementation of stored functions to map
An unordered_map stores functions, allowing for functions to be
removed by index, and bulk removals with filtering by index.

Also added reset(), which changes the state of the Manager to be
almost identical to a newly constructed one.
2016-09-21 21:01:48 +09:00
2e115cd7a2 Fixed docs, ids changed to const references 2016-09-20 20:31:56 +09:00
7c49ab4f04 Added capability to store functions
EC::Manager can now store functions similar to functions
given to EC::Manager::forMatchingSignature.
2016-09-20 20:07:28 +09:00
ab2209b698 Fixed bug where deleted entities retain info 2016-08-30 17:34:34 +09:00
74ecae5dff Temporary(?) bugfix 2016-08-28 16:11:23 +09:00
428df3f1ab Fixed not working as cmake subproject 2016-08-27 13:32:32 +09:00
646cb89157 Fixed missing include 2016-04-20 22:18:25 +09:00
816e596878 Added missing includes 2016-04-20 21:59:47 +09:00
b2355248be Fixed include gtest on nonstanndard gtest install 2016-04-11 14:59:56 +09:00
2a11d1e86c Added note about manager's addComponent
AddComponent overwrites an already existing component
if it exists.
2016-04-06 19:35:24 +09:00
577132554e Added support for components of type UniquePtr 2016-04-06 19:32:30 +09:00
a008830373 Added License and legal related requirements
All source files in src/EC now has some text describing
attribution notice to the original work this work derives from.
2016-03-15 19:29:13 +09:00
dbe291c7c6 Slight change to docs 2016-03-14 20:39:09 +09:00
aa05522772 Slight change to unit tests, docs
Unit test now creates Component with
Manager::addComponent.
2016-03-14 20:36:05 +09:00
a28a68cc65 Slight addition to EC::Manager documentation 2016-03-14 20:09:51 +09:00
bfac16072c Fix to EC::Manager::cleanup 2016-03-14 20:05:49 +09:00
fa40fb3a66 Added Doxygen comments
Slight change to EC::Manager::isAlive
2016-03-14 20:01:55 +09:00
0f579d7241 Minor fixes/changes 2016-03-14 18:25:38 +09:00
635eed34a4 Minor fixes/changes 2016-03-14 18:16:09 +09:00
c3f90ec6b0 Made some Meta stuff more generic 2016-03-14 17:53:57 +09:00
de07c8ad1a Fixed entity deletion bug
Fixed bug where deleted entity would retain Components/Tags.
2016-03-14 11:39:37 +09:00
c6002149d3 Fix to Meta/Matching 2016-03-13 18:17:06 +09:00
f123f075eb Added Meta/Matching, progress on Bitset/Manager 2016-03-13 18:07:49 +09:00
bee0c9d26d Added forEach to EC/Meta 2016-03-13 14:06:57 +09:00
eeb22ede25 Fixed 'make install' 2016-03-08 22:59:17 +09:00
24ce103fbb Added EC/Meta/TypeListGet, WIP in Bitset, Manager
TODO, get a ForEach type recursion working for Bitset.
2016-03-05 23:33:24 +09:00
d8dfba8361 Fixed support for Clang
Minor addition to unit tests.
2016-03-05 20:16:32 +09:00
1926a9eabb Added EC/Meta/Morph.hpp
Started work on EC/Manager.hpp
2016-03-04 22:59:43 +09:00
f99e7c69ca Updated CMakeLists.txt to include EC/Meta/Combine 2016-03-04 21:43:46 +09:00
9c5894520f Changed Bitset to use Combined lists 2016-03-04 21:39:25 +09:00
a503eb628d Added EC/Meta/Combine.hpp
Also some renaming in MetaTest.hpp
2016-03-04 21:35:26 +09:00
c08f7d6445 Slight change to Bitset test
Now, will not break if listAll and listTagsAll changes.
2016-03-04 21:15:30 +09:00
12bc0d9f8f Added EC/Bitset.hpp and EC/Meta/ContainsAll.hpp
Also added EC/EC.hpp and EC/Meta/Meta.hpp that loads all
headers in that directory.
2016-03-04 21:12:37 +09:00
c318121dc8 Split Meta.hpp 2016-03-04 20:20:56 +09:00
4092c7c565 Added IndexOf 2016-02-25 12:27:04 +09:00
8ffacb16b1 Basic meta stuff working 2016-02-25 12:08:02 +09:00
0b39f8bc93 Init commit 2016-02-24 19:35:55 +09:00