StaticInitializerOrder.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. int count_MultiblockStructureType = 0;
  10. #undef REGISTER
  11. #define REGISTER(c, typ) \
  12. const int c::ID = count_##typ++; \
  13. int registry_initializer_##c##_##typ = StaticRegistry<typ>::INSTANCE.getCount(); \
  14. const c *c::INSTANCE = new c(); \
  15. bool initialized_##c##_##typ = StaticRegistry<typ>::INSTANCE.info(c::ID);
  16. // order of includes determines the ids
  17. // block types
  18. #include "NoBlock.h" // must be first
  19. #include "BasicBlocks.h"
  20. // dimensions
  21. #include "OverworldDimension.h"
  22. // entities
  23. #include "Player.h"
  24. #include "ItemEntity.h"
  25. // item skills
  26. #include "PlayerHand.h"
  27. #include "StoneTool.h"
  28. #include "BasicItems.h"
  29. // world updates
  30. #include "AddEntityUpdate.h"
  31. #include "EntityRemovedUpdate.h"
  32. // Multiblocks
  33. #include "MultiblockTree.h"
  34. #include "LightSources.h"