1
0

cPickup now uses full cItem, instead of a pointer

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1114 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-12-28 02:45:20 +00:00
parent 4ce5f215ed
commit 0cc3ab7c1e
6 changed files with 45 additions and 108 deletions

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: AllToLua ** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 12/22/12 19:15:15. ** Generated automatically by tolua++-1.0.92 on 12/28/12 15:46:17.
*/ */
#ifndef __cplusplus #ifndef __cplusplus
@ -16168,15 +16168,15 @@ static int tolua_AllToLua_cPickup_new00(lua_State* tolua_S)
else else
#endif #endif
{ {
int a_X = ((int) tolua_tonumber(tolua_S,2,0)); int a_MicroPosX = ((int) tolua_tonumber(tolua_S,2,0));
int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); int a_MicroPosY = ((int) tolua_tonumber(tolua_S,3,0));
int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); int a_MicroPosZ = ((int) tolua_tonumber(tolua_S,4,0));
const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0)); const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0));
float a_SpeedX = ((float) tolua_tonumber(tolua_S,6,0.f)); float a_SpeedX = ((float) tolua_tonumber(tolua_S,6,0.f));
float a_SpeedY = ((float) tolua_tonumber(tolua_S,7,0.f)); float a_SpeedY = ((float) tolua_tonumber(tolua_S,7,0.f));
float a_SpeedZ = ((float) tolua_tonumber(tolua_S,8,0.f)); float a_SpeedZ = ((float) tolua_tonumber(tolua_S,8,0.f));
{ {
cPickup* tolua_ret = (cPickup*) Mtolua_new((cPickup)(a_X,a_Y,a_Z,*a_Item,a_SpeedX,a_SpeedY,a_SpeedZ)); cPickup* tolua_ret = (cPickup*) Mtolua_new((cPickup)(a_MicroPosX,a_MicroPosY,a_MicroPosZ,*a_Item,a_SpeedX,a_SpeedY,a_SpeedZ));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPickup"); tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPickup");
} }
} }
@ -16210,15 +16210,15 @@ static int tolua_AllToLua_cPickup_new00_local(lua_State* tolua_S)
else else
#endif #endif
{ {
int a_X = ((int) tolua_tonumber(tolua_S,2,0)); int a_MicroPosX = ((int) tolua_tonumber(tolua_S,2,0));
int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); int a_MicroPosY = ((int) tolua_tonumber(tolua_S,3,0));
int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); int a_MicroPosZ = ((int) tolua_tonumber(tolua_S,4,0));
const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0)); const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0));
float a_SpeedX = ((float) tolua_tonumber(tolua_S,6,0.f)); float a_SpeedX = ((float) tolua_tonumber(tolua_S,6,0.f));
float a_SpeedY = ((float) tolua_tonumber(tolua_S,7,0.f)); float a_SpeedY = ((float) tolua_tonumber(tolua_S,7,0.f));
float a_SpeedZ = ((float) tolua_tonumber(tolua_S,8,0.f)); float a_SpeedZ = ((float) tolua_tonumber(tolua_S,8,0.f));
{ {
cPickup* tolua_ret = (cPickup*) Mtolua_new((cPickup)(a_X,a_Y,a_Z,*a_Item,a_SpeedX,a_SpeedY,a_SpeedZ)); cPickup* tolua_ret = (cPickup*) Mtolua_new((cPickup)(a_MicroPosX,a_MicroPosY,a_MicroPosZ,*a_Item,a_SpeedX,a_SpeedY,a_SpeedZ));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPickup"); tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPickup");
tolua_register_gc(tolua_S,lua_gettop(tolua_S)); tolua_register_gc(tolua_S,lua_gettop(tolua_S));
} }
@ -16232,35 +16232,6 @@ static int tolua_AllToLua_cPickup_new00_local(lua_State* tolua_S)
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
/* method: delete of class cPickup */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_delete00
static int tolua_AllToLua_cPickup_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPickup",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cPickup* self = (cPickup*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetItem of class cPickup */ /* method: GetItem of class cPickup */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_GetItem00 #ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_GetItem00
static int tolua_AllToLua_cPickup_GetItem00(lua_State* tolua_S) static int tolua_AllToLua_cPickup_GetItem00(lua_State* tolua_S)
@ -16280,8 +16251,8 @@ static int tolua_AllToLua_cPickup_GetItem00(lua_State* tolua_S)
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetItem'", NULL); if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetItem'", NULL);
#endif #endif
{ {
cItem* tolua_ret = (cItem*) self->GetItem(); cItem& tolua_ret = (cItem&) self->GetItem();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem");
} }
} }
return 1; return 1;
@ -16429,7 +16400,7 @@ public:
void cPickup__SpawnOn( cClientHandle& a_Client) { void cPickup__SpawnOn( cClientHandle& a_Client) {
return ( void )cPickup::SpawnOn(a_Client); return ( void )cPickup::SpawnOn(a_Client);
}; };
Lua__cPickup( int a_X, int a_Y, int a_Z, const cItem& a_Item, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f): cPickup(a_X,a_Y,a_Z,a_Item,a_SpeedX,a_SpeedY,a_SpeedZ){}; Lua__cPickup( int a_MicroPosX, int a_MicroPosY, int a_MicroPosZ, const cItem& a_Item, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f): cPickup(a_MicroPosX,a_MicroPosY,a_MicroPosZ,a_Item,a_SpeedX,a_SpeedY,a_SpeedZ){};
}; };
/* method: tolua__set_instance of class Lua__cPickup */ /* method: tolua__set_instance of class Lua__cPickup */
@ -16520,15 +16491,15 @@ static int tolua_AllToLua_Lua__cPickup_new00(lua_State* tolua_S)
else else
#endif #endif
{ {
int a_X = ((int) tolua_tonumber(tolua_S,2,0)); int a_MicroPosX = ((int) tolua_tonumber(tolua_S,2,0));
int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); int a_MicroPosY = ((int) tolua_tonumber(tolua_S,3,0));
int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); int a_MicroPosZ = ((int) tolua_tonumber(tolua_S,4,0));
const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0)); const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0));
float a_SpeedX = ((float) tolua_tonumber(tolua_S,6,0.f)); float a_SpeedX = ((float) tolua_tonumber(tolua_S,6,0.f));
float a_SpeedY = ((float) tolua_tonumber(tolua_S,7,0.f)); float a_SpeedY = ((float) tolua_tonumber(tolua_S,7,0.f));
float a_SpeedZ = ((float) tolua_tonumber(tolua_S,8,0.f)); float a_SpeedZ = ((float) tolua_tonumber(tolua_S,8,0.f));
{ {
Lua__cPickup* tolua_ret = (Lua__cPickup*) Mtolua_new((Lua__cPickup)(a_X,a_Y,a_Z,*a_Item,a_SpeedX,a_SpeedY,a_SpeedZ)); Lua__cPickup* tolua_ret = (Lua__cPickup*) Mtolua_new((Lua__cPickup)(a_MicroPosX,a_MicroPosY,a_MicroPosZ,*a_Item,a_SpeedX,a_SpeedY,a_SpeedZ));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"Lua__cPickup"); tolua_pushusertype(tolua_S,(void*)tolua_ret,"Lua__cPickup");
} }
} }
@ -16562,15 +16533,15 @@ static int tolua_AllToLua_Lua__cPickup_new00_local(lua_State* tolua_S)
else else
#endif #endif
{ {
int a_X = ((int) tolua_tonumber(tolua_S,2,0)); int a_MicroPosX = ((int) tolua_tonumber(tolua_S,2,0));
int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); int a_MicroPosY = ((int) tolua_tonumber(tolua_S,3,0));
int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); int a_MicroPosZ = ((int) tolua_tonumber(tolua_S,4,0));
const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0)); const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0));
float a_SpeedX = ((float) tolua_tonumber(tolua_S,6,0.f)); float a_SpeedX = ((float) tolua_tonumber(tolua_S,6,0.f));
float a_SpeedY = ((float) tolua_tonumber(tolua_S,7,0.f)); float a_SpeedY = ((float) tolua_tonumber(tolua_S,7,0.f));
float a_SpeedZ = ((float) tolua_tonumber(tolua_S,8,0.f)); float a_SpeedZ = ((float) tolua_tonumber(tolua_S,8,0.f));
{ {
Lua__cPickup* tolua_ret = (Lua__cPickup*) Mtolua_new((Lua__cPickup)(a_X,a_Y,a_Z,*a_Item,a_SpeedX,a_SpeedY,a_SpeedZ)); Lua__cPickup* tolua_ret = (Lua__cPickup*) Mtolua_new((Lua__cPickup)(a_MicroPosX,a_MicroPosY,a_MicroPosZ,*a_Item,a_SpeedX,a_SpeedY,a_SpeedZ));
tolua_pushusertype(tolua_S,(void*)tolua_ret,"Lua__cPickup"); tolua_pushusertype(tolua_S,(void*)tolua_ret,"Lua__cPickup");
tolua_register_gc(tolua_S,lua_gettop(tolua_S)); tolua_register_gc(tolua_S,lua_gettop(tolua_S));
} }
@ -16584,35 +16555,6 @@ static int tolua_AllToLua_Lua__cPickup_new00_local(lua_State* tolua_S)
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
/* method: delete of class Lua__cPickup */
#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPickup_delete00
static int tolua_AllToLua_Lua__cPickup_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Lua__cPickup",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
Lua__cPickup* self = (Lua__cPickup*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
#endif
Mtolua_delete(self);
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* function to release collected object via destructor */ /* function to release collected object via destructor */
#ifdef __cplusplus #ifdef __cplusplus
@ -23969,6 +23911,10 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_ITEM_BOOK_AND_QUILL",E_ITEM_BOOK_AND_QUILL); tolua_constant(tolua_S,"E_ITEM_BOOK_AND_QUILL",E_ITEM_BOOK_AND_QUILL);
tolua_constant(tolua_S,"E_ITEM_WRITTEN_BOOK",E_ITEM_WRITTEN_BOOK); tolua_constant(tolua_S,"E_ITEM_WRITTEN_BOOK",E_ITEM_WRITTEN_BOOK);
tolua_constant(tolua_S,"E_ITEM_EMERALD",E_ITEM_EMERALD); tolua_constant(tolua_S,"E_ITEM_EMERALD",E_ITEM_EMERALD);
tolua_constant(tolua_S,"E_ITEM_FLOWER_POT",E_ITEM_FLOWER_POT);
tolua_constant(tolua_S,"E_ITEM_FIREWORK_ROCKET",E_ITEM_FIREWORK_ROCKET);
tolua_constant(tolua_S,"E_ITEM_FIREWORK_STAR",E_ITEM_FIREWORK_STAR);
tolua_constant(tolua_S,"E_ITEM_ENCHANTED_BOOK",E_ITEM_ENCHANTED_BOOK);
tolua_constant(tolua_S,"E_ITEM_13_DISC",E_ITEM_13_DISC); tolua_constant(tolua_S,"E_ITEM_13_DISC",E_ITEM_13_DISC);
tolua_constant(tolua_S,"E_ITEM_CAT_DISC",E_ITEM_CAT_DISC); tolua_constant(tolua_S,"E_ITEM_CAT_DISC",E_ITEM_CAT_DISC);
tolua_constant(tolua_S,"E_ITEM_BLOCKS_DISC",E_ITEM_BLOCKS_DISC); tolua_constant(tolua_S,"E_ITEM_BLOCKS_DISC",E_ITEM_BLOCKS_DISC);
@ -24030,6 +23976,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_COBBLESTONE",E_META_DOUBLE_STEP_COBBLESTONE); tolua_constant(tolua_S,"E_META_DOUBLE_STEP_COBBLESTONE",E_META_DOUBLE_STEP_COBBLESTONE);
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_BRICK",E_META_DOUBLE_STEP_BRICK); tolua_constant(tolua_S,"E_META_DOUBLE_STEP_BRICK",E_META_DOUBLE_STEP_BRICK);
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_BRICK",E_META_DOUBLE_STEP_STONE_BRICK); tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_BRICK",E_META_DOUBLE_STEP_STONE_BRICK);
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_NETHER_BRICK",E_META_DOUBLE_STEP_NETHER_BRICK);
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_SECRET",E_META_DOUBLE_STEP_STONE_SECRET); tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_SECRET",E_META_DOUBLE_STEP_STONE_SECRET);
tolua_constant(tolua_S,"E_META_STEP_STONE",E_META_STEP_STONE); tolua_constant(tolua_S,"E_META_STEP_STONE",E_META_STEP_STONE);
tolua_constant(tolua_S,"E_META_STEP_SANDSTONE",E_META_STEP_SANDSTONE); tolua_constant(tolua_S,"E_META_STEP_SANDSTONE",E_META_STEP_SANDSTONE);
@ -24037,6 +23984,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_META_STEP_COBBLESTONE",E_META_STEP_COBBLESTONE); tolua_constant(tolua_S,"E_META_STEP_COBBLESTONE",E_META_STEP_COBBLESTONE);
tolua_constant(tolua_S,"E_META_STEP_BRICK",E_META_STEP_BRICK); tolua_constant(tolua_S,"E_META_STEP_BRICK",E_META_STEP_BRICK);
tolua_constant(tolua_S,"E_META_STEP_STONE_BRICK",E_META_STEP_STONE_BRICK); tolua_constant(tolua_S,"E_META_STEP_STONE_BRICK",E_META_STEP_STONE_BRICK);
tolua_constant(tolua_S,"E_META_STEP_NETHER_BRICK",E_META_STEP_NETHER_BRICK);
tolua_constant(tolua_S,"E_META_STEP_STONE_SECRET",E_META_STEP_STONE_SECRET); tolua_constant(tolua_S,"E_META_STEP_STONE_SECRET",E_META_STEP_STONE_SECRET);
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE",E_META_SILVERFISH_EGG_STONE); tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE",E_META_SILVERFISH_EGG_STONE);
tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_COBBLESTONE",E_META_SILVERFISH_EGG_COBBLESTONE); tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_COBBLESTONE",E_META_SILVERFISH_EGG_COBBLESTONE);
@ -24718,7 +24666,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"new",tolua_AllToLua_cPickup_new00); tolua_function(tolua_S,"new",tolua_AllToLua_cPickup_new00);
tolua_function(tolua_S,"new_local",tolua_AllToLua_cPickup_new00_local); tolua_function(tolua_S,"new_local",tolua_AllToLua_cPickup_new00_local);
tolua_function(tolua_S,".call",tolua_AllToLua_cPickup_new00_local); tolua_function(tolua_S,".call",tolua_AllToLua_cPickup_new00_local);
tolua_function(tolua_S,"delete",tolua_AllToLua_cPickup_delete00);
tolua_function(tolua_S,"GetItem",tolua_AllToLua_cPickup_GetItem00); tolua_function(tolua_S,"GetItem",tolua_AllToLua_cPickup_GetItem00);
tolua_function(tolua_S,"CollectedBy",tolua_AllToLua_cPickup_CollectedBy00); tolua_function(tolua_S,"CollectedBy",tolua_AllToLua_cPickup_CollectedBy00);
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);
@ -24733,7 +24680,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"new",tolua_AllToLua_Lua__cPickup_new00); tolua_function(tolua_S,"new",tolua_AllToLua_Lua__cPickup_new00);
tolua_function(tolua_S,"new_local",tolua_AllToLua_Lua__cPickup_new00_local); tolua_function(tolua_S,"new_local",tolua_AllToLua_Lua__cPickup_new00_local);
tolua_function(tolua_S,".call",tolua_AllToLua_Lua__cPickup_new00_local); tolua_function(tolua_S,".call",tolua_AllToLua_Lua__cPickup_new00_local);
tolua_function(tolua_S,"delete",tolua_AllToLua_Lua__cPickup_delete00);
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cRoot","cRoot","",NULL); tolua_cclass(tolua_S,"cRoot","cRoot","",NULL);
tolua_beginmodule(tolua_S,"cRoot"); tolua_beginmodule(tolua_S,"cRoot");

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: AllToLua ** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 12/22/12 19:15:16. ** Generated automatically by tolua++-1.0.92 on 12/28/12 15:46:18.
*/ */
/* Exported function */ /* Exported function */

View File

@ -24,13 +24,13 @@
cPickup::cPickup(int a_X, int a_Y, int a_Z, const cItem & a_Item, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */) cPickup::cPickup(int a_MicroPosX, int a_MicroPosY, int a_MicroPosZ, const cItem & a_Item, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */)
: cEntity(etPickup, ((double)(a_X))/32, ((double)(a_Y))/32, ((double)(a_Z))/32 ) : cEntity(etPickup, ((double)(a_MicroPosX)) / 32, ((double)(a_MicroPosY)) / 32, ((double)(a_MicroPosZ)) / 32)
, m_Speed( a_SpeedX, a_SpeedY, a_SpeedZ ) , m_Speed( a_SpeedX, a_SpeedY, a_SpeedZ )
, m_bOnGround( false ) , m_bOnGround( false )
, m_bReplicated( false ) , m_bReplicated( false )
, m_Timer( 0.f ) , m_Timer( 0.f )
, m_Item( new cItem( a_Item ) ) , m_Item(a_Item)
, m_bCollected( false ) , m_bCollected( false )
{ {
} }
@ -39,15 +39,6 @@ cPickup::cPickup(int a_X, int a_Y, int a_Z, const cItem & a_Item, float a_SpeedX
cPickup::~cPickup()
{
delete m_Item;
}
void cPickup::Initialize(cWorld * a_World) void cPickup::Initialize(cWorld * a_World)
{ {
super::Initialize(a_World); super::Initialize(a_World);
@ -244,15 +235,15 @@ bool cPickup::CollectedBy(cPlayer * a_Dest)
return false; return false;
} }
if (a_Dest->GetInventory().AddItemAnyAmount(*m_Item)) if (a_Dest->GetInventory().AddItemAnyAmount(m_Item))
{ {
m_World->BroadcastCollectPickup(*this, *a_Dest); m_World->BroadcastCollectPickup(*this, *a_Dest);
m_bCollected = true; m_bCollected = true;
m_Timer = 0; m_Timer = 0;
if (m_Item->m_ItemCount != 0) if (m_Item.m_ItemCount != 0)
{ {
cItems Pickup; cItems Pickup;
Pickup.push_back(cItem(*m_Item)); Pickup.push_back(cItem(m_Item));
m_World->SpawnItemPickups(Pickup, m_Pos.x, m_Pos.y, m_Pos.z); m_World->SpawnItemPickups(Pickup, m_Pos.x, m_Pos.y, m_Pos.z);
} }
return true; return true;

View File

@ -2,12 +2,13 @@
#pragma once #pragma once
#include "Entity.h" #include "Entity.h"
#include "Item.h"
class cPlayer; class cPlayer;
class cItem;
@ -23,13 +24,12 @@ class cPickup :
public: public:
CLASS_PROTODEF(cPickup); CLASS_PROTODEF(cPickup);
cPickup(int a_X, int a_Y, int a_Z, const cItem & a_Item, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f); //tolua_export cPickup(int a_MicroPosX, int a_MicroPosY, int a_MicroPosZ, const cItem & a_Item, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f); //tolua_export
~cPickup(); //tolua_export
virtual void Initialize(cWorld * a_World) override; virtual void Initialize(cWorld * a_World) override;
cItem * GetItem(void) {return m_Item; } //tolua_export cItem & GetItem(void) {return m_Item; } //tolua_export
const cItem * GetItem(void) const {return m_Item; } const cItem & GetItem(void) const {return m_Item; }
virtual void SpawnOn(cClientHandle & a_ClientHandle) override; virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
@ -51,7 +51,7 @@ private:
float m_Timer; float m_Timer;
cItem* m_Item; cItem m_Item;
bool m_bCollected; bool m_bCollected;
}; //tolua_export }; //tolua_export

View File

@ -477,9 +477,9 @@ void cProtocol125::SendPickupSpawn(const cPickup & a_Pickup)
cCSLock Lock(m_CSPacket); cCSLock Lock(m_CSPacket);
WriteByte (PACKET_PICKUP_SPAWN); WriteByte (PACKET_PICKUP_SPAWN);
WriteInt (a_Pickup.GetUniqueID()); WriteInt (a_Pickup.GetUniqueID());
WriteShort (a_Pickup.GetItem()->m_ItemType); WriteShort (a_Pickup.GetItem().m_ItemType);
WriteByte (a_Pickup.GetItem()->m_ItemCount); WriteByte (a_Pickup.GetItem().m_ItemCount);
WriteShort (a_Pickup.GetItem()->m_ItemDamage); WriteShort (a_Pickup.GetItem().m_ItemDamage);
WriteVectorI((Vector3i)(a_Pickup.GetPosition() * 32)); WriteVectorI((Vector3i)(a_Pickup.GetPosition() * 32));
WriteByte ((char)(a_Pickup.GetSpeed().x * 8)); WriteByte ((char)(a_Pickup.GetSpeed().x * 8));
WriteByte ((char)(a_Pickup.GetSpeed().y * 8)); WriteByte ((char)(a_Pickup.GetSpeed().y * 8));

View File

@ -98,7 +98,7 @@ void cProtocol142::SendPickupSpawn(const cPickup & a_Pickup)
cCSLock Lock(m_CSPacket); cCSLock Lock(m_CSPacket);
WriteByte (PACKET_PICKUP_SPAWN); WriteByte (PACKET_PICKUP_SPAWN);
WriteInt (a_Pickup.GetUniqueID()); WriteInt (a_Pickup.GetUniqueID());
WriteItem (*(a_Pickup.GetItem())); WriteItem (a_Pickup.GetItem());
WriteVectorI((Vector3i)(a_Pickup.GetPosition() * 32)); WriteVectorI((Vector3i)(a_Pickup.GetPosition() * 32));
WriteByte ((char)(a_Pickup.GetSpeed().x * 8)); WriteByte ((char)(a_Pickup.GetSpeed().x * 8));
WriteByte ((char)(a_Pickup.GetSpeed().y * 8)); WriteByte ((char)(a_Pickup.GetSpeed().y * 8));
@ -155,7 +155,7 @@ cProtocol146::cProtocol146(cClientHandle * a_Client) :
void cProtocol146::SendPickupSpawn(const cPickup & a_Pickup) void cProtocol146::SendPickupSpawn(const cPickup & a_Pickup)
{ {
ASSERT(!a_Pickup.GetItem()->IsEmpty()); ASSERT(!a_Pickup.GetItem().IsEmpty());
cCSLock Lock(m_CSPacket); cCSLock Lock(m_CSPacket);
@ -177,7 +177,7 @@ void cProtocol146::SendPickupSpawn(const cPickup & a_Pickup)
WriteByte(PACKET_ENTITY_METADATA); WriteByte(PACKET_ENTITY_METADATA);
WriteInt(a_Pickup.GetUniqueID()); WriteInt(a_Pickup.GetUniqueID());
WriteByte(0xaa); // a slot value at index 10 WriteByte(0xaa); // a slot value at index 10
WriteItem(*a_Pickup.GetItem()); WriteItem(a_Pickup.GetItem());
WriteByte(0x7f); // End of metadata WriteByte(0x7f); // End of metadata
Flush(); Flush();
} }