summaryrefslogtreecommitdiffstats
path: root/src/Blocks
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-03-05 22:21:39 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-03-05 22:21:39 +0100
commitf3da0cf1ae96048bb84a083099faec0b0a736bf1 (patch)
treec18dd3120d26e49e9c0634b87054a4fc14e6969b /src/Blocks
parentHandle client 'leave bed' request (diff)
downloadcuberite-f3da0cf1ae96048bb84a083099faec0b0a736bf1.tar
cuberite-f3da0cf1ae96048bb84a083099faec0b0a736bf1.tar.gz
cuberite-f3da0cf1ae96048bb84a083099faec0b0a736bf1.tar.bz2
cuberite-f3da0cf1ae96048bb84a083099faec0b0a736bf1.tar.lz
cuberite-f3da0cf1ae96048bb84a083099faec0b0a736bf1.tar.xz
cuberite-f3da0cf1ae96048bb84a083099faec0b0a736bf1.tar.zst
cuberite-f3da0cf1ae96048bb84a083099faec0b0a736bf1.zip
Diffstat (limited to 'src/Blocks')
-rw-r--r--src/Blocks/BlockBed.cpp13
-rw-r--r--src/Blocks/WorldInterface.h5
2 files changed, 8 insertions, 10 deletions
diff --git a/src/Blocks/BlockBed.cpp b/src/Blocks/BlockBed.cpp
index 23cb5a042..e56f4bfe0 100644
--- a/src/Blocks/BlockBed.cpp
+++ b/src/Blocks/BlockBed.cpp
@@ -1,13 +1,9 @@
#include "Globals.h"
#include "BlockBed.h"
-
-
-
#include "BroadcastInterface.h"
#include "Entities/../World.h"
#include "Entities/Player.h"
-#include "WorldInterface.h"
@@ -127,7 +123,14 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface
a_Player->SetIsInBed(true);
a_Player->SendMessageSuccess("Home position set successfully");
- a_WorldInterface.ScheduleTask(20, cWorld::cTaskTryAwakeSleepingPlayers(Vector3i(a_BlockX + PillowDirection.x, a_BlockY, a_BlockZ + PillowDirection.z), a_ChunkInterface));
+ cTimeFastForwardTester Tester;
+ if (a_WorldInterface.ForEachPlayer(Tester))
+ {
+ cPlayerBedStateUnsetter Unsetter(Vector3i(a_BlockX + PillowDirection.x, a_BlockY, a_BlockZ + PillowDirection.z), a_ChunkInterface);
+ a_WorldInterface.ForEachPlayer(Unsetter);
+ a_WorldInterface.SetTimeOfDay(0);
+ a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x0b); // Clear the "occupied" bit of the bed's block
+ }
}
}
else
diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h
index dcb7eee00..106c314e7 100644
--- a/src/Blocks/WorldInterface.h
+++ b/src/Blocks/WorldInterface.h
@@ -11,7 +11,6 @@ typedef cItemCallback<cBlockEntity> cBlockEntityCallback;
class cMonster;
class cPlayer;
-class cTask;
class cWorldInterface
@@ -60,8 +59,4 @@ public:
/** Wakes up the simulators for the specified block */
virtual void WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ) = 0;
- /** Queues a task onto the tick thread, with the specified delay.
- The task object will be deleted once the task is finished */
- virtual void ScheduleTask(int a_DelayTicks, cTask * a_Task) = 0;
-
};