#include "WorldUpdate.h" WorldUpdate::WorldUpdate( int type, int dimensionId, Framework::Vec3 minAffected, Framework::Vec3 maxAffected ) : ReferenceCounter(), affectedDimensionId( dimensionId ), minAffected( minAffected ), maxAffected( maxAffected ), type( type ) {} void WorldUpdate::writeAndCheck( Framework::StreamWriter* zWriter ) { zWriter->schreibe( (char*)&type, 4 ); this->write( zWriter ); zWriter->schreibe( (char*)&type, 4 ); } int WorldUpdate::getAffectedDimension() const { return affectedDimensionId; } const Framework::Vec3& WorldUpdate::getMinAffectedPoint() const { return minAffected; } const Framework::Vec3& WorldUpdate::getMaxAffectedPoint() const { return maxAffected; } int WorldUpdate::getType() const { return type; } 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 ); } WorldUpdateType::WorldUpdateType( int id ) : ReferenceCounter() { StaticRegistry::INSTANCE.registerT( this, id ); }