WorldUpdate.h 929 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include <ReferenceCounter.h>
  3. #include <Vec3.h>
  4. #include <Writer.h>
  5. #include "StaticRegistry.h"
  6. class Dimension;
  7. class WorldUpdateTypeEnum
  8. {
  9. public:
  10. static const int ADD_ENTITY = 0;
  11. static const int REMOVE_ENTITY = 1;
  12. };
  13. class WorldUpdate : public Framework::ReferenceCounter
  14. {
  15. private:
  16. int affectedDimensionId;
  17. Framework::Vec3<int> minAffected;
  18. Framework::Vec3<int> maxAffected;
  19. int type;
  20. protected:
  21. virtual void write(Framework::StreamWriter* zWriter) = 0;
  22. public:
  23. WorldUpdate(int type, int dimensionId, Framework::Vec3<int> minAffected, Framework::Vec3<int> maxAffected);
  24. virtual void onUpdate(Dimension* zDimension) = 0;
  25. void writeAndCheck(Framework::StreamWriter* zWriter);
  26. int getAffectedDimension() const;
  27. const Framework::Vec3<int>& getMinAffectedPoint() const;
  28. const Framework::Vec3<int>& getMaxAffectedPoint() const;
  29. int getType() const;
  30. int distanceTo(int x, int y) const;
  31. };