Added cItemHandler::GetMaxStackSize() with a very basic implementation
git-svn-id: http://mc-server.googlecode.com/svn/trunk@726 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
ecf6217ae9
commit
15a5031885
@ -237,6 +237,22 @@ void cItemHandler::OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char cItemHandler::GetMaxStackSize(void)
|
||||||
|
{
|
||||||
|
if (m_ItemID < 256)
|
||||||
|
{
|
||||||
|
// All blocks can stack up to 64
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default items don't stack:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cItemHandler::IsTool()
|
bool cItemHandler::IsTool()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../Defines.h"
|
#include "../Defines.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// fwd:
|
||||||
class cWorld;
|
class cWorld;
|
||||||
class cPlayer;
|
class cPlayer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cItemHandler
|
class cItemHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -14,6 +23,9 @@ public:
|
|||||||
virtual void OnBlockDestroyed(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z);
|
virtual void OnBlockDestroyed(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_X, int a_Y, int a_Z);
|
||||||
virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item);
|
virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item);
|
||||||
|
|
||||||
|
/// Returns the maximum stack size for a given item
|
||||||
|
virtual char GetMaxStackSize(void);
|
||||||
|
|
||||||
struct FoodInfo
|
struct FoodInfo
|
||||||
{
|
{
|
||||||
FoodInfo(short a_FoodLevel, float a_Saturation, char a_PoisionChance = 0)
|
FoodInfo(short a_FoodLevel, float a_Saturation, char a_PoisionChance = 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user