StaticInitializerOrder.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #include "StaticRegistry.h"
  2. #include "BlockType.h"
  3. #include "ItemType.h"
  4. int count_DimensionGenerator = 0;
  5. int count_ItemType = 0;
  6. int count_BlockType = 0;
  7. int count_WorldUpdateType = 0;
  8. int count_EntityType = 0;
  9. #undef REGISTER
  10. #define REGISTER(c, typ) \
  11. const int c::ID = count_##typ++; \
  12. int registry_initializer_##c##_##typ = StaticRegistry<typ>::INSTANCE.getCount(); \
  13. const c *c::INSTANCE = new c(); \
  14. bool initialized_##c##_##typ = StaticRegistry<typ>::INSTANCE.info(c::ID);
  15. // order of includes determines the ids
  16. // block types
  17. #include "NoBlock.h" // must be first
  18. #include "BasicBlocks.h"
  19. // dimensions
  20. #include "OverworldDimension.h"
  21. // entities
  22. #include "Player.h"
  23. #include "ItemEntity.h"
  24. // item skills
  25. #include "PlayerHand.h"
  26. #include "StoneTool.h"
  27. // world updates
  28. #include "AddChunkUpdate.h"
  29. #include "PlaceBlockUpdate.h"
  30. #include "BlockChangedUpdate.h"
  31. #include "BlockRemovedUpdate.h"
  32. #include "AddEntityUpdate.h"
  33. #include "EntityChangedUpdate.h"
  34. #include "EntityRemovedUpdate.h"