aboutsummaryrefslogtreecommitdiff
path: root/src/map.hh
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-05-25 22:37:57 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-05-25 22:37:57 -0300
commitad8213f35523cbb07f418ae275af448a47cc0288 (patch)
tree4d77b8ff2b44461734b5a2cbaad5402b4a94736f /src/map.hh
parent5f883a80175a4cc9abda9d647a6a0d73bda84878 (diff)
downloadgame-ad8213f35523cbb07f418ae275af448a47cc0288.tar.gz
game-ad8213f35523cbb07f418ae275af448a47cc0288.zip
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.
Diffstat (limited to 'src/map.hh')
-rw-r--r--src/map.hh43
1 files changed, 41 insertions, 2 deletions
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_