diff options
Diffstat (limited to 'src/map.hh')
| -rw-r--r-- | src/map.hh | 43 |
1 files changed, 41 insertions, 2 deletions
@@ -3,12 +3,22 @@ #include "common.hh" #include "objects.hh" +#include "script.hh" struct Object { // REGULAR FUNCTIONS // ========================================================================= - Object(void) { this->ObjectID = 0; } - Object(uint32 ObjectID) { this->ObjectID = ObjectID; } + constexpr Object(void) : ObjectID(0) {} + constexpr Object(uint32 ObjectID): ObjectID(ObjectID) {} + + constexpr bool operator==(const Object &other) const { + return this->ObjectID == other.ObjectID; + } + + constexpr bool operator!=(const Object &other) const { + return this->ObjectID != other.ObjectID; + } + bool exists(void); ObjectType getObjectType(void); @@ -71,7 +81,36 @@ struct TCronEntry { int Next; }; +// NOTE(fusion): Map management functions. Most for internal use. +void SwapObject(TWriteBinaryFile *File, Object Obj, uint32 FileNumber); +void SwapSector(void); +void UnswapSector(uint32 FileNumber); +void DeleteSwappedSectors(void); +void LoadObjects(TReadScriptFile *Script, TWriteStream *Stream, bool Skip); +void LoadObjects(TReadStream *Stream, Object Con); +void InitSector(int SectorX, int SectorY, int SectorZ); +void LoadSector(const char *FileName, int SectorX, int SectorY, int SectorZ); +void LoadMap(void); +void SaveObjects(Object Obj, TWriteStream *Stream, bool Stop); +void SaveObjects(TReadStream *Stream, TWriteScriptFile *Script); +void SaveSector(char *FileName, int SectorX, int SectorY, int SectorZ); +void SaveMap(void); void InitMap(void); void ExitMap(bool Save); +// NOTE(fusion): Object related functions. +Object CreateObject(void); +TObject *AccessObject(Object Obj); +void ChangeObject(Object Obj, ObjectType NewType); +int GetObjectPriority(Object Obj); +void PlaceObject(Object Obj, Object Con, bool Append); +Object AppendObject(Object Con, ObjectType Type); +Object GetFirstContainerObject(Object Con); +Object GetContainerObject(Object Con, int Index); +void GetObjectCoordinates(Object Obj, int *x, int *y, int *z); +uint8 GetMapContainerFlags(Object Obj); +Object GetMapContainer(int x, int y, int z); +Object GetMapContainer(Object Obj); +Object GetFirstObject(int x, int y, int z); + #endif //TIBIA_MAP_HH_ |
