summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemMinecart.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2016-12-19 21:12:23 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2017-08-07 20:24:16 +0200
commit4ef47aed62364f9cf1474864e5cf94232b4477af (patch)
tree28ca15247c2437b91e9aada48c2da4a1a3c00c17 /src/Items/ItemMinecart.h
parentRemoved unneeded includes (#3902) (diff)
downloadcuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar
cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar.gz
cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar.bz2
cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar.lz
cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar.xz
cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.tar.zst
cuberite-4ef47aed62364f9cf1474864e5cf94232b4477af.zip
Diffstat (limited to 'src/Items/ItemMinecart.h')
-rw-r--r--src/Items/ItemMinecart.h19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/Items/ItemMinecart.h b/src/Items/ItemMinecart.h
index 623342d41..05f375f06 100644
--- a/src/Items/ItemMinecart.h
+++ b/src/Items/ItemMinecart.h
@@ -59,24 +59,9 @@ public:
double x = static_cast<double>(a_BlockX) + 0.5;
double y = static_cast<double>(a_BlockY) + 0.5;
double z = static_cast<double>(a_BlockZ) + 0.5;
- cMinecart * Minecart = nullptr;
- switch (m_ItemType)
- {
- case E_ITEM_MINECART: Minecart = new cRideableMinecart (x, y, z, cItem(), 1); break;
- case E_ITEM_CHEST_MINECART: Minecart = new cMinecartWithChest (x, y, z); break;
- case E_ITEM_FURNACE_MINECART: Minecart = new cMinecartWithFurnace (x, y, z); break;
- case E_ITEM_MINECART_WITH_TNT: Minecart = new cMinecartWithTNT (x, y, z); break;
- case E_ITEM_MINECART_WITH_HOPPER: Minecart = new cMinecartWithHopper (x, y, z); break;
- default:
- {
- ASSERT(!"Unhandled minecart item");
- return false;
- }
- } // switch (m_ItemType)
- if (!Minecart->Initialize(*a_World))
+
+ if (a_World->SpawnMinecart(x, y, z, m_ItemType) == cEntity::INVALID_ID)
{
- delete Minecart;
- Minecart = nullptr;
return false;
}