|
@@ -1,14 +1,10 @@
|
|
#include "WorldUpdate.h"
|
|
#include "WorldUpdate.h"
|
|
|
|
|
|
-WorldUpdate::WorldUpdate(int type,
|
|
|
|
- int dimensionId,
|
|
|
|
- Framework::Vec3<int> minAffected,
|
|
|
|
- Framework::Vec3<int> maxAffected)
|
|
|
|
|
|
+WorldUpdate::WorldUpdate(int type, int dimensionId, Framework::Vec3<float> pos)
|
|
: ReferenceCounter(),
|
|
: ReferenceCounter(),
|
|
affectedDimensionId(dimensionId),
|
|
affectedDimensionId(dimensionId),
|
|
- minAffected(minAffected),
|
|
|
|
- maxAffected(maxAffected),
|
|
|
|
- type(type)
|
|
|
|
|
|
+ type(type),
|
|
|
|
+ pos(pos)
|
|
{}
|
|
{}
|
|
|
|
|
|
void WorldUpdate::writeAndCheck(Framework::StreamWriter* zWriter)
|
|
void WorldUpdate::writeAndCheck(Framework::StreamWriter* zWriter)
|
|
@@ -23,16 +19,6 @@ int WorldUpdate::getAffectedDimension() const
|
|
return affectedDimensionId;
|
|
return affectedDimensionId;
|
|
}
|
|
}
|
|
|
|
|
|
-const Framework::Vec3<int>& WorldUpdate::getMinAffectedPoint() const
|
|
|
|
-{
|
|
|
|
- return minAffected;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const Framework::Vec3<int>& WorldUpdate::getMaxAffectedPoint() const
|
|
|
|
-{
|
|
|
|
- return maxAffected;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int WorldUpdate::getType() const
|
|
int WorldUpdate::getType() const
|
|
{
|
|
{
|
|
return type;
|
|
return type;
|
|
@@ -40,9 +26,5 @@ int WorldUpdate::getType() const
|
|
|
|
|
|
int WorldUpdate::distanceTo(int x, int y) const
|
|
int WorldUpdate::distanceTo(int x, int y) const
|
|
{
|
|
{
|
|
- int xDist = MIN(abs(x - minAffected.x), abs(x - maxAffected.x));
|
|
|
|
- int yDist = MIN(abs(y - minAffected.y), abs(y - maxAffected.y));
|
|
|
|
- if (x >= minAffected.x && x <= maxAffected.x) xDist = 0;
|
|
|
|
- if (y >= minAffected.y && y <= maxAffected.y) yDist = 0;
|
|
|
|
- return MIN(xDist, yDist);
|
|
|
|
-}
|
|
|
|
|
|
+ return pos.abstand(Framework::Vec3<float>((float)x, (float)y, pos.z));
|
|
|
|
+}
|