DarkflameServer/dGame
David Markowitz ae349d6b15
feat: Add isolated and simplified path to add components (#1204)
* Components: Make ComponentType inline

Prevents the next commits ODR violation

* Components: Add new components

* Entity: Add headers

inline script component ComponentType

* Components: Flip constructor argument order

Entity comes first always

* Entity: Add generic AddComponent

Allows for much easier adding of components and is error proof by not allowing the user to add more than 1 of a specific component type to an Entity.

* Entity: Migrate all component constructors

Move all to the new variadic templates AddComponent function to reduce clutter and ways the component map is modified.
The new function makes no assumptions.  Component is assumed to not exist and is checked for with operator[].  This will construct a null component which will then be newed if the component didnt exist, or it will just get the current component if it does already exist.  No new component will be allocated or constructed if the component already exists and the already existing pointer is returned instead.

* Entity: Add placement new

For the case where the component may already exist, use a placement new to construct the component again, it would be constructed again, but would not need to go through the allocator.

* Entity: Add comments on likely new code

* Tests: Fix tests

* Update Entity.cpp

* Update SGCannon.cpp

* Entity: call destructor when re-constructing

* Update Entity.cpp

Update Entity.cpp

---------

Co-authored-by: Aaron Kimbrell <aronwk.aaron@gmail.com>
2023-10-22 20:08:49 -05:00
..
dBehaviors feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
dComponents feat: Add isolated and simplified path to add components (#1204) 2023-10-22 20:08:49 -05:00
dEntity format codebase 2022-07-28 08:39:57 -05:00
dGameMessages feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
dInventory feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
dMission feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
dPropertyBehaviors feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
dUtilities feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
Character.cpp feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
Character.h Revert playerflags functions to uint instead of int (#1130) 2023-06-26 00:51:28 -07:00
CMakeLists.txt Organize dScripts (#814) 2022-11-03 12:57:54 -05:00
Entity.cpp feat: Add isolated and simplified path to add components (#1204) 2023-10-22 20:08:49 -05:00
Entity.h feat: Add isolated and simplified path to add components (#1204) 2023-10-22 20:08:49 -05:00
EntityManager.cpp feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
EntityManager.h refactor: re-write AOE, add FilterTargets, Update TacArc Reading (#1035) 2023-10-09 15:18:51 -05:00
LeaderboardManager.cpp feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
LeaderboardManager.h Add weekly filter 2023-06-05 16:04:56 -07:00
Player.cpp feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
Player.h convert to unix line endings 2022-08-05 22:01:59 -05:00
TeamManager.cpp Teams: Default team loot to ffa (#1224) 2023-10-18 09:18:22 -05:00
TeamManager.h Teams: Default team loot to ffa (#1224) 2023-10-18 09:18:22 -05:00
TradingManager.cpp feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
TradingManager.h format codebase 2022-07-28 08:39:57 -05:00
User.cpp feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
User.h breakout gmlevel into a scoped enum (#996) 2023-03-24 18:16:45 -05:00
UserManager.cpp feat: Abstract Logger and simplify code (#1207) 2023-10-21 16:31:55 -07:00
UserManager.h format codebase 2022-07-28 08:39:57 -05:00