From ad8213f35523cbb07f418ae275af448a47cc0288 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Sun, 25 May 2025 22:37:57 -0300 Subject: linux Makefile + fix most compilation problems I wanted to see if the compiler had any problems with the code so far and added a few stub definitions so that each file would properly compile. We still fail when linking but we're able to to find and fix compile time errors. --- src/map.hh | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'src/map.hh') diff --git a/src/map.hh b/src/map.hh index 590fb41..3c92fff 100644 --- a/src/map.hh +++ b/src/map.hh @@ -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_ -- cgit v1.2.3