StaticInitializerOrder.cpp 945 B

1234567891011121314151617181920212223242526272829303132333435
  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. #include "BasicItems.h"
  28. // world updates
  29. #include "AddEntityUpdate.h"
  30. #include "EntityRemovedUpdate.h"
  31. #include "LightSources.h"