1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #pragma once
- #include <ReferenceCounter.h>
- #include <Punkt.h>
- #include "Block.h"
- class MultiblockStructureType;
- class MultiblockStructureEnum
- {
- public:
- static const int TREE = 0;
- };
- class MultiblockStructure : public virtual Framework::ReferenceCounter
- {
- private:
- Framework::Array<Framework::Punkt> affectedChunks;
- Framework::Array<Framework::Vec3<int>> memberBlockPositions;
- Framework::Vec3<int> uniquePosition;
- int dimensionId;
- __int64 structureId;
- int structureTypeId;
- bool isLoading;
- protected:
- Framework::RCArray<Block> loadedMembers;
- public:
- MultiblockStructure(int dimensionId, __int64 structureId, Framework::Vec3<int> uniquePosition, int structureTypeId);
- ~MultiblockStructure();
- void onBlockLoaded(Block* block);
- void onBlockUnloaded(Block* zBlock);
- void addMemberPosition(Framework::Vec3<int > blockPos);
- virtual void onBlockRemoved(Block* zBlock);
- bool isEmpty() const;
- bool isFullyLoaded() const;
- bool isFullyUnloaded() const;
- bool isBlockMember(Block* zBlock) const;
- __int64 getStructureId() const;
- Framework::Vec3<int> getUniquePosition() const;
- int getStructureTypeId() const;
- friend MultiblockStructureType;
- };
- class MultiblockStructureType : public Framework::ReferenceCounter
- {
- private:
- const int id;
- protected:
- MultiblockStructureType(int id);
- ~MultiblockStructureType();
- virtual void loadSuperStructure(MultiblockStructure* zStructure, Framework::StreamReader* zReader) const;
- virtual void saveSuperStructure(MultiblockStructure* zStructure, Framework::StreamWriter* zWriter) const;
- virtual MultiblockStructure* createStructure(int dimensionId, __int64 structureId, Framework::Vec3<int> uniquePosition) const = 0;
- public:
- MultiblockStructure* loadStructure(int dimensionId, __int64 structureId, Framework::Vec3<int> uniquePosition, Framework::StreamReader* zReader) const;
- void saveStructure(MultiblockStructure* zStructure, Framework::StreamWriter* zWriter) const;
- int getId() const;
- };
|