From 2423fbf2efa39e28cc348acc11b9269e573dcdef Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:15:34 +0200 Subject: Normalized comments. This was mostly done automatically and then visually inspected for obvious errors. All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign. --- src/Items/ItemBucket.h | 4 ++-- src/Items/ItemFishingRod.h | 27 ++++++++++++++++++++------- src/Items/ItemHandler.cpp | 4 ++-- src/Items/ItemHandler.h | 8 ++++---- src/Items/ItemItemFrame.h | 4 ++-- src/Items/ItemLeaves.h | 2 +- src/Items/ItemLilypad.h | 4 ++-- src/Items/ItemPainting.h | 8 ++++---- src/Items/ItemRedstoneDust.h | 2 +- src/Items/ItemSeeds.h | 2 +- 10 files changed, 39 insertions(+), 26 deletions(-) (limited to 'src/Items') diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index a733bda19..4cdfab0fe 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -49,7 +49,7 @@ public: Vector3i BlockPos; if (!GetBlockFromTrace(a_World, a_Player, BlockPos)) { - return false; // Nothing in range. + return false; // Nothing in range. } if (a_World->GetBlockMeta(BlockPos.x, BlockPos.y, BlockPos.z) != 0) @@ -160,7 +160,7 @@ public: { if (IsBlockWater(a_BlockType) || IsBlockLava(a_BlockType)) { - if (a_BlockMeta != 0) // GetBlockFromTrace is called for scooping up fluids; the hit block should be a source + if (a_BlockMeta != 0) // GetBlockFromTrace is called for scooping up fluids; the hit block should be a source { return false; } diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h index 3b1ad1717..435d8ccf4 100644 --- a/src/Items/ItemFishingRod.h +++ b/src/Items/ItemFishingRod.h @@ -17,13 +17,15 @@ -///////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////////// // cFloaterCallback class cFloaterCallback : public cEntityCallback { public: - cFloaterCallback(void) : + cFloaterCallback(void) : m_CanPickup(false), m_AttachedMobID(-1) { @@ -49,8 +51,13 @@ protected: Vector3d m_Pos; } ; -//////////////////////////////////////////////////////////////////////////// -// cSweepEntityCallback + + + + +//////////////////////////////////////////////////////////////////////////////// +// cSweepEntityCallback: + class cSweepEntityCallback : public cEntityCallback { @@ -73,6 +80,8 @@ protected: + + class cItemFishingRodHandler : public cItemHandler { @@ -106,19 +115,19 @@ public: { cItems Drops; int ItemCategory = a_World->GetTickRandomNumber(99); - if (ItemCategory <= 4) // Treasures 5% + if (ItemCategory <= 4) // Treasures 5% { int Treasure = a_World->GetTickRandomNumber(5); switch (Treasure) { case 0: { - Drops.Add(cItem(E_ITEM_BOW)); // TODO: Enchantments + Drops.Add(cItem(E_ITEM_BOW)); // TODO: Enchantments break; } case 1: { - Drops.Add(cItem(E_ITEM_BOOK)); // TODO: Enchanted book + Drops.Add(cItem(E_ITEM_BOOK)); // TODO: Enchanted book break; } case 2: @@ -237,3 +246,7 @@ public: return true; } } ; + + + + diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index 85406c826..c261ce0e8 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -362,7 +362,7 @@ char cItemHandler::GetMaxStackSize(void) return 64; } - switch (m_ItemType) //sorted by id + switch (m_ItemType) { case E_ITEM_ARROW: return 64; case E_ITEM_BAKED_POTATO: return 64; @@ -568,7 +568,7 @@ bool cItemHandler::EatItem(cPlayer * a_Player, cItem * a_Item) cFastRandom r1; if ((r1.NextInt(100, a_Player->GetUniqueID()) - Info.PoisonChance) <= 0) { - a_Player->FoodPoison(600); // Give the player food poisoning for 30 seconds. + a_Player->FoodPoison(600); // Give the player food poisoning for 30 seconds. } } diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h index cffca11ab..b33671c2d 100644 --- a/src/Items/ItemHandler.h +++ b/src/Items/ItemHandler.h @@ -60,7 +60,7 @@ public: { double Saturation; int FoodLevel; - int PoisonChance; // 0 - 100, in percent. 0 = no chance of poisoning, 100 = sure poisoning + int PoisonChance; // 0 - 100, in percent. 0 = no chance of poisoning, 100 = sure poisoning FoodInfo(int a_FoodLevel, double a_Saturation, int a_PoisonChance = 0) : Saturation(a_Saturation), @@ -112,11 +112,11 @@ public: protected: int m_ItemType; - static cItemHandler *CreateItemHandler(int m_ItemType); + static cItemHandler * CreateItemHandler(int m_ItemType); static cItemHandler * m_ItemHandler[E_ITEM_LAST + 1]; - static bool m_HandlerInitialized; //used to detect if the itemhandlers are initialized + static bool m_HandlerInitialized; // used to detect if the itemhandlers are initialized }; -//Short function +// Short function inline cItemHandler *ItemHandler(int a_ItemType) { return cItemHandler::GetItemHandler(a_ItemType); } diff --git a/src/Items/ItemItemFrame.h b/src/Items/ItemItemFrame.h index b258b4aea..87e20ecf0 100644 --- a/src/Items/ItemItemFrame.h +++ b/src/Items/ItemItemFrame.h @@ -27,9 +27,9 @@ public: return false; } - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir); // Make sure block that will be occupied is free + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir); // Make sure block that will be occupied is free BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir, true); // We want the clicked block, so go back again + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir, true); // We want the clicked block, so go back again if (Block == E_BLOCK_AIR) { diff --git a/src/Items/ItemLeaves.h b/src/Items/ItemLeaves.h index 12cb45d1c..0ed6e5e0e 100644 --- a/src/Items/ItemLeaves.h +++ b/src/Items/ItemLeaves.h @@ -31,7 +31,7 @@ public: a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta ); - a_BlockMeta = a_BlockMeta | 0x4; //0x4 bit set means this is a player-placed leaves block, not to be decayed + a_BlockMeta = a_BlockMeta | 0x4; // 0x4 bit set means this is a player-placed leaves block, not to be decayed return res; } } ; diff --git a/src/Items/ItemLilypad.h b/src/Items/ItemLilypad.h index bc650cdbd..b9d837384 100644 --- a/src/Items/ItemLilypad.h +++ b/src/Items/ItemLilypad.h @@ -25,7 +25,7 @@ public: virtual bool IsPlaceable(void) override { - return false; // Set as not placeable so OnItemUse is called + return false; // Set as not placeable so OnItemUse is called } @@ -57,7 +57,7 @@ public: { if (IsBlockWater(a_CBBlockType)) { - if ((a_CBBlockMeta != 0) || (a_CBEntryFace == BLOCK_FACE_NONE)) // The hit block should be a source. The FACE_NONE check is clicking whilst submerged + if ((a_CBBlockMeta != 0) || (a_CBEntryFace == BLOCK_FACE_NONE)) // The hit block should be a source. The FACE_NONE check is clicking whilst submerged { return false; } diff --git a/src/Items/ItemPainting.h b/src/Items/ItemPainting.h index e4bb76ebe..a2a77ce21 100644 --- a/src/Items/ItemPainting.h +++ b/src/Items/ItemPainting.h @@ -27,9 +27,9 @@ public: return false; } - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir); // Make sure block that will be occupied is free + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir); // Make sure block that will be occupied is free BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir, true); // We want the clicked block, so go back again + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir, true); // We want the clicked block, so go back again if (Block == E_BLOCK_AIR) { @@ -38,14 +38,14 @@ public: // The client uses different values for painting directions and block faces. Our constants are for the block faces, so we convert them here to painting faces switch (a_Dir) { - case BLOCK_FACE_ZP: break; // Initialised to zero + case BLOCK_FACE_ZP: break; // Initialised to zero case BLOCK_FACE_ZM: Dir = 2; break; case BLOCK_FACE_XM: Dir = 1; break; case BLOCK_FACE_XP: Dir = 3; break; default: ASSERT(!"Unhandled block face when trying spawn painting!"); return false; } - static const struct // Define all the possible painting titles + static const struct // Define all the possible painting titles { AString Title; } gPaintingTitlesList[] = diff --git a/src/Items/ItemRedstoneDust.h b/src/Items/ItemRedstoneDust.h index 274d905a5..33e386b03 100644 --- a/src/Items/ItemRedstoneDust.h +++ b/src/Items/ItemRedstoneDust.h @@ -27,7 +27,7 @@ public: BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override { - if (!cBlockInfo::FullyOccupiesVoxel(a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ))) // Some solid blocks, such as cocoa beans, are not suitable for dust + if (!cBlockInfo::FullyOccupiesVoxel(a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ))) // Some solid blocks, such as cocoa beans, are not suitable for dust { return false; } diff --git a/src/Items/ItemSeeds.h b/src/Items/ItemSeeds.h index 7283edcee..53f5d51c3 100644 --- a/src/Items/ItemSeeds.h +++ b/src/Items/ItemSeeds.h @@ -25,7 +25,7 @@ public: virtual bool IsFood(void) override { - switch (m_ItemType) // Special cases, both a seed and food + switch (m_ItemType) // Special cases, both a seed and food { case E_ITEM_CARROT: case E_ITEM_POTATO: return true; -- cgit v1.2.3 From 5e198c673009cf8ca9d92cf59848999bc96bbc37 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:50:58 +0200 Subject: Basic style fixes. --- src/Items/ItemBed.h | 2 +- src/Items/ItemBrewingStand.h | 2 +- src/Items/ItemCake.h | 2 +- src/Items/ItemCauldron.h | 2 +- src/Items/ItemComparator.h | 2 +- src/Items/ItemDoor.h | 6 +++--- src/Items/ItemFishingRod.h | 2 +- src/Items/ItemFlowerPot.h | 2 +- src/Items/ItemHandler.cpp | 6 +++--- src/Items/ItemHandler.h | 4 ++-- src/Items/ItemLeaves.h | 2 +- src/Items/ItemMobHead.h | 2 +- src/Items/ItemNetherWart.h | 2 +- src/Items/ItemRedstoneDust.h | 2 +- src/Items/ItemRedstoneRepeater.h | 2 +- src/Items/ItemSapling.h | 2 +- src/Items/ItemSeeds.h | 4 ++-- src/Items/ItemSign.h | 2 +- src/Items/ItemSugarcane.h | 2 +- 19 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/Items') diff --git a/src/Items/ItemBed.h b/src/Items/ItemBed.h index f23d69731..94a14cf16 100644 --- a/src/Items/ItemBed.h +++ b/src/Items/ItemBed.h @@ -26,7 +26,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemBrewingStand.h b/src/Items/ItemBrewingStand.h index d5eefb855..7be57763c 100644 --- a/src/Items/ItemBrewingStand.h +++ b/src/Items/ItemBrewingStand.h @@ -25,7 +25,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemCake.h b/src/Items/ItemCake.h index 48e23ed59..d1cb091b6 100644 --- a/src/Items/ItemCake.h +++ b/src/Items/ItemCake.h @@ -25,7 +25,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemCauldron.h b/src/Items/ItemCauldron.h index 07ae12660..9617c30ef 100644 --- a/src/Items/ItemCauldron.h +++ b/src/Items/ItemCauldron.h @@ -25,7 +25,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemComparator.h b/src/Items/ItemComparator.h index 60d9c3648..fc843c186 100644 --- a/src/Items/ItemComparator.h +++ b/src/Items/ItemComparator.h @@ -24,7 +24,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemDoor.h b/src/Items/ItemDoor.h index f3677c28c..c1b439024 100644 --- a/src/Items/ItemDoor.h +++ b/src/Items/ItemDoor.h @@ -25,7 +25,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override @@ -33,8 +33,8 @@ public: a_BlockType = (m_ItemType == E_ITEM_WOODEN_DOOR) ? E_BLOCK_WOODEN_DOOR : E_BLOCK_IRON_DOOR; cChunkInterface ChunkInterface(a_World->GetChunkMap()); bool Meta = BlockHandler(a_BlockType)->GetPlacementBlockTypeMeta( - ChunkInterface, a_Player, - a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, + ChunkInterface, a_Player, + a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta ); diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h index 435d8ccf4..0c07cd422 100644 --- a/src/Items/ItemFishingRod.h +++ b/src/Items/ItemFishingRod.h @@ -210,7 +210,7 @@ public: if (FishType <= 1) // Clownfish has a 2% chance of spawning { Drops.Add(cItem(E_ITEM_RAW_FISH, 1, E_META_RAW_FISH_CLOWNFISH)); - } + } else if (FishType <= 12) // Pufferfish has a 13% chance of spawning { Drops.Add(cItem(E_ITEM_RAW_FISH, 1, E_META_RAW_FISH_CLOWNFISH)); diff --git a/src/Items/ItemFlowerPot.h b/src/Items/ItemFlowerPot.h index 60bf87985..320dce997 100644 --- a/src/Items/ItemFlowerPot.h +++ b/src/Items/ItemFlowerPot.h @@ -25,7 +25,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index c261ce0e8..3e02a43fa 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -458,7 +458,7 @@ char cItemHandler::GetMaxStackSize(void) bool cItemHandler::IsTool() { // TODO: Rewrite this to list all tools specifically - return + return (m_ItemType >= 256 && m_ItemType <= 259) || (m_ItemType == 261) || (m_ItemType >= 267 && m_ItemType <= 279) @@ -525,7 +525,7 @@ bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType) bool cItemHandler::GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) @@ -542,7 +542,7 @@ bool cItemHandler::GetPlacementBlockTypeMeta( cChunkInterface ChunkInterface(a_World->GetChunkMap()); return BlockH->GetPlacementBlockTypeMeta( ChunkInterface, a_Player, - a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, + a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta ); diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h index b33671c2d..3ea04d1cb 100644 --- a/src/Items/ItemHandler.h +++ b/src/Items/ItemHandler.h @@ -28,7 +28,7 @@ public: virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir); /** Called when the client sends the SHOOT status in the lclk packet */ - virtual void OnItemShoot(cPlayer *, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) + virtual void OnItemShoot(cPlayer *, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) { UNUSED(a_BlockX); UNUSED(a_BlockY); @@ -97,7 +97,7 @@ public: */ virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ); diff --git a/src/Items/ItemLeaves.h b/src/Items/ItemLeaves.h index 0ed6e5e0e..f48126dc5 100644 --- a/src/Items/ItemLeaves.h +++ b/src/Items/ItemLeaves.h @@ -20,7 +20,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemMobHead.h b/src/Items/ItemMobHead.h index 5ae040282..4c36fe8d8 100644 --- a/src/Items/ItemMobHead.h +++ b/src/Items/ItemMobHead.h @@ -26,7 +26,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemNetherWart.h b/src/Items/ItemNetherWart.h index a6a9a286a..10a0864b5 100644 --- a/src/Items/ItemNetherWart.h +++ b/src/Items/ItemNetherWart.h @@ -25,7 +25,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemRedstoneDust.h b/src/Items/ItemRedstoneDust.h index 33e386b03..a2289239c 100644 --- a/src/Items/ItemRedstoneDust.h +++ b/src/Items/ItemRedstoneDust.h @@ -22,7 +22,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemRedstoneRepeater.h b/src/Items/ItemRedstoneRepeater.h index c5fb5d566..13a797d00 100644 --- a/src/Items/ItemRedstoneRepeater.h +++ b/src/Items/ItemRedstoneRepeater.h @@ -24,7 +24,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemSapling.h b/src/Items/ItemSapling.h index 61b1a32be..dbcb12be5 100644 --- a/src/Items/ItemSapling.h +++ b/src/Items/ItemSapling.h @@ -20,7 +20,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemSeeds.h b/src/Items/ItemSeeds.h index 53f5d51c3..4c9e82ae0 100644 --- a/src/Items/ItemSeeds.h +++ b/src/Items/ItemSeeds.h @@ -30,7 +30,7 @@ public: case E_ITEM_CARROT: case E_ITEM_POTATO: return true; default: return false; - } + } } virtual FoodInfo GetFoodInfo(void) override @@ -45,7 +45,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemSign.h b/src/Items/ItemSign.h index 60cf0f5f8..235a4fa93 100644 --- a/src/Items/ItemSign.h +++ b/src/Items/ItemSign.h @@ -27,7 +27,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Items/ItemSugarcane.h b/src/Items/ItemSugarcane.h index e891cc367..dd2e2ece3 100644 --- a/src/Items/ItemSugarcane.h +++ b/src/Items/ItemSugarcane.h @@ -23,7 +23,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cWorld * a_World, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override -- cgit v1.2.3 From d0cc9aedb3e63d39324c52b6385406f362ab41b7 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:59:02 +0200 Subject: More trailing whitespace fixes. --- src/Items/ItemBucket.h | 8 ++++---- src/Items/ItemHandler.h | 2 +- src/Items/ItemSeeds.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Items') diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index 4cdfab0fe..6d7926fa4 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -94,7 +94,7 @@ public: bool PlaceFluid(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_FluidBlock) - { + { if (a_BlockFace != BLOCK_FACE_NONE) { return false; @@ -209,14 +209,14 @@ public: } m_Pos.Set(a_BlockX, a_BlockY, a_BlockZ); // (Block could be washed away, replace it) return true; // Abort tracing - } + } return false; } } Callbacks; cLineBlockTracer Tracer(*a_World, Callbacks); Vector3d Start(a_Player->GetEyePosition()); - Vector3d End(a_Player->GetEyePosition() + a_Player->GetLookVector() * 5); + Vector3d End(a_Player->GetEyePosition() + a_Player->GetLookVector() * 5); // cTracer::Trace returns true when whole line was traversed. By returning true when we hit something, we ensure that this never happens if liquid could be placed // Use this to judge whether the position is valid @@ -227,6 +227,6 @@ public: return true; } - return false; + return false; } }; diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h index 3ea04d1cb..c7362c5f4 100644 --- a/src/Items/ItemHandler.h +++ b/src/Items/ItemHandler.h @@ -91,7 +91,7 @@ public: /** Can the anvil repair this item, when a_Item is the second input? */ virtual bool CanRepairWithRawMaterial(short a_ItemType); - /** Called before a block is placed into a world. + /** Called before a block is placed into a world. The handler should return true to allow placement, false to refuse. Also, the handler should set a_BlockType and a_BlockMeta to correct values for the newly placed block. */ diff --git a/src/Items/ItemSeeds.h b/src/Items/ItemSeeds.h index 4c9e82ae0..54a1183d7 100644 --- a/src/Items/ItemSeeds.h +++ b/src/Items/ItemSeeds.h @@ -40,7 +40,7 @@ public: case E_ITEM_CARROT: return FoodInfo(4, 4.8); case E_ITEM_POTATO: return FoodInfo(1, 0.6); default: return FoodInfo(0, 0); - } + } } virtual bool GetPlacementBlockTypeMeta( -- cgit v1.2.3 From c03161f75d22a7965aea20fb9843ae580a07079a Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 23:15:53 +0200 Subject: Fixed tabs used for alignment. --- src/Items/ItemFishingRod.h | 2 +- src/Items/ItemHandler.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/Items') diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h index 0c07cd422..6350a38ba 100644 --- a/src/Items/ItemFishingRod.h +++ b/src/Items/ItemFishingRod.h @@ -63,7 +63,7 @@ class cSweepEntityCallback : { public: cSweepEntityCallback(Vector3d a_PlayerPos) : - m_PlayerPos(a_PlayerPos) + m_PlayerPos(a_PlayerPos) { } diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index 3e02a43fa..178bc2fca 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -459,13 +459,13 @@ bool cItemHandler::IsTool() { // TODO: Rewrite this to list all tools specifically return - (m_ItemType >= 256 && m_ItemType <= 259) - || (m_ItemType == 261) - || (m_ItemType >= 267 && m_ItemType <= 279) - || (m_ItemType >= 283 && m_ItemType <= 286) - || (m_ItemType >= 290 && m_ItemType <= 294) - || (m_ItemType == 325) - || (m_ItemType == 346); + ((m_ItemType >= 256) && (m_ItemType <= 259)) || + (m_ItemType == 261) || + ((m_ItemType >= 267) && (m_ItemType <= 279)) || + ((m_ItemType >= 283) && (m_ItemType <= 286)) || + ((m_ItemType >= 290) && (m_ItemType <= 294)) || + (m_ItemType == 325) || + (m_ItemType == 346); } -- cgit v1.2.3 From eeacb6f2223f88a64ce877458c58fa60194e45a6 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 18 Jul 2014 02:19:30 +0200 Subject: Added a extra wall sign handler. Fixes #1119 --- src/Items/ItemSign.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Items') diff --git a/src/Items/ItemSign.h b/src/Items/ItemSign.h index 235a4fa93..0fa0fa0be 100644 --- a/src/Items/ItemSign.h +++ b/src/Items/ItemSign.h @@ -3,7 +3,8 @@ #include "ItemHandler.h" #include "../World.h" -#include "../Blocks/BlockSign.h" +#include "../Blocks/BlockSignPost.h" +#include "../Blocks/BlockWallSign.h" @@ -34,12 +35,12 @@ public: { if (a_BlockFace == BLOCK_FACE_TOP) { - a_BlockMeta = cBlockSignHandler::RotationToMetaData(a_Player->GetYaw()); + a_BlockMeta = cBlockSignPostHandler::RotationToMetaData(a_Player->GetYaw()); a_BlockType = E_BLOCK_SIGN_POST; } else { - a_BlockMeta = cBlockSignHandler::DirectionToMetaData(a_BlockFace); + a_BlockMeta = cBlockWallSignHandler::DirectionToMetaData(a_BlockFace); a_BlockType = E_BLOCK_WALLSIGN; } return true; -- cgit v1.2.3 From 465743757a4847b860d932a20c3a7570aec6bec5 Mon Sep 17 00:00:00 2001 From: archshift Date: Thu, 17 Jul 2014 23:59:33 -0700 Subject: Items/CMakeLists.txt: Replaced glob with list of files --- src/Items/CMakeLists.txt | 52 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) (limited to 'src/Items') diff --git a/src/Items/CMakeLists.txt b/src/Items/CMakeLists.txt index a6fe6ea70..0c15a6944 100644 --- a/src/Items/CMakeLists.txt +++ b/src/Items/CMakeLists.txt @@ -4,9 +4,51 @@ project (MCServer) include_directories ("${PROJECT_SOURCE_DIR}/../") -file(GLOB SOURCE - "*.cpp" - "*.h" -) +SET (SRCS + ItemHandler.cpp) -add_library(Items ${SOURCE}) +SET (HDRS + ItemArmor.h + ItemBed.h + ItemBoat.h + ItemBow.h + ItemBrewingStand.h + ItemBucket.h + ItemCake.h + ItemCauldron.h + ItemCloth.h + ItemComparator.h + ItemDoor.h + ItemDye.h + ItemEmptyMap.h + ItemFishingRod.h + ItemFlowerPot.h + ItemFood.h + ItemHandler.h + ItemHoe.h + ItemItemFrame.h + ItemLeaves.h + ItemLighter.h + ItemLilypad.h + ItemMap.h + ItemMilk.h + ItemMinecart.h + ItemMobHead.h + ItemNetherWart.h + ItemPainting.h + ItemPickaxe.h + ItemPotion.h + ItemRedstoneDust.h + ItemRedstoneRepeater.h + ItemSapling.h + ItemSeeds.h + ItemShears.h + ItemShovel.h + ItemSign.h + ItemSpawnEgg.h + ItemString.h + ItemSugarcane.h + ItemSword.h + ItemThrowable.h) + +add_library(Items ${SRCS} ${HDRS}) -- cgit v1.2.3 From 725d1fd1e2995b1720673c280fea1125ac338b3c Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 18 Jul 2014 13:26:43 -0700 Subject: Subdirs: Only add_library if not using MSVC --- src/Items/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Items') diff --git a/src/Items/CMakeLists.txt b/src/Items/CMakeLists.txt index 0c15a6944..12a467672 100644 --- a/src/Items/CMakeLists.txt +++ b/src/Items/CMakeLists.txt @@ -51,4 +51,6 @@ SET (HDRS ItemSword.h ItemThrowable.h) -add_library(Items ${SRCS} ${HDRS}) +if(NOT MSVC) + add_library(Items ${SRCS} ${HDRS}) +endif() -- cgit v1.2.3 From f5bcfdc58c7b5d69abbb222787bb2229c0b54088 Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 19 Jul 2014 02:51:39 -0700 Subject: Splash potions: Renamed PotionParticleType to PotionColor for clarity --- src/Items/ItemPotion.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Items') diff --git a/src/Items/ItemPotion.h b/src/Items/ItemPotion.h index f3afbf99b..f16d89b39 100644 --- a/src/Items/ItemPotion.h +++ b/src/Items/ItemPotion.h @@ -17,8 +17,8 @@ public: } - /** Returns the potion particle type (used by the client for visuals), based on the potion's damage value */ - static int GetPotionParticleType(short a_ItemDamage) + /** Returns the potion color (used by the client for visuals), based on the potion's damage value */ + static int GetPotionColor(short a_ItemDamage) { // Lowest six bits return (a_ItemDamage & 0x3f); @@ -156,7 +156,7 @@ public: cSplashPotionEntity * Projectile = new cSplashPotionEntity( a_Player, Pos.x, Pos.y, Pos.z, Speed, GetEntityEffectType(PotionDamage), cEntityEffect(GetEntityEffectDuration(PotionDamage), - GetEntityEffectIntensity(PotionDamage)), GetPotionParticleType(PotionDamage) + GetEntityEffectIntensity(PotionDamage)), GetPotionColor(PotionDamage) ); if (Projectile == NULL) { -- cgit v1.2.3 From 00c524519ef6c7ceaf4ac91307617cfd65d7cf21 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 19 Jul 2014 14:53:41 +0200 Subject: Fixed style: spaces after commas. --- src/Items/ItemBucket.h | 2 +- src/Items/ItemShovel.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Items') diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index 6d7926fa4..a17c4838b 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -117,7 +117,7 @@ public: return false; } cItem Item(E_ITEM_BUCKET, 1); - if (!a_Player->GetInventory().AddItem(Item,true,true)) + if (!a_Player->GetInventory().AddItem(Item, true, true)) { return false; } diff --git a/src/Items/ItemShovel.h b/src/Items/ItemShovel.h index 333ba46e8..78cfe26fe 100644 --- a/src/Items/ItemShovel.h +++ b/src/Items/ItemShovel.h @@ -28,7 +28,7 @@ public: { cChunkInterface ChunkInterface(a_World->GetChunkMap()); cBlockInServerPluginInterface PluginInterface(*a_World); - BlockHandler(Block)->DropBlock(ChunkInterface,*a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ); + BlockHandler(Block)->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ); a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); a_Player->UseEquippedItem(); -- cgit v1.2.3