123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include "WorldUpdate.h"
- WorldUpdate::WorldUpdate( int type, int dimensionId, Framework::Vec3<int> minAffected, Framework::Vec3<int> maxAffected )
- : ReferenceCounter(),
- affectedDimensionId( dimensionId ),
- minAffected( minAffected ),
- maxAffected( maxAffected ),
- type( type )
- {}
- int WorldUpdate::getAffectedDimension() const
- {
- return affectedDimensionId;
- }
- const Framework::Vec3<int>& WorldUpdate::getMinAffectedPoint() const
- {
- return minAffected;
- }
- const Framework::Vec3<int>& WorldUpdate::getMaxAffectedPoint() const
- {
- return maxAffected;
- }
- int WorldUpdate::getType() const
- {
- return type;
- }
- int WorldUpdate::distanceTo( int x, int y ) const
- {
- int dist = abs( x - minAffected.x );
- if( dist > abs( x - maxAffected.x ) )
- dist = abs( x - maxAffected.x );
- if( dist > abs( y - minAffected.y ) )
- dist = abs( y - minAffected.y );
- if( dist > abs( y - maxAffected.y ) )
- dist = abs( y - maxAffected.y );
- return dist;
- }
- WorldUpdateType::WorldUpdateType( int id )
- : ReferenceCounter()
- {
- StaticRegistry<WorldUpdateType>::INSTANCE.registerT( this, id );
- }
|