From c565950e1fd336e08bda35c26cb9b8983681fd60 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 22 Aug 2013 08:51:40 +0200 Subject: Removed unwanted VirtualHooks remnants. cEntity no longer needs its SpawnOn() default-implemented, it can now be a true pure virtual function. --- source/Entities/Entity.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/Entities') diff --git a/source/Entities/Entity.h b/source/Entities/Entity.h index 820405cb9..7a070a5dd 100644 --- a/source/Entities/Entity.h +++ b/source/Entities/Entity.h @@ -276,9 +276,8 @@ public: /** Descendants override this function to send a command to the specified client to spawn the entity on the client. To spawn on all eligible clients, use cChunkMap::BroadcastSpawnEntity() - Needs to have a default implementation due to Lua bindings. */ - virtual void SpawnOn(cClientHandle & a_Client) {ASSERT(!"SpawnOn() unimplemented!"); } + virtual void SpawnOn(cClientHandle & a_Client) = 0; // tolua_begin -- cgit v1.2.3 From b1ad3f83369924fed0232ce66eabbb24f3c6cd9e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 24 Aug 2013 21:34:42 +0200 Subject: Fixed pickup behavior outside the world. One part of #131. --- source/Entities/Pickup.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/Entities') diff --git a/source/Entities/Pickup.cpp b/source/Entities/Pickup.cpp index 0417b861d..c8f36d503 100644 --- a/source/Entities/Pickup.cpp +++ b/source/Entities/Pickup.cpp @@ -73,18 +73,19 @@ void cPickup::Tick(float a_Dt, cChunk & a_Chunk) if (!m_bCollected) { int BlockY = (int) floor(GetPosY()); - if (BlockY < cChunkDef::Height) // Don't do anything except for falling when above the world + if ((BlockY >= 0) && (BlockY < cChunkDef::Height)) // Don't do anything except for falling when outside the world { int BlockX = (int) floor(GetPosX()); int BlockZ = (int) floor(GetPosZ()); - //Position might have changed due to physics. So we have to make sure we have the correct chunk. + // Position might have changed due to physics. So we have to make sure we have the correct chunk. cChunk * CurrentChunk = a_Chunk.GetNeighborChunk(BlockX, BlockZ); if (CurrentChunk != NULL) // Make sure the chunk is loaded { int RelBlockX = BlockX - (CurrentChunk->GetPosX() * cChunkDef::Width); int RelBlockZ = BlockZ - (CurrentChunk->GetPosZ() * cChunkDef::Width); - BLOCKTYPE BlockBelow = CurrentChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ); + // If the pickup is on the bottommost block position, make it think the void is made of air: (#131) + BLOCKTYPE BlockBelow = (BlockY > 0) ? CurrentChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR; BLOCKTYPE BlockIn = CurrentChunk->GetBlock(RelBlockX, BlockY, RelBlockZ); if ( -- cgit v1.2.3