From 15b92af166e03e3deb8baf5eb2ec6b0be5981646 Mon Sep 17 00:00:00 2001 From: Tycho Date: Sat, 25 Jan 2014 11:14:14 -0800 Subject: First attempt at Implementing Interfaces --- src/Blocks/WorldInterface.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/Blocks/WorldInterface.h (limited to 'src/Blocks/WorldInterface.h') diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h new file mode 100644 index 000000000..8cf2103d1 --- /dev/null +++ b/src/Blocks/WorldInterface.h @@ -0,0 +1,13 @@ + +#pragma once + +class cWorldInterface +{ +public: + + virtual Int64 GetTimeOfDay(void) const; + + virtual eDimension GetDimension(void) const; + + virtual void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ); +}; -- cgit v1.2.3 From 14e48ccb4bbad6f43121dc27f042083cda160f45 Mon Sep 17 00:00:00 2001 From: Tycho Date: Sun, 26 Jan 2014 06:20:39 -0800 Subject: Refactored cBlockHandler::OnUse and dependents --- src/Blocks/WorldInterface.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/Blocks/WorldInterface.h') diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index 8cf2103d1..a29d7a73a 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -1,13 +1,25 @@ #pragma once +#include "BroadcastInterface.h" + class cWorldInterface { public: - virtual Int64 GetTimeOfDay(void) const; + virtual Int64 GetTimeOfDay(void) const = 0; + virtual Int64 GetWorldAge(void) const = 0; + + virtual eDimension GetDimension(void) const = 0; + + virtual cBroadcastInterface * GetBroadcastManager() = 0; + + virtual void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData) = 0; + + /** Spawns item pickups for each item in the list. May compress pickups if too many entities: */ + virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed = 1.0, bool IsPlayerCreated = false) = 0; - virtual eDimension GetDimension(void) const; + /** Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the speed specified: */ + virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated = false) = 0; - virtual void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ); }; -- cgit v1.2.3 From 25ec7750aac9800bec83a844020a6eeda5cd4d74 Mon Sep 17 00:00:00 2001 From: Tycho Date: Fri, 31 Jan 2014 15:17:41 -0800 Subject: Changed signitures of Several BLockHandler Methods Changed the signitures of the following to use interfaces: GetPlacementBlockTypeMeta OnPlaced OnPlacedByPlayer OnDestroyed OnNeighbourChanged NeighbourChanged OnUse CanBeAt Check --- src/Blocks/WorldInterface.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Blocks/WorldInterface.h') diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index a29d7a73a..c50bd1ad7 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -22,4 +22,6 @@ public: /** Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the speed specified: */ virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated = false) = 0; + /** Spawns a mob of the specified type. Returns the mob's EntityID if recognized and spawned, <0 otherwise */ + virtual int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType) = 0; }; -- cgit v1.2.3 From c6304b2b4faf31c2e4a91a07bcac298467898dba Mon Sep 17 00:00:00 2001 From: Tycho Date: Sat, 1 Feb 2014 05:06:32 -0800 Subject: Changed pointers to references --- src/Blocks/WorldInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Blocks/WorldInterface.h') diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index c50bd1ad7..f6b83942f 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -12,7 +12,7 @@ public: virtual eDimension GetDimension(void) const = 0; - virtual cBroadcastInterface * GetBroadcastManager() = 0; + virtual cBroadcastInterface & GetBroadcastManager() = 0; virtual void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData) = 0; -- cgit v1.2.3 From cf3b4ec226034b006fd646b395f4e8a609f6f378 Mon Sep 17 00:00:00 2001 From: Tycho Date: Sat, 1 Feb 2014 06:01:13 -0800 Subject: Changed Signiture of OnDestroyedByPlayer --- src/Blocks/WorldInterface.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Blocks/WorldInterface.h') diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index f6b83942f..b6f2f55a7 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -2,6 +2,9 @@ #pragma once #include "BroadcastInterface.h" +#include "../Mobs/Monster.h" + +class cItems; class cWorldInterface { -- cgit v1.2.3 From 594ddd86a04d895fdecb1cd4767031abc5c8dcca Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 5 Mar 2014 19:33:43 +0100 Subject: Add SendBlockTo to cWorldInterface --- src/Blocks/WorldInterface.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Blocks/WorldInterface.h') diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index b6f2f55a7..c38ffc6db 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -27,4 +27,7 @@ public: /** Spawns a mob of the specified type. Returns the mob's EntityID if recognized and spawned, <0 otherwise */ virtual int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType) = 0; + + /** If there is a block entity at the specified coords, sends it to the client specified */ + virtual void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, cPlayer * a_Player) = 0; }; -- cgit v1.2.3 From 1c7a580e520ba6c28936e46d36abba658bd477b1 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 6 Mar 2014 13:35:53 +0100 Subject: Fix comment --- src/Blocks/WorldInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Blocks/WorldInterface.h') diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index c38ffc6db..e59b00eff 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -28,6 +28,6 @@ public: /** Spawns a mob of the specified type. Returns the mob's EntityID if recognized and spawned, <0 otherwise */ virtual int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType) = 0; - /** If there is a block entity at the specified coords, sends it to the client specified */ + /** Sends the block on those coords to the player */ virtual void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, cPlayer * a_Player) = 0; }; -- cgit v1.2.3 From b64e9fb7f52e4a2b75b49413fdc2194132885370 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 9 Mar 2014 00:17:23 +0000 Subject: Beds now work properly fixes #707 Also fixes FS392 Conflicts: src/Blocks/WorldInterface.h src/ClientHandle.cpp --- src/Blocks/WorldInterface.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Blocks/WorldInterface.h') diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index e59b00eff..580339d32 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -27,7 +27,13 @@ public: /** Spawns a mob of the specified type. Returns the mob's EntityID if recognized and spawned, <0 otherwise */ virtual int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType) = 0; - + /** Sends the block on those coords to the player */ virtual void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, cPlayer * a_Player) = 0; + + /** Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true */ + virtual bool ForEachPlayer(cItemCallback & a_Callback) = 0; + + virtual void SetTimeOfDay(Int64 a_TimeOfDay) = 0; + }; -- cgit v1.2.3 From 773ce7fde692e86531e1e92f42776e316b793d83 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 28 Mar 2014 21:35:45 +0100 Subject: Fixed non-virtual destructors warnings. --- src/Blocks/WorldInterface.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Blocks/WorldInterface.h') diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index 580339d32..bfbb053d9 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -9,7 +9,8 @@ class cItems; class cWorldInterface { public: - + virtual ~cWorldInterface() {} + virtual Int64 GetTimeOfDay(void) const = 0; virtual Int64 GetWorldAge(void) const = 0; -- cgit v1.2.3