Merge remote-tracking branch 'origin/ClearMetaMixin'
commit
639dfdb67d
|
@ -3,17 +3,19 @@
|
||||||
|
|
||||||
#include "BlockHandler.h"
|
#include "BlockHandler.h"
|
||||||
#include "../World.h"
|
#include "../World.h"
|
||||||
|
#include "ClearMetaOnDrop.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cBlockLadderHandler :
|
class cBlockLadderHandler :
|
||||||
public cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04>
|
public cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04> >
|
||||||
{
|
{
|
||||||
|
typedef cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04> > super;
|
||||||
public:
|
public:
|
||||||
cBlockLadderHandler(BLOCKTYPE a_BlockType)
|
cBlockLadderHandler(BLOCKTYPE a_BlockType)
|
||||||
: cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04>(a_BlockType)
|
: super(a_BlockType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,19 +8,14 @@
|
||||||
|
|
||||||
|
|
||||||
class cBlockLilypadHandler :
|
class cBlockLilypadHandler :
|
||||||
public cBlockHandler
|
public cClearMetaOnDrop<cBlockHandler>
|
||||||
{
|
{
|
||||||
|
typedef cClearMetaOnDrop<cBlockHandler> super;
|
||||||
public:
|
public:
|
||||||
cBlockLilypadHandler(BLOCKTYPE a_BlockType)
|
cBlockLilypadHandler(BLOCKTYPE a_BlockType)
|
||||||
: cBlockHandler(a_BlockType)
|
: super(a_BlockType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
|
||||||
{
|
|
||||||
// Reset meta to zero
|
|
||||||
a_Pickups.push_back(cItem(E_BLOCK_LILY_PAD, 1, 0));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
|
|
||||||
|
|
||||||
class cBlockPumpkinHandler :
|
class cBlockPumpkinHandler :
|
||||||
public cMetaRotator<cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01, false>
|
public cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01, false> >
|
||||||
{
|
{
|
||||||
|
typedef cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01, false> > super;
|
||||||
public:
|
public:
|
||||||
cBlockPumpkinHandler(BLOCKTYPE a_BlockType)
|
cBlockPumpkinHandler(BLOCKTYPE a_BlockType)
|
||||||
: cMetaRotator<cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01, false>(a_BlockType)
|
: super(a_BlockType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// mixin for use to clear meta values when the block is converted to a pickup
|
||||||
|
|
||||||
|
// Usage: inherit from this class, passing the parent class as the parameter Base
|
||||||
|
// For example to use in class Foo which should inherit Bar use
|
||||||
|
// class Foo : public cClearMetaOnDrop<Bar>;
|
||||||
|
|
||||||
|
template<class Base>
|
||||||
|
class cClearMetaOnDrop : public Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
cClearMetaOnDrop(BLOCKTYPE a_BlockType) :
|
||||||
|
Base(a_BlockType)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual ~cClearMetaOnDrop() {}
|
||||||
|
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||||
|
{
|
||||||
|
a_Pickups.push_back(cItem(this->m_BlockType));
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue