WorldUpdate.h 992 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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,
  24. int dimensionId,
  25. Framework::Vec3<int> minAffected,
  26. Framework::Vec3<int> maxAffected);
  27. virtual void onUpdate(Dimension* zDimension) = 0;
  28. void writeAndCheck(Framework::StreamWriter* zWriter);
  29. int getAffectedDimension() const;
  30. const Framework::Vec3<int>& getMinAffectedPoint() const;
  31. const Framework::Vec3<int>& getMaxAffectedPoint() const;
  32. int getType() const;
  33. int distanceTo(int x, int y) const;
  34. };