summaryrefslogtreecommitdiffstats
path: root/source/Minecart.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-02-18 17:48:50 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-02-18 17:48:50 +0100
commitd47ff5520373acb359590fb036b6a761af58cf75 (patch)
tree63f68f88d8bf8730da1dd32880ec526dc889bc6c /source/Minecart.cpp
parentRemoved all E_ITEM_ symbols equivalent to E_BLOCK_, and all obsolete item and block symbols. (diff)
downloadcuberite-d47ff5520373acb359590fb036b6a761af58cf75.tar
cuberite-d47ff5520373acb359590fb036b6a761af58cf75.tar.gz
cuberite-d47ff5520373acb359590fb036b6a761af58cf75.tar.bz2
cuberite-d47ff5520373acb359590fb036b6a761af58cf75.tar.lz
cuberite-d47ff5520373acb359590fb036b6a761af58cf75.tar.xz
cuberite-d47ff5520373acb359590fb036b6a761af58cf75.tar.zst
cuberite-d47ff5520373acb359590fb036b6a761af58cf75.zip
Diffstat (limited to '')
-rw-r--r--source/Minecart.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/source/Minecart.cpp b/source/Minecart.cpp
new file mode 100644
index 000000000..10c9fe580
--- /dev/null
+++ b/source/Minecart.cpp
@@ -0,0 +1,62 @@
+
+// Minecart.cpp
+
+// Implements the cMinecart class representing a minecart in the world
+
+#include "Globals.h"
+#include "Minecart.h"
+#include "World.h"
+#include "ClientHandle.h"
+
+
+
+
+
+cMinecart::cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z) :
+ super(etMinecart, a_X, a_Y, a_Z),
+ m_Payload(a_Payload)
+{
+}
+
+
+
+
+void cMinecart::Initialize(cWorld * a_World)
+{
+ super::Initialize(a_World);
+ a_World->BroadcastSpawn(*this);
+}
+
+
+
+
+
+void cMinecart::SpawnOn(cClientHandle & a_ClientHandle)
+{
+ char Type = 0;
+ switch (m_Payload)
+ {
+ case mpNone: Type = 10; break;
+ case mpChest: Type = 11; break;
+ case mpFurnace: Type = 12; break;
+ default:
+ {
+ ASSERT(!"Unknown payload, cannot spawn on client");
+ return;
+ }
+ }
+ a_ClientHandle.SendSpawnVehicle(*this, Type);
+}
+
+
+
+
+
+void cMinecart::Tick(float a_Dt, MTRand & a_TickRandom)
+{
+ // TODO: the physics
+}
+
+
+
+