From f763242e5c5d8e6469685c4be95d3dc264ed6a67 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 23 Apr 2014 21:06:07 +0100 Subject: [PATCH] Small changes --- src/CraftingRecipes.cpp | 4 ++-- src/Items/ItemLilypad.h | 14 ++++++-------- src/Items/ItemThrowable.h | 5 ++++- src/World.h | 4 +++- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/CraftingRecipes.cpp b/src/CraftingRecipes.cpp index 30e7a8733..157d634cd 100644 --- a/src/CraftingRecipes.cpp +++ b/src/CraftingRecipes.cpp @@ -800,7 +800,7 @@ void cCraftingRecipes::HandleFireworks(const cItem * a_CraftingGrid, cCraftingRe break; } case E_ITEM_PAPER: break; - default: LOG("Unexpected item in firework rocket a_Recipe, was the crafting file fireworks section changed?"); break; + default: LOG("Unexpected item in firework rocket recipe, was the crafting file's fireworks section changed?"); break; } } } @@ -835,7 +835,7 @@ void cCraftingRecipes::HandleFireworks(const cItem * a_CraftingGrid, cCraftingRe case E_ITEM_GOLD_NUGGET: a_Recipe->m_Result.m_FireworkItem.m_Type = 2; break; case E_ITEM_FEATHER: a_Recipe->m_Result.m_FireworkItem.m_Type = 4; break; case E_ITEM_HEAD: a_Recipe->m_Result.m_FireworkItem.m_Type = 3; break; - default: LOG("Unexpected item in firework star a_Recipe, was the crafting file fireworks section changed?"); break; // ermahgerd BARD ardmins + default: LOG("Unexpected item in firework star recipe, was the crafting file's fireworks section changed?"); break; // ermahgerd BARD ardmins } } diff --git a/src/Items/ItemLilypad.h b/src/Items/ItemLilypad.h index 8fc1d8543..bc650cdbd 100644 --- a/src/Items/ItemLilypad.h +++ b/src/Items/ItemLilypad.h @@ -47,9 +47,9 @@ public: public cBlockTracer::cCallbacks { public: - cCallbacks(cWorld * a_CBWorld) : - m_HasHitFluid(false), - m_World(a_CBWorld) + + cCallbacks(void) : + m_HasHitFluid(false) { } @@ -62,10 +62,9 @@ public: return false; } AddFaceDirection(a_CBBlockX, a_CBBlockY, a_CBBlockZ, BLOCK_FACE_YP); // Always place pad at top of water block - BLOCKTYPE Block = m_World->GetBlock(a_CBBlockX, a_CBBlockY, a_CBBlockZ); if ( - !IsBlockWater(Block) && - cBlockInfo::FullyOccupiesVoxel(Block) + !IsBlockWater(a_CBBlockType) && + cBlockInfo::FullyOccupiesVoxel(a_CBBlockType) ) { // Can't place lilypad on air/in another block! @@ -80,11 +79,10 @@ public: Vector3i m_Pos; bool m_HasHitFluid; - cWorld * m_World; }; - cCallbacks Callbacks(a_World); + cCallbacks Callbacks; cLineBlockTracer Tracer(*a_Player->GetWorld(), Callbacks); Vector3d Start(a_Player->GetEyePosition() + a_Player->GetLookVector()); Vector3d End(a_Player->GetEyePosition() + a_Player->GetLookVector() * 5); diff --git a/src/Items/ItemThrowable.h b/src/Items/ItemThrowable.h index c6a4e714e..f90caf037 100644 --- a/src/Items/ItemThrowable.h +++ b/src/Items/ItemThrowable.h @@ -127,7 +127,10 @@ public: return false; } - a_World->CreateProjectile(a_BlockX + 0.5, a_BlockY + 1, a_BlockZ + 0.5, m_ProjectileKind, a_Player, a_Player->GetEquippedItem()); + if (a_World->CreateProjectile(a_BlockX + 0.5, a_BlockY + 1, a_BlockZ + 0.5, m_ProjectileKind, a_Player, a_Player->GetEquippedItem()) == -1) + { + return false; + } if (!a_Player->IsGameModeCreative()) { diff --git a/src/World.h b/src/World.h index e08ef7f53..61733bca0 100644 --- a/src/World.h +++ b/src/World.h @@ -710,7 +710,9 @@ public: virtual int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType) override; // tolua_export int SpawnMobFinalize(cMonster* a_Monster); - /** Creates a projectile of the specified type. Returns the projectile's EntityID if successful, <0 otherwise */ + /** Creates a projectile of the specified type. Returns the projectile's EntityID if successful, <0 otherwise + Item parameter used currently for Fireworks to correctly set entity metadata based on item metadata + */ int CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const cItem a_Item, const Vector3d * a_Speed = NULL); // tolua_export /** Returns a random number from the m_TickRand in range [0 .. a_Range]. To be used only in the tick thread! */