1
0

Basic style fixes.

This commit is contained in:
madmaxoft 2014-07-17 22:50:58 +02:00
parent 7a9f9ab744
commit 5e198c6730
130 changed files with 290 additions and 286 deletions

View File

@ -33,9 +33,7 @@
/**************************** // Better error reporting for Lua
* Better error reporting for Lua
**/
static int tolua_do_error(lua_State* L, const char * a_pMsg, tolua_Error * a_pToLuaError) static int tolua_do_error(lua_State* L, const char * a_pMsg, tolua_Error * a_pToLuaError)
{ {
// Retrieve current function name // Retrieve current function name
@ -81,10 +79,7 @@ static int lua_do_error(lua_State* L, const char * a_pFormat, ...)
/**************************** // Lua bound functions with special return types
* Lua bound functions with special return types
**/
static int tolua_StringSplit(lua_State * tolua_S) static int tolua_StringSplit(lua_State * tolua_S)
{ {
cLuaState LuaState(tolua_S); cLuaState LuaState(tolua_S);
@ -557,10 +552,12 @@ static int tolua_DoWithXYZ(lua_State* tolua_S)
template< class Ty1, template<
class Ty2, class Ty1,
bool (Ty1::*Func1)(int, int, cItemCallback<Ty2> &) > class Ty2,
static int tolua_ForEachInChunk(lua_State* tolua_S) bool (Ty1::*Func1)(int, int, cItemCallback<Ty2> &)
>
static int tolua_ForEachInChunk(lua_State * tolua_S)
{ {
int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */ int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */
if ((NumArgs != 3) && (NumArgs != 4)) if ((NumArgs != 3) && (NumArgs != 4))
@ -651,9 +648,11 @@ static int tolua_ForEachInChunk(lua_State* tolua_S)
template< class Ty1, template<
class Ty2, class Ty1,
bool (Ty1::*Func1)(cItemCallback<Ty2> &) > class Ty2,
bool (Ty1::*Func1)(cItemCallback<Ty2> &)
>
static int tolua_ForEach(lua_State * tolua_S) static int tolua_ForEach(lua_State * tolua_S)
{ {
int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */ int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */

View File

@ -42,10 +42,7 @@ public:
// Called each tick // Called each tick
virtual void Tick(float a_Dt) = 0; virtual void Tick(float a_Dt) = 0;
/** /** Calls the specified hook with the params given. Returns the bool that the hook callback returns.*/
* On all these functions, return true if you want to override default behavior and not call other plugins on that callback.
* You can also return false, so default behavior is used.
**/
virtual bool OnBlockSpread (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, eSpreadSource a_Source) = 0; virtual bool OnBlockSpread (cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, eSpreadSource a_Source) = 0;
virtual bool OnBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) = 0; virtual bool OnBlockToPickups (cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) = 0;
virtual bool OnChat (cPlayer * a_Player, AString & a_Message) = 0; virtual bool OnChat (cPlayer * a_Player, AString & a_Message) = 0;
@ -152,7 +149,7 @@ private:
int m_Version; int m_Version;
AString m_Directory; AString m_Directory;
}; // tolua_export }; // tolua_export

View File

@ -78,7 +78,7 @@ bool cPluginLua::Initialize(void)
{ {
cCSLock Lock(m_CriticalSection); cCSLock Lock(m_CriticalSection);
if (!m_LuaState.IsValid()) if (!m_LuaState.IsValid())
{ {
m_LuaState.Create(); m_LuaState.Create();
m_LuaState.RegisterAPILibs(); m_LuaState.RegisterAPILibs();
@ -1015,7 +1015,7 @@ bool cPluginLua::OnPlayerUsedBlock(cPlayer & a_Player, int a_BlockX, int a_Block
bool cPluginLua::OnPlayerUsedItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) bool cPluginLua::OnPlayerUsedItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
{ {
cCSLock Lock(m_CriticalSection); cCSLock Lock(m_CriticalSection);
bool res = false; bool res = false;
@ -1294,8 +1294,8 @@ bool cPluginLua::OnTakeDamage(cEntity & a_Receiver, TakeDamageInfo & a_TDI)
bool cPluginLua::OnUpdatedSign( bool cPluginLua::OnUpdatedSign(
cWorld * a_World, cWorld * a_World,
int a_BlockX, int a_BlockY, int a_BlockZ, int a_BlockX, int a_BlockY, int a_BlockZ,
const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4,
cPlayer * a_Player cPlayer * a_Player
) )
@ -1319,8 +1319,8 @@ bool cPluginLua::OnUpdatedSign(
bool cPluginLua::OnUpdatingSign( bool cPluginLua::OnUpdatingSign(
cWorld * a_World, cWorld * a_World,
int a_BlockX, int a_BlockY, int a_BlockZ, int a_BlockX, int a_BlockY, int a_BlockZ,
AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4,
cPlayer * a_Player cPlayer * a_Player
) )
@ -1517,7 +1517,7 @@ bool cPluginLua::CanAddOldStyleHook(int a_HookType)
return true; return true;
} }
LOGWARNING("Plugin %s wants to add a hook (%d), but it doesn't provide the callback function \"%s\" for it. The plugin need not work properly.", LOGWARNING("Plugin %s wants to add a hook (%d), but it doesn't provide the callback function \"%s\" for it. The plugin need not work properly.",
GetName().c_str(), a_HookType, FnName GetName().c_str(), a_HookType, FnName
); );
m_LuaState.LogStackTrace(); m_LuaState.LogStackTrace();

View File

@ -145,7 +145,7 @@ public:
// cWebPlugin and WebAdmin stuff // cWebPlugin and WebAdmin stuff
virtual AString HandleWebRequest(const HTTPRequest * a_Request ) override; virtual AString HandleWebRequest(const HTTPRequest * a_Request ) override;
bool AddWebTab(const AString & a_Title, lua_State * a_LuaState, int a_FunctionReference); // >> EXPORTED IN MANUALBINDINGS << bool AddWebTab(const AString & a_Title, lua_State * a_LuaState, int a_FunctionReference); // >> EXPORTED IN MANUALBINDINGS <<
/** Binds the command to call the function specified by a Lua function reference. Simply adds to CommandMap. */ /** Binds the command to call the function specified by a Lua function reference. Simply adds to CommandMap. */
void BindCommand(const AString & a_Command, int a_FnRef); void BindCommand(const AString & a_Command, int a_FnRef);

View File

@ -1486,7 +1486,7 @@ bool cPluginManager::DisablePlugin(const AString & a_PluginName)
if (itr->first.compare(a_PluginName) == 0) // _X 2013_02_01: wtf? Isn't this supposed to be what find() does? if (itr->first.compare(a_PluginName) == 0) // _X 2013_02_01: wtf? Isn't this supposed to be what find() does?
{ {
m_DisablePluginList.push_back(itr->second); m_DisablePluginList.push_back(itr->second);
itr->second = NULL; // Get rid of this thing right away itr->second = NULL; // Get rid of this thing right away
return true; return true;
} }
return false; return false;

View File

@ -51,10 +51,12 @@ class cBlockEntityWithItems;
class cPluginManager // tolua_export // tolua_begin
{ // tolua_export class cPluginManager
public: // tolua_export {
public:
// tolua_end
// Called each tick // Called each tick
virtual void Tick(float a_Dt); virtual void Tick(float a_Dt);
@ -157,15 +159,17 @@ public: // tolua_export
/** Returns the instance of the Plugin Manager (there is only ever one) */ /** Returns the instance of the Plugin Manager (there is only ever one) */
static cPluginManager * Get(void); // tolua_export static cPluginManager * Get(void); // tolua_export
typedef std::map< AString, cPlugin * > PluginMap; typedef std::map< AString, cPlugin * > PluginMap;
typedef std::list< cPlugin * > PluginList; typedef std::list< cPlugin * > PluginList;
cPlugin * GetPlugin( const AString & a_Plugin ) const; // tolua_export cPlugin * GetPlugin( const AString & a_Plugin ) const; // tolua_export
const PluginMap & GetAllPlugins() const; // >> EXPORTED IN MANUALBINDINGS << const PluginMap & GetAllPlugins() const; // >> EXPORTED IN MANUALBINDINGS <<
void FindPlugins(); // tolua_export // tolua_begin
void ReloadPlugins(); // tolua_export void FindPlugins();
void ReloadPlugins();
// tolua_end
/** Adds the plugin to the list of plugins called for the specified hook type. Handles multiple adds as a single add */ /** Adds the plugin to the list of plugins called for the specified hook type. Handles multiple adds as a single add */
void AddHook(cPlugin * a_Plugin, int a_HookType); void AddHook(cPlugin * a_Plugin, int a_HookType);
@ -335,7 +339,7 @@ private:
bool AddPlugin(cPlugin * a_Plugin); bool AddPlugin(cPlugin * a_Plugin);
/** Tries to match a_Command to the internal table of commands, if a match is found, the corresponding plugin is called. Returns crExecuted if the command is executed. */ /** Tries to match a_Command to the internal table of commands, if a match is found, the corresponding plugin is called. Returns crExecuted if the command is executed. */
cPluginManager::CommandResult HandleCommand(cPlayer * a_Player, const AString & a_Command, bool a_ShouldCheckPermissions); cPluginManager::CommandResult HandleCommand(cPlayer * a_Player, const AString & a_Command, bool a_ShouldCheckPermissions);
} ; // tolua_export } ; // tolua_export

View File

@ -64,27 +64,27 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
std::pair< AString, AString > Names; std::pair< AString, AString > Names;
AStringVector Split = StringSplit(a_Request->Path, "/"); AStringVector Split = StringSplit(a_Request->Path, "/");
if( Split.size() > 1 ) if (Split.size() > 1)
{ {
sWebPluginTab* Tab = 0; sWebPluginTab * Tab = NULL;
if( Split.size() > 2 ) // If we got the tab name, show that page if (Split.size() > 2) // If we got the tab name, show that page
{ {
for( TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr ) for( TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr )
{ {
if( (*itr)->SafeTitle.compare( Split[2] ) == 0 ) // This is the one! Rawr if ((*itr)->SafeTitle.compare(Split[2]) == 0) // This is the one!
{ {
Tab = *itr; Tab = *itr;
break; break;
} }
} }
} }
else // Otherwise show the first tab else // Otherwise show the first tab
{ {
if( GetTabs().size() > 0 ) if( GetTabs().size() > 0 )
Tab = *GetTabs().begin(); Tab = *GetTabs().begin();
} }
if( Tab ) if (Tab != NULL)
{ {
Names.first = Tab->Title; Names.first = Tab->Title;
Names.second = Tab->SafeTitle; Names.second = Tab->SafeTitle;
@ -97,13 +97,13 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
AString cWebPlugin::SafeString( const AString & a_String ) AString cWebPlugin::SafeString(const AString & a_String)
{ {
AString RetVal; AString RetVal;
for( unsigned int i = 0; i < a_String.size(); ++i ) for( unsigned int i = 0; i < a_String.size(); ++i )
{ {
char c = a_String[i]; char c = a_String[i];
if( c == ' ' ) if( c == ' ' )
{ {
c = '_'; c = '_';
} }
@ -111,3 +111,7 @@ AString cWebPlugin::SafeString( const AString & a_String )
} }
return RetVal; return RetVal;
} }

View File

@ -32,7 +32,7 @@ int cBeaconEntity::GetPyramidLevel(void)
} }
Area.Read( Area.Read(
m_World, m_World,
GetPosX() - 4, GetPosX() + 4, GetPosX() - 4, GetPosX() + 4,
MinY, MaxY, MinY, MaxY,
GetPosZ() - 4, GetPosZ() + 4, GetPosZ() - 4, GetPosZ() + 4,

View File

@ -177,7 +177,7 @@ void cChestEntity::OpenNewWindow(void)
return; return;
} }
// There is no chest neighbor, open a single-chest window: // There is no chest neighbor, open a single-chest window:
OpenWindow(new cChestWindow(this)); OpenWindow(new cChestWindow(this));
} }

View File

@ -26,7 +26,7 @@ namespace Json
// tolua_begin // tolua_begin
class cCommandBlockEntity : class cCommandBlockEntity :
public cBlockEntity public cBlockEntity
{ {
typedef cBlockEntity super; typedef cBlockEntity super;

View File

@ -99,7 +99,7 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
} }
m_World->BroadcastSoundParticleEffect(2000, m_PosX, m_PosY, m_PosZ, SmokeDir); m_World->BroadcastSoundParticleEffect(2000, m_PosX, m_PosY, m_PosZ, SmokeDir);
m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.0f); m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.0f);
} }

View File

@ -16,10 +16,10 @@ class cEnderChestEntity :
{ {
typedef cBlockEntity super; typedef cBlockEntity super;
public: public:
// tolua_end // tolua_end
cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
virtual ~cEnderChestEntity(); virtual ~cEnderChestEntity();
static const char * GetClassStatic(void) { return "cEnderChestEntity"; } static const char * GetClassStatic(void) { return "cEnderChestEntity"; }

View File

@ -27,7 +27,7 @@ namespace Json
// tolua_begin // tolua_begin
class cFlowerPotEntity : class cFlowerPotEntity :
public cBlockEntity public cBlockEntity
{ {
typedef cBlockEntity super; typedef cBlockEntity super;

View File

@ -19,7 +19,7 @@ namespace Json
// tolua_begin // tolua_begin
class cJukeboxEntity : class cJukeboxEntity :
public cBlockEntity public cBlockEntity
{ {
typedef cBlockEntity super; typedef cBlockEntity super;

View File

@ -25,7 +25,7 @@ namespace Json
// tolua_begin // tolua_begin
class cMobHeadEntity : class cMobHeadEntity :
public cBlockEntity public cBlockEntity
{ {
typedef cBlockEntity super; typedef cBlockEntity super;

View File

@ -28,7 +28,7 @@ enum ENUM_NOTE_INSTRUMENTS
// tolua_begin // tolua_begin
class cNoteEntity : class cNoteEntity :
public cBlockEntity public cBlockEntity
{ {
typedef cBlockEntity super; typedef cBlockEntity super;

View File

@ -25,7 +25,7 @@ namespace Json
// tolua_begin // tolua_begin
class cSignEntity : class cSignEntity :
public cBlockEntity public cBlockEntity
{ {
typedef cBlockEntity super; typedef cBlockEntity super;

View File

@ -34,7 +34,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -116,7 +116,7 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface
if (Meta & 0x8) if (Meta & 0x8)
{ {
// Is pillow // Is pillow
a_WorldInterface.GetBroadcastManager().BroadcastUseBed(*a_Player, a_BlockX, a_BlockY, a_BlockZ); a_WorldInterface.GetBroadcastManager().BroadcastUseBed(*a_Player, a_BlockX, a_BlockY, a_BlockZ);
} }
else else
@ -142,7 +142,7 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface
a_WorldInterface.SetTimeOfDay(0); a_WorldInterface.SetTimeOfDay(0);
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0xB); // Where 0xB = 1011, and zero is to make sure 'occupied' bit is always unset a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0xB); // Where 0xB = 1011, and zero is to make sure 'occupied' bit is always unset
} }
} }
} }
else else
{ {

View File

@ -86,8 +86,8 @@ public:
virtual void OnPlacedByPlayer( virtual void OnPlacedByPlayer(
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
) override ) override

View File

@ -46,7 +46,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -32,7 +32,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -22,7 +22,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override
@ -68,7 +68,7 @@ public:
virtual void OnPlacedByPlayer( virtual void OnPlacedByPlayer(
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta

View File

@ -71,7 +71,7 @@ public:
} }
} }
} }
} }
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override

View File

@ -152,7 +152,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta)
// Return a_Meta if panel is a top panel (0x08 bit is set to 1) // Return a_Meta if panel is a top panel (0x08 bit is set to 1)
// Note: Currently, you can not properly mirror the hinges on a double door. The orientation of the door is stored // Note: Currently, you can not properly mirror the hinges on a double door. The orientation of the door is stored
// in only the bottom tile while the hinge position is in the top tile. This function only operates on one tile at a time, // in only the bottom tile while the hinge position is in the top tile. This function only operates on one tile at a time,
// so the function can only see either the hinge position or orientation, but not both, at any given time. The class itself // so the function can only see either the hinge position or orientation, but not both, at any given time. The class itself
// needs extra datamembers. // needs extra datamembers.
if (a_Meta & 0x08) return a_Meta; if (a_Meta & 0x08) return a_Meta;
@ -179,7 +179,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(NIBBLETYPE a_Meta)
// Return a_Meta if panel is a top panel (0x08 bit is set to 1) // Return a_Meta if panel is a top panel (0x08 bit is set to 1)
// Note: Currently, you can not properly mirror the hinges on a double door. The orientation of the door is stored // Note: Currently, you can not properly mirror the hinges on a double door. The orientation of the door is stored
// in only the bottom tile while the hinge position is in the top tile. This function only operates on one tile at a time, // in only the bottom tile while the hinge position is in the top tile. This function only operates on one tile at a time,
// so the function can only see either the hinge position or orientation, but not both, at any given time.The class itself // so the function can only see either the hinge position or orientation, but not both, at any given time.The class itself
// needs extra datamembers. // needs extra datamembers.

View File

@ -28,7 +28,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -24,7 +24,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -19,7 +19,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -17,7 +17,7 @@ public:
: cBlockHandler(a_BlockType) : cBlockHandler(a_BlockType)
{ {
} }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override

View File

@ -13,7 +13,7 @@ class cBlockFurnaceHandler :
public cMetaRotator<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04> public cMetaRotator<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04>
{ {
public: public:
cBlockFurnaceHandler(BLOCKTYPE a_BlockType) cBlockFurnaceHandler(BLOCKTYPE a_BlockType)
: cMetaRotator<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04>(a_BlockType) : cMetaRotator<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04>(a_BlockType)
{ {
} }
@ -27,7 +27,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -176,7 +176,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
{ {
switch(a_BlockType) switch(a_BlockType)
{ {
// Block handlers, alphabetically sorted: // Block handlers, alphabetically sorted:
case E_BLOCK_ACACIA_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_ACACIA_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_ACTIVATOR_RAIL: return new cBlockRailHandler (a_BlockType); case E_BLOCK_ACTIVATOR_RAIL: return new cBlockRailHandler (a_BlockType);
case E_BLOCK_ANVIL: return new cBlockAnvilHandler (a_BlockType); case E_BLOCK_ANVIL: return new cBlockAnvilHandler (a_BlockType);
@ -327,7 +327,7 @@ cBlockHandler::cBlockHandler(BLOCKTYPE a_BlockType)
bool cBlockHandler::GetPlacementBlockTypeMeta( bool cBlockHandler::GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) )

View File

@ -30,14 +30,14 @@ public:
/// Note that the coords are chunk-relative! /// Note that the coords are chunk-relative!
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ); virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
/** 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. 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. Also, the handler should set a_BlockType and a_BlockMeta to correct values for the newly placed block.
Called by cItemHandler::GetPlacementBlockTypeMeta() if the item is a block Called by cItemHandler::GetPlacementBlockTypeMeta() if the item is a block
*/ */
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
); );
@ -47,8 +47,8 @@ public:
/// Called by cClientHandle::HandlePlaceBlock() after the player has placed a new block. Called after OnPlaced(). /// Called by cClientHandle::HandlePlaceBlock() after the player has placed a new block. Called after OnPlaced().
virtual void OnPlacedByPlayer( virtual void OnPlacedByPlayer(
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
); );
@ -90,7 +90,7 @@ public:
virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta); virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta);
/** Checks if the block can be placed at this point. /** Checks if the block can be placed at this point.
Default: CanBeAt(...) Default: CanBeAt(...)
NOTE: This call doesn't actually place the block NOTE: This call doesn't actually place the block
*/ */
// virtual bool CanBePlacedAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir); // virtual bool CanBePlacedAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir);
@ -98,27 +98,27 @@ public:
/// Called to check whether this block supports a rclk action. If it returns true, OnUse() is called /// Called to check whether this block supports a rclk action. If it returns true, OnUse() is called
virtual bool IsUseable(void); virtual bool IsUseable(void);
/** Indicates whether the client will click through this block. /** Indicates whether the client will click through this block.
For example digging a fire will hit the block below the fire so fire is clicked through For example digging a fire will hit the block below the fire so fire is clicked through
*/ */
virtual bool IsClickedThrough(void); virtual bool IsClickedThrough(void);
/** Checks if the player can build "inside" this block. /** Checks if the player can build "inside" this block.
For example blocks placed "on" snow will be placed at the same position. So: Snow ignores Build collision For example blocks placed "on" snow will be placed at the same position. So: Snow ignores Build collision
*/ */
virtual bool DoesIgnoreBuildCollision(void); virtual bool DoesIgnoreBuildCollision(void);
/// <summary>Similar to DoesIgnoreBuildCollision(void), but is used for cases where block meta/player item-in-hand is needed to determine collision (thin snow)</summary> /// <summary>Similar to DoesIgnoreBuildCollision(void), but is used for cases where block meta/player item-in-hand is needed to determine collision (thin snow)</summary>
virtual bool DoesIgnoreBuildCollision(cPlayer *, NIBBLETYPE a_Meta) virtual bool DoesIgnoreBuildCollision(cPlayer *, NIBBLETYPE a_Meta)
{ {
UNUSED(a_Meta); UNUSED(a_Meta);
return DoesIgnoreBuildCollision(); return DoesIgnoreBuildCollision();
} }
/// <summary>Returns if this block drops if it gets destroyed by an unsuitable situation. Default: true</summary> /// <summary>Returns if this block drops if it gets destroyed by an unsuitable situation. Default: true</summary>
virtual bool DoesDropOnUnsuitable(void); virtual bool DoesDropOnUnsuitable(void);
/** Called when one of the neighbors gets set; equivalent to MC block update. /** Called when one of the neighbors gets set; equivalent to MC block update.
By default drops if position no more suitable (CanBeAt(), DoesDropOnUnsuitable(), Drop()), By default drops if position no more suitable (CanBeAt(), DoesDropOnUnsuitable(), Drop()),
and wakes up all simulators on the block. and wakes up all simulators on the block.
*/ */

View File

@ -19,7 +19,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -29,7 +29,7 @@ public:
// TODO: Ice destroyed with air below it should turn into air instead of water // TODO: Ice destroyed with air below it should turn into air instead of water
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_WATER, 0); a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_WATER, 0);
// This is called later than the real destroying of this ice block // This is called later than the real destroying of this ice block
} }
} ; } ;

View File

@ -100,10 +100,10 @@ public:
int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width; int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
cBlockArea Area; cBlockArea Area;
if (!Area.Read( if (!Area.Read(
a_Chunk.GetWorld(), a_Chunk.GetWorld(),
BlockX - LEAVES_CHECK_DISTANCE, BlockX + LEAVES_CHECK_DISTANCE, BlockX - LEAVES_CHECK_DISTANCE, BlockX + LEAVES_CHECK_DISTANCE,
a_RelY - LEAVES_CHECK_DISTANCE, a_RelY + LEAVES_CHECK_DISTANCE, a_RelY - LEAVES_CHECK_DISTANCE, a_RelY + LEAVES_CHECK_DISTANCE,
BlockZ - LEAVES_CHECK_DISTANCE, BlockZ + LEAVES_CHECK_DISTANCE, BlockZ - LEAVES_CHECK_DISTANCE, BlockZ + LEAVES_CHECK_DISTANCE,
cBlockArea::baTypes) cBlockArea::baTypes)
) )
{ {

View File

@ -43,7 +43,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -193,8 +193,8 @@ public:
} }
virtual void OnPlacedByPlayer( virtual void OnPlacedByPlayer(
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
) override ) override

View File

@ -62,7 +62,7 @@ void cBlockPistonHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorld
bool cBlockPistonHandler::GetPlacementBlockTypeMeta( bool cBlockPistonHandler::GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) )

View File

@ -17,7 +17,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override; ) override;
@ -75,7 +75,7 @@ public:
return BLOCK_FACE_NONE; return BLOCK_FACE_NONE;
} }
} }
} }
static void ExtendPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); static void ExtendPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
static void RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); static void RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);

View File

@ -18,7 +18,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -19,7 +19,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -76,14 +76,14 @@ public:
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0); a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
// Spawn the golem: // Spawn the golem:
a_WorldInterface.SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtIronGolem); a_WorldInterface.SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtIronGolem);
} }
} }
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -18,7 +18,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -31,7 +31,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override
@ -223,7 +223,7 @@ public:
case E_META_RAIL_ZM_ZP: case E_META_RAIL_ZM_ZP:
{ {
if ( if (
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH, E_PURE_DOWN) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH, E_PURE_DOWN) ||
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH, E_PURE_DOWN) IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH, E_PURE_DOWN)
) )
{ {
@ -235,7 +235,7 @@ public:
case E_META_RAIL_XM_XP: case E_META_RAIL_XM_XP:
{ {
if ( if (
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST, E_PURE_DOWN) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST, E_PURE_DOWN) ||
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST, E_PURE_DOWN) IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST, E_PURE_DOWN)
) )
{ {
@ -247,7 +247,7 @@ public:
case E_META_RAIL_ASCEND_XP: case E_META_RAIL_ASCEND_XP:
{ {
if ( if (
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_EAST) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_EAST) ||
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST) IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST)
) )
{ {
@ -259,7 +259,7 @@ public:
case E_META_RAIL_ASCEND_XM: case E_META_RAIL_ASCEND_XM:
{ {
if ( if (
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST) ||
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_WEST) IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_WEST)
) )
{ {
@ -271,7 +271,7 @@ public:
case E_META_RAIL_ASCEND_ZM: case E_META_RAIL_ASCEND_ZM:
{ {
if ( if (
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_NORTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_NORTH) ||
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH) IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH)
) )
{ {
@ -283,7 +283,7 @@ public:
case E_META_RAIL_ASCEND_ZP: case E_META_RAIL_ASCEND_ZP:
{ {
if ( if (
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) ||
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_SOUTH) IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_SOUTH)
) )
{ {
@ -295,7 +295,7 @@ public:
case E_META_RAIL_CURVED_ZP_XP: case E_META_RAIL_CURVED_ZP_XP:
{ {
if ( if (
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH) ||
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST) IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST)
) )
{ {
@ -307,7 +307,7 @@ public:
case E_META_RAIL_CURVED_ZP_XM: case E_META_RAIL_CURVED_ZP_XM:
{ {
if ( if (
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH) ||
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST) IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST)
) )
{ {
@ -319,7 +319,7 @@ public:
case E_META_RAIL_CURVED_ZM_XM: case E_META_RAIL_CURVED_ZM_XM:
{ {
if ( if (
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) ||
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST) IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST)
) )
{ {
@ -331,7 +331,7 @@ public:
case E_META_RAIL_CURVED_ZM_XP: case E_META_RAIL_CURVED_ZM_XP:
{ {
if ( if (
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) ||
IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST) IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST)
) )
{ {

View File

@ -18,7 +18,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -59,7 +59,7 @@ public:
} }
} }
return 0x2; return 0x2;
} }
virtual void OnPlacedByPlayer( virtual void OnPlacedByPlayer(

View File

@ -33,7 +33,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -19,7 +19,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -20,7 +20,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -19,7 +19,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -18,7 +18,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
class cBroadcastInterface class cBroadcastInterface
{ {
public: public:
virtual ~cBroadcastInterface() {} virtual ~cBroadcastInterface() {}

View File

@ -21,7 +21,7 @@ public:
return m_ChunkMap->GetBlock(a_BlockX,a_BlockY,a_BlockZ); return m_ChunkMap->GetBlock(a_BlockX,a_BlockY,a_BlockZ);
} }
BLOCKTYPE GetBlock(const Vector3i & a_Pos) BLOCKTYPE GetBlock(const Vector3i & a_Pos)
{ {
return GetBlock(a_Pos.x, a_Pos.y, a_Pos.z); return GetBlock(a_Pos.x, a_Pos.y, a_Pos.z);
} }
NIBBLETYPE GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ) NIBBLETYPE GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ)

View File

@ -4,7 +4,7 @@
// mixin for use to clear meta values when the block is converted to a pickup // 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 // 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 // For example to use in class Foo which should inherit Bar use
// class Foo : public cClearMetaOnDrop<Bar>; // class Foo : public cClearMetaOnDrop<Bar>;
template<class Base> template<class Base>

View File

@ -47,8 +47,8 @@ NIBBLETYPE cMetaRotator<Base, BitMask, North, East, South, West, AssertIfNotMatc
NIBBLETYPE OtherMeta = a_Meta & (~BitMask); NIBBLETYPE OtherMeta = a_Meta & (~BitMask);
switch (a_Meta & BitMask) switch (a_Meta & BitMask)
{ {
case South: return West | OtherMeta; case South: return West | OtherMeta;
case West: return North | OtherMeta; case West: return North | OtherMeta;
case North: return East | OtherMeta; case North: return East | OtherMeta;
case East: return South | OtherMeta; case East: return South | OtherMeta;
} }
@ -69,7 +69,7 @@ NIBBLETYPE cMetaRotator<Base, BitMask, North, East, South, West, AssertIfNotMatc
NIBBLETYPE OtherMeta = a_Meta & (~BitMask); NIBBLETYPE OtherMeta = a_Meta & (~BitMask);
switch (a_Meta & BitMask) switch (a_Meta & BitMask)
{ {
case South: return East | OtherMeta; case South: return East | OtherMeta;
case East: return North | OtherMeta; case East: return North | OtherMeta;
case North: return West | OtherMeta; case North: return West | OtherMeta;
case West: return South | OtherMeta; case West: return South | OtherMeta;

View File

@ -24,7 +24,7 @@ public:
virtual cBroadcastInterface & GetBroadcastManager() = 0; virtual cBroadcastInterface & GetBroadcastManager() = 0;
virtual void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData) = 0; virtual void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData) = 0;
/** Spawns item pickups for each item in the list. May compress pickups if too many entities: */ /** Spawns item pickups for each item in the list. May compress pickups if too many entities: */
virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed = 1.0, bool IsPlayerCreated = false) = 0; virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed = 1.0, bool IsPlayerCreated = false) = 0;

View File

@ -72,7 +72,7 @@ bool cArrowEntity::CanPickup(const cPlayer & a_Player) const
void cArrowEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) void cArrowEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
{ {
if (GetSpeed().EqualsEps(Vector3d(0, 0, 0), 0.0000001)) if (GetSpeed().EqualsEps(Vector3d(0, 0, 0), 0.0000001))
{ {
SetSpeed(GetLookVector().NormalizeCopy() * 0.1); // Ensure that no division by zero happens later SetSpeed(GetLookVector().NormalizeCopy() * 0.1); // Ensure that no division by zero happens later
@ -97,7 +97,7 @@ void cArrowEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFa
void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
{ {
int Damage = (int)(GetSpeed().Length() / 20 * m_DamageCoeff + 0.5); int Damage = (int)(GetSpeed().Length() / 20 * m_DamageCoeff + 0.5);
if (m_IsCritical) if (m_IsCritical)
{ {

View File

@ -104,7 +104,7 @@ void cBoat::Tick(float a_Dt, cChunk & a_Chunk)
if (IsBlockWater(m_World->GetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT))) if (IsBlockWater(m_World->GetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT)))
{ {
if (GetSpeedY() < 2) if (GetSpeedY() < 2)
{ {
AddSpeedY(0.2); AddSpeedY(0.2);
} }
} }

View File

@ -74,7 +74,7 @@ cEntity::~cEntity()
/* /*
// DEBUG: // DEBUG:
LOGD("Deleting entity %d at pos {%.2f, %.2f, %.2f} ~ [%d, %d]; ptr %p", LOGD("Deleting entity %d at pos {%.2f, %.2f, %.2f} ~ [%d, %d]; ptr %p",
m_UniqueID, m_UniqueID,
m_Pos.x, m_Pos.y, m_Pos.z, m_Pos.x, m_Pos.y, m_Pos.z,
(int)(m_Pos.x / cChunkDef::Width), (int)(m_Pos.z / cChunkDef::Width), (int)(m_Pos.x / cChunkDef::Width), (int)(m_Pos.z / cChunkDef::Width),
@ -1090,7 +1090,7 @@ void cEntity::HandleAir(void)
{ {
if (m_AirTickTimer < 1) if (m_AirTickTimer < 1)
{ {
// Damage player // Damage player
TakeDamage(dtDrowning, NULL, 1, 1, 0); TakeDamage(dtDrowning, NULL, 1, 1, 0);
// Reset timer // Reset timer
m_AirTickTimer = DROWNING_TICKS; m_AirTickTimer = DROWNING_TICKS;
@ -1382,8 +1382,8 @@ void cEntity::SetMass(double a_Mass)
} }
else else
{ {
// Make sure that mass is not zero. 1g is the default because we // Make sure that mass is not zero. 1g is the default because we
// have to choose a number. It's perfectly legal to have a mass // have to choose a number. It's perfectly legal to have a mass
// less than 1g as long as is NOT equal or less than zero. // less than 1g as long as is NOT equal or less than zero.
m_Mass = 0.001; m_Mass = 0.001;
} }
@ -1469,7 +1469,7 @@ void cEntity::SetWidth(double a_Width)
void cEntity::AddPosX(double a_AddPosX) void cEntity::AddPosX(double a_AddPosX)
{ {
m_Pos.x += a_AddPosX; m_Pos.x += a_AddPosX;
} }
@ -1477,7 +1477,7 @@ void cEntity::AddPosX(double a_AddPosX)
void cEntity::AddPosY(double a_AddPosY) void cEntity::AddPosY(double a_AddPosY)
{ {
m_Pos.y += a_AddPosY; m_Pos.y += a_AddPosY;
} }
@ -1485,7 +1485,7 @@ void cEntity::AddPosY(double a_AddPosY)
void cEntity::AddPosZ(double a_AddPosZ) void cEntity::AddPosZ(double a_AddPosZ)
{ {
m_Pos.z += a_AddPosZ; m_Pos.z += a_AddPosZ;
} }
@ -1495,7 +1495,7 @@ void cEntity::AddPosition(double a_AddPosX, double a_AddPosY, double a_AddPosZ)
{ {
m_Pos.x += a_AddPosX; m_Pos.x += a_AddPosX;
m_Pos.y += a_AddPosY; m_Pos.y += a_AddPosY;
m_Pos.z += a_AddPosZ; m_Pos.z += a_AddPosZ;
} }
@ -1505,7 +1505,7 @@ void cEntity::AddSpeed(double a_AddSpeedX, double a_AddSpeedY, double a_AddSpeed
{ {
m_Speed.x += a_AddSpeedX; m_Speed.x += a_AddSpeedX;
m_Speed.y += a_AddSpeedY; m_Speed.y += a_AddSpeedY;
m_Speed.z += a_AddSpeedZ; m_Speed.z += a_AddSpeedZ;
WrapSpeed(); WrapSpeed();
} }
@ -1515,7 +1515,7 @@ void cEntity::AddSpeed(double a_AddSpeedX, double a_AddSpeedY, double a_AddSpeed
void cEntity::AddSpeedX(double a_AddSpeedX) void cEntity::AddSpeedX(double a_AddSpeedX)
{ {
m_Speed.x += a_AddSpeedX; m_Speed.x += a_AddSpeedX;
WrapSpeed(); WrapSpeed();
} }
@ -1525,7 +1525,7 @@ void cEntity::AddSpeedX(double a_AddSpeedX)
void cEntity::AddSpeedY(double a_AddSpeedY) void cEntity::AddSpeedY(double a_AddSpeedY)
{ {
m_Speed.y += a_AddSpeedY; m_Speed.y += a_AddSpeedY;
WrapSpeed(); WrapSpeed();
} }
@ -1535,7 +1535,7 @@ void cEntity::AddSpeedY(double a_AddSpeedY)
void cEntity::AddSpeedZ(double a_AddSpeedZ) void cEntity::AddSpeedZ(double a_AddSpeedZ)
{ {
m_Speed.z += a_AddSpeedZ; m_Speed.z += a_AddSpeedZ;
WrapSpeed(); WrapSpeed();
} }
@ -1590,7 +1590,7 @@ Vector3d cEntity::GetLookVector(void) const
// Set position // Set position
void cEntity::SetPosition(double a_PosX, double a_PosY, double a_PosZ) void cEntity::SetPosition(double a_PosX, double a_PosY, double a_PosZ)
{ {
m_Pos.Set(a_PosX, a_PosY, a_PosZ); m_Pos.Set(a_PosX, a_PosY, a_PosZ);
} }
@ -1599,7 +1599,7 @@ void cEntity::SetPosition(double a_PosX, double a_PosY, double a_PosZ)
void cEntity::SetPosX(double a_PosX) void cEntity::SetPosX(double a_PosX)
{ {
m_Pos.x = a_PosX; m_Pos.x = a_PosX;
} }
@ -1608,7 +1608,7 @@ void cEntity::SetPosX(double a_PosX)
void cEntity::SetPosY(double a_PosY) void cEntity::SetPosY(double a_PosY)
{ {
m_Pos.y = a_PosY; m_Pos.y = a_PosY;
} }

View File

@ -428,7 +428,7 @@ public:
virtual void OnRightClicked(cPlayer &) {}; virtual void OnRightClicked(cPlayer &) {};
/// Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy(). /// Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy().
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL)
{ {
UNUSED(a_Drops); UNUSED(a_Drops);
UNUSED(a_Killer); UNUSED(a_Killer);

View File

@ -99,7 +99,7 @@ public:
protected: protected:
cItem m_Content; cItem m_Content;
int m_Height; int m_Height;
} ; } ;

View File

@ -340,7 +340,7 @@ float cPlayer::GetXpPercentage()
short int currentLevel = CalcLevelFromXp(m_CurrentXp); short int currentLevel = CalcLevelFromXp(m_CurrentXp);
short int currentLevel_XpBase = XpForLevel(currentLevel); short int currentLevel_XpBase = XpForLevel(currentLevel);
return (float)(m_CurrentXp - currentLevel_XpBase) / return (float)(m_CurrentXp - currentLevel_XpBase) /
(float)(XpForLevel(1+currentLevel) - currentLevel_XpBase); (float)(XpForLevel(1+currentLevel) - currentLevel_XpBase);
} }
@ -392,7 +392,7 @@ short cPlayer::DeltaExperience(short a_Xp_delta)
m_LifetimeTotalXp += a_Xp_delta; m_LifetimeTotalXp += a_Xp_delta;
} }
LOGD("Player \"%s\" gained/lost %d experience, total is now: %d", LOGD("Player \"%s\" gained/lost %d experience, total is now: %d",
GetName().c_str(), a_Xp_delta, m_CurrentXp); GetName().c_str(), a_Xp_delta, m_CurrentXp);
// Set experience to be updated // Set experience to be updated
@ -1278,7 +1278,7 @@ Vector3d cPlayer::GetThrowSpeed(double a_SpeedCoeff) const
// TODO: Add a slight random change (+-0.0075 in each direction) // TODO: Add a slight random change (+-0.0075 in each direction)
return res * a_SpeedCoeff; return res * a_SpeedCoeff;
} }
@ -1311,7 +1311,7 @@ void cPlayer::MoveTo( const Vector3d & a_NewPos )
{ {
// When attached to an entity, the client sends position packets with weird coords: // When attached to an entity, the client sends position packets with weird coords:
// Y = -999 and X, Z = attempting to create speed, usually up to 0.03 // Y = -999 and X, Z = attempting to create speed, usually up to 0.03
// We cannot test m_AttachedTo, because when deattaching, the server thinks the client is already deattached while // We cannot test m_AttachedTo, because when deattaching, the server thinks the client is already deattached while
// the client may still send more of these nonsensical packets. // the client may still send more of these nonsensical packets.
if (m_AttachedTo != NULL) if (m_AttachedTo != NULL)
{ {
@ -1889,7 +1889,7 @@ bool cPlayer::SaveToDisk()
{ {
LOGWARNING("Error writing player \"%s\" to file \"%s\" - cannot save data. Player will lose their progress. ", LOGWARNING("Error writing player \"%s\" to file \"%s\" - cannot save data. Player will lose their progress. ",
GetName().c_str(), SourceFile.c_str() GetName().c_str(), SourceFile.c_str()
); );
return false; return false;
} }

View File

@ -198,7 +198,7 @@ public:
// Sets the current gamemode, doesn't check validity, doesn't send update packets to client // Sets the current gamemode, doesn't check validity, doesn't send update packets to client
void LoginSetGameMode(eGameMode a_GameMode); void LoginSetGameMode(eGameMode a_GameMode);
/** Forces the player to move in the given direction. /** Forces the player to move in the given direction.
@deprecated Use SetSpeed instead. */ @deprecated Use SetSpeed instead. */
void ForceSetSpeed(const Vector3d & a_Speed); // tolua_export void ForceSetSpeed(const Vector3d & a_Speed); // tolua_export
@ -430,7 +430,7 @@ protected:
AString m_LoadedWorldName; AString m_LoadedWorldName;
/** Xp Level stuff */ /** Xp Level stuff */
enum enum
{ {
XP_TO_LEVEL15 = 255, XP_TO_LEVEL15 = 255,
XP_PER_LEVEL_TO15 = 17, XP_PER_LEVEL_TO15 = 17,

View File

@ -52,7 +52,7 @@ public:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace); virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace);
/// Called by the physics blocktracer when the entity hits another entity /// Called by the physics blocktracer when the entity hits another entity
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
{ {
UNUSED(a_EntityHit); UNUSED(a_EntityHit);
UNUSED(a_HitPos); UNUSED(a_HitPos);
@ -89,7 +89,7 @@ public:
protected: protected:
/** A structure that stores the Entity ID and Playername of the projectile's creator /** A structure that stores the Entity ID and Playername of the projectile's creator
Used to migitate invalid pointers caused by the creator being destroyed Used to migitate invalid pointers caused by the creator being destroyed
*/ */
struct CreatorData struct CreatorData

View File

@ -186,7 +186,7 @@ public:
// Accessors used by cChunkGenerator::Generator descendants: // Accessors used by cChunkGenerator::Generator descendants:
inline cChunkDef::BiomeMap & GetBiomeMap (void) { return m_BiomeMap; } inline cChunkDef::BiomeMap & GetBiomeMap (void) { return m_BiomeMap; }
inline cChunkDef::BlockTypes & GetBlockTypes (void) { return *((cChunkDef::BlockTypes *)m_BlockArea.GetBlockTypes()); } inline cChunkDef::BlockTypes & GetBlockTypes (void) { return *((cChunkDef::BlockTypes *)m_BlockArea.GetBlockTypes()); }
// CANNOT, different compression! // CANNOT, different compression!
// inline cChunkDef::BlockNibbles & GetBlockMetas (void) { return *((cChunkDef::BlockNibbles *)m_BlockArea.GetBlockMetas()); } // inline cChunkDef::BlockNibbles & GetBlockMetas (void) { return *((cChunkDef::BlockNibbles *)m_BlockArea.GetBlockMetas()); }
inline BlockNibbleBytes & GetBlockMetasUncompressed(void) { return *((BlockNibbleBytes *)m_BlockArea.GetBlockMetas()); } inline BlockNibbleBytes & GetBlockMetasUncompressed(void) { return *((BlockNibbleBytes *)m_BlockArea.GetBlockMetas()); }
inline cChunkDef::HeightMap & GetHeightMap (void) { return m_HeightMap; } inline cChunkDef::HeightMap & GetHeightMap (void) { return m_HeightMap; }

View File

@ -68,7 +68,7 @@ void cCompoGenDebugBiomes::ComposeTerrain(cChunkDesc & a_ChunkDesc)
static BLOCKTYPE Blocks[] = static BLOCKTYPE Blocks[] =
{ {
E_BLOCK_STONE, E_BLOCK_STONE,
E_BLOCK_COBBLESTONE, E_BLOCK_COBBLESTONE,
E_BLOCK_LOG, E_BLOCK_LOG,
E_BLOCK_PLANKS, E_BLOCK_PLANKS,
E_BLOCK_SANDSTONE, E_BLOCK_SANDSTONE,
@ -563,7 +563,7 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc)
{ {
//* //*
FloorLo[INTERPOL_X * x + 17 * INTERPOL_Z * z] = FloorLo[INTERPOL_X * x + 17 * INTERPOL_Z * z] =
m_Noise1.IntNoise3DInt(BaseX + INTERPOL_X * x, 0, BaseZ + INTERPOL_Z * z) * m_Noise1.IntNoise3DInt(BaseX + INTERPOL_X * x, 0, BaseZ + INTERPOL_Z * z) *
m_Noise2.IntNoise3DInt(BaseX + INTERPOL_X * x, 0, BaseZ + INTERPOL_Z * z) / m_Noise2.IntNoise3DInt(BaseX + INTERPOL_X * x, 0, BaseZ + INTERPOL_Z * z) /
256; 256;
//*/ //*/

View File

@ -234,7 +234,7 @@ void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile)
{ {
if (CacheSize < 4) if (CacheSize < 4)
{ {
LOGWARNING("Biomegen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d", LOGWARNING("Biomegen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d",
CacheSize, 4 CacheSize, 4
); );
CacheSize = 4; CacheSize = 4;
@ -252,7 +252,7 @@ void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile)
void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile) void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile)
{ {
bool CacheOffByDefault = false; bool CacheOffByDefault = false;
m_HeightGen = cTerrainHeightGen::CreateHeightGen(a_IniFile, *m_BiomeGen, m_ChunkGenerator.GetSeed(), CacheOffByDefault); m_HeightGen = cTerrainHeightGen::CreateHeightGen(a_IniFile, *m_BiomeGen, m_ChunkGenerator.GetSeed(), CacheOffByDefault);
// Add a cache, if requested: // Add a cache, if requested:
int CacheSize = a_IniFile.GetValueSetI("Generator", "HeightGenCacheSize", CacheOffByDefault ? 0 : 64); int CacheSize = a_IniFile.GetValueSetI("Generator", "HeightGenCacheSize", CacheOffByDefault ? 0 : 64);
@ -260,7 +260,7 @@ void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile)
{ {
if (CacheSize < 4) if (CacheSize < 4)
{ {
LOGWARNING("Heightgen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d", LOGWARNING("Heightgen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d",
CacheSize, 4 CacheSize, 4
); );
CacheSize = 4; CacheSize = 4;

View File

@ -214,7 +214,7 @@ void cFinishGenSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
// Generate small foliage (1-block): // Generate small foliage (1-block):
// TODO: Update heightmap with 1-block-tall foliage // TODO: Update heightmap with 1-block-tall foliage
for (int z = 0; z < cChunkDef::Width; z++) for (int z = 0; z < cChunkDef::Width; z++)
{ {
int BlockZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z; int BlockZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z;
const float zz = (float)BlockZ; const float zz = (float)BlockZ;
@ -678,7 +678,7 @@ cFinishGenFluidSprings::cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cI
AString HeightDistribution = a_IniFile.GetValueSet(SectionName, "HeightDistribution", DefaultHeightDistribution); AString HeightDistribution = a_IniFile.GetValueSet(SectionName, "HeightDistribution", DefaultHeightDistribution);
if (!m_HeightDistribution.SetDefString(HeightDistribution) || (m_HeightDistribution.GetSum() <= 0)) if (!m_HeightDistribution.SetDefString(HeightDistribution) || (m_HeightDistribution.GetSum() <= 0))
{ {
LOGWARNING("[%sSprings]: HeightDistribution is invalid, using the default of \"%s\".", LOGWARNING("[%sSprings]: HeightDistribution is invalid, using the default of \"%s\".",
(a_Fluid == E_BLOCK_WATER) ? "Water" : "Lava", (a_Fluid == E_BLOCK_WATER) ? "Water" : "Lava",
DefaultHeightDistribution.c_str() DefaultHeightDistribution.c_str()
); );

View File

@ -267,7 +267,7 @@ float cHeiGenClassic::GetNoise(float x, float y)
void cHeiGenClassic::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) void cHeiGenClassic::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap)
{ {
for (int z = 0; z < cChunkDef::Width; z++) for (int z = 0; z < cChunkDef::Width; z++)
{ {
const float zz = (float)(a_ChunkZ * cChunkDef::Width + z); const float zz = (float)(a_ChunkZ * cChunkDef::Width + z);
for (int x = 0; x < cChunkDef::Width; x++) for (int x = 0; x < cChunkDef::Width; x++)

View File

@ -1,7 +1,7 @@
// PieceGenerator.cpp // PieceGenerator.cpp
// Implements the cBFSPieceGenerator class and cDFSPieceGenerator class // Implements the cBFSPieceGenerator class and cDFSPieceGenerator class
// representing base classes for generating structures composed of individual "pieces" // representing base classes for generating structures composed of individual "pieces"
#include "Globals.h" #include "Globals.h"

View File

@ -1,7 +1,7 @@
// PieceGenerator.h // PieceGenerator.h
// Declares the cBFSPieceGenerator class and cDFSPieceGenerator class // Declares the cBFSPieceGenerator class and cDFSPieceGenerator class
// representing base classes for generating structures composed of individual "pieces" // representing base classes for generating structures composed of individual "pieces"
/* /*
@ -251,7 +251,7 @@ protected:
const cPiece::cConnector & a_ExistingConnector, // The existing connector const cPiece::cConnector & a_ExistingConnector, // The existing connector
const Vector3i & a_ToPos, // The position on which the new connector should be placed const Vector3i & a_ToPos, // The position on which the new connector should be placed
const cPiece & a_Piece, // The new piece const cPiece & a_Piece, // The new piece
const cPiece::cConnector & a_NewConnector, // The connector of the new piece const cPiece::cConnector & a_NewConnector, // The connector of the new piece
int a_NumCCWRotations, // Number of rotations for the new piece to align the connector int a_NumCCWRotations, // Number of rotations for the new piece to align the connector
const cPlacedPieces & a_OutPieces // All the already-placed pieces to check const cPlacedPieces & a_OutPieces // All the already-placed pieces to check
); );

View File

@ -181,7 +181,7 @@ void cPrefab::AddRotatedBlockAreas(void)
m_BlockArea[2].CopyFrom(m_BlockArea[0]); m_BlockArea[2].CopyFrom(m_BlockArea[0]);
m_BlockArea[2].MirrorXY(); m_BlockArea[2].MirrorXY();
m_BlockArea[2].MirrorYZ(); m_BlockArea[2].MirrorYZ();
} }
// 3 CCW rotations = 1 CW rotation: // 3 CCW rotations = 1 CW rotation:
if ((m_AllowedRotations & 0x04) != 0) if ((m_AllowedRotations & 0x04) != 0)

View File

@ -183,7 +183,7 @@ protected:
bool m_MoveToGround; bool m_MoveToGround;
// cPiece overrides: // cPiece overrides:
virtual cConnectors GetConnectors(void) const override; virtual cConnectors GetConnectors(void) const override;
virtual Vector3i GetSize(void) const override; virtual Vector3i GetSize(void) const override;
virtual cCuboid GetHitBox(void) const override; virtual cCuboid GetHitBox(void) const override;

View File

@ -151,7 +151,7 @@ void cStructGenTrees::GenerateSingleTree(
sSetBlockVector TreeLogs, TreeOther; sSetBlockVector TreeLogs, TreeOther;
GetTreeImageByBiome( GetTreeImageByBiome(
a_ChunkX * cChunkDef::Width + x, Height + 1, a_ChunkZ * cChunkDef::Width + z, a_ChunkX * cChunkDef::Width + x, Height + 1, a_ChunkZ * cChunkDef::Width + z,
m_Noise, a_Seq, m_Noise, a_Seq,
a_ChunkDesc.GetBiome(x, z), a_ChunkDesc.GetBiome(x, z),
TreeLogs, TreeOther TreeLogs, TreeOther
); );
@ -181,7 +181,7 @@ void cStructGenTrees::GenerateSingleTree(
} }
ApplyTreeImage(a_ChunkX, a_ChunkZ, a_ChunkDesc, TreeOther, a_OutsideOther); ApplyTreeImage(a_ChunkX, a_ChunkZ, a_ChunkDesc, TreeOther, a_OutsideOther);
ApplyTreeImage(a_ChunkX, a_ChunkZ, a_ChunkDesc, TreeLogs, a_OutsideLogs); ApplyTreeImage(a_ChunkX, a_ChunkZ, a_ChunkDesc, TreeLogs, a_OutsideLogs);
} }
@ -500,7 +500,7 @@ void cStructGenLakes::CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a
continue; continue;
} }
int IdxYZ = BubbleX + IdxY + (BubbleZ + z) * 16; int IdxYZ = BubbleX + IdxY + (BubbleZ + z) * 16;
for (int x = -BubbleR; x <= BubbleR; x++) for (int x = -BubbleR; x <= BubbleR; x++)
{ {
if (x * x + DistYZ < RSquared) if (x * x + DistYZ < RSquared)
{ {
@ -511,10 +511,10 @@ void cStructGenLakes::CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a
} // for y } // for y
} // for i - bubbles } // for i - bubbles
// Turn air in the bottom half into liquid: // Turn air in the bottom half into liquid:
for (int y = 0; y < 4; y++) for (int y = 0; y < 4; y++)
{ {
for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++) for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++)
{ {
if (BlockTypes[x + z * 16 + y * 16 * 16] == E_BLOCK_AIR) if (BlockTypes[x + z * 16 + y * 16 * 16] == E_BLOCK_AIR)
{ {
@ -573,8 +573,8 @@ void cStructGenDirectOverhangs::GenFinish(cChunkDesc & a_ChunkDesc)
// Interpolate the lowest floor: // Interpolate the lowest floor:
for (int z = 0; z <= 16 / INTERPOL_Z; z++) for (int x = 0; x <= 16 / INTERPOL_X; x++) for (int z = 0; z <= 16 / INTERPOL_Z; z++) for (int x = 0; x <= 16 / INTERPOL_X; x++)
{ {
FloorLo[INTERPOL_X * x + 17 * INTERPOL_Z * z] = FloorLo[INTERPOL_X * x + 17 * INTERPOL_Z * z] =
m_Noise1.IntNoise3DInt(BaseX + INTERPOL_X * x, BaseY, BaseZ + INTERPOL_Z * z) * m_Noise1.IntNoise3DInt(BaseX + INTERPOL_X * x, BaseY, BaseZ + INTERPOL_Z * z) *
m_Noise2.IntNoise3DInt(BaseX + INTERPOL_X * x, BaseY, BaseZ + INTERPOL_Z * z) / m_Noise2.IntNoise3DInt(BaseX + INTERPOL_X * x, BaseY, BaseZ + INTERPOL_Z * z) /
256; 256;
} // for x, z - FloorLo[] } // for x, z - FloorLo[]

View File

@ -83,7 +83,7 @@ static const sCoords BigO4[] = // Part of Big Jungle tree
typedef struct typedef struct
{ {
const sCoords * Coords; const sCoords * Coords;
size_t Count; size_t Count;
@ -203,7 +203,7 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
{ {
GetAppleBushImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks); GetAppleBushImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
} }
else else
{ {
GetJungleTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks); GetJungleTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
} }
@ -598,11 +598,11 @@ void GetPineTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Noise
} }
int h = a_BlockY + TrunkHeight + 2; int h = a_BlockY + TrunkHeight + 2;
// Top layer - just a single leaves block: // Top layer - just a single leaves block:
a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER)); a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER));
h--; h--;
// One more layer is above the trunk, push the central leaves: // One more layer is above the trunk, push the central leaves:
a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER)); a_OtherBlocks.push_back(sSetBlock(a_BlockX, h, a_BlockZ, E_BLOCK_LEAVES, E_META_LEAVES_CONIFER));
// Layers expanding in size, then collapsing again: // Layers expanding in size, then collapsing again:

View File

@ -139,7 +139,7 @@ AString cHTTPRequest::GetBareURL(void) const
size_t cHTTPRequest::ParseRequestLine(const char * a_Data, size_t a_Size) size_t cHTTPRequest::ParseRequestLine(const char * a_Data, size_t a_Size)
{ {
m_IncomingHeaderData.append(a_Data, a_Size); m_IncomingHeaderData.append(a_Data, a_Size);
size_t IdxEnd = m_IncomingHeaderData.size(); size_t IdxEnd = m_IncomingHeaderData.size();

View File

@ -26,7 +26,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -25,7 +25,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -25,7 +25,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -25,7 +25,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -24,7 +24,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -25,7 +25,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override
@ -33,8 +33,8 @@ public:
a_BlockType = (m_ItemType == E_ITEM_WOODEN_DOOR) ? E_BLOCK_WOODEN_DOOR : E_BLOCK_IRON_DOOR; a_BlockType = (m_ItemType == E_ITEM_WOODEN_DOOR) ? E_BLOCK_WOODEN_DOOR : E_BLOCK_IRON_DOOR;
cChunkInterface ChunkInterface(a_World->GetChunkMap()); cChunkInterface ChunkInterface(a_World->GetChunkMap());
bool Meta = BlockHandler(a_BlockType)->GetPlacementBlockTypeMeta( bool Meta = BlockHandler(a_BlockType)->GetPlacementBlockTypeMeta(
ChunkInterface, a_Player, 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_CursorX, a_CursorY, a_CursorZ,
a_BlockType, a_BlockMeta a_BlockType, a_BlockMeta
); );

View File

@ -210,7 +210,7 @@ public:
if (FishType <= 1) // Clownfish has a 2% chance of spawning if (FishType <= 1) // Clownfish has a 2% chance of spawning
{ {
Drops.Add(cItem(E_ITEM_RAW_FISH, 1, E_META_RAW_FISH_CLOWNFISH)); Drops.Add(cItem(E_ITEM_RAW_FISH, 1, E_META_RAW_FISH_CLOWNFISH));
} }
else if (FishType <= 12) // Pufferfish has a 13% chance of spawning else if (FishType <= 12) // Pufferfish has a 13% chance of spawning
{ {
Drops.Add(cItem(E_ITEM_RAW_FISH, 1, E_META_RAW_FISH_CLOWNFISH)); Drops.Add(cItem(E_ITEM_RAW_FISH, 1, E_META_RAW_FISH_CLOWNFISH));

View File

@ -25,7 +25,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -458,7 +458,7 @@ char cItemHandler::GetMaxStackSize(void)
bool cItemHandler::IsTool() bool cItemHandler::IsTool()
{ {
// TODO: Rewrite this to list all tools specifically // TODO: Rewrite this to list all tools specifically
return return
(m_ItemType >= 256 && m_ItemType <= 259) (m_ItemType >= 256 && m_ItemType <= 259)
|| (m_ItemType == 261) || (m_ItemType == 261)
|| (m_ItemType >= 267 && m_ItemType <= 279) || (m_ItemType >= 267 && m_ItemType <= 279)
@ -525,7 +525,7 @@ bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType)
bool cItemHandler::GetPlacementBlockTypeMeta( bool cItemHandler::GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) )
@ -542,7 +542,7 @@ bool cItemHandler::GetPlacementBlockTypeMeta(
cChunkInterface ChunkInterface(a_World->GetChunkMap()); cChunkInterface ChunkInterface(a_World->GetChunkMap());
return BlockH->GetPlacementBlockTypeMeta( return BlockH->GetPlacementBlockTypeMeta(
ChunkInterface, a_Player, 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_CursorX, a_CursorY, a_CursorZ,
a_BlockType, a_BlockMeta a_BlockType, a_BlockMeta
); );

View File

@ -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); 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 */ /** 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_BlockX);
UNUSED(a_BlockY); UNUSED(a_BlockY);
@ -97,7 +97,7 @@ public:
*/ */
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
); );

View File

@ -20,7 +20,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -26,7 +26,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -25,7 +25,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -22,7 +22,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -24,7 +24,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -20,7 +20,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -30,7 +30,7 @@ public:
case E_ITEM_CARROT: case E_ITEM_CARROT:
case E_ITEM_POTATO: return true; case E_ITEM_POTATO: return true;
default: return false; default: return false;
} }
} }
virtual FoodInfo GetFoodInfo(void) override virtual FoodInfo GetFoodInfo(void) override
@ -45,7 +45,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -27,7 +27,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -23,7 +23,7 @@ public:
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player, 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, int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override ) override

View File

@ -42,7 +42,7 @@ void cAggressiveMonster::InStateChasing(float a_Dt)
MoveToPosition(m_Target->GetPosition()); MoveToPosition(m_Target->GetPosition());
} }
} }
} }

View File

@ -353,13 +353,13 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
// If enemy passive we ignore checks for player visibility // If enemy passive we ignore checks for player visibility
InStateIdle(a_Dt); InStateIdle(a_Dt);
break; break;
} }
case CHASING: case CHASING:
{ {
// If we do not see a player anymore skip chasing action // If we do not see a player anymore skip chasing action
InStateChasing(a_Dt); InStateChasing(a_Dt);
break; break;
} }
case ESCAPING: case ESCAPING:
{ {
InStateEscaping(a_Dt); InStateEscaping(a_Dt);
@ -588,7 +588,7 @@ void cMonster::CheckEventSeePlayer(void)
void cMonster::CheckEventLostPlayer(void) void cMonster::CheckEventLostPlayer(void)
{ {
if (m_Target != NULL) if (m_Target != NULL)
{ {
if ((m_Target->GetPosition() - GetPosition()).Length() > m_SightDistance) if ((m_Target->GetPosition() - GetPosition()).Length() > m_SightDistance)

View File

@ -233,7 +233,7 @@ protected:
AString m_SoundHurt; AString m_SoundHurt;
AString m_SoundDeath; AString m_SoundDeath;
float m_AttackRate; float m_AttackRate;
int m_AttackDamage; int m_AttackDamage;
int m_AttackRange; int m_AttackRange;
float m_AttackInterval; float m_AttackInterval;
@ -250,13 +250,13 @@ protected:
bool m_BurnsInDaylight; bool m_BurnsInDaylight;
/** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/ /** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/
void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0); void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);
/** Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops*/ /** Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops*/
void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0); void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0);
/** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops*/ /** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops*/
void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel); void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel);
/** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/ /** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
void AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel); void AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel);

View File

@ -55,7 +55,7 @@ void cVillager::Tick(float a_Dt, cChunk & a_Chunk)
{ {
switch (m_Type) switch (m_Type)
{ {
case vtFarmer: case vtFarmer:
{ {
HandleFarmerPlaceCrops(); HandleFarmerPlaceCrops();
} }

View File

@ -108,7 +108,7 @@ bool cCriticalSection::IsLockedByCurrentThread(void)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// cCSLock // cCSLock
cCSLock::cCSLock(cCriticalSection * a_CS) cCSLock::cCSLock(cCriticalSection * a_CS)
: m_CS(a_CS) : m_CS(a_CS)
, m_IsLocked(false) , m_IsLocked(false)
{ {
@ -119,7 +119,7 @@ cCSLock::cCSLock(cCriticalSection * a_CS)
cCSLock::cCSLock(cCriticalSection & a_CS) cCSLock::cCSLock(cCriticalSection & a_CS)
: m_CS(&a_CS) : m_CS(&a_CS)
, m_IsLocked(false) , m_IsLocked(false)
{ {

Some files were not shown because too many files have changed in this diff Show More