12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #pragma once
- #include <Array.h>
- #include <Punkt.h>
- #include <ReferenceCounter.h>
- #include <Vec3.h>
- #include <Writer.h>
- class MultiblockStructureType;
- class Block;
- 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;
- };
|