Merge remote-tracking branch 'origin/master' into saplingsandleaves
Conflicts: src/Defines.h
This commit is contained in:
commit
18a0b60c12
1
.gitignore
vendored
1
.gitignore
vendored
@ -65,6 +65,7 @@ lib/tolua++/tolua
|
|||||||
src/Bindings/Bindings.*
|
src/Bindings/Bindings.*
|
||||||
src/Bindings/BindingDependecies.txt
|
src/Bindings/BindingDependecies.txt
|
||||||
MCServer.dir/
|
MCServer.dir/
|
||||||
|
src/AllFiles.lst
|
||||||
|
|
||||||
#win32 cmake stuff
|
#win32 cmake stuff
|
||||||
*.vcxproj
|
*.vcxproj
|
||||||
|
@ -4,5 +4,5 @@ struct lua_State;
|
|||||||
class DeprecatedBindings
|
class DeprecatedBindings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Bind( lua_State* tolua_S );
|
static void Bind( lua_State* tolua_S);
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,7 @@ inline unsigned int GetTime()
|
|||||||
return (unsigned int)time(0);
|
return (unsigned int)time(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string GetChar( std::string & a_Str, unsigned int a_Idx )
|
inline std::string GetChar( std::string & a_Str, unsigned int a_Idx)
|
||||||
{
|
{
|
||||||
return std::string(1, a_Str[ a_Idx ]);
|
return std::string(1, a_Str[ a_Idx ]);
|
||||||
}
|
}
|
||||||
|
@ -319,9 +319,9 @@ static int tolua_DoWith(lua_State* tolua_S)
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
|
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
|
||||||
: LuaState( a_LuaState )
|
: LuaState( a_LuaState)
|
||||||
, FuncRef( a_FuncRef )
|
, FuncRef( a_FuncRef)
|
||||||
, TableRef( a_TableRef )
|
, TableRef( a_TableRef)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -358,7 +358,7 @@ static int tolua_DoWith(lua_State* tolua_S)
|
|||||||
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
|
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
|
||||||
|
|
||||||
/* Push return value on stack */
|
/* Push return value on stack */
|
||||||
tolua_pushboolean(tolua_S, bRetVal );
|
tolua_pushboolean(tolua_S, bRetVal);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +448,7 @@ static int tolua_DoWithID(lua_State* tolua_S)
|
|||||||
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
|
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
|
||||||
|
|
||||||
/* Push return value on stack */
|
/* Push return value on stack */
|
||||||
tolua_pushboolean(tolua_S, bRetVal );
|
tolua_pushboolean(tolua_S, bRetVal);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ static int tolua_DoWithXYZ(lua_State* tolua_S)
|
|||||||
int ItemX = ((int)tolua_tonumber(tolua_S, 2, 0));
|
int ItemX = ((int)tolua_tonumber(tolua_S, 2, 0));
|
||||||
int ItemY = ((int)tolua_tonumber(tolua_S, 3, 0));
|
int ItemY = ((int)tolua_tonumber(tolua_S, 3, 0));
|
||||||
int ItemZ = ((int)tolua_tonumber(tolua_S, 4, 0));
|
int ItemZ = ((int)tolua_tonumber(tolua_S, 4, 0));
|
||||||
LOG("x %i y %i z %i", ItemX, ItemY, ItemZ );
|
LOG("x %i y %i z %i", ItemX, ItemY, ItemZ);
|
||||||
if (!lua_isfunction( tolua_S, 5))
|
if (!lua_isfunction( tolua_S, 5))
|
||||||
{
|
{
|
||||||
return lua_do_error(tolua_S, "Error in function call '#funcname#': Expected a function for parameter #4");
|
return lua_do_error(tolua_S, "Error in function call '#funcname#': Expected a function for parameter #4");
|
||||||
@ -506,9 +506,9 @@ static int tolua_DoWithXYZ(lua_State* tolua_S)
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
|
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
|
||||||
: LuaState( a_LuaState )
|
: LuaState( a_LuaState)
|
||||||
, FuncRef( a_FuncRef )
|
, FuncRef( a_FuncRef)
|
||||||
, TableRef( a_TableRef )
|
, TableRef( a_TableRef)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -544,7 +544,7 @@ static int tolua_DoWithXYZ(lua_State* tolua_S)
|
|||||||
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
|
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
|
||||||
|
|
||||||
/* Push return value on stack */
|
/* Push return value on stack */
|
||||||
tolua_pushboolean(tolua_S, bRetVal );
|
tolua_pushboolean(tolua_S, bRetVal);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,9 +601,9 @@ static int tolua_ForEachInChunk(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
|
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
|
||||||
: LuaState( a_LuaState )
|
: LuaState( a_LuaState)
|
||||||
, FuncRef( a_FuncRef )
|
, FuncRef( a_FuncRef)
|
||||||
, TableRef( a_TableRef )
|
, TableRef( a_TableRef)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -640,7 +640,7 @@ static int tolua_ForEachInChunk(lua_State * tolua_S)
|
|||||||
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
|
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
|
||||||
|
|
||||||
/* Push return value on stack */
|
/* Push return value on stack */
|
||||||
tolua_pushboolean(tolua_S, bRetVal );
|
tolua_pushboolean(tolua_S, bRetVal);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,12 +656,12 @@ template<
|
|||||||
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' */
|
||||||
if( NumArgs != 1 && NumArgs != 2)
|
if ((NumArgs != 1) && (NumArgs != 2))
|
||||||
{
|
{
|
||||||
return lua_do_error(tolua_S, "Error in function call '#funcname#': Requires 1 or 2 arguments, got %i", NumArgs);
|
return lua_do_error(tolua_S, "Error in function call '#funcname#': Requires 1 or 2 arguments, got %i", NumArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ty1 * self = (Ty1 *) tolua_tousertype(tolua_S, 1, NULL);
|
Ty1 * self = (Ty1 *)tolua_tousertype(tolua_S, 1, NULL);
|
||||||
if (self == NULL)
|
if (self == NULL)
|
||||||
{
|
{
|
||||||
return lua_do_error(tolua_S, "Error in function call '#funcname#': Not called on an object instance");
|
return lua_do_error(tolua_S, "Error in function call '#funcname#': Not called on an object instance");
|
||||||
@ -694,16 +694,16 @@ static int tolua_ForEach(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
|
cLuaCallback(lua_State* a_LuaState, int a_FuncRef, int a_TableRef)
|
||||||
: LuaState( a_LuaState )
|
: LuaState( a_LuaState)
|
||||||
, FuncRef( a_FuncRef )
|
, FuncRef( a_FuncRef)
|
||||||
, TableRef( a_TableRef )
|
, TableRef( a_TableRef)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool Item(Ty2 * a_Item) override
|
virtual bool Item(Ty2 * a_Item) override
|
||||||
{
|
{
|
||||||
lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */
|
lua_rawgeti( LuaState, LUA_REGISTRYINDEX, FuncRef); /* Push function reference */
|
||||||
tolua_pushusertype( LuaState, a_Item, Ty2::GetClassStatic() );
|
tolua_pushusertype( LuaState, a_Item, Ty2::GetClassStatic());
|
||||||
if (TableRef != LUA_REFNIL)
|
if (TableRef != LUA_REFNIL)
|
||||||
{
|
{
|
||||||
lua_rawgeti( LuaState, LUA_REGISTRYINDEX, TableRef); /* Push table reference */
|
lua_rawgeti( LuaState, LUA_REGISTRYINDEX, TableRef); /* Push table reference */
|
||||||
@ -733,7 +733,7 @@ static int tolua_ForEach(lua_State * tolua_S)
|
|||||||
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
|
luaL_unref(tolua_S, LUA_REGISTRYINDEX, FuncRef);
|
||||||
|
|
||||||
/* Push return value on stack */
|
/* Push return value on stack */
|
||||||
tolua_pushboolean(tolua_S, bRetVal );
|
tolua_pushboolean(tolua_S, bRetVal);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1360,7 +1360,7 @@ static int tolua_cPluginManager_AddHook(lua_State * tolua_S)
|
|||||||
static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S)
|
static int tolua_cPluginManager_ForEachCommand(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 != 1)
|
if (NumArgs != 1)
|
||||||
{
|
{
|
||||||
LOGWARN("Error in function call 'ForEachCommand': Requires 1 argument, got %i", NumArgs);
|
LOGWARN("Error in function call 'ForEachCommand': Requires 1 argument, got %i", NumArgs);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1390,8 +1390,8 @@ static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cLuaCallback(lua_State * a_LuaState, int a_FuncRef)
|
cLuaCallback(lua_State * a_LuaState, int a_FuncRef)
|
||||||
: LuaState( a_LuaState )
|
: LuaState( a_LuaState)
|
||||||
, FuncRef( a_FuncRef )
|
, FuncRef( a_FuncRef)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1437,7 +1437,7 @@ static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S)
|
|||||||
static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S)
|
static int tolua_cPluginManager_ForEachConsoleCommand(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 != 1)
|
if (NumArgs != 1)
|
||||||
{
|
{
|
||||||
LOGWARN("Error in function call 'ForEachConsoleCommand': Requires 1 argument, got %i", NumArgs);
|
LOGWARN("Error in function call 'ForEachConsoleCommand': Requires 1 argument, got %i", NumArgs);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1467,8 +1467,8 @@ static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cLuaCallback(lua_State * a_LuaState, int a_FuncRef)
|
cLuaCallback(lua_State * a_LuaState, int a_FuncRef)
|
||||||
: LuaState( a_LuaState )
|
: LuaState( a_LuaState)
|
||||||
, FuncRef( a_FuncRef )
|
, FuncRef( a_FuncRef)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1938,16 +1938,16 @@ static int tolua_cPluginLua_AddWebTab(lua_State * tolua_S)
|
|||||||
return tolua_do_error(tolua_S, "#ferror calling function '#funcname#'", &tolua_err);
|
return tolua_do_error(tolua_S, "#ferror calling function '#funcname#'", &tolua_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Reference != LUA_REFNIL )
|
if (Reference != LUA_REFNIL)
|
||||||
{
|
{
|
||||||
if( !self->AddWebTab( Title.c_str(), tolua_S, Reference ) )
|
if (!self->AddWebTab(Title.c_str(), tolua_S, Reference))
|
||||||
{
|
{
|
||||||
luaL_unref( tolua_S, LUA_REGISTRYINDEX, Reference );
|
luaL_unref(tolua_S, LUA_REGISTRYINDEX, Reference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGERROR("ERROR: cPluginLua:AddWebTab invalid function reference in 2nd argument (Title: \"%s\")", Title.c_str() );
|
LOGWARNING("cPluginLua:AddWebTab: invalid function reference in 2nd argument (Title: \"%s\")", Title.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1963,7 +1963,7 @@ static int tolua_cPluginLua_AddTab(lua_State* tolua_S)
|
|||||||
LOGWARN("WARNING: Using deprecated function AddTab()! Use AddWebTab() instead. (plugin \"%s\" in folder \"%s\")",
|
LOGWARN("WARNING: Using deprecated function AddTab()! Use AddWebTab() instead. (plugin \"%s\" in folder \"%s\")",
|
||||||
self->GetName().c_str(), self->GetDirectory().c_str()
|
self->GetName().c_str(), self->GetDirectory().c_str()
|
||||||
);
|
);
|
||||||
return tolua_cPluginLua_AddWebTab( tolua_S );
|
return tolua_cPluginLua_AddWebTab( tolua_S);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2011,12 +2011,12 @@ static int tolua_md5(lua_State* tolua_S)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string, std::string >& a_StringStringMap )
|
static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string, std::string >& a_StringStringMap)
|
||||||
{
|
{
|
||||||
lua_newtable(tolua_S);
|
lua_newtable(tolua_S);
|
||||||
int top = lua_gettop(tolua_S);
|
int top = lua_gettop(tolua_S);
|
||||||
|
|
||||||
for( std::map< std::string, std::string >::iterator it = a_StringStringMap.begin(); it != a_StringStringMap.end(); ++it )
|
for (std::map<std::string, std::string>::iterator it = a_StringStringMap.begin(); it != a_StringStringMap.end(); ++it)
|
||||||
{
|
{
|
||||||
const char* key = it->first.c_str();
|
const char* key = it->first.c_str();
|
||||||
const char* value = it->second.c_str();
|
const char* value = it->second.c_str();
|
||||||
@ -2060,11 +2060,11 @@ static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S)
|
|||||||
lua_newtable(tolua_S);
|
lua_newtable(tolua_S);
|
||||||
int top = lua_gettop(tolua_S);
|
int top = lua_gettop(tolua_S);
|
||||||
|
|
||||||
for( std::map< std::string, HTTPFormData >::iterator it = FormData.begin(); it != FormData.end(); ++it )
|
for (std::map<std::string, HTTPFormData>::iterator it = FormData.begin(); it != FormData.end(); ++it)
|
||||||
{
|
{
|
||||||
lua_pushstring(tolua_S, it->first.c_str() );
|
lua_pushstring(tolua_S, it->first.c_str());
|
||||||
tolua_pushusertype(tolua_S, &(it->second), "HTTPFormData" );
|
tolua_pushusertype(tolua_S, &(it->second), "HTTPFormData");
|
||||||
// lua_pushlstring(tolua_S, it->second.Value.c_str(), it->second.Value.size() ); // Might contain binary data
|
// lua_pushlstring(tolua_S, it->second.Value.c_str(), it->second.Value.size()); // Might contain binary data
|
||||||
lua_settable(tolua_S, top);
|
lua_settable(tolua_S, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2109,12 +2109,12 @@ static int tolua_cWebPlugin_GetTabNames(lua_State * tolua_S)
|
|||||||
lua_newtable(tolua_S);
|
lua_newtable(tolua_S);
|
||||||
int index = 1;
|
int index = 1;
|
||||||
cWebPlugin::TabNameList::const_iterator iter = TabNames.begin();
|
cWebPlugin::TabNameList::const_iterator iter = TabNames.begin();
|
||||||
while(iter != TabNames.end())
|
while (iter != TabNames.end())
|
||||||
{
|
{
|
||||||
const AString & FancyName = iter->first;
|
const AString & FancyName = iter->first;
|
||||||
const AString & WebName = iter->second;
|
const AString & WebName = iter->second;
|
||||||
tolua_pushstring( tolua_S, WebName.c_str() ); // Because the WebName is supposed to be unique, use it as key
|
tolua_pushstring( tolua_S, WebName.c_str()); // Because the WebName is supposed to be unique, use it as key
|
||||||
tolua_pushstring( tolua_S, FancyName.c_str() );
|
tolua_pushstring( tolua_S, FancyName.c_str());
|
||||||
//
|
//
|
||||||
lua_rawset(tolua_S, -3);
|
lua_rawset(tolua_S, -3);
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -4,5 +4,5 @@ struct lua_State;
|
|||||||
class ManualBindings
|
class ManualBindings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Bind( lua_State* tolua_S );
|
static void Bind( lua_State* tolua_S);
|
||||||
};
|
};
|
||||||
|
@ -33,7 +33,7 @@ class cPlugin
|
|||||||
public:
|
public:
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
cPlugin( const AString & a_PluginDirectory );
|
cPlugin( const AString & a_PluginDirectory);
|
||||||
virtual ~cPlugin();
|
virtual ~cPlugin();
|
||||||
|
|
||||||
virtual void OnDisable(void) {}
|
virtual void OnDisable(void) {}
|
||||||
@ -141,7 +141,7 @@ public:
|
|||||||
E_SQUIRREL, // OBSOLETE, but kept in place to remind us of the horrors lurking in the history
|
E_SQUIRREL, // OBSOLETE, but kept in place to remind us of the horrors lurking in the history
|
||||||
};
|
};
|
||||||
PluginLanguage GetLanguage() { return m_Language; }
|
PluginLanguage GetLanguage() { return m_Language; }
|
||||||
void SetLanguage( PluginLanguage a_Language ) { m_Language = a_Language; }
|
void SetLanguage( PluginLanguage a_Language) { m_Language = a_Language; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PluginLanguage m_Language;
|
PluginLanguage m_Language;
|
||||||
|
@ -1655,7 +1655,7 @@ int cPluginLua::CallFunctionFromForeignState(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AString cPluginLua::HandleWebRequest(const HTTPRequest * a_Request )
|
AString cPluginLua::HandleWebRequest(const HTTPRequest * a_Request)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CriticalSection);
|
cCSLock Lock(m_CriticalSection);
|
||||||
std::string RetVal = "";
|
std::string RetVal = "";
|
||||||
|
@ -144,7 +144,7 @@ public:
|
|||||||
virtual const AString GetWebTitle(void) const {return GetName(); }
|
virtual const AString GetWebTitle(void) const {return GetName(); }
|
||||||
|
|
||||||
// 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. */
|
||||||
|
@ -72,7 +72,7 @@ void cPluginManager::FindPlugins(void)
|
|||||||
{
|
{
|
||||||
PluginMap::iterator thiz = itr;
|
PluginMap::iterator thiz = itr;
|
||||||
++thiz;
|
++thiz;
|
||||||
m_Plugins.erase( itr );
|
m_Plugins.erase( itr);
|
||||||
itr = thiz;
|
itr = thiz;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1432,11 +1432,11 @@ cPluginManager::CommandResult cPluginManager::HandleCommand(cPlayer * a_Player,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cPlugin * cPluginManager::GetPlugin( const AString & a_Plugin ) const
|
cPlugin * cPluginManager::GetPlugin( const AString & a_Plugin) const
|
||||||
{
|
{
|
||||||
for( PluginMap::const_iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr )
|
for (PluginMap::const_iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->second == NULL ) continue;
|
if (itr->second == NULL) continue;
|
||||||
if (itr->second->GetName().compare(a_Plugin) == 0)
|
if (itr->second->GetName().compare(a_Plugin) == 0)
|
||||||
{
|
{
|
||||||
return itr->second;
|
return itr->second;
|
||||||
|
@ -163,7 +163,7 @@ public:
|
|||||||
|
|
||||||
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 <<
|
||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
|
@ -45,12 +45,12 @@ cWebPlugin::~cWebPlugin()
|
|||||||
std::list<std::pair<AString, AString> > cWebPlugin::GetTabNames(void)
|
std::list<std::pair<AString, AString> > cWebPlugin::GetTabNames(void)
|
||||||
{
|
{
|
||||||
std::list< std::pair< AString, AString > > NameList;
|
std::list< std::pair< AString, AString > > NameList;
|
||||||
for( TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr )
|
for (TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr)
|
||||||
{
|
{
|
||||||
std::pair< AString, AString > StringPair;
|
std::pair< AString, AString > StringPair;
|
||||||
StringPair.first = (*itr)->Title;
|
StringPair.first = (*itr)->Title;
|
||||||
StringPair.second = (*itr)->SafeTitle;
|
StringPair.second = (*itr)->SafeTitle;
|
||||||
NameList.push_back( StringPair );
|
NameList.push_back( StringPair);
|
||||||
}
|
}
|
||||||
return NameList;
|
return NameList;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
|
|||||||
sWebPluginTab * Tab = NULL;
|
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!
|
if ((*itr)->SafeTitle.compare(Split[2]) == 0) // This is the one!
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
|
|||||||
}
|
}
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,14 +100,14 @@ 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 = '_';
|
||||||
}
|
}
|
||||||
RetVal.push_back( c );
|
RetVal.push_back( c);
|
||||||
}
|
}
|
||||||
return RetVal;
|
return RetVal;
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@ public:
|
|||||||
// tolua_begin
|
// tolua_begin
|
||||||
virtual const AString GetWebTitle(void) const = 0;
|
virtual const AString GetWebTitle(void) const = 0;
|
||||||
|
|
||||||
virtual AString HandleWebRequest(const HTTPRequest * a_Request ) = 0;
|
virtual AString HandleWebRequest(const HTTPRequest * a_Request) = 0;
|
||||||
|
|
||||||
static AString SafeString( const AString & a_String );
|
static AString SafeString( const AString & a_String);
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
struct sWebPluginTab
|
struct sWebPluginTab
|
||||||
@ -37,7 +37,7 @@ public:
|
|||||||
|
|
||||||
typedef std::list< std::pair<AString, AString> > TabNameList;
|
typedef std::list< std::pair<AString, AString> > TabNameList;
|
||||||
TabNameList GetTabNames(); // >> EXPORTED IN MANUALBINDINGS <<
|
TabNameList GetTabNames(); // >> EXPORTED IN MANUALBINDINGS <<
|
||||||
std::pair< AString, AString > GetTabNameForRequest(const HTTPRequest* a_Request );
|
std::pair< AString, AString > GetTabNameForRequest(const HTTPRequest* a_Request);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TabList m_Tabs;
|
TabList m_Tabs;
|
||||||
|
@ -66,7 +66,7 @@ int cBeaconEntity::GetPyramidLevel(void)
|
|||||||
|
|
||||||
bool cBeaconEntity::IsMineralBlock(BLOCKTYPE a_BlockType)
|
bool cBeaconEntity::IsMineralBlock(BLOCKTYPE a_BlockType)
|
||||||
{
|
{
|
||||||
switch(a_BlockType)
|
switch (a_BlockType)
|
||||||
{
|
{
|
||||||
case E_BLOCK_DIAMOND_BLOCK:
|
case E_BLOCK_DIAMOND_BLOCK:
|
||||||
case E_BLOCK_GOLD_BLOCK:
|
case E_BLOCK_GOLD_BLOCK:
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
static bool IsMineralBlock(BLOCKTYPE a_BlockType);
|
static bool IsMineralBlock(BLOCKTYPE a_BlockType);
|
||||||
|
|
||||||
// cBlockEntity overrides:
|
// cBlockEntity overrides:
|
||||||
virtual void SaveToJson(Json::Value& a_Value ) override;
|
virtual void SaveToJson(Json::Value& a_Value) override;
|
||||||
virtual void SendTo(cClientHandle & a_Client) override;
|
virtual void SendTo(cClientHandle & a_Client) override;
|
||||||
virtual void UsedBy(cPlayer * a_Player) override;
|
virtual void UsedBy(cPlayer * a_Player) override;
|
||||||
virtual bool Tick(float a_Dt, cChunk & /* a_Chunk */) override;
|
virtual bool Tick(float a_Dt, cChunk & /* a_Chunk */) override;
|
||||||
|
@ -79,7 +79,7 @@ public:
|
|||||||
virtual void SaveToJson (Json::Value & a_Value) = 0;
|
virtual void SaveToJson (Json::Value & a_Value) = 0;
|
||||||
|
|
||||||
/// Called when a player uses this entity; should open the UI window
|
/// Called when a player uses this entity; should open the UI window
|
||||||
virtual void UsedBy( cPlayer * a_Player ) = 0;
|
virtual void UsedBy( cPlayer * a_Player) = 0;
|
||||||
|
|
||||||
/** Sends the packet defining the block entity to the client specified.
|
/** Sends the packet defining the block entity to the client specified.
|
||||||
To send to all eligible clients, use cWorld::BroadcastBlockEntity()
|
To send to all eligible clients, use cWorld::BroadcastBlockEntity()
|
||||||
|
@ -38,8 +38,8 @@ public:
|
|||||||
/// Creates a new empty command block entity
|
/// Creates a new empty command block entity
|
||||||
cCommandBlockEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
|
cCommandBlockEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
|
||||||
|
|
||||||
bool LoadFromJson( const Json::Value& a_Value );
|
bool LoadFromJson( const Json::Value& a_Value);
|
||||||
virtual void SaveToJson(Json::Value& a_Value ) override;
|
virtual void SaveToJson(Json::Value& a_Value) override;
|
||||||
|
|
||||||
virtual bool Tick(float a_Dt, cChunk & a_Chunk) override;
|
virtual bool Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||||
virtual void SendTo(cClientHandle & a_Client) override;
|
virtual void SendTo(cClientHandle & a_Client) override;
|
||||||
|
@ -39,8 +39,8 @@ public:
|
|||||||
/** Creates a new flowerpot entity at the specified block coords. a_World may be NULL */
|
/** Creates a new flowerpot entity at the specified block coords. a_World may be NULL */
|
||||||
cFlowerPotEntity(int a_BlocX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
cFlowerPotEntity(int a_BlocX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||||
|
|
||||||
bool LoadFromJson( const Json::Value& a_Value );
|
bool LoadFromJson( const Json::Value& a_Value);
|
||||||
virtual void SaveToJson(Json::Value& a_Value ) override;
|
virtual void SaveToJson(Json::Value& a_Value) override;
|
||||||
|
|
||||||
virtual void Destroy(void) override;
|
virtual void Destroy(void) override;
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ bool cFurnaceEntity::LoadFromJson(const Json::Value & a_Value)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cFurnaceEntity::SaveToJson( Json::Value& a_Value )
|
void cFurnaceEntity::SaveToJson( Json::Value& a_Value)
|
||||||
{
|
{
|
||||||
a_Value["x"] = m_PosX;
|
a_Value["x"] = m_PosX;
|
||||||
a_Value["y"] = m_PosY;
|
a_Value["y"] = m_PosY;
|
||||||
|
@ -37,8 +37,8 @@ public:
|
|||||||
/** Creates a new mob head entity at the specified block coords. a_World may be NULL */
|
/** Creates a new mob head entity at the specified block coords. a_World may be NULL */
|
||||||
cMobHeadEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
cMobHeadEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||||
|
|
||||||
bool LoadFromJson( const Json::Value& a_Value );
|
bool LoadFromJson( const Json::Value& a_Value);
|
||||||
virtual void SaveToJson(Json::Value& a_Value ) override;
|
virtual void SaveToJson(Json::Value& a_Value) override;
|
||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ public:
|
|||||||
/// Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be NULL
|
/// Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be NULL
|
||||||
cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World);
|
cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World);
|
||||||
|
|
||||||
bool LoadFromJson( const Json::Value& a_Value );
|
bool LoadFromJson( const Json::Value& a_Value);
|
||||||
virtual void SaveToJson(Json::Value& a_Value ) override;
|
virtual void SaveToJson(Json::Value& a_Value) override;
|
||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ void cBlockBedHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInt
|
|||||||
{
|
{
|
||||||
NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
|
|
||||||
Vector3i ThisPos( a_BlockX, a_BlockY, a_BlockZ );
|
Vector3i ThisPos( a_BlockX, a_BlockY, a_BlockZ);
|
||||||
Vector3i Direction = MetaDataToDirection( OldMeta & 0x7 );
|
Vector3i Direction = MetaDataToDirection( OldMeta & 0x7);
|
||||||
if (OldMeta & 0x8)
|
if (OldMeta & 0x8)
|
||||||
{
|
{
|
||||||
// Was pillow
|
// Was pillow
|
||||||
|
@ -175,7 +175,7 @@ public:
|
|||||||
|
|
||||||
cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
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);
|
||||||
@ -254,7 +254,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
|||||||
case E_BLOCK_NEW_LOG: return new cBlockSidewaysHandler (a_BlockType);
|
case E_BLOCK_NEW_LOG: return new cBlockSidewaysHandler (a_BlockType);
|
||||||
case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType);
|
case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType);
|
||||||
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
|
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
|
||||||
case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler ( );
|
case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler;
|
||||||
case E_BLOCK_PLANKS: return new cBlockPlanksHandler (a_BlockType);
|
case E_BLOCK_PLANKS: return new cBlockPlanksHandler (a_BlockType);
|
||||||
case E_BLOCK_POTATOES: return new cBlockCropsHandler (a_BlockType);
|
case E_BLOCK_POTATOES: return new cBlockCropsHandler (a_BlockType);
|
||||||
case E_BLOCK_POWERED_RAIL: return new cBlockRailHandler (a_BlockType);
|
case E_BLOCK_POWERED_RAIL: return new cBlockRailHandler (a_BlockType);
|
||||||
|
@ -99,7 +99,7 @@ public:
|
|||||||
|
|
||||||
static bool CanBePlacedOn(BLOCKTYPE a_BlockType, eBlockFace a_BlockFace)
|
static bool CanBePlacedOn(BLOCKTYPE a_BlockType, eBlockFace a_BlockFace)
|
||||||
{
|
{
|
||||||
if ( !cBlockInfo::FullyOccupiesVoxel(a_BlockType) )
|
if (!cBlockInfo::FullyOccupiesVoxel(a_BlockType))
|
||||||
{
|
{
|
||||||
return (a_BlockFace == BLOCK_FACE_TOP); // Allow placement only when torch upright (for glass, etc.); exceptions won't even be sent by client, no need to handle
|
return (a_BlockFace == BLOCK_FACE_TOP); // Allow placement only when torch upright (for glass, etc.); exceptions won't even be sent by client, no need to handle
|
||||||
}
|
}
|
||||||
@ -119,7 +119,8 @@ public:
|
|||||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, Face, true);
|
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, Face, true);
|
||||||
BLOCKTYPE BlockInQuestion = a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
BLOCKTYPE BlockInQuestion = a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
|
|
||||||
if ( // If on a block that can only hold a torch if torch is standing on it, return that face
|
// If on a block that can only hold a torch if torch is standing on it, return that face
|
||||||
|
if (
|
||||||
((BlockInQuestion == E_BLOCK_GLASS) ||
|
((BlockInQuestion == E_BLOCK_GLASS) ||
|
||||||
(BlockInQuestion == E_BLOCK_FENCE) ||
|
(BlockInQuestion == E_BLOCK_FENCE) ||
|
||||||
(BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) ||
|
(BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) ||
|
||||||
@ -167,7 +168,7 @@ public:
|
|||||||
// No need to check for upright orientation, it was done when the torch was placed
|
// No need to check for upright orientation, it was done when the torch was placed
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ( !cBlockInfo::FullyOccupiesVoxel(BlockInQuestion) )
|
else if (!cBlockInfo::FullyOccupiesVoxel(BlockInQuestion))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
static char MetaDataToDirection(NIBBLETYPE a_MetaData)
|
static char MetaDataToDirection(NIBBLETYPE a_MetaData)
|
||||||
{
|
{
|
||||||
switch(a_MetaData)
|
switch (a_MetaData)
|
||||||
{
|
{
|
||||||
case 0x1: return BLOCK_FACE_NORTH;
|
case 0x1: return BLOCK_FACE_NORTH;
|
||||||
case 0x4: return BLOCK_FACE_SOUTH;
|
case 0x4: return BLOCK_FACE_SOUTH;
|
||||||
|
@ -6,7 +6,7 @@ class cBroadcastInterface
|
|||||||
public:
|
public:
|
||||||
virtual ~cBroadcastInterface() {}
|
virtual ~cBroadcastInterface() {}
|
||||||
|
|
||||||
virtual void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) = 0;
|
virtual void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) = 0;
|
||||||
virtual void BroadcastSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL) = 0;
|
virtual void BroadcastSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL) = 0;
|
||||||
virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) = 0;
|
virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) = 0;
|
||||||
};
|
};
|
||||||
|
@ -61,9 +61,9 @@ public:
|
|||||||
m_ChunkMap->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
m_ChunkMap->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FastSetBlock(const Vector3i & a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta )
|
void FastSetBlock(const Vector3i & a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||||
{
|
{
|
||||||
FastSetBlock( a_Pos.x, a_Pos.y, a_Pos.z, a_BlockType, a_BlockMeta );
|
FastSetBlock( a_Pos.x, a_Pos.y, a_Pos.z, a_BlockType, a_BlockMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UseBlockEntity(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
|
void UseBlockEntity(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
|
@ -228,6 +228,26 @@ else ()
|
|||||||
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /DEBUG")
|
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /DEBUG")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Generate a list of all source files:
|
||||||
|
set(ALLFILES "")
|
||||||
|
foreach(folder ${FOLDERS})
|
||||||
|
get_directory_property(FOLDER_SRCS DIRECTORY ${folder} DEFINITION SRCS)
|
||||||
|
foreach (src ${FOLDER_SRCS})
|
||||||
|
list(APPEND ALLFILES "${folder}/${src}")
|
||||||
|
endforeach(src)
|
||||||
|
|
||||||
|
get_directory_property(FOLDER_HDRS DIRECTORY ${folder} DEFINITION HDRS)
|
||||||
|
foreach (hdr ${FOLDER_HDRS})
|
||||||
|
list(APPEND ALLFILES "${folder}/${hdr}")
|
||||||
|
endforeach(hdr)
|
||||||
|
endforeach(folder)
|
||||||
|
foreach(arg ${ALLFILES})
|
||||||
|
set(ALLFILESLINES "${ALLFILESLINES}${arg}\n")
|
||||||
|
endforeach()
|
||||||
|
FILE(WRITE "AllFiles.lst" "${ALLFILESLINES}")
|
||||||
|
|
||||||
|
|
||||||
set(EXECUTABLE MCServer)
|
set(EXECUTABLE MCServer)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
@ -2,31 +2,31 @@
|
|||||||
|
|
||||||
#include "ChatColor.h"
|
#include "ChatColor.h"
|
||||||
|
|
||||||
const std::string cChatColor::Color = "\xc2\xa7"; // or in other words: "§" in UTF-8
|
const char * cChatColor::Color = "\xc2\xa7"; // or in other words: "§" in UTF-8
|
||||||
const std::string cChatColor::Delimiter = "\xc2\xa7"; // or in other words: "§" in UTF-8
|
const char * cChatColor::Delimiter = "\xc2\xa7"; // or in other words: "§" in UTF-8
|
||||||
const std::string cChatColor::Black = cChatColor::Color + "0";
|
const char * cChatColor::Black = "\xc2\xa7""0";
|
||||||
const std::string cChatColor::Navy = cChatColor::Color + "1";
|
const char * cChatColor::Navy = "\xc2\xa7""1";
|
||||||
const std::string cChatColor::Green = cChatColor::Color + "2";
|
const char * cChatColor::Green = "\xc2\xa7""2";
|
||||||
const std::string cChatColor::Blue = cChatColor::Color + "3";
|
const char * cChatColor::Blue = "\xc2\xa7""3";
|
||||||
const std::string cChatColor::Red = cChatColor::Color + "4";
|
const char * cChatColor::Red = "\xc2\xa7""4";
|
||||||
const std::string cChatColor::Purple = cChatColor::Color + "5";
|
const char * cChatColor::Purple = "\xc2\xa7""5";
|
||||||
const std::string cChatColor::Gold = cChatColor::Color + "6";
|
const char * cChatColor::Gold = "\xc2\xa7""6";
|
||||||
const std::string cChatColor::LightGray = cChatColor::Color + "7";
|
const char * cChatColor::LightGray = "\xc2\xa7""7";
|
||||||
const std::string cChatColor::Gray = cChatColor::Color + "8";
|
const char * cChatColor::Gray = "\xc2\xa7""8";
|
||||||
const std::string cChatColor::DarkPurple = cChatColor::Color + "9";
|
const char * cChatColor::DarkPurple = "\xc2\xa7""9";
|
||||||
const std::string cChatColor::LightGreen = cChatColor::Color + "a";
|
const char * cChatColor::LightGreen = "\xc2\xa7""a";
|
||||||
const std::string cChatColor::LightBlue = cChatColor::Color + "b";
|
const char * cChatColor::LightBlue = "\xc2\xa7""b";
|
||||||
const std::string cChatColor::Rose = cChatColor::Color + "c";
|
const char * cChatColor::Rose = "\xc2\xa7""c";
|
||||||
const std::string cChatColor::LightPurple = cChatColor::Color + "d";
|
const char * cChatColor::LightPurple = "\xc2\xa7""d";
|
||||||
const std::string cChatColor::Yellow = cChatColor::Color + "e";
|
const char * cChatColor::Yellow = "\xc2\xa7""e";
|
||||||
const std::string cChatColor::White = cChatColor::Color + "f";
|
const char * cChatColor::White = "\xc2\xa7""f";
|
||||||
|
|
||||||
const std::string cChatColor::Random = cChatColor::Color + "k";
|
const char * cChatColor::Random = "\xc2\xa7""k";
|
||||||
const std::string cChatColor::Bold = cChatColor::Color + "l";
|
const char * cChatColor::Bold = "\xc2\xa7""l";
|
||||||
const std::string cChatColor::Strikethrough = cChatColor::Color + "m";
|
const char * cChatColor::Strikethrough = "\xc2\xa7""m";
|
||||||
const std::string cChatColor::Underlined = cChatColor::Color + "n";
|
const char * cChatColor::Underlined = "\xc2\xa7""n";
|
||||||
const std::string cChatColor::Italic = cChatColor::Color + "o";
|
const char * cChatColor::Italic = "\xc2\xa7""o";
|
||||||
const std::string cChatColor::Plain = cChatColor::Color + "r";
|
const char * cChatColor::Plain = "\xc2\xa7""r";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,34 +9,36 @@
|
|||||||
class cChatColor
|
class cChatColor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const std::string Color;
|
static const char * Delimiter;
|
||||||
static const std::string Delimiter;
|
|
||||||
|
/** @deprecated use ChatColor::Delimiter instead */
|
||||||
|
static const char * Color;
|
||||||
|
|
||||||
static const std::string Black;
|
static const char * Black;
|
||||||
static const std::string Navy;
|
static const char * Navy;
|
||||||
static const std::string Green;
|
static const char * Green;
|
||||||
static const std::string Blue;
|
static const char * Blue;
|
||||||
static const std::string Red;
|
static const char * Red;
|
||||||
static const std::string Purple;
|
static const char * Purple;
|
||||||
static const std::string Gold;
|
static const char * Gold;
|
||||||
static const std::string LightGray;
|
static const char * LightGray;
|
||||||
static const std::string Gray;
|
static const char * Gray;
|
||||||
static const std::string DarkPurple;
|
static const char * DarkPurple;
|
||||||
static const std::string LightGreen;
|
static const char * LightGreen;
|
||||||
static const std::string LightBlue;
|
static const char * LightBlue;
|
||||||
static const std::string Rose;
|
static const char * Rose;
|
||||||
static const std::string LightPurple;
|
static const char * LightPurple;
|
||||||
static const std::string Yellow;
|
static const char * Yellow;
|
||||||
static const std::string White;
|
static const char * White;
|
||||||
|
|
||||||
// Styles ( source: http://wiki.vg/Chat )
|
|
||||||
static const std::string Random;
|
|
||||||
static const std::string Bold;
|
|
||||||
static const std::string Strikethrough;
|
|
||||||
static const std::string Underlined;
|
|
||||||
static const std::string Italic;
|
|
||||||
static const std::string Plain;
|
|
||||||
|
|
||||||
|
// Styles
|
||||||
|
// source: http://wiki.vg/Chat
|
||||||
|
static const char * Random;
|
||||||
|
static const char * Bold;
|
||||||
|
static const char * Strikethrough;
|
||||||
|
static const char * Underlined;
|
||||||
|
static const char * Italic;
|
||||||
|
static const char * Plain;
|
||||||
};
|
};
|
||||||
|
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env lua
|
||||||
|
|
||||||
-- CheckBasicStyle.lua
|
-- CheckBasicStyle.lua
|
||||||
|
|
||||||
@ -8,7 +9,7 @@ Checks that all source files (*.cpp, *.h) use the basic style requirements of th
|
|||||||
- Two spaces between code and line-end comment ("//")
|
- Two spaces between code and line-end comment ("//")
|
||||||
- Spaces after comma, not before
|
- Spaces after comma, not before
|
||||||
- Opening braces not at the end of a code line
|
- Opening braces not at the end of a code line
|
||||||
- (TODO) Spaces after if, for, while
|
- Spaces after if, for, while
|
||||||
- (TODO) Spaces before *, /, &
|
- (TODO) Spaces before *, /, &
|
||||||
- (TODO) Hex numbers with even digit length
|
- (TODO) Hex numbers with even digit length
|
||||||
- (TODO) Hex numbers in lowercase
|
- (TODO) Hex numbers in lowercase
|
||||||
@ -23,26 +24,12 @@ the line brings the editor directly to the violation.
|
|||||||
|
|
||||||
Returns 0 on success, 1 on internal failure, 2 if any violations found
|
Returns 0 on success, 1 on internal failure, 2 if any violations found
|
||||||
|
|
||||||
This script requires LuaFileSystem to be available in the current Lua interpreter.
|
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Check that LFS is installed:
|
|
||||||
local hasLfs = pcall(require, "lfs")
|
|
||||||
if not(hasLfs) then
|
|
||||||
print("This script requires LuaFileSystem to be installed")
|
|
||||||
os.exit(1)
|
|
||||||
end
|
|
||||||
local lfs = require("lfs")
|
|
||||||
assert(lfs ~= nil)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- The list of file extensions that are processed:
|
-- The list of file extensions that are processed:
|
||||||
local g_ShouldProcessExt =
|
local g_ShouldProcessExt =
|
||||||
{
|
{
|
||||||
@ -53,13 +40,12 @@ local g_ShouldProcessExt =
|
|||||||
--- The list of files not to be processed:
|
--- The list of files not to be processed:
|
||||||
local g_IgnoredFiles =
|
local g_IgnoredFiles =
|
||||||
{
|
{
|
||||||
"./Bindings/Bindings.cpp",
|
"Bindings/Bindings.cpp",
|
||||||
"./Bindings/DeprecatedBindings.cpp",
|
"LeakFinder.cpp",
|
||||||
"./LeakFinder.cpp",
|
"LeakFinder.h",
|
||||||
"./LeakFinder.h",
|
"MersenneTwister.h",
|
||||||
"./MersenneTwister.h",
|
"StackWalker.cpp",
|
||||||
"./StackWalker.cpp",
|
"StackWalker.h",
|
||||||
"./StackWalker.h",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--- The list of files not to be processed, as a dictionary (filename => true), built from g_IgnoredFiles
|
--- The list of files not to be processed, as a dictionary (filename => true), built from g_IgnoredFiles
|
||||||
@ -125,6 +111,22 @@ local g_ViolationPatterns =
|
|||||||
|
|
||||||
-- Check that opening braces are not at the end of a code line:
|
-- Check that opening braces are not at the end of a code line:
|
||||||
{"[^%s].-{\n?$", "Brace should be on a separate line"},
|
{"[^%s].-{\n?$", "Brace should be on a separate line"},
|
||||||
|
|
||||||
|
-- Space after keywords:
|
||||||
|
{"[^_]if%(", "Needs a space after \"if\""},
|
||||||
|
{"for%(", "Needs a space after \"for\""},
|
||||||
|
{"while%(", "Needs a space after \"while\""},
|
||||||
|
{"switch%(", "Needs a space after \"switch\""},
|
||||||
|
{"catch%(", "Needs a space after \"catch\""},
|
||||||
|
|
||||||
|
-- No space after keyword's parenthesis:
|
||||||
|
{"[^%a#]if %( ", "Remove the space after \"(\""},
|
||||||
|
{"for %( ", "Remove the space after \"(\""},
|
||||||
|
{"while %( ", "Remove the space after \"(\""},
|
||||||
|
{"catch %( ", "Remove the space after \"(\""},
|
||||||
|
|
||||||
|
-- No space before a closing parenthesis:
|
||||||
|
{" %)", "Remove the space before \")\""},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -182,17 +184,6 @@ local function ProcessItem(a_ItemName)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If the item is a folder, recurse:
|
|
||||||
local attrs = lfs.attributes(a_ItemName)
|
|
||||||
if (attrs and (attrs.mode == "directory")) then
|
|
||||||
for fnam in lfs.dir(a_ItemName) do
|
|
||||||
if ((fnam ~= ".") and (fnam ~= "..")) then
|
|
||||||
ProcessItem(a_ItemName .. "/" .. fnam)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ext = a_ItemName:match("%.([^/%.]-)$")
|
local ext = a_ItemName:match("%.([^/%.]-)$")
|
||||||
if (g_ShouldProcessExt[ext]) then
|
if (g_ShouldProcessExt[ext]) then
|
||||||
ProcessFile(a_ItemName)
|
ProcessFile(a_ItemName)
|
||||||
@ -203,8 +194,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Process the entire current folder:
|
-- Process all files in the AllFiles.lst file (generated by cmake):
|
||||||
ProcessItem(".")
|
for fnam in io.lines("AllFiles.lst") do
|
||||||
|
ProcessItem(fnam)
|
||||||
|
end
|
||||||
|
|
||||||
-- Report final verdict:
|
-- Report final verdict:
|
||||||
print("Number of violations found: " .. g_NumViolations)
|
print("Number of violations found: " .. g_NumViolations)
|
||||||
|
@ -44,12 +44,12 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// sSetBlock:
|
// sSetBlock:
|
||||||
|
|
||||||
sSetBlock::sSetBlock( int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ) // absolute block position
|
sSetBlock::sSetBlock( int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) // absolute block position
|
||||||
: x( a_BlockX )
|
: x( a_BlockX)
|
||||||
, y( a_BlockY )
|
, y( a_BlockY)
|
||||||
, z( a_BlockZ )
|
, z( a_BlockZ)
|
||||||
, BlockType( a_BlockType )
|
, BlockType( a_BlockType)
|
||||||
, BlockMeta( a_BlockMeta )
|
, BlockMeta( a_BlockMeta)
|
||||||
{
|
{
|
||||||
cChunkDef::AbsoluteToRelative(x, y, z, ChunkX, ChunkZ);
|
cChunkDef::AbsoluteToRelative(x, y, z, ChunkX, ChunkZ);
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ cChunk::~cChunk()
|
|||||||
{
|
{
|
||||||
cPluginManager::Get()->CallHookChunkUnloaded(m_World, m_PosX, m_PosZ);
|
cPluginManager::Get()->CallHookChunkUnloaded(m_World, m_PosX, m_PosZ);
|
||||||
|
|
||||||
// LOGINFO("### delete cChunk() (%i, %i) from %p, thread 0x%x ###", m_PosX, m_PosZ, this, GetCurrentThreadId() );
|
// LOGINFO("### delete cChunk() (%i, %i) from %p, thread 0x%x ###", m_PosX, m_PosZ, this, GetCurrentThreadId());
|
||||||
|
|
||||||
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
|
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
|
||||||
{
|
{
|
||||||
@ -781,7 +781,7 @@ void cChunk::CheckBlocks()
|
|||||||
void cChunk::TickBlocks(void)
|
void cChunk::TickBlocks(void)
|
||||||
{
|
{
|
||||||
// Tick dem blocks
|
// Tick dem blocks
|
||||||
// _X: We must limit the random number or else we get a nasty int overflow bug ( http://forum.mc-server.org/showthread.php?tid=457 )
|
// _X: We must limit the random number or else we get a nasty int overflow bug - http://forum.mc-server.org/showthread.php?tid=457
|
||||||
int RandomX = m_World->GetTickRandomNumber(0x00ffffff);
|
int RandomX = m_World->GetTickRandomNumber(0x00ffffff);
|
||||||
int RandomY = m_World->GetTickRandomNumber(0x00ffffff);
|
int RandomY = m_World->GetTickRandomNumber(0x00ffffff);
|
||||||
int RandomZ = m_World->GetTickRandomNumber(0x00ffffff);
|
int RandomZ = m_World->GetTickRandomNumber(0x00ffffff);
|
||||||
@ -1394,7 +1394,7 @@ void cChunk::CalculateHeightmap(const BLOCKTYPE * a_BlockTypes)
|
|||||||
{
|
{
|
||||||
for (int y = Height - 1; y > -1; y--)
|
for (int y = Height - 1; y > -1; y--)
|
||||||
{
|
{
|
||||||
int index = MakeIndex( x, y, z );
|
int index = MakeIndex( x, y, z);
|
||||||
if (a_BlockTypes[index] != E_BLOCK_AIR)
|
if (a_BlockTypes[index] != E_BLOCK_AIR)
|
||||||
{
|
{
|
||||||
m_HeightMap[x + z * Width] = (HEIGHTTYPE)y;
|
m_HeightMap[x + z * Width] = (HEIGHTTYPE)y;
|
||||||
@ -1530,11 +1530,12 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
|
|||||||
|
|
||||||
m_ChunkData.SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType);
|
m_ChunkData.SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType);
|
||||||
|
|
||||||
if ( // Queue block to be sent only if ...
|
// Queue block to be sent only if ...
|
||||||
|
if (
|
||||||
a_SendToClients && // ... we are told to do so AND ...
|
a_SendToClients && // ... we are told to do so AND ...
|
||||||
(
|
(
|
||||||
(OldBlockMeta != a_BlockMeta) || // ... the meta value is different OR ...
|
(OldBlockMeta != a_BlockMeta) || // ... the meta value is different OR ...
|
||||||
!( // ... the old and new blocktypes AREN'T liquids (because client doesn't need to distinguish betwixt them); see below for specifics:
|
!( // ... the old and new blocktypes AREN'T liquids (because client doesn't need to distinguish betwixt them):
|
||||||
((OldBlockType == E_BLOCK_STATIONARY_WATER) && (a_BlockType == E_BLOCK_WATER)) || // Replacing stationary water with water
|
((OldBlockType == E_BLOCK_STATIONARY_WATER) && (a_BlockType == E_BLOCK_WATER)) || // Replacing stationary water with water
|
||||||
((OldBlockType == E_BLOCK_WATER) && (a_BlockType == E_BLOCK_STATIONARY_WATER)) || // Replacing water with stationary water
|
((OldBlockType == E_BLOCK_WATER) && (a_BlockType == E_BLOCK_STATIONARY_WATER)) || // Replacing water with stationary water
|
||||||
((OldBlockType == E_BLOCK_STATIONARY_LAVA) && (a_BlockType == E_BLOCK_LAVA)) || // Replacing stationary water with water
|
((OldBlockType == E_BLOCK_STATIONARY_LAVA) && (a_BlockType == E_BLOCK_LAVA)) || // Replacing stationary water with water
|
||||||
@ -1729,9 +1730,9 @@ void cChunk::CollectPickupsByPlayer(cPlayer * a_Player)
|
|||||||
{
|
{
|
||||||
continue; // Only pickups and projectiles can be picked up
|
continue; // Only pickups and projectiles can be picked up
|
||||||
}
|
}
|
||||||
float DiffX = (float)((*itr)->GetPosX() - PosX );
|
float DiffX = (float)((*itr)->GetPosX() - PosX);
|
||||||
float DiffY = (float)((*itr)->GetPosY() - PosY );
|
float DiffY = (float)((*itr)->GetPosY() - PosY);
|
||||||
float DiffZ = (float)((*itr)->GetPosZ() - PosZ );
|
float DiffZ = (float)((*itr)->GetPosZ() - PosZ);
|
||||||
float SqrDist = DiffX * DiffX + DiffY * DiffY + DiffZ * DiffZ;
|
float SqrDist = DiffX * DiffX + DiffY * DiffY + DiffZ * DiffZ;
|
||||||
if (SqrDist < 1.5f * 1.5f) // 1.5 block
|
if (SqrDist < 1.5f * 1.5f) // 1.5 block
|
||||||
{
|
{
|
||||||
@ -1793,7 +1794,7 @@ bool cChunk::SetSignLines(int a_PosX, int a_PosY, int a_PosZ, const AString & a_
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cChunk::RemoveBlockEntity( cBlockEntity* a_BlockEntity )
|
void cChunk::RemoveBlockEntity( cBlockEntity* a_BlockEntity)
|
||||||
{
|
{
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
m_BlockEntities.remove(a_BlockEntity);
|
m_BlockEntities.remove(a_BlockEntity);
|
||||||
@ -1813,9 +1814,9 @@ bool cChunk::AddClient(cClientHandle* a_Client)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_LoadedByClient.push_back( a_Client );
|
m_LoadedByClient.push_back( a_Client);
|
||||||
|
|
||||||
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr )
|
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
// DEBUG:
|
// DEBUG:
|
||||||
@ -1834,7 +1835,7 @@ bool cChunk::AddClient(cClientHandle* a_Client)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cChunk::RemoveClient( cClientHandle* a_Client )
|
void cChunk::RemoveClient( cClientHandle* a_Client)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
@ -1847,7 +1848,7 @@ void cChunk::RemoveClient( cClientHandle* a_Client )
|
|||||||
|
|
||||||
if (!a_Client->IsDestroyed())
|
if (!a_Client->IsDestroyed())
|
||||||
{
|
{
|
||||||
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr )
|
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
// DEBUG:
|
// DEBUG:
|
||||||
@ -1867,7 +1868,7 @@ void cChunk::RemoveClient( cClientHandle* a_Client )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cChunk::HasClient( cClientHandle* a_Client )
|
bool cChunk::HasClient( cClientHandle* a_Client)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
@ -2652,7 +2653,7 @@ cChunk * cChunk::GetRelNeighborChunkAdjustCoords(int & a_RelX, int & a_RelZ) con
|
|||||||
|
|
||||||
void cChunk::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle)
|
void cChunk::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
(*itr)->SendAttachEntity(a_Entity, a_Vehicle);
|
(*itr)->SendAttachEntity(a_Entity, a_Vehicle);
|
||||||
} // for itr - LoadedByClient[]
|
} // for itr - LoadedByClient[]
|
||||||
@ -2664,7 +2665,7 @@ void cChunk::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity * a_V
|
|||||||
|
|
||||||
void cChunk::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2680,7 +2681,7 @@ void cChunk::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char
|
|||||||
|
|
||||||
void cChunk::BroadcastBlockBreakAnimation(int a_entityID, int a_blockX, int a_blockY, int a_blockZ, char a_stage, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastBlockBreakAnimation(int a_entityID, int a_blockX, int a_blockY, int a_blockZ, char a_stage, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2702,7 +2703,7 @@ void cChunk::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cons
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2718,7 +2719,7 @@ void cChunk::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cons
|
|||||||
|
|
||||||
void cChunk::BroadcastChunkData(cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastChunkData(cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2734,7 +2735,7 @@ void cChunk::BroadcastChunkData(cChunkDataSerializer & a_Serializer, const cClie
|
|||||||
|
|
||||||
void cChunk::BroadcastCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastCollectEntity(const cEntity & a_Entity, const cPlayer & a_Player, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2750,7 +2751,7 @@ void cChunk::BroadcastCollectEntity(const cEntity & a_Entity, const cPlayer & a_
|
|||||||
|
|
||||||
void cChunk::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2766,7 +2767,7 @@ void cChunk::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandl
|
|||||||
|
|
||||||
void cChunk::BroadcastEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastEntityEffect(const cEntity & a_Entity, int a_EffectID, int a_Amplifier, short a_Duration, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2782,7 +2783,7 @@ void cChunk::BroadcastEntityEffect(const cEntity & a_Entity, int a_EffectID, int
|
|||||||
|
|
||||||
void cChunk::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2798,7 +2799,7 @@ void cChunk::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum,
|
|||||||
|
|
||||||
void cChunk::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2814,7 +2815,7 @@ void cChunk::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHand
|
|||||||
|
|
||||||
void cChunk::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2830,7 +2831,7 @@ void cChunk::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle *
|
|||||||
|
|
||||||
void cChunk::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2846,7 +2847,7 @@ void cChunk::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHand
|
|||||||
|
|
||||||
void cChunk::BroadcastEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2862,7 +2863,7 @@ void cChunk::BroadcastEntityRelMove(const cEntity & a_Entity, char a_RelX, char
|
|||||||
|
|
||||||
void cChunk::BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2878,7 +2879,7 @@ void cChunk::BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, c
|
|||||||
|
|
||||||
void cChunk::BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2894,7 +2895,7 @@ void cChunk::BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, cons
|
|||||||
|
|
||||||
void cChunk::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2910,7 +2911,7 @@ void cChunk::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHand
|
|||||||
|
|
||||||
void cChunk::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2926,7 +2927,7 @@ void cChunk::BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation
|
|||||||
|
|
||||||
void cChunk::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude)
|
void cChunk::BroadcastParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2942,7 +2943,7 @@ void cChunk::BroadcastParticleEffect(const AString & a_ParticleName, float a_Src
|
|||||||
|
|
||||||
void cChunk::BroadcastRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2958,7 +2959,7 @@ void cChunk::BroadcastRemoveEntityEffect(const cEntity & a_Entity, int a_EffectI
|
|||||||
|
|
||||||
void cChunk::BroadcastSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2974,7 +2975,7 @@ void cChunk::BroadcastSoundEffect(const AString & a_SoundName, double a_X, doubl
|
|||||||
|
|
||||||
void cChunk::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -2990,7 +2991,7 @@ void cChunk::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY
|
|||||||
|
|
||||||
void cChunk::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -3006,7 +3007,7 @@ void cChunk::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Ex
|
|||||||
|
|
||||||
void cChunk::BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude)
|
void cChunk::BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (*itr == a_Exclude)
|
if (*itr == a_Exclude)
|
||||||
{
|
{
|
||||||
@ -3020,9 +3021,9 @@ void cChunk::BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, cons
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cChunk::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ )
|
void cChunk::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr )
|
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
|
||||||
{
|
{
|
||||||
(*itr)->SendUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ);
|
(*itr)->SendUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
} // for itr - LoadedByClient[]
|
} // for itr - LoadedByClient[]
|
||||||
|
12
src/Chunk.h
12
src/Chunk.h
@ -82,9 +82,9 @@ public:
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
To save a chunk, the WSSchema must:
|
To save a chunk, the WSSchema must:
|
||||||
1. Mark the chunk as being saved (MarkSaving() )
|
1. Mark the chunk as being saved (MarkSaving())
|
||||||
2. Get the chunk's data using GetAllData()
|
2. Get the chunk's data using GetAllData()
|
||||||
3. Mark the chunk as saved (MarkSaved() )
|
3. Mark the chunk as saved (MarkSaved())
|
||||||
If anywhere inside this sequence another thread mmodifies the chunk, the chunk will not get marked as saved in MarkSaved()
|
If anywhere inside this sequence another thread mmodifies the chunk, the chunk will not get marked as saved in MarkSaved()
|
||||||
*/
|
*/
|
||||||
void MarkSaving(void); // Marks the chunk as being saved.
|
void MarkSaving(void); // Marks the chunk as being saved.
|
||||||
@ -144,7 +144,7 @@ public:
|
|||||||
|
|
||||||
void SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, bool a_SendToClients = true);
|
void SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, bool a_SendToClients = true);
|
||||||
// SetBlock() does a lot of work (heightmap, tickblocks, blockentities) so a BlockIdx version doesn't make sense
|
// SetBlock() does a lot of work (heightmap, tickblocks, blockentities) so a BlockIdx version doesn't make sense
|
||||||
void SetBlock( const Vector3i & a_RelBlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ) { SetBlock( a_RelBlockPos.x, a_RelBlockPos.y, a_RelBlockPos.z, a_BlockType, a_BlockMeta ); }
|
void SetBlock( const Vector3i & a_RelBlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { SetBlock( a_RelBlockPos.x, a_RelBlockPos.y, a_RelBlockPos.z, a_BlockType, a_BlockMeta); }
|
||||||
|
|
||||||
/** Queues a block change till the specified world tick */
|
/** Queues a block change till the specified world tick */
|
||||||
void QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick, BLOCKTYPE a_PreviousBlockType = E_BLOCK_AIR);
|
void QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick, BLOCKTYPE a_PreviousBlockType = E_BLOCK_AIR);
|
||||||
@ -195,7 +195,7 @@ public:
|
|||||||
/** Sets the sign text. Returns true if successful. Also sends update packets to all clients in the chunk */
|
/** Sets the sign text. Returns true if successful. Also sends update packets to all clients in the chunk */
|
||||||
bool SetSignLines(int a_RelX, int a_RelY, int a_RelZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4);
|
bool SetSignLines(int a_RelX, int a_RelY, int a_RelZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4);
|
||||||
|
|
||||||
int GetHeight( int a_X, int a_Z );
|
int GetHeight( int a_X, int a_Z);
|
||||||
|
|
||||||
void SendBlockTo(int a_RelX, int a_RelY, int a_RelZ, cClientHandle * a_Client);
|
void SendBlockTo(int a_RelX, int a_RelY, int a_RelZ, cClientHandle * a_Client);
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ public:
|
|||||||
void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL);
|
void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL);
|
||||||
void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
||||||
void BroadcastThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL);
|
void BroadcastThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL);
|
||||||
void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ );
|
void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||||
|
|
||||||
void SendBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client);
|
void SendBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client);
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ, int & a_BlockX, int & a_BlockY, int & a_BlockZ);
|
void PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ, int & a_BlockX, int & a_BlockY, int & a_BlockZ);
|
||||||
Vector3i PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ );
|
Vector3i PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ);
|
||||||
|
|
||||||
inline void MarkDirty(void)
|
inline void MarkDirty(void)
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
/// Converts absolute block coords into relative (chunk + block) coords:
|
/// Converts absolute block coords into relative (chunk + block) coords:
|
||||||
inline static void AbsoluteToRelative(/* in-out */ int & a_X, int & a_Y, int & a_Z, /* out */ int & a_ChunkX, int & a_ChunkZ )
|
inline static void AbsoluteToRelative(/* in-out */ int & a_X, int & a_Y, int & a_Z, /* out */ int & a_ChunkX, int & a_ChunkZ)
|
||||||
{
|
{
|
||||||
UNUSED(a_Y);
|
UNUSED(a_Y);
|
||||||
BlockToChunk(a_X, a_Z, a_ChunkX, a_ChunkZ);
|
BlockToChunk(a_X, a_Z, a_ChunkX, a_ChunkZ);
|
||||||
@ -118,7 +118,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline static int MakeIndex(int x, int y, int z )
|
inline static int MakeIndex(int x, int y, int z)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
(x < Width) && (x > -1) &&
|
(x < Width) && (x > -1) &&
|
||||||
@ -145,7 +145,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline static Vector3i IndexToCoordinate( unsigned int index )
|
inline static Vector3i IndexToCoordinate( unsigned int index)
|
||||||
{
|
{
|
||||||
#if AXIS_ORDER == AXIS_ORDER_XZY
|
#if AXIS_ORDER == AXIS_ORDER_XZY
|
||||||
return Vector3i( // 1.2
|
return Vector3i( // 1.2
|
||||||
@ -357,7 +357,7 @@ struct sSetBlock
|
|||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
|
|
||||||
sSetBlock( int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ); // absolute block position
|
sSetBlock( int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // absolute block position
|
||||||
sSetBlock(int a_ChunkX, int a_ChunkZ, int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) :
|
sSetBlock(int a_ChunkX, int a_ChunkZ, int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) :
|
||||||
x(a_X), y(a_Y), z(a_Z),
|
x(a_X), y(a_Y), z(a_Z),
|
||||||
ChunkX(a_ChunkX), ChunkZ(a_ChunkZ),
|
ChunkX(a_ChunkX), ChunkZ(a_ChunkZ),
|
||||||
|
@ -64,7 +64,7 @@ cChunkMap::~cChunkMap()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cChunkMap::RemoveLayer( cChunkLayer* a_Layer )
|
void cChunkMap::RemoveLayer( cChunkLayer* a_Layer)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
m_Layers.remove(a_Layer);
|
m_Layers.remove(a_Layer);
|
||||||
@ -147,7 +147,7 @@ cChunkPtr cChunkMap::GetChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
|
|||||||
// No need to lock m_CSLayers, since it's already locked by the operation that called us
|
// No need to lock m_CSLayers, since it's already locked by the operation that called us
|
||||||
ASSERT(m_CSLayers.IsLockedByCurrentThread());
|
ASSERT(m_CSLayers.IsLockedByCurrentThread());
|
||||||
|
|
||||||
cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ );
|
cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ);
|
||||||
if (Layer == NULL)
|
if (Layer == NULL)
|
||||||
{
|
{
|
||||||
// An error must have occurred, since layers are automatically created if they don't exist
|
// An error must have occurred, since layers are automatically created if they don't exist
|
||||||
@ -170,10 +170,10 @@ cChunkPtr cChunkMap::GetChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cChunkPtr cChunkMap::GetChunkNoGen( int a_ChunkX, int a_ChunkY, int a_ChunkZ )
|
cChunkPtr cChunkMap::GetChunkNoGen( int a_ChunkX, int a_ChunkY, int a_ChunkZ)
|
||||||
{
|
{
|
||||||
// No need to lock m_CSLayers, since it's already locked by the operation that called us
|
// No need to lock m_CSLayers, since it's already locked by the operation that called us
|
||||||
cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ );
|
cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ);
|
||||||
if (Layer == NULL)
|
if (Layer == NULL)
|
||||||
{
|
{
|
||||||
// An error must have occurred, since layers are automatically created if they don't exist
|
// An error must have occurred, since layers are automatically created if they don't exist
|
||||||
@ -197,10 +197,10 @@ cChunkPtr cChunkMap::GetChunkNoGen( int a_ChunkX, int a_ChunkY, int a_ChunkZ )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cChunkPtr cChunkMap::GetChunkNoLoad( int a_ChunkX, int a_ChunkY, int a_ChunkZ )
|
cChunkPtr cChunkMap::GetChunkNoLoad( int a_ChunkX, int a_ChunkY, int a_ChunkZ)
|
||||||
{
|
{
|
||||||
// No need to lock m_CSLayers, since it's already locked by the operation that called us
|
// No need to lock m_CSLayers, since it's already locked by the operation that called us
|
||||||
cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ );
|
cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ);
|
||||||
if (Layer == NULL)
|
if (Layer == NULL)
|
||||||
{
|
{
|
||||||
// An error must have occurred, since layers are automatically created if they don't exist
|
// An error must have occurred, since layers are automatically created if they don't exist
|
||||||
@ -720,7 +720,7 @@ void cChunkMap::BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, c
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cChunkMap::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ )
|
void cChunkMap::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
int ChunkX, ChunkZ;
|
int ChunkX, ChunkZ;
|
||||||
@ -1154,9 +1154,9 @@ void cChunkMap::CollectPickupsByPlayer(cPlayer * a_Player)
|
|||||||
GetChunkNoLoad(ChunkX, ChunkY, ChunkZ)->CollectPickupsByPlayer(a_Player);
|
GetChunkNoLoad(ChunkX, ChunkY, ChunkZ)->CollectPickupsByPlayer(a_Player);
|
||||||
|
|
||||||
// Check the neighboring chunks as well:
|
// Check the neighboring chunks as well:
|
||||||
GetChunkNoLoad(OtherChunkX, ChunkY, ChunkZ )->CollectPickupsByPlayer(a_Player);
|
GetChunkNoLoad(OtherChunkX, ChunkY, ChunkZ)->CollectPickupsByPlayer (a_Player);
|
||||||
GetChunkNoLoad(OtherChunkX, ChunkY, OtherChunkZ)->CollectPickupsByPlayer(a_Player);
|
GetChunkNoLoad(OtherChunkX, ChunkY, OtherChunkZ)->CollectPickupsByPlayer(a_Player);
|
||||||
GetChunkNoLoad(ChunkX, ChunkY, ChunkZ )->CollectPickupsByPlayer(a_Player);
|
GetChunkNoLoad(ChunkX, ChunkY, ChunkZ)->CollectPickupsByPlayer (a_Player);
|
||||||
GetChunkNoLoad(ChunkX, ChunkY, OtherChunkZ)->CollectPickupsByPlayer(a_Player);
|
GetChunkNoLoad(ChunkX, ChunkY, OtherChunkZ)->CollectPickupsByPlayer(a_Player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1181,7 +1181,7 @@ BLOCKTYPE cChunkMap::GetBlock(int a_BlockX, int a_BlockY, int a_BlockZ)
|
|||||||
} // for itr - m_FastSetBlockQueue[]
|
} // for itr - m_FastSetBlockQueue[]
|
||||||
}
|
}
|
||||||
int ChunkX, ChunkZ;
|
int ChunkX, ChunkZ;
|
||||||
cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ );
|
cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ);
|
||||||
|
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||||
@ -1210,11 +1210,11 @@ NIBBLETYPE cChunkMap::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ)
|
|||||||
} // for itr - m_FastSetBlockQueue[]
|
} // for itr - m_FastSetBlockQueue[]
|
||||||
}
|
}
|
||||||
int ChunkX, ChunkZ;
|
int ChunkX, ChunkZ;
|
||||||
cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ );
|
cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ);
|
||||||
|
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
|
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||||
if ((Chunk != NULL) && Chunk->IsValid() )
|
if ((Chunk != NULL) && Chunk->IsValid())
|
||||||
{
|
{
|
||||||
return Chunk->GetMeta(a_BlockX, a_BlockY, a_BlockZ);
|
return Chunk->GetMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
}
|
}
|
||||||
@ -1228,11 +1228,11 @@ NIBBLETYPE cChunkMap::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ)
|
|||||||
NIBBLETYPE cChunkMap::GetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ)
|
NIBBLETYPE cChunkMap::GetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
int ChunkX, ChunkZ;
|
int ChunkX, ChunkZ;
|
||||||
cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ );
|
cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ);
|
||||||
|
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
|
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||||
if ((Chunk != NULL) && Chunk->IsValid() )
|
if ((Chunk != NULL) && Chunk->IsValid())
|
||||||
{
|
{
|
||||||
return Chunk->GetSkyLight(a_BlockX, a_BlockY, a_BlockZ);
|
return Chunk->GetSkyLight(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
}
|
}
|
||||||
@ -1246,11 +1246,11 @@ NIBBLETYPE cChunkMap::GetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ)
|
|||||||
NIBBLETYPE cChunkMap::GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ)
|
NIBBLETYPE cChunkMap::GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
int ChunkX, ChunkZ;
|
int ChunkX, ChunkZ;
|
||||||
cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ );
|
cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ);
|
||||||
|
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
|
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||||
if ((Chunk != NULL) && Chunk->IsValid() )
|
if ((Chunk != NULL) && Chunk->IsValid())
|
||||||
{
|
{
|
||||||
return Chunk->GetBlockLight(a_BlockX, a_BlockY, a_BlockZ);
|
return Chunk->GetBlockLight(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
}
|
}
|
||||||
@ -1288,10 +1288,10 @@ void cChunkMap::SetBlock(cWorldInterface & a_WorldInterface, int a_BlockX, int a
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
|
int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
|
||||||
cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ );
|
cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ);
|
||||||
|
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
|
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||||
if ((Chunk != NULL) && Chunk->IsValid())
|
if ((Chunk != NULL) && Chunk->IsValid())
|
||||||
{
|
{
|
||||||
Chunk->SetBlock(X, Y, Z, a_BlockType, a_BlockMeta, a_SendToClients);
|
Chunk->SetBlock(X, Y, Z, a_BlockType, a_BlockMeta, a_SendToClients);
|
||||||
@ -1324,10 +1324,10 @@ void cChunkMap::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYP
|
|||||||
bool cChunkMap::GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta)
|
bool cChunkMap::GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta)
|
||||||
{
|
{
|
||||||
int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
|
int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
|
||||||
cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ );
|
cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ);
|
||||||
|
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
|
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||||
if ((Chunk != NULL) && Chunk->IsValid())
|
if ((Chunk != NULL) && Chunk->IsValid())
|
||||||
{
|
{
|
||||||
Chunk->GetBlockTypeMeta(X, Y, Z, a_BlockType, a_BlockMeta);
|
Chunk->GetBlockTypeMeta(X, Y, Z, a_BlockType, a_BlockMeta);
|
||||||
@ -1343,10 +1343,10 @@ bool cChunkMap::GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCK
|
|||||||
bool cChunkMap::GetBlockInfo(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight)
|
bool cChunkMap::GetBlockInfo(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight)
|
||||||
{
|
{
|
||||||
int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
|
int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
|
||||||
cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ );
|
cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ);
|
||||||
|
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
|
cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||||
if ((Chunk != NULL) && Chunk->IsValid())
|
if ((Chunk != NULL) && Chunk->IsValid())
|
||||||
{
|
{
|
||||||
Chunk->GetBlockInfo(X, Y, Z, a_BlockType, a_Meta, a_SkyLight, a_BlockLight);
|
Chunk->GetBlockInfo(X, Y, Z, a_BlockType, a_Meta, a_SkyLight, a_BlockLight);
|
||||||
@ -1364,7 +1364,7 @@ void cChunkMap::ReplaceBlocks(const sSetBlockVector & a_Blocks, BLOCKTYPE a_Filt
|
|||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr)
|
for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr)
|
||||||
{
|
{
|
||||||
cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ );
|
cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ);
|
||||||
if ((Chunk == NULL) || !Chunk->IsValid())
|
if ((Chunk == NULL) || !Chunk->IsValid())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -1385,7 +1385,7 @@ void cChunkMap::ReplaceTreeBlocks(const sSetBlockVector & a_Blocks)
|
|||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr)
|
for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr)
|
||||||
{
|
{
|
||||||
cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ );
|
cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ);
|
||||||
if ((Chunk == NULL) || !Chunk->IsValid())
|
if ((Chunk == NULL) || !Chunk->IsValid())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -1498,7 +1498,7 @@ bool cChunkMap::GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure)
|
|||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
for (sSetBlockVector::iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr)
|
for (sSetBlockVector::iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr)
|
||||||
{
|
{
|
||||||
cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ );
|
cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ);
|
||||||
if ((Chunk == NULL) || !Chunk->IsValid())
|
if ((Chunk == NULL) || !Chunk->IsValid())
|
||||||
{
|
{
|
||||||
if (!a_ContinueOnFailure)
|
if (!a_ContinueOnFailure)
|
||||||
@ -1522,17 +1522,17 @@ bool cChunkMap::DigBlock(int a_X, int a_Y, int a_Z)
|
|||||||
{
|
{
|
||||||
int PosX = a_X, PosY = a_Y, PosZ = a_Z, ChunkX, ChunkZ;
|
int PosX = a_X, PosY = a_Y, PosZ = a_Z, ChunkX, ChunkZ;
|
||||||
|
|
||||||
cChunkDef::AbsoluteToRelative( PosX, PosY, PosZ, ChunkX, ChunkZ );
|
cChunkDef::AbsoluteToRelative( PosX, PosY, PosZ, ChunkX, ChunkZ);
|
||||||
|
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSLayers);
|
cCSLock Lock(m_CSLayers);
|
||||||
cChunkPtr DestChunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ );
|
cChunkPtr DestChunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||||
if ((DestChunk == NULL) || !DestChunk->IsValid())
|
if ((DestChunk == NULL) || !DestChunk->IsValid())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DestChunk->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0 );
|
DestChunk->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0);
|
||||||
m_World->GetSimulatorManager()->WakeUp(a_X, a_Y, a_Z, DestChunk);
|
m_World->GetSimulatorManager()->WakeUp(a_X, a_Y, a_Z, DestChunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2715,10 +2715,10 @@ cChunkMap::cChunkLayer::cChunkLayer(
|
|||||||
cChunkMap * a_Parent,
|
cChunkMap * a_Parent,
|
||||||
cAllocationPool<cChunkData::sChunkSection> & a_Pool
|
cAllocationPool<cChunkData::sChunkSection> & a_Pool
|
||||||
)
|
)
|
||||||
: m_LayerX( a_LayerX )
|
: m_LayerX( a_LayerX)
|
||||||
, m_LayerZ( a_LayerZ )
|
, m_LayerZ( a_LayerZ)
|
||||||
, m_Parent( a_Parent )
|
, m_Parent( a_Parent)
|
||||||
, m_NumChunksLoaded( 0 )
|
, m_NumChunksLoaded( 0)
|
||||||
, m_Pool(a_Pool)
|
, m_Pool(a_Pool)
|
||||||
{
|
{
|
||||||
memset(m_Chunks, 0, sizeof(m_Chunks));
|
memset(m_Chunks, 0, sizeof(m_Chunks));
|
||||||
@ -2741,7 +2741,7 @@ cChunkMap::cChunkLayer::~cChunkLayer()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cChunkPtr cChunkMap::cChunkLayer::GetChunk( int a_ChunkX, int a_ChunkY, int a_ChunkZ )
|
cChunkPtr cChunkMap::cChunkLayer::GetChunk( int a_ChunkX, int a_ChunkY, int a_ChunkZ)
|
||||||
{
|
{
|
||||||
// Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check
|
// Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public:
|
|||||||
|
|
||||||
static const int LAYER_SIZE = 32;
|
static const int LAYER_SIZE = 32;
|
||||||
|
|
||||||
cChunkMap(cWorld* a_World );
|
cChunkMap(cWorld* a_World);
|
||||||
~cChunkMap();
|
~cChunkMap();
|
||||||
|
|
||||||
// Broadcast respective packets to all clients of the chunk where the event is taking place
|
// Broadcast respective packets to all clients of the chunk where the event is taking place
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL);
|
void BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL);
|
||||||
void BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
void BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
|
||||||
void BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL);
|
void BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL);
|
||||||
void BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ );
|
void BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||||
|
|
||||||
/** Sends the block entity, if it is at the coords specified, to a_Client */
|
/** Sends the block entity, if it is at the coords specified, to a_Client */
|
||||||
void SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client);
|
void SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client);
|
||||||
@ -289,7 +289,7 @@ public:
|
|||||||
/** Sets the sign text. Returns true if sign text changed. */
|
/** Sets the sign text. Returns true if sign text changed. */
|
||||||
bool SetSignLines(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);
|
bool SetSignLines(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);
|
||||||
|
|
||||||
/** Marks the chunk as being regenerated - all its clients want that chunk again (used by cWorld::RegenerateChunk() ) */
|
/** Marks the chunk as being regenerated - all its clients want that chunk again (used by cWorld::RegenerateChunk()) */
|
||||||
void MarkChunkRegenerating(int a_ChunkX, int a_ChunkZ);
|
void MarkChunkRegenerating(int a_ChunkX, int a_ChunkZ);
|
||||||
|
|
||||||
bool IsChunkLighted(int a_ChunkX, int a_ChunkZ);
|
bool IsChunkLighted(int a_ChunkX, int a_ChunkZ);
|
||||||
@ -368,7 +368,7 @@ private:
|
|||||||
~cChunkLayer();
|
~cChunkLayer();
|
||||||
|
|
||||||
/** Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check */
|
/** Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check */
|
||||||
cChunkPtr GetChunk( int a_ChunkX, int a_ChunkY, int a_ChunkZ );
|
cChunkPtr GetChunk( int a_ChunkX, int a_ChunkY, int a_ChunkZ);
|
||||||
|
|
||||||
/** Returns the specified chunk, or NULL if not created yet */
|
/** Returns the specified chunk, or NULL if not created yet */
|
||||||
cChunk * FindChunk(int a_ChunkX, int a_ChunkZ);
|
cChunk * FindChunk(int a_ChunkX, int a_ChunkZ);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/*
|
/*
|
||||||
The whole thing is a thread that runs in a loop, waiting for either:
|
The whole thing is a thread that runs in a loop, waiting for either:
|
||||||
"finished chunks" (ChunkReady()), or
|
"finished chunks" (ChunkReady()), or
|
||||||
"chunks to send" (QueueSendChunkTo() )
|
"chunks to send" (QueueSendChunkTo())
|
||||||
to come to a queue.
|
to come to a queue.
|
||||||
And once they do, it requests the chunk data and sends it all away, either
|
And once they do, it requests the chunk data and sends it all away, either
|
||||||
broadcasting (ChunkReady), or
|
broadcasting (ChunkReady), or
|
||||||
|
@ -210,11 +210,11 @@ AString cClientHandle::FormatMessageType(bool ShouldAppendChatPrefixes, eMessage
|
|||||||
{
|
{
|
||||||
if (ShouldAppendChatPrefixes)
|
if (ShouldAppendChatPrefixes)
|
||||||
{
|
{
|
||||||
return Printf("%s[MSG: %s] %s%s", cChatColor::LightBlue.c_str(), a_AdditionalData.c_str(), cChatColor::White.c_str(), cChatColor::Italic.c_str());
|
return Printf("%s[MSG: %s] %s%s", cChatColor::LightBlue, a_AdditionalData.c_str(), cChatColor::White, cChatColor::Italic);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Printf("%s: %s", a_AdditionalData.c_str(), cChatColor::LightBlue.c_str());
|
return Printf("%s: %s", a_AdditionalData.c_str(), cChatColor::LightBlue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -533,9 +533,9 @@ void cClientHandle::HandlePing(void)
|
|||||||
|
|
||||||
Printf(Reply, "%s%s%i%s%i",
|
Printf(Reply, "%s%s%i%s%i",
|
||||||
Server.GetDescription().c_str(),
|
Server.GetDescription().c_str(),
|
||||||
cChatColor::Delimiter.c_str(),
|
cChatColor::Delimiter,
|
||||||
Server.GetNumPlayers(),
|
Server.GetNumPlayers(),
|
||||||
cChatColor::Delimiter.c_str(),
|
cChatColor::Delimiter,
|
||||||
Server.GetMaxPlayers()
|
Server.GetMaxPlayers()
|
||||||
);
|
);
|
||||||
Kick(Reply);
|
Kick(Reply);
|
||||||
@ -1170,7 +1170,7 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
|
|||||||
{
|
{
|
||||||
// Only compare ItemType, not meta (torches have different metas)
|
// Only compare ItemType, not meta (torches have different metas)
|
||||||
// The -1 check is there because sometimes the client sends -1 instead of the held item
|
// The -1 check is there because sometimes the client sends -1 instead of the held item
|
||||||
// ( http://forum.mc-server.org/showthread.php?tid=549&pid=4502#pid4502 )
|
// Ref.: http://forum.mc-server.org/showthread.php?tid=549&pid=4502#pid4502
|
||||||
LOGWARN("Player %s tried to place a block that was not equipped (exp %d, got %d)",
|
LOGWARN("Player %s tried to place a block that was not equipped (exp %d, got %d)",
|
||||||
m_Username.c_str(), Equipped.m_ItemType, a_HeldItem.m_ItemType
|
m_Username.c_str(), Equipped.m_ItemType, a_HeldItem.m_ItemType
|
||||||
);
|
);
|
||||||
@ -2562,7 +2562,7 @@ void cClientHandle::SendUpdateSign(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cClientHandle::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ )
|
void cClientHandle::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
m_Protocol->SendUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ);
|
m_Protocol->SendUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
}
|
}
|
||||||
@ -2624,7 +2624,7 @@ const AString & cClientHandle::GetUsername(void) const
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cClientHandle::SetUsername( const AString & a_Username )
|
void cClientHandle::SetUsername( const AString & a_Username)
|
||||||
{
|
{
|
||||||
m_Username = a_Username;
|
m_Username = a_Username;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ public:
|
|||||||
void SendUnloadChunk (int a_ChunkX, int a_ChunkZ);
|
void SendUnloadChunk (int a_ChunkX, int a_ChunkZ);
|
||||||
void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity);
|
void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity);
|
||||||
void SendUpdateSign (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);
|
void SendUpdateSign (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);
|
||||||
void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ );
|
void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||||
void SendWeather (eWeather a_Weather);
|
void SendWeather (eWeather a_Weather);
|
||||||
void SendWholeInventory (const cWindow & a_Window);
|
void SendWholeInventory (const cWindow & a_Window);
|
||||||
void SendWindowClose (const cWindow & a_Window);
|
void SendWindowClose (const cWindow & a_Window);
|
||||||
@ -190,7 +190,7 @@ public:
|
|||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
const AString & GetUsername(void) const;
|
const AString & GetUsername(void) const;
|
||||||
void SetUsername( const AString & a_Username );
|
void SetUsername( const AString & a_Username);
|
||||||
|
|
||||||
inline short GetPing(void) const { return m_Ping; }
|
inline short GetPing(void) const { return m_Ping; }
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ private:
|
|||||||
/** The type used for storing the names of registered plugin channels. */
|
/** The type used for storing the names of registered plugin channels. */
|
||||||
typedef std::set<AString> cChannels;
|
typedef std::set<AString> cChannels;
|
||||||
|
|
||||||
/** Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 ) */
|
/** Number of chunks the player can see in each direction */
|
||||||
int m_ViewDistance;
|
int m_ViewDistance;
|
||||||
|
|
||||||
/** Server generates this many chunks AHEAD of player sight. */
|
/** Server generates this many chunks AHEAD of player sight. */
|
||||||
|
@ -582,7 +582,7 @@ cCraftingRecipes::cRecipe * cCraftingRecipes::FindRecipe(const cItem * a_Craftin
|
|||||||
// Get the real bounds of the crafting grid:
|
// Get the real bounds of the crafting grid:
|
||||||
int GridLeft = MAX_GRID_WIDTH, GridTop = MAX_GRID_HEIGHT;
|
int GridLeft = MAX_GRID_WIDTH, GridTop = MAX_GRID_HEIGHT;
|
||||||
int GridRight = 0, GridBottom = 0;
|
int GridRight = 0, GridBottom = 0;
|
||||||
for (int y = 0; y < a_GridHeight; y++ ) for(int x = 0; x < a_GridWidth; x++)
|
for (int y = 0; y < a_GridHeight; y++) for (int x = 0; x < a_GridWidth; x++)
|
||||||
{
|
{
|
||||||
if (!a_CraftingGrid[x + y * a_GridWidth].IsEmpty())
|
if (!a_CraftingGrid[x + y * a_GridWidth].IsEmpty())
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,17 @@ static bool DoIntervalsIntersect(int a_Min1, int a_Max1, int a_Min2, int a_Max2)
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cCuboid:
|
// cCuboid:
|
||||||
|
|
||||||
|
cCuboid & cCuboid::operator=(cCuboid a_Other)
|
||||||
|
{
|
||||||
|
std::swap(p1, a_Other.p1);
|
||||||
|
std::swap(p2, a_Other.p2);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cCuboid::Assign(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2)
|
void cCuboid::Assign(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2)
|
||||||
{
|
{
|
||||||
p1.x = a_X1;
|
p1.x = a_X1;
|
||||||
|
@ -15,10 +15,12 @@ public:
|
|||||||
Vector3i p1, p2;
|
Vector3i p1, p2;
|
||||||
|
|
||||||
cCuboid(void) {}
|
cCuboid(void) {}
|
||||||
cCuboid(const cCuboid & a_Cuboid ) : p1(a_Cuboid.p1), p2(a_Cuboid.p2) {}
|
cCuboid(const cCuboid & a_Cuboid) : p1(a_Cuboid.p1), p2(a_Cuboid.p2) {}
|
||||||
cCuboid(const Vector3i & a_p1, const Vector3i & a_p2) : p1(a_p1), p2(a_p2) {}
|
cCuboid(const Vector3i & a_p1, const Vector3i & a_p2) : p1(a_p1), p2(a_p2) {}
|
||||||
cCuboid(int a_X1, int a_Y1, int a_Z1) : p1(a_X1, a_Y1, a_Z1), p2(a_X1, a_Y1, a_Z1) {}
|
cCuboid(int a_X1, int a_Y1, int a_Z1) : p1(a_X1, a_Y1, a_Z1), p2(a_X1, a_Y1, a_Z1) {}
|
||||||
cCuboid(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2) : p1(a_X1, a_Y1, a_Z1), p2(a_X2, a_Y2, a_Z2) {}
|
cCuboid(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2) : p1(a_X1, a_Y1, a_Z1), p2(a_X2, a_Y2, a_Z2) {}
|
||||||
|
|
||||||
|
cCuboid & operator=(cCuboid a_Other);
|
||||||
|
|
||||||
void Assign(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2);
|
void Assign(int a_X1, int a_Y1, int a_Z1, int a_X2, int a_Y2, int a_Z2);
|
||||||
void Assign(const cCuboid & a_SrcCuboid);
|
void Assign(const cCuboid & a_SrcCuboid);
|
||||||
@ -56,7 +58,7 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsInside( const Vector3d & v ) const
|
bool IsInside( const Vector3d & v) const
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
(v.x >= p1.x) && (v.x <= p2.x) &&
|
(v.x >= p1.x) && (v.x <= p2.x) &&
|
||||||
|
@ -470,7 +470,7 @@ inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_B
|
|||||||
{
|
{
|
||||||
int Y = a_BlockY;
|
int Y = a_BlockY;
|
||||||
AddFaceDirection(a_BlockX, Y, a_BlockZ, a_BlockFace, a_bInverse);
|
AddFaceDirection(a_BlockX, Y, a_BlockZ, a_BlockFace, a_bInverse);
|
||||||
a_BlockY = Clamp<unsigned char>(Y, 0, 255);
|
a_BlockY = Clamp<unsigned char>((unsigned char)Y, 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -479,9 +479,9 @@ inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_B
|
|||||||
|
|
||||||
inline void EulerToVector(double a_Pan, double a_Pitch, double & a_X, double & a_Y, double & a_Z)
|
inline void EulerToVector(double a_Pan, double a_Pitch, double & a_X, double & a_Y, double & a_Z)
|
||||||
{
|
{
|
||||||
// a_X = sinf ( a_Pan / 180 * PI ) * cosf ( a_Pitch / 180 * PI );
|
// a_X = sinf ( a_Pan / 180 * PI) * cosf ( a_Pitch / 180 * PI);
|
||||||
// a_Y = -sinf ( a_Pitch / 180 * PI );
|
// a_Y = -sinf ( a_Pitch / 180 * PI);
|
||||||
// a_Z = -cosf ( a_Pan / 180 * PI ) * cosf ( a_Pitch / 180 * PI );
|
// a_Z = -cosf ( a_Pan / 180 * PI) * cosf ( a_Pitch / 180 * PI);
|
||||||
a_X = cos(a_Pan / 180 * PI) * cos(a_Pitch / 180 * PI);
|
a_X = cos(a_Pan / 180 * PI) * cos(a_Pitch / 180 * PI);
|
||||||
a_Y = sin(a_Pan / 180 * PI) * cos(a_Pitch / 180 * PI);
|
a_Y = sin(a_Pan / 180 * PI) * cos(a_Pitch / 180 * PI);
|
||||||
a_Z = sin(a_Pitch / 180 * PI);
|
a_Z = sin(a_Pitch / 180 * PI);
|
||||||
@ -519,7 +519,7 @@ inline float GetSignf(float a_Val)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline float GetSpecialSignf( float a_Val )
|
inline float GetSpecialSignf( float a_Val)
|
||||||
{
|
{
|
||||||
return (a_Val <= 0.f) ? -1.f : 1.f;
|
return (a_Val <= 0.f) ? -1.f : 1.f;
|
||||||
}
|
}
|
||||||
@ -640,11 +640,11 @@ namespace ItemCategory
|
|||||||
|
|
||||||
inline bool IsTool(short a_ItemID)
|
inline bool IsTool(short a_ItemID)
|
||||||
{
|
{
|
||||||
return IsPickaxe( a_ItemID )
|
return IsPickaxe( a_ItemID)
|
||||||
|| IsAxe ( a_ItemID )
|
|| IsAxe ( a_ItemID)
|
||||||
|| IsSword ( a_ItemID )
|
|| IsSword ( a_ItemID)
|
||||||
|| IsHoe ( a_ItemID )
|
|| IsHoe ( a_ItemID)
|
||||||
|| IsShovel ( a_ItemID );
|
|| IsShovel ( a_ItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ Serialization will never put zero-level enchantments into the stringspec and wil
|
|||||||
class cEnchantments
|
class cEnchantments
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Individual enchantment IDs, corresponding to their NBT IDs ( http://www.minecraftwiki.net/wiki/Data_Values#Enchantment_IDs )
|
/** Individual enchantment IDs, corresponding to their NBT IDs: http://www.minecraftwiki.net/wiki/Data_Values#Enchantment_IDs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
inline UInt64 HostToNetwork8(const void * a_Value)
|
inline UInt64 HostToNetwork8(const void * a_Value)
|
||||||
{
|
{
|
||||||
unsigned long long __HostToNetwork8;
|
unsigned long long __HostToNetwork8;
|
||||||
memcpy( &__HostToNetwork8, a_Value, sizeof( __HostToNetwork8 ) );
|
memcpy( &__HostToNetwork8, a_Value, sizeof( __HostToNetwork8));
|
||||||
__HostToNetwork8 = (( ( (unsigned long long)htonl((u_long)__HostToNetwork8) ) << 32) + htonl(__HostToNetwork8 >> 32));
|
__HostToNetwork8 = (( ( (unsigned long long)htonl((u_long)__HostToNetwork8)) << 32) + htonl(__HostToNetwork8 >> 32));
|
||||||
return __HostToNetwork8;
|
return __HostToNetwork8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,11 +20,11 @@ inline UInt64 HostToNetwork8(const void * a_Value)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline UInt32 HostToNetwork4(const void* a_Value )
|
inline UInt32 HostToNetwork4(const void* a_Value)
|
||||||
{
|
{
|
||||||
unsigned int __HostToNetwork4;
|
unsigned int __HostToNetwork4;
|
||||||
memcpy( &__HostToNetwork4, a_Value, sizeof( __HostToNetwork4 ) );
|
memcpy( &__HostToNetwork4, a_Value, sizeof( __HostToNetwork4));
|
||||||
__HostToNetwork4 = ntohl( __HostToNetwork4 );
|
__HostToNetwork4 = ntohl( __HostToNetwork4);
|
||||||
return __HostToNetwork4;
|
return __HostToNetwork4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,7 +648,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
|
|||||||
|
|
||||||
int RelBlockX = BlockX - (NextChunk->GetPosX() * cChunkDef::Width);
|
int RelBlockX = BlockX - (NextChunk->GetPosX() * cChunkDef::Width);
|
||||||
int RelBlockZ = BlockZ - (NextChunk->GetPosZ() * cChunkDef::Width);
|
int RelBlockZ = BlockZ - (NextChunk->GetPosZ() * cChunkDef::Width);
|
||||||
BLOCKTYPE BlockIn = NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ );
|
BLOCKTYPE BlockIn = NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ);
|
||||||
BLOCKTYPE BlockBelow = (BlockY > 0) ? NextChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR;
|
BLOCKTYPE BlockBelow = (BlockY > 0) ? NextChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR;
|
||||||
if (!cBlockInfo::IsSolid(BlockIn)) // Making sure we are not inside a solid block
|
if (!cBlockInfo::IsSolid(BlockIn)) // Making sure we are not inside a solid block
|
||||||
{
|
{
|
||||||
@ -758,7 +758,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
|
|||||||
|
|
||||||
m_WaterSpeed *= 0.9f; // Reduce speed each tick
|
m_WaterSpeed *= 0.9f; // Reduce speed each tick
|
||||||
|
|
||||||
switch(WaterDir)
|
switch (WaterDir)
|
||||||
{
|
{
|
||||||
case X_PLUS:
|
case X_PLUS:
|
||||||
m_WaterSpeed.x = 0.2f;
|
m_WaterSpeed.x = 0.2f;
|
||||||
|
@ -62,9 +62,9 @@ void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk)
|
|||||||
}
|
}
|
||||||
a_Distance.Normalize();
|
a_Distance.Normalize();
|
||||||
a_Distance *= ((float) (5.5 - Distance));
|
a_Distance *= ((float) (5.5 - Distance));
|
||||||
SetSpeedX( a_Distance.x );
|
SetSpeedX( a_Distance.x);
|
||||||
SetSpeedY( a_Distance.y );
|
SetSpeedY( a_Distance.y);
|
||||||
SetSpeedZ( a_Distance.z );
|
SetSpeedZ( a_Distance.z);
|
||||||
BroadcastMovementUpdate();
|
BroadcastMovementUpdate();
|
||||||
}
|
}
|
||||||
HandlePhysics(a_Dt, a_Chunk);
|
HandlePhysics(a_Dt, a_Chunk);
|
||||||
|
@ -140,7 +140,7 @@ cPlayer::~cPlayer(void)
|
|||||||
|
|
||||||
SaveToDisk();
|
SaveToDisk();
|
||||||
|
|
||||||
m_World->RemovePlayer( this );
|
m_World->RemovePlayer( this);
|
||||||
|
|
||||||
m_ClientHandle = NULL;
|
m_ClientHandle = NULL;
|
||||||
|
|
||||||
@ -173,11 +173,11 @@ void cPlayer::SpawnOn(cClientHandle & a_Client)
|
|||||||
}
|
}
|
||||||
a_Client.SendPlayerSpawn(*this);
|
a_Client.SendPlayerSpawn(*this);
|
||||||
a_Client.SendEntityHeadLook(*this);
|
a_Client.SendEntityHeadLook(*this);
|
||||||
a_Client.SendEntityEquipment(*this, 0, m_Inventory.GetEquippedItem() );
|
a_Client.SendEntityEquipment(*this, 0, m_Inventory.GetEquippedItem());
|
||||||
a_Client.SendEntityEquipment(*this, 1, m_Inventory.GetEquippedBoots() );
|
a_Client.SendEntityEquipment(*this, 1, m_Inventory.GetEquippedBoots());
|
||||||
a_Client.SendEntityEquipment(*this, 2, m_Inventory.GetEquippedLeggings() );
|
a_Client.SendEntityEquipment(*this, 2, m_Inventory.GetEquippedLeggings());
|
||||||
a_Client.SendEntityEquipment(*this, 3, m_Inventory.GetEquippedChestplate() );
|
a_Client.SendEntityEquipment(*this, 3, m_Inventory.GetEquippedChestplate());
|
||||||
a_Client.SendEntityEquipment(*this, 4, m_Inventory.GetEquippedHelmet() );
|
a_Client.SendEntityEquipment(*this, 4, m_Inventory.GetEquippedHelmet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -286,19 +286,19 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
|
|||||||
short cPlayer::CalcLevelFromXp(short a_XpTotal)
|
short cPlayer::CalcLevelFromXp(short a_XpTotal)
|
||||||
{
|
{
|
||||||
// level 0 to 15
|
// level 0 to 15
|
||||||
if(a_XpTotal <= XP_TO_LEVEL15)
|
if (a_XpTotal <= XP_TO_LEVEL15)
|
||||||
{
|
{
|
||||||
return a_XpTotal / XP_PER_LEVEL_TO15;
|
return a_XpTotal / XP_PER_LEVEL_TO15;
|
||||||
}
|
}
|
||||||
|
|
||||||
// level 30+
|
// level 30+
|
||||||
if(a_XpTotal > XP_TO_LEVEL30)
|
if (a_XpTotal > XP_TO_LEVEL30)
|
||||||
{
|
{
|
||||||
return (short) (151.5 + sqrt( 22952.25 - (14 * (2220 - a_XpTotal)))) / 7;
|
return (short) (151.5 + sqrt( 22952.25 - (14 * (2220 - a_XpTotal)))) / 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
// level 16 to 30
|
// level 16 to 30
|
||||||
return (short) ( 29.5 + sqrt( 870.25 - (6 * ( 360 - a_XpTotal )))) / 3;
|
return (short) ( 29.5 + sqrt( 870.25 - (6 * ( 360 - a_XpTotal)))) / 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -308,19 +308,19 @@ short cPlayer::CalcLevelFromXp(short a_XpTotal)
|
|||||||
short cPlayer::XpForLevel(short a_Level)
|
short cPlayer::XpForLevel(short a_Level)
|
||||||
{
|
{
|
||||||
// level 0 to 15
|
// level 0 to 15
|
||||||
if(a_Level <= 15)
|
if (a_Level <= 15)
|
||||||
{
|
{
|
||||||
return a_Level * XP_PER_LEVEL_TO15;
|
return a_Level * XP_PER_LEVEL_TO15;
|
||||||
}
|
}
|
||||||
|
|
||||||
// level 30+
|
// level 30+
|
||||||
if(a_Level >= 31)
|
if (a_Level >= 31)
|
||||||
{
|
{
|
||||||
return (short) ( (3.5 * a_Level * a_Level) - (151.5 * a_Level) + 2220 );
|
return (short) ( (3.5 * a_Level * a_Level) - (151.5 * a_Level) + 2220);
|
||||||
}
|
}
|
||||||
|
|
||||||
// level 16 to 30
|
// level 16 to 30
|
||||||
return (short) ( (1.5 * a_Level * a_Level) - (29.5 * a_Level) + 360 );
|
return (short) ( (1.5 * a_Level * a_Level) - (29.5 * a_Level) + 360);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ float cPlayer::GetXpPercentage()
|
|||||||
|
|
||||||
bool cPlayer::SetCurrentExperience(short int a_CurrentXp)
|
bool cPlayer::SetCurrentExperience(short int a_CurrentXp)
|
||||||
{
|
{
|
||||||
if(!(a_CurrentXp >= 0) || (a_CurrentXp > (SHRT_MAX - m_LifetimeTotalXp)))
|
if (!(a_CurrentXp >= 0) || (a_CurrentXp > (SHRT_MAX - m_LifetimeTotalXp)))
|
||||||
{
|
{
|
||||||
LOGWARNING("Tried to update experiece with an invalid Xp value: %d", a_CurrentXp);
|
LOGWARNING("Tried to update experiece with an invalid Xp value: %d", a_CurrentXp);
|
||||||
return false; // oops, they gave us a dodgey number
|
return false; // oops, they gave us a dodgey number
|
||||||
@ -1007,7 +1007,7 @@ double cPlayer::GetEyeHeight(void) const
|
|||||||
|
|
||||||
Vector3d cPlayer::GetEyePosition(void) const
|
Vector3d cPlayer::GetEyePosition(void) const
|
||||||
{
|
{
|
||||||
return Vector3d( GetPosX(), m_Stance, GetPosZ() );
|
return Vector3d( GetPosX(), m_Stance, GetPosZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1169,7 +1169,7 @@ void cPlayer::SetGameMode(eGameMode a_GameMode)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cPlayer::LoginSetGameMode( eGameMode a_GameMode )
|
void cPlayer::LoginSetGameMode( eGameMode a_GameMode)
|
||||||
{
|
{
|
||||||
m_GameMode = a_GameMode;
|
m_GameMode = a_GameMode;
|
||||||
}
|
}
|
||||||
@ -1305,7 +1305,7 @@ void cPlayer::DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cPlayer::MoveTo( const Vector3d & a_NewPos )
|
void cPlayer::MoveTo( const Vector3d & a_NewPos)
|
||||||
{
|
{
|
||||||
if ((a_NewPos.y < -990) && (GetPosY() > -100))
|
if ((a_NewPos.y < -990) && (GetPosY() > -100))
|
||||||
{
|
{
|
||||||
@ -1328,7 +1328,7 @@ void cPlayer::MoveTo( const Vector3d & a_NewPos )
|
|||||||
Vector3d DeltaPos = a_NewPos - GetPosition();
|
Vector3d DeltaPos = a_NewPos - GetPosition();
|
||||||
UpdateMovementStats(DeltaPos);
|
UpdateMovementStats(DeltaPos);
|
||||||
|
|
||||||
SetPosition( a_NewPos );
|
SetPosition( a_NewPos);
|
||||||
SetStance(a_NewPos.y + 1.62);
|
SetStance(a_NewPos.y + 1.62);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1354,11 +1354,11 @@ void cPlayer::SetVisible(bool a_bVisible)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cPlayer::AddToGroup( const AString & a_GroupName )
|
void cPlayer::AddToGroup( const AString & a_GroupName)
|
||||||
{
|
{
|
||||||
cGroup* Group = cRoot::Get()->GetGroupManager()->GetGroup( a_GroupName );
|
cGroup* Group = cRoot::Get()->GetGroupManager()->GetGroup( a_GroupName);
|
||||||
m_Groups.push_back( Group );
|
m_Groups.push_back( Group);
|
||||||
LOGD("Added %s to group %s", GetName().c_str(), a_GroupName.c_str() );
|
LOGD("Added %s to group %s", GetName().c_str(), a_GroupName.c_str());
|
||||||
ResolveGroups();
|
ResolveGroups();
|
||||||
ResolvePermissions();
|
ResolvePermissions();
|
||||||
}
|
}
|
||||||
@ -1367,28 +1367,28 @@ void cPlayer::AddToGroup( const AString & a_GroupName )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cPlayer::RemoveFromGroup( const AString & a_GroupName )
|
void cPlayer::RemoveFromGroup( const AString & a_GroupName)
|
||||||
{
|
{
|
||||||
bool bRemoved = false;
|
bool bRemoved = false;
|
||||||
for( GroupList::iterator itr = m_Groups.begin(); itr != m_Groups.end(); ++itr )
|
for (GroupList::iterator itr = m_Groups.begin(); itr != m_Groups.end(); ++itr)
|
||||||
{
|
{
|
||||||
if( (*itr)->GetName().compare(a_GroupName ) == 0 )
|
if ((*itr)->GetName().compare(a_GroupName) == 0)
|
||||||
{
|
{
|
||||||
m_Groups.erase( itr );
|
m_Groups.erase( itr);
|
||||||
bRemoved = true;
|
bRemoved = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bRemoved )
|
if (bRemoved)
|
||||||
{
|
{
|
||||||
LOGD("Removed %s from group %s", GetName().c_str(), a_GroupName.c_str() );
|
LOGD("Removed %s from group %s", GetName().c_str(), a_GroupName.c_str());
|
||||||
ResolveGroups();
|
ResolveGroups();
|
||||||
ResolvePermissions();
|
ResolvePermissions();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGWARN("Tried to remove %s from group %s but was not in that group", GetName().c_str(), a_GroupName.c_str() );
|
LOGWARN("Tried to remove %s from group %s but was not in that group", GetName().c_str(), a_GroupName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1404,30 +1404,30 @@ bool cPlayer::HasPermission(const AString & a_Permission)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AStringVector Split = StringSplit( a_Permission, "." );
|
AStringVector Split = StringSplit( a_Permission, ".");
|
||||||
PermissionMap Possibilities = m_ResolvedPermissions;
|
PermissionMap Possibilities = m_ResolvedPermissions;
|
||||||
// Now search the namespaces
|
// Now search the namespaces
|
||||||
while( Possibilities.begin() != Possibilities.end() )
|
while (Possibilities.begin() != Possibilities.end())
|
||||||
{
|
{
|
||||||
PermissionMap::iterator itr = Possibilities.begin();
|
PermissionMap::iterator itr = Possibilities.begin();
|
||||||
if( itr->second )
|
if (itr->second)
|
||||||
{
|
{
|
||||||
AStringVector OtherSplit = StringSplit( itr->first, "." );
|
AStringVector OtherSplit = StringSplit( itr->first, ".");
|
||||||
if( OtherSplit.size() <= Split.size() )
|
if (OtherSplit.size() <= Split.size())
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for( i = 0; i < OtherSplit.size(); ++i )
|
for (i = 0; i < OtherSplit.size(); ++i)
|
||||||
{
|
{
|
||||||
if( OtherSplit[i].compare( Split[i] ) != 0 )
|
if (OtherSplit[i].compare( Split[i]) != 0)
|
||||||
{
|
{
|
||||||
if( OtherSplit[i].compare("*") == 0 ) return true; // WildCard man!! WildCard!
|
if (OtherSplit[i].compare("*") == 0) return true; // WildCard man!! WildCard!
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( i == Split.size() ) return true;
|
if (i == Split.size()) return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Possibilities.erase( itr );
|
Possibilities.erase( itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing that matched :(
|
// Nothing that matched :(
|
||||||
@ -1438,11 +1438,11 @@ bool cPlayer::HasPermission(const AString & a_Permission)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cPlayer::IsInGroup( const AString & a_Group )
|
bool cPlayer::IsInGroup( const AString & a_Group)
|
||||||
{
|
{
|
||||||
for( GroupList::iterator itr = m_ResolvedGroups.begin(); itr != m_ResolvedGroups.end(); ++itr )
|
for (GroupList::iterator itr = m_ResolvedGroups.begin(); itr != m_ResolvedGroups.end(); ++itr)
|
||||||
{
|
{
|
||||||
if( a_Group.compare( (*itr)->GetName().c_str() ) == 0 )
|
if (a_Group.compare( (*itr)->GetName().c_str()) == 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1457,15 +1457,15 @@ void cPlayer::ResolvePermissions()
|
|||||||
m_ResolvedPermissions.clear(); // Start with an empty map
|
m_ResolvedPermissions.clear(); // Start with an empty map
|
||||||
|
|
||||||
// Copy all player specific permissions into the resolved permissions map
|
// Copy all player specific permissions into the resolved permissions map
|
||||||
for( PermissionMap::iterator itr = m_Permissions.begin(); itr != m_Permissions.end(); ++itr )
|
for (PermissionMap::iterator itr = m_Permissions.begin(); itr != m_Permissions.end(); ++itr)
|
||||||
{
|
{
|
||||||
m_ResolvedPermissions[ itr->first ] = itr->second;
|
m_ResolvedPermissions[ itr->first ] = itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( GroupList::iterator GroupItr = m_ResolvedGroups.begin(); GroupItr != m_ResolvedGroups.end(); ++GroupItr )
|
for (GroupList::iterator GroupItr = m_ResolvedGroups.begin(); GroupItr != m_ResolvedGroups.end(); ++GroupItr)
|
||||||
{
|
{
|
||||||
const cGroup::PermissionMap & Permissions = (*GroupItr)->GetPermissions();
|
const cGroup::PermissionMap & Permissions = (*GroupItr)->GetPermissions();
|
||||||
for( cGroup::PermissionMap::const_iterator itr = Permissions.begin(); itr != Permissions.end(); ++itr )
|
for (cGroup::PermissionMap::const_iterator itr = Permissions.begin(); itr != Permissions.end(); ++itr)
|
||||||
{
|
{
|
||||||
m_ResolvedPermissions[ itr->first ] = itr->second;
|
m_ResolvedPermissions[ itr->first ] = itr->second;
|
||||||
}
|
}
|
||||||
@ -1484,14 +1484,14 @@ void cPlayer::ResolveGroups()
|
|||||||
// Get a complete resolved list of all groups the player is in
|
// Get a complete resolved list of all groups the player is in
|
||||||
std::map< cGroup*, bool > AllGroups; // Use a map, because it's faster than iterating through a list to find duplicates
|
std::map< cGroup*, bool > AllGroups; // Use a map, because it's faster than iterating through a list to find duplicates
|
||||||
GroupList ToIterate;
|
GroupList ToIterate;
|
||||||
for( GroupList::iterator GroupItr = m_Groups.begin(); GroupItr != m_Groups.end(); ++GroupItr )
|
for (GroupList::iterator GroupItr = m_Groups.begin(); GroupItr != m_Groups.end(); ++GroupItr)
|
||||||
{
|
{
|
||||||
ToIterate.push_back( *GroupItr );
|
ToIterate.push_back( *GroupItr);
|
||||||
}
|
}
|
||||||
while( ToIterate.begin() != ToIterate.end() )
|
while (ToIterate.begin() != ToIterate.end())
|
||||||
{
|
{
|
||||||
cGroup* CurrentGroup = *ToIterate.begin();
|
cGroup* CurrentGroup = *ToIterate.begin();
|
||||||
if( AllGroups.find( CurrentGroup ) != AllGroups.end() )
|
if (AllGroups.find( CurrentGroup) != AllGroups.end())
|
||||||
{
|
{
|
||||||
LOGWARNING("ERROR: Player \"%s\" is in the group multiple times (\"%s\"). Please fix your settings in users.ini!",
|
LOGWARNING("ERROR: Player \"%s\" is in the group multiple times (\"%s\"). Please fix your settings in users.ini!",
|
||||||
GetName().c_str(), CurrentGroup->GetName().c_str()
|
GetName().c_str(), CurrentGroup->GetName().c_str()
|
||||||
@ -1500,19 +1500,19 @@ void cPlayer::ResolveGroups()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
AllGroups[ CurrentGroup ] = true;
|
AllGroups[ CurrentGroup ] = true;
|
||||||
m_ResolvedGroups.push_back( CurrentGroup ); // Add group to resolved list
|
m_ResolvedGroups.push_back( CurrentGroup); // Add group to resolved list
|
||||||
const cGroup::GroupList & Inherits = CurrentGroup->GetInherits();
|
const cGroup::GroupList & Inherits = CurrentGroup->GetInherits();
|
||||||
for( cGroup::GroupList::const_iterator itr = Inherits.begin(); itr != Inherits.end(); ++itr )
|
for (cGroup::GroupList::const_iterator itr = Inherits.begin(); itr != Inherits.end(); ++itr)
|
||||||
{
|
{
|
||||||
if( AllGroups.find( *itr ) != AllGroups.end() )
|
if (AllGroups.find( *itr) != AllGroups.end())
|
||||||
{
|
{
|
||||||
LOGERROR("ERROR: Player %s is in the same group multiple times due to inheritance (%s). FIX IT!", GetName().c_str(), (*itr)->GetName().c_str() );
|
LOGERROR("ERROR: Player %s is in the same group multiple times due to inheritance (%s). FIX IT!", GetName().c_str(), (*itr)->GetName().c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ToIterate.push_back( *itr );
|
ToIterate.push_back( *itr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ToIterate.erase( ToIterate.begin() );
|
ToIterate.erase( ToIterate.begin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1522,12 +1522,12 @@ void cPlayer::ResolveGroups()
|
|||||||
|
|
||||||
AString cPlayer::GetColor(void) const
|
AString cPlayer::GetColor(void) const
|
||||||
{
|
{
|
||||||
if ( m_Color != '-' )
|
if (m_Color != '-')
|
||||||
{
|
{
|
||||||
return cChatColor::Color + m_Color;
|
return cChatColor::Delimiter + m_Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_Groups.size() < 1 )
|
if (m_Groups.size() < 1)
|
||||||
{
|
{
|
||||||
return cChatColor::White;
|
return cChatColor::White;
|
||||||
}
|
}
|
||||||
@ -1914,11 +1914,11 @@ cPlayer::StringList cPlayer::GetResolvedPermissions()
|
|||||||
StringList Permissions;
|
StringList Permissions;
|
||||||
|
|
||||||
const PermissionMap& ResolvedPermissions = m_ResolvedPermissions;
|
const PermissionMap& ResolvedPermissions = m_ResolvedPermissions;
|
||||||
for( PermissionMap::const_iterator itr = ResolvedPermissions.begin(); itr != ResolvedPermissions.end(); ++itr )
|
for (PermissionMap::const_iterator itr = ResolvedPermissions.begin(); itr != ResolvedPermissions.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->second)
|
if (itr->second)
|
||||||
{
|
{
|
||||||
Permissions.push_back( itr->first );
|
Permissions.push_back( itr->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,8 +117,8 @@ public:
|
|||||||
/** Returns true if the player is currently charging the bow */
|
/** Returns true if the player is currently charging the bow */
|
||||||
bool IsChargingBow(void) const { return m_IsChargingBow; }
|
bool IsChargingBow(void) const { return m_IsChargingBow; }
|
||||||
|
|
||||||
void SetTouchGround( bool a_bTouchGround );
|
void SetTouchGround( bool a_bTouchGround);
|
||||||
inline void SetStance( const double a_Stance ) { m_Stance = a_Stance; }
|
inline void SetStance( const double a_Stance) { m_Stance = a_Stance; }
|
||||||
double GetEyeHeight(void) const; // tolua_export
|
double GetEyeHeight(void) const; // tolua_export
|
||||||
Vector3d GetEyePosition(void) const; // tolua_export
|
Vector3d GetEyePosition(void) const; // tolua_export
|
||||||
inline bool IsOnGround(void) const {return m_bTouchGround; } // tolua_export
|
inline bool IsOnGround(void) const {return m_bTouchGround; } // tolua_export
|
||||||
@ -239,15 +239,15 @@ public:
|
|||||||
typedef std::list< std::string > StringList;
|
typedef std::list< std::string > StringList;
|
||||||
|
|
||||||
/** Adds a player to existing group or creates a new group when it doesn't exist */
|
/** Adds a player to existing group or creates a new group when it doesn't exist */
|
||||||
void AddToGroup( const AString & a_GroupName ); // tolua_export
|
void AddToGroup( const AString & a_GroupName); // tolua_export
|
||||||
|
|
||||||
/** Removes a player from the group, resolves permissions and group inheritance (case sensitive) */
|
/** Removes a player from the group, resolves permissions and group inheritance (case sensitive) */
|
||||||
void RemoveFromGroup( const AString & a_GroupName ); // tolua_export
|
void RemoveFromGroup( const AString & a_GroupName); // tolua_export
|
||||||
|
|
||||||
bool HasPermission( const AString & a_Permission ); // tolua_export
|
bool HasPermission( const AString & a_Permission); // tolua_export
|
||||||
const GroupList & GetGroups() { return m_Groups; } // >> EXPORTED IN MANUALBINDINGS <<
|
const GroupList & GetGroups() { return m_Groups; } // >> EXPORTED IN MANUALBINDINGS <<
|
||||||
StringList GetResolvedPermissions(); // >> EXPORTED IN MANUALBINDINGS <<
|
StringList GetResolvedPermissions(); // >> EXPORTED IN MANUALBINDINGS <<
|
||||||
bool IsInGroup( const AString & a_Group ); // tolua_export
|
bool IsInGroup( const AString & a_Group); // tolua_export
|
||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ public:
|
|||||||
|
|
||||||
void Respawn(void); // tolua_export
|
void Respawn(void); // tolua_export
|
||||||
|
|
||||||
void SetVisible( bool a_bVisible ); // tolua_export
|
void SetVisible( bool a_bVisible); // tolua_export
|
||||||
bool IsVisible(void) const { return m_bVisible; } // tolua_export
|
bool IsVisible(void) const { return m_bVisible; } // tolua_export
|
||||||
|
|
||||||
/** Moves the player to the specified world.
|
/** Moves the player to the specified world.
|
||||||
|
@ -33,17 +33,18 @@ public:
|
|||||||
/** Called by cWorld::ForEachEntity(), adds the stored entity effect to the entity, if it is close enough. */
|
/** Called by cWorld::ForEachEntity(), adds the stored entity effect to the entity, if it is close enough. */
|
||||||
virtual bool Item(cEntity * a_Entity) override
|
virtual bool Item(cEntity * a_Entity) override
|
||||||
{
|
{
|
||||||
|
if (!a_Entity->IsPawn())
|
||||||
|
{
|
||||||
|
// Not an entity that can take effects
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
double SplashDistance = (a_Entity->GetPosition() - m_HitPos).Length();
|
double SplashDistance = (a_Entity->GetPosition() - m_HitPos).Length();
|
||||||
if (SplashDistance >= 20)
|
if (SplashDistance >= 20)
|
||||||
{
|
{
|
||||||
// Too far away
|
// Too far away
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!a_Entity->IsPawn())
|
|
||||||
{
|
|
||||||
// Not an entity that can take effects
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// y = -0.25x + 1, where x is the distance from the player. Approximation for potion splash.
|
// y = -0.25x + 1, where x is the distance from the player. Approximation for potion splash.
|
||||||
// TODO: better equation
|
// TODO: better equation
|
||||||
@ -114,7 +115,7 @@ void cSplashPotionEntity::Splash(const Vector3d & a_HitPos)
|
|||||||
cSplashPotionCallback Callback(a_HitPos, m_EntityEffectType, m_EntityEffect);
|
cSplashPotionCallback Callback(a_HitPos, m_EntityEffectType, m_EntityEffect);
|
||||||
m_World->ForEachEntity(Callback);
|
m_World->ForEachEntity(Callback);
|
||||||
|
|
||||||
m_World->BroadcastSoundParticleEffect(2002, (int)a_HitPos.x, (int)a_HitPos.y, (int)a_HitPos.z, m_PotionColor);
|
m_World->BroadcastSoundParticleEffect(2002, (int)floor(a_HitPos.x), (int)floor(a_HitPos.y), (int)floor(a_HitPos.z), m_PotionColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ struct cFurnaceRecipe::sFurnaceRecipeState
|
|||||||
|
|
||||||
|
|
||||||
cFurnaceRecipe::cFurnaceRecipe()
|
cFurnaceRecipe::cFurnaceRecipe()
|
||||||
: m_pState( new sFurnaceRecipeState )
|
: m_pState( new sFurnaceRecipeState)
|
||||||
{
|
{
|
||||||
ReloadRecipes();
|
ReloadRecipes();
|
||||||
}
|
}
|
||||||
|
@ -703,10 +703,10 @@ cGridStructGen::cStructurePtr cStructGenWormNestCaves::CreateStructure(int a_Gri
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStructGenMarbleCaves:
|
// cStructGenMarbleCaves:
|
||||||
|
|
||||||
static float GetMarbleNoise( float x, float y, float z, cNoise & a_Noise )
|
static float GetMarbleNoise( float x, float y, float z, cNoise & a_Noise)
|
||||||
{
|
{
|
||||||
static const float PI_2 = 1.57079633f;
|
static const float PI_2 = 1.57079633f;
|
||||||
float oct1 = (a_Noise.CubicNoise3D(x * 0.1f, y * 0.1f, z * 0.1f )) * 4;
|
float oct1 = (a_Noise.CubicNoise3D(x * 0.1f, y * 0.1f, z * 0.1f)) * 4;
|
||||||
|
|
||||||
oct1 = oct1 * oct1 * oct1;
|
oct1 = oct1 * oct1 * oct1;
|
||||||
if (oct1 < 0.f) oct1 = PI_2;
|
if (oct1 < 0.f) oct1 = PI_2;
|
||||||
@ -730,7 +730,7 @@ void cStructGenMarbleCaves::GenFinish(cChunkDesc & a_ChunkDesc)
|
|||||||
const float xx = (float)(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x);
|
const float xx = (float)(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x);
|
||||||
|
|
||||||
int Top = a_ChunkDesc.GetHeight(x, z);
|
int Top = a_ChunkDesc.GetHeight(x, z);
|
||||||
for (int y = 1; y < Top; ++y )
|
for (int y = 1; y < Top; ++y)
|
||||||
{
|
{
|
||||||
if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_STONE)
|
if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_STONE)
|
||||||
{
|
{
|
||||||
|
@ -229,7 +229,7 @@ void cChunkGenerator::Execute(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cChunkCoords coords = m_Queue.front(); // Get next coord from queue
|
cChunkCoords coords = m_Queue.front(); // Get next coord from queue
|
||||||
m_Queue.erase( m_Queue.begin() ); // Remove coordinate from queue
|
m_Queue.erase( m_Queue.begin()); // Remove coordinate from queue
|
||||||
bool SkipEnabled = (m_Queue.size() > QUEUE_SKIP_LIMIT);
|
bool SkipEnabled = (m_Queue.size() > QUEUE_SKIP_LIMIT);
|
||||||
Lock.Unlock(); // Unlock ASAP
|
Lock.Unlock(); // Unlock ASAP
|
||||||
m_evtRemoved.Set();
|
m_evtRemoved.Set();
|
||||||
|
@ -415,6 +415,10 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
|||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed));
|
m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed));
|
||||||
}
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "TallGrass") == 0)
|
||||||
|
{
|
||||||
|
m_FinishGens.push_back(new cFinishGenTallGrass(Seed));
|
||||||
|
}
|
||||||
else if (NoCaseCompare(*itr, "TestRails") == 0)
|
else if (NoCaseCompare(*itr, "TestRails") == 0)
|
||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cTestRailsGen(Seed, 100, 1, 7, 50));
|
m_FinishGens.push_back(new cTestRailsGen(Seed, 100, 1, 7, 50));
|
||||||
|
@ -159,6 +159,65 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// cFinishGenTallGrass:
|
||||||
|
|
||||||
|
void cFinishGenTallGrass::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < cChunkDef::Width; x++)
|
||||||
|
{
|
||||||
|
int xx = x + a_ChunkDesc.GetChunkX() * cChunkDef::Width;
|
||||||
|
for (int z = 0; z < cChunkDef::Width; z++)
|
||||||
|
{
|
||||||
|
int zz = z + a_ChunkDesc.GetChunkZ() * cChunkDef::Width;
|
||||||
|
int BiomeDensity = GetBiomeDensity(a_ChunkDesc.GetBiome(x, z));
|
||||||
|
|
||||||
|
// Choose if we want to place long grass here. If not then bail out:
|
||||||
|
if ((m_Noise.IntNoise2DInt(xx + m_Noise.IntNoise1DInt(xx), zz + m_Noise.IntNoise1DInt(zz)) / 7 % 100) > BiomeDensity)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the top block + 1. This is the place where the grass would finaly be placed:
|
||||||
|
int y = a_ChunkDesc.GetHeight(x, z) + 1;
|
||||||
|
|
||||||
|
// Check if long grass can be placed:
|
||||||
|
if (
|
||||||
|
(a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) ||
|
||||||
|
((a_ChunkDesc.GetBlockType(x, y - 1, z) != E_BLOCK_GRASS) && (a_ChunkDesc.GetBlockType(x, y - 1, z) != E_BLOCK_DIRT))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Choose what long grass meta we should use:
|
||||||
|
int GrassType = m_Noise.IntNoise2DInt(xx * 50, zz * 50) / 7 % 100;
|
||||||
|
if (GrassType < 60)
|
||||||
|
{
|
||||||
|
a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 1);
|
||||||
|
}
|
||||||
|
else if (GrassType < 90)
|
||||||
|
{
|
||||||
|
a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If double long grass we have to choose what type we should use:
|
||||||
|
if (a_ChunkDesc.GetBlockType(x, y + 1, z) == E_BLOCK_AIR)
|
||||||
|
{
|
||||||
|
NIBBLETYPE Meta = (m_Noise.IntNoise2DInt(xx * 100, zz * 100) / 7 % 100) > 25 ? 2 : 3;
|
||||||
|
a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_BIG_FLOWER, Meta);
|
||||||
|
a_ChunkDesc.SetBlockTypeMeta(x, y + 1, z, E_BLOCK_BIG_FLOWER, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// cFinishGenSprinkleFoliage:
|
// cFinishGenSprinkleFoliage:
|
||||||
|
|
||||||
@ -239,14 +298,14 @@ void cFinishGenSprinkleFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const float xx = (float)BlockX;
|
const float xx = (float)BlockX;
|
||||||
float val1 = m_Noise.CubicNoise2D(xx * 0.1f, zz * 0.1f );
|
float val1 = m_Noise.CubicNoise2D(xx * 0.1f, zz * 0.1f);
|
||||||
float val2 = m_Noise.CubicNoise2D(xx * 0.01f, zz * 0.01f );
|
float val2 = m_Noise.CubicNoise2D(xx * 0.01f, zz * 0.01f);
|
||||||
switch (a_ChunkDesc.GetBlockType(x, Top, z))
|
switch (a_ChunkDesc.GetBlockType(x, Top, z))
|
||||||
{
|
{
|
||||||
case E_BLOCK_GRASS:
|
case E_BLOCK_GRASS:
|
||||||
{
|
{
|
||||||
float val3 = m_Noise.CubicNoise2D(xx * 0.01f + 10, zz * 0.01f + 10 );
|
float val3 = m_Noise.CubicNoise2D(xx * 0.01f + 10, zz * 0.01f + 10);
|
||||||
float val4 = m_Noise.CubicNoise2D(xx * 0.05f + 20, zz * 0.05f + 20 );
|
float val4 = m_Noise.CubicNoise2D(xx * 0.05f + 20, zz * 0.05f + 20);
|
||||||
if (val1 + val2 > 0.2f)
|
if (val1 + val2 > 0.2f)
|
||||||
{
|
{
|
||||||
a_ChunkDesc.SetBlockType(x, ++Top, z, E_BLOCK_YELLOW_FLOWER);
|
a_ChunkDesc.SetBlockType(x, ++Top, z, E_BLOCK_YELLOW_FLOWER);
|
||||||
|
@ -69,6 +69,43 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class cFinishGenTallGrass :
|
||||||
|
public cFinishGen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cFinishGenTallGrass(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
cNoise m_Noise;
|
||||||
|
int m_Seed;
|
||||||
|
|
||||||
|
// cFinishGen override:
|
||||||
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
|
|
||||||
|
int GetBiomeDensity(EMCSBiome a_Biome)
|
||||||
|
{
|
||||||
|
switch (a_Biome)
|
||||||
|
{
|
||||||
|
case biSavanna:
|
||||||
|
case biSavannaM:
|
||||||
|
case biSavannaPlateau:
|
||||||
|
case biSavannaPlateauM:
|
||||||
|
case biPlains:
|
||||||
|
{
|
||||||
|
return 70;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class cFinishGenSprinkleFoliage :
|
class cFinishGenSprinkleFoliage :
|
||||||
public cFinishGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
|
@ -253,7 +253,7 @@ float cHeiGenClassic::GetNoise(float x, float y)
|
|||||||
float oct2 = m_Noise.CubicNoise2D(x * m_HeightFreq2, y * m_HeightFreq2) * m_HeightAmp2;
|
float oct2 = m_Noise.CubicNoise2D(x * m_HeightFreq2, y * m_HeightFreq2) * m_HeightAmp2;
|
||||||
float oct3 = m_Noise.CubicNoise2D(x * m_HeightFreq3, y * m_HeightFreq3) * m_HeightAmp3;
|
float oct3 = m_Noise.CubicNoise2D(x * m_HeightFreq3, y * m_HeightFreq3) * m_HeightAmp3;
|
||||||
|
|
||||||
float height = m_Noise.CubicNoise2D(x * 0.1f, y * 0.1f ) * 2;
|
float height = m_Noise.CubicNoise2D(x * 0.1f, y * 0.1f) * 2;
|
||||||
|
|
||||||
float flatness = ((m_Noise.CubicNoise2D(x * 0.5f, y * 0.5f) + 1.f) * 0.5f) * 1.1f; // 0 ... 1.5
|
float flatness = ((m_Noise.CubicNoise2D(x * 0.5f, y * 0.5f) + 1.f) * 0.5f) * 1.1f; // 0 ... 1.5
|
||||||
flatness *= flatness * flatness;
|
flatness *= flatness * flatness;
|
||||||
|
@ -2367,9 +2367,9 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] =
|
|||||||
"a: 24: 2\n" /* sandstone */
|
"a: 24: 2\n" /* sandstone */
|
||||||
"b: 4: 0\n" /* cobblestone */
|
"b: 4: 0\n" /* cobblestone */
|
||||||
"c: 24: 0\n" /* sandstone */
|
"c: 24: 0\n" /* sandstone */
|
||||||
"d: 12: 0\n" /* sand */
|
"d: 13: 0\n" /* gravel */
|
||||||
"e: 13: 0\n" /* gravel */
|
"e: 5: 0\n" /* wood */
|
||||||
"f: 5: 0\n" /* wood */
|
"f: 12: 0\n" /* sand */
|
||||||
"g: 64: 3\n" /* wooddoorblock */
|
"g: 64: 3\n" /* wooddoorblock */
|
||||||
"h: 85: 0\n" /* fence */
|
"h: 85: 0\n" /* fence */
|
||||||
"i: 64: 0\n" /* wooddoorblock */
|
"i: 64: 0\n" /* wooddoorblock */
|
||||||
@ -2392,26 +2392,26 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] =
|
|||||||
/* * 012345678901234 */
|
/* * 012345678901234 */
|
||||||
/* 0 */ "mmmabbbammmmmmm"
|
/* 0 */ "mmmabbbammmmmmm"
|
||||||
/* 1 */ "mmmmbbbmmmmmmmm"
|
/* 1 */ "mmmmbbbmmmmmmmm"
|
||||||
/* 2 */ "acccccccccadddd"
|
/* 2 */ "acccccccccacccc"
|
||||||
/* 3 */ "cccccccccccdddd"
|
/* 3 */ "ccccccccccccccc"
|
||||||
/* 4 */ "cccccccccccdddd"
|
/* 4 */ "ccccccccccccccc"
|
||||||
/* 5 */ "cccccccccccdddd"
|
/* 5 */ "ccccccccccccccc"
|
||||||
/* 6 */ "cccccccccccdddd"
|
/* 6 */ "ccccccccccccccc"
|
||||||
/* 7 */ "cccccccccccdddd"
|
/* 7 */ "ccccccccccccccc"
|
||||||
/* 8 */ "acccccccccadddd"
|
/* 8 */ "acccccccccacccc"
|
||||||
|
|
||||||
// Level 1
|
// Level 1
|
||||||
/* z\x* 11111 */
|
/* z\x* 11111 */
|
||||||
/* * 012345678901234 */
|
/* * 012345678901234 */
|
||||||
/* 0 */ "mmmaeeeammmmmmm"
|
/* 0 */ "mmmadddammmmmmm"
|
||||||
/* 1 */ "mmmmeeemmmmmmmm"
|
/* 1 */ "mmmmdddmmmmmmmm"
|
||||||
/* 2 */ "accccfccccadddd"
|
/* 2 */ "acccceccccaffff"
|
||||||
/* 3 */ "cfffffffffcdddd"
|
/* 3 */ "ceeeeeeeeecffff"
|
||||||
/* 4 */ "cfffffffffcdddd"
|
/* 4 */ "ceeeeeeeeecffff"
|
||||||
/* 5 */ "cffffffffffdddd"
|
/* 5 */ "ceeeeeeeeeeffff"
|
||||||
/* 6 */ "cfffffffffcdddd"
|
/* 6 */ "ceeeeeeeeecffff"
|
||||||
/* 7 */ "cfffffffffcdddd"
|
/* 7 */ "ceeeeeeeeecffff"
|
||||||
/* 8 */ "acccccccccadddd"
|
/* 8 */ "acccccccccaffff"
|
||||||
|
|
||||||
// Level 2
|
// Level 2
|
||||||
/* z\x* 11111 */
|
/* z\x* 11111 */
|
||||||
|
@ -134,11 +134,11 @@ const cPrefab::sDef g_JapaneseVillagePrefabs[] =
|
|||||||
// The data has been exported from the gallery Plains, area index 166, ID 554, created by Aloe_vera
|
// The data has been exported from the gallery Plains, area index 166, ID 554, created by Aloe_vera
|
||||||
{
|
{
|
||||||
// Size:
|
// Size:
|
||||||
11, 7, 13, // SizeX = 11, SizeY = 7, SizeZ = 13
|
11, 8, 13, // SizeX = 11, SizeY = 8, SizeZ = 13
|
||||||
|
|
||||||
// Hitbox (relative to bounding box):
|
// Hitbox (relative to bounding box):
|
||||||
0, 0, 0, // MinX, MinY, MinZ
|
0, 0, 0, // MinX, MinY, MinZ
|
||||||
10, 6, 12, // MaxX, MaxY, MaxZ
|
10, 7, 12, // MaxX, MaxY, MaxZ
|
||||||
|
|
||||||
// Block definitions:
|
// Block definitions:
|
||||||
".: 0: 0\n" /* air */
|
".: 0: 0\n" /* air */
|
||||||
@ -150,6 +150,7 @@ const cPrefab::sDef g_JapaneseVillagePrefabs[] =
|
|||||||
"f: 59: 7\n" /* crops */
|
"f: 59: 7\n" /* crops */
|
||||||
"g: 83: 0\n" /* reedblock */
|
"g: 83: 0\n" /* reedblock */
|
||||||
"h:113: 0\n" /* netherbrickfence */
|
"h:113: 0\n" /* netherbrickfence */
|
||||||
|
"i: 50: 5\n" /* torch */
|
||||||
"m: 19: 0\n" /* sponge */,
|
"m: 19: 0\n" /* sponge */,
|
||||||
|
|
||||||
// Block data:
|
// Block data:
|
||||||
@ -270,7 +271,24 @@ const cPrefab::sDef g_JapaneseVillagePrefabs[] =
|
|||||||
/* 9 */ "..........."
|
/* 9 */ "..........."
|
||||||
/* 10 */ ".h.......h."
|
/* 10 */ ".h.......h."
|
||||||
/* 11 */ "hhh.....hhh"
|
/* 11 */ "hhh.....hhh"
|
||||||
/* 12 */ ".h.......h.",
|
/* 12 */ ".h.......h."
|
||||||
|
|
||||||
|
// Level 7
|
||||||
|
/* z\x* 1 */
|
||||||
|
/* * 01234567890 */
|
||||||
|
/* 0 */ ".i.......i."
|
||||||
|
/* 1 */ "i.i.....i.i"
|
||||||
|
/* 2 */ ".i.......i."
|
||||||
|
/* 3 */ "..........."
|
||||||
|
/* 4 */ "..........."
|
||||||
|
/* 5 */ "..........."
|
||||||
|
/* 6 */ "..........."
|
||||||
|
/* 7 */ "..........."
|
||||||
|
/* 8 */ "..........."
|
||||||
|
/* 9 */ "..........."
|
||||||
|
/* 10 */ ".i.......i."
|
||||||
|
/* 11 */ "i.i.....i.i"
|
||||||
|
/* 12 */ ".i.......i.",
|
||||||
|
|
||||||
// Connectors:
|
// Connectors:
|
||||||
"-1: 10, 2, 6: 5\n" /* Type -1, direction X+ */,
|
"-1: 10, 2, 6: 5\n" /* Type -1, direction X+ */,
|
||||||
@ -2195,33 +2213,33 @@ const cPrefab::sDef g_JapaneseVillagePrefabs[] =
|
|||||||
|
|
||||||
// Level 1
|
// Level 1
|
||||||
/* z\x* 0123456 */
|
/* z\x* 0123456 */
|
||||||
/* 0 */ "bmmmmmm"
|
/* 0 */ "bbbbbbb"
|
||||||
/* 1 */ "bmmmmmm"
|
/* 1 */ "bbbbbbb"
|
||||||
/* 2 */ "bmmmmmm"
|
/* 2 */ "bbbbbbb"
|
||||||
/* 3 */ "bmmmmmm"
|
/* 3 */ "bbbabbb"
|
||||||
/* 4 */ "bmmmmmm"
|
/* 4 */ "bbbbbbb"
|
||||||
/* 5 */ "bmmmmmm"
|
/* 5 */ "bbbbbbb"
|
||||||
/* 6 */ "bbbbbbb"
|
/* 6 */ "bbbbbbb"
|
||||||
|
|
||||||
// Level 2
|
// Level 2
|
||||||
/* z\x* 0123456 */
|
/* z\x* 0123456 */
|
||||||
/* 0 */ "......."
|
/* 0 */ "mm...mm"
|
||||||
/* 1 */ "..c.c.."
|
/* 1 */ "m.c...m"
|
||||||
/* 2 */ ".dccdc."
|
/* 2 */ ".dccdc."
|
||||||
/* 3 */ "..cefc."
|
/* 3 */ "..cefc."
|
||||||
/* 4 */ ".ccfgh."
|
/* 4 */ ".ccfgh."
|
||||||
/* 5 */ "..ccc.."
|
/* 5 */ "m.ccc.m"
|
||||||
/* 6 */ "......."
|
/* 6 */ "mm...mm"
|
||||||
|
|
||||||
// Level 3
|
// Level 3
|
||||||
/* z\x* 0123456 */
|
/* z\x* 0123456 */
|
||||||
/* 0 */ "......."
|
/* 0 */ "m.....m"
|
||||||
/* 1 */ "......."
|
/* 1 */ "......."
|
||||||
/* 2 */ "......."
|
/* 2 */ "......."
|
||||||
/* 3 */ "...e..."
|
/* 3 */ "...e..."
|
||||||
/* 4 */ "......."
|
/* 4 */ "......."
|
||||||
/* 5 */ "......."
|
/* 5 */ "......."
|
||||||
/* 6 */ "......."
|
/* 6 */ "m.....m"
|
||||||
|
|
||||||
// Level 4
|
// Level 4
|
||||||
/* z\x* 0123456 */
|
/* z\x* 0123456 */
|
||||||
|
@ -356,8 +356,8 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
"e: 8: 0\n" /* water */
|
"e: 8: 0\n" /* water */
|
||||||
"f: 50: 5\n" /* torch */
|
"f: 50: 5\n" /* torch */
|
||||||
"g: 59: 7\n" /* crops */
|
"g: 59: 7\n" /* crops */
|
||||||
"h: 59: 0\n" /* crops */
|
"h: 59: 3\n" /* crops */
|
||||||
"i: 59: 1\n" /* crops */
|
"i: 59: 5\n" /* crops */
|
||||||
"m: 19: 0\n" /* sponge */,
|
"m: 19: 0\n" /* sponge */,
|
||||||
|
|
||||||
// Block data:
|
// Block data:
|
||||||
@ -368,7 +368,7 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 1 */ "aaaaaaaaaaaaaaa"
|
/* 1 */ "aaaaaaaaaaaaaaa"
|
||||||
/* 2 */ "aaaaaaaaaaaaaaa"
|
/* 2 */ "aaaaaaaaaaaaaaa"
|
||||||
/* 3 */ "aaaaaaaaaaaaaaa"
|
/* 3 */ "aaaaaaaaaaaaaaa"
|
||||||
/* 4 */ "aaaaaaaaaaaaaaa"
|
/* 4 */ "aaaaaaabaaaaaaa"
|
||||||
/* 5 */ "aaaaaaabaaaaaaa"
|
/* 5 */ "aaaaaaabaaaaaaa"
|
||||||
/* 6 */ "aaaaaaabaaaaaaa"
|
/* 6 */ "aaaaaaabaaaaaaa"
|
||||||
/* 7 */ "aaaaaaabaaaaaaa"
|
/* 7 */ "aaaaaaabaaaaaaa"
|
||||||
@ -405,12 +405,12 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* * 012345678901234 */
|
/* * 012345678901234 */
|
||||||
/* 0 */ "f.....f.f.....f"
|
/* 0 */ "f.....f.f.....f"
|
||||||
/* 1 */ ".gg.gg...gg.gg."
|
/* 1 */ ".gg.gg...gg.gg."
|
||||||
/* 2 */ ".gh.hg...gg.gg."
|
/* 2 */ ".gg.hg...gg.gg."
|
||||||
/* 3 */ ".gh.ih...gg.gg."
|
/* 3 */ ".gg.gi...gg.gg."
|
||||||
/* 4 */ ".gg.hg...gg.gg."
|
/* 4 */ ".gg.gg...gg.gg."
|
||||||
/* 5 */ ".gg.hg...gg.gg."
|
/* 5 */ ".gg.gg...gg.gg."
|
||||||
/* 6 */ ".ig.hg...gg.gg."
|
/* 6 */ ".gg.gg...gg.gg."
|
||||||
/* 7 */ ".hg.gh...gg.gg."
|
/* 7 */ ".gg.gg...gg.gg."
|
||||||
/* 8 */ "f.....f.f.....f"
|
/* 8 */ "f.....f.f.....f"
|
||||||
|
|
||||||
// Level 4
|
// Level 4
|
||||||
@ -3603,8 +3603,8 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
|
|
||||||
// Block definitions:
|
// Block definitions:
|
||||||
".: 0: 0\n" /* air */
|
".: 0: 0\n" /* air */
|
||||||
"a: 2: 0\n" /* grass */
|
"a: 3: 0\n" /* dirt */
|
||||||
"b: 3: 0\n" /* dirt */
|
"b: 2: 0\n" /* grass */
|
||||||
"c: 4: 0\n" /* cobblestone */
|
"c: 4: 0\n" /* cobblestone */
|
||||||
"d: 67: 0\n" /* stairs */
|
"d: 67: 0\n" /* stairs */
|
||||||
"e: 67: 2\n" /* stairs */
|
"e: 67: 2\n" /* stairs */
|
||||||
@ -3629,19 +3629,19 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
// Level 0
|
// Level 0
|
||||||
/* z\x* 1 */
|
/* z\x* 1 */
|
||||||
/* * 01234567890 */
|
/* * 01234567890 */
|
||||||
/* 0 */ "aaaabbbaaaa"
|
/* 0 */ "aaaaaaaaaaa"
|
||||||
/* 1 */ "abbbbbbbbba"
|
/* 1 */ "aaaaaaaaaaa"
|
||||||
/* 2 */ "abbbbbbbbba"
|
/* 2 */ "aaaaaaaaaaa"
|
||||||
/* 3 */ "abbbbbbbbba"
|
/* 3 */ "aaaaaaaaaaa"
|
||||||
/* 4 */ "abbbbbbbbba"
|
/* 4 */ "aaaaaaaaaab"
|
||||||
/* 5 */ "abbbbbbbbba"
|
/* 5 */ "baaaaaaaaab"
|
||||||
/* 6 */ "abbbbbbbbba"
|
/* 6 */ "aaaaaaaaaaa"
|
||||||
/* 7 */ "abbbbbbbbba"
|
/* 7 */ "baaaaaaaaaa"
|
||||||
/* 8 */ "aabbbbbbbaa"
|
/* 8 */ "baaaaaaaaaa"
|
||||||
/* 9 */ "aabbbbbbbaa"
|
/* 9 */ "baaaaaaaaab"
|
||||||
/* 10 */ "aabbbbbbbaa"
|
/* 10 */ "aaaaaaaaaaa"
|
||||||
/* 11 */ "aabbbbbbbaa"
|
/* 11 */ "aaaaaaaaaba"
|
||||||
/* 12 */ "aabbbbbbbaa"
|
/* 12 */ "aaaaaaaaaba"
|
||||||
|
|
||||||
// Level 1
|
// Level 1
|
||||||
/* z\x* 1 */
|
/* z\x* 1 */
|
||||||
@ -3654,11 +3654,11 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 5 */ "mcccccccccm"
|
/* 5 */ "mcccccccccm"
|
||||||
/* 6 */ "mcccccccccm"
|
/* 6 */ "mcccccccccm"
|
||||||
/* 7 */ "mcccccccccm"
|
/* 7 */ "mcccccccccm"
|
||||||
/* 8 */ "mmbbbbbbbmm"
|
/* 8 */ "mmaaaaaaamm"
|
||||||
/* 9 */ "mmbbbbbbbmm"
|
/* 9 */ "mmaaaaaaamm"
|
||||||
/* 10 */ "mmbbbbbbbmm"
|
/* 10 */ "mmaaaaaaamm"
|
||||||
/* 11 */ "mmbbbbbbbmm"
|
/* 11 */ "mmaaaaaaamm"
|
||||||
/* 12 */ "mmbbbbbbbmm"
|
/* 12 */ "mmaaaaaaamm"
|
||||||
|
|
||||||
// Level 2
|
// Level 2
|
||||||
/* z\x* 1 */
|
/* z\x* 1 */
|
||||||
@ -3671,11 +3671,11 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 5 */ ".cggggcccc."
|
/* 5 */ ".cggggcccc."
|
||||||
/* 6 */ ".cggggcccc."
|
/* 6 */ ".cggggcccc."
|
||||||
/* 7 */ ".ccccccccc."
|
/* 7 */ ".ccccccccc."
|
||||||
/* 8 */ "..aaaaaaa.."
|
/* 8 */ "..bbbbbbb.."
|
||||||
/* 9 */ "..aaaaaaa.."
|
/* 9 */ "mmbbbbbbbmm"
|
||||||
/* 10 */ "..aaaaaaa.."
|
/* 10 */ "mmbbbbbbbmm"
|
||||||
/* 11 */ "..aaaaaaa.."
|
/* 11 */ "mmbbbbbbbmm"
|
||||||
/* 12 */ "..aaaaaaa.."
|
/* 12 */ "mmbbbbbbbmm"
|
||||||
|
|
||||||
// Level 3
|
// Level 3
|
||||||
/* z\x* 1 */
|
/* z\x* 1 */
|
||||||
@ -3689,10 +3689,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 6 */ ".i.......i."
|
/* 6 */ ".i.......i."
|
||||||
/* 7 */ ".hiiijiiih."
|
/* 7 */ ".hiiijiiih."
|
||||||
/* 8 */ "..l.....l.."
|
/* 8 */ "..l.....l.."
|
||||||
/* 9 */ "..l.....l.."
|
/* 9 */ "mml.....lmm"
|
||||||
/* 10 */ "..l.....l.."
|
/* 10 */ "mml.....lmm"
|
||||||
/* 11 */ "..l.....l.."
|
/* 11 */ "mml.....lmm"
|
||||||
/* 12 */ "..lllllll.."
|
/* 12 */ "mmlllllllmm"
|
||||||
|
|
||||||
// Level 4
|
// Level 4
|
||||||
/* z\x* 1 */
|
/* z\x* 1 */
|
||||||
@ -3706,10 +3706,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 6 */ ".o.......o."
|
/* 6 */ ".o.......o."
|
||||||
/* 7 */ ".hooipiooh."
|
/* 7 */ ".hooipiooh."
|
||||||
/* 8 */ "..........."
|
/* 8 */ "..........."
|
||||||
/* 9 */ "..........."
|
/* 9 */ "mm.......mm"
|
||||||
/* 10 */ "..........."
|
/* 10 */ "mm.......mm"
|
||||||
/* 11 */ "..........."
|
/* 11 */ "mm.......mm"
|
||||||
/* 12 */ "..........."
|
/* 12 */ "mm.......mm"
|
||||||
|
|
||||||
// Level 5
|
// Level 5
|
||||||
/* z\x* 1 */
|
/* z\x* 1 */
|
||||||
@ -3723,10 +3723,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 6 */ ".i.......i."
|
/* 6 */ ".i.......i."
|
||||||
/* 7 */ "uiiiiiiiiiu"
|
/* 7 */ "uiiiiiiiiiu"
|
||||||
/* 8 */ "kkkkkkkkkkk"
|
/* 8 */ "kkkkkkkkkkk"
|
||||||
/* 9 */ "..........."
|
/* 9 */ "mm.......mm"
|
||||||
/* 10 */ "..........."
|
/* 10 */ "mm.......mm"
|
||||||
/* 11 */ "..........."
|
/* 11 */ "mm.......mm"
|
||||||
/* 12 */ "..........."
|
/* 12 */ "mm.......mm"
|
||||||
|
|
||||||
// Level 6
|
// Level 6
|
||||||
/* z\x* 1 */
|
/* z\x* 1 */
|
||||||
@ -3740,10 +3740,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 6 */ "uiiiiiiiiiu"
|
/* 6 */ "uiiiiiiiiiu"
|
||||||
/* 7 */ "kkkkkkkkkkk"
|
/* 7 */ "kkkkkkkkkkk"
|
||||||
/* 8 */ "..........."
|
/* 8 */ "..........."
|
||||||
/* 9 */ "..........."
|
/* 9 */ "mm.......mm"
|
||||||
/* 10 */ "..........."
|
/* 10 */ "mm.......mm"
|
||||||
/* 11 */ "..........."
|
/* 11 */ "mm.......mm"
|
||||||
/* 12 */ "..........."
|
/* 12 */ "mm.......mm"
|
||||||
|
|
||||||
// Level 7
|
// Level 7
|
||||||
/* z\x* 1 */
|
/* z\x* 1 */
|
||||||
@ -3757,10 +3757,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 6 */ "kkkkkkkkkkk"
|
/* 6 */ "kkkkkkkkkkk"
|
||||||
/* 7 */ "..........."
|
/* 7 */ "..........."
|
||||||
/* 8 */ "..........."
|
/* 8 */ "..........."
|
||||||
/* 9 */ "..........."
|
/* 9 */ "mm.......mm"
|
||||||
/* 10 */ "..........."
|
/* 10 */ "mm.......mm"
|
||||||
/* 11 */ "..........."
|
/* 11 */ "mm.......mm"
|
||||||
/* 12 */ "..........."
|
/* 12 */ "mm.......mm"
|
||||||
|
|
||||||
// Level 8
|
// Level 8
|
||||||
/* z\x* 1 */
|
/* z\x* 1 */
|
||||||
@ -3774,10 +3774,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 6 */ "..........."
|
/* 6 */ "..........."
|
||||||
/* 7 */ "..........."
|
/* 7 */ "..........."
|
||||||
/* 8 */ "..........."
|
/* 8 */ "..........."
|
||||||
/* 9 */ "..........."
|
/* 9 */ "mm.......mm"
|
||||||
/* 10 */ "..........."
|
/* 10 */ "mm.......mm"
|
||||||
/* 11 */ "..........."
|
/* 11 */ "mm.......mm"
|
||||||
/* 12 */ "...........",
|
/* 12 */ "mm.......mm",
|
||||||
|
|
||||||
// Connectors:
|
// Connectors:
|
||||||
"-1: 5, 2, 0: 2\n" /* Type -1, direction Z- */,
|
"-1: 5, 2, 0: 2\n" /* Type -1, direction Z- */,
|
||||||
@ -4237,30 +4237,29 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
// Block definitions:
|
// Block definitions:
|
||||||
".: 0: 0\n" /* air */
|
".: 0: 0\n" /* air */
|
||||||
"a: 4: 0\n" /* cobblestone */
|
"a: 4: 0\n" /* cobblestone */
|
||||||
"b: 2: 0\n" /* grass */
|
"b: 67: 0\n" /* stairs */
|
||||||
"c: 67: 0\n" /* stairs */
|
"c: 67: 2\n" /* stairs */
|
||||||
"d: 67: 2\n" /* stairs */
|
"d: 67: 1\n" /* stairs */
|
||||||
"e: 67: 1\n" /* stairs */
|
"e: 5: 0\n" /* wood */
|
||||||
"f: 5: 0\n" /* wood */
|
"f: 67: 3\n" /* stairs */
|
||||||
"g: 67: 3\n" /* stairs */
|
"g: 17: 0\n" /* tree */
|
||||||
"h: 17: 0\n" /* tree */
|
"h: 64: 7\n" /* wooddoorblock */
|
||||||
"i: 64: 7\n" /* wooddoorblock */
|
"i: 64: 5\n" /* wooddoorblock */
|
||||||
"j: 64: 5\n" /* wooddoorblock */
|
"j:102: 0\n" /* glasspane */
|
||||||
"k:102: 0\n" /* glasspane */
|
"k: 64:12\n" /* wooddoorblock */
|
||||||
"l: 64:12\n" /* wooddoorblock */
|
"l: 53: 2\n" /* woodstairs */
|
||||||
"m: 19: 0\n" /* sponge */
|
"m: 19: 0\n" /* sponge */
|
||||||
"n: 53: 2\n" /* woodstairs */
|
"n: 53: 1\n" /* woodstairs */
|
||||||
"o: 53: 1\n" /* woodstairs */
|
"o: 53: 7\n" /* woodstairs */
|
||||||
"p: 53: 7\n" /* woodstairs */
|
"p: 53: 6\n" /* woodstairs */
|
||||||
"q: 53: 6\n" /* woodstairs */
|
"q: 53: 3\n" /* woodstairs */
|
||||||
"r: 53: 3\n" /* woodstairs */
|
"r: 53: 0\n" /* woodstairs */
|
||||||
"s: 53: 0\n" /* woodstairs */
|
"s: 53: 5\n" /* woodstairs */
|
||||||
"t: 53: 5\n" /* woodstairs */
|
"t: 53: 4\n" /* woodstairs */
|
||||||
"u: 53: 4\n" /* woodstairs */
|
"u: 50: 3\n" /* torch */
|
||||||
"v: 50: 3\n" /* torch */
|
"v: 50: 2\n" /* torch */
|
||||||
"w: 50: 2\n" /* torch */
|
"w: 50: 4\n" /* torch */
|
||||||
"x: 50: 4\n" /* torch */
|
"x: 50: 1\n" /* torch */,
|
||||||
"y: 50: 1\n" /* torch */,
|
|
||||||
|
|
||||||
// Block data:
|
// Block data:
|
||||||
// Level 0
|
// Level 0
|
||||||
@ -4274,134 +4273,134 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 5 */ "maaaaaaaaaaaaaam"
|
/* 5 */ "maaaaaaaaaaaaaam"
|
||||||
/* 6 */ "maaaaaaaaaaaaaam"
|
/* 6 */ "maaaaaaaaaaaaaam"
|
||||||
/* 7 */ "maaaaaaaaaaaaaam"
|
/* 7 */ "maaaaaaaaaaaaaam"
|
||||||
/* 8 */ "bbbbbaaaaaaaaaam"
|
/* 8 */ "mmmmmaaaaaaaaaam"
|
||||||
/* 9 */ "bbbbbbbbaaaaaaam"
|
/* 9 */ "mmmmmmmmaaaaaaam"
|
||||||
/* 10 */ "bbbbbbbbaaaaaaam"
|
/* 10 */ "mmmmmmmmaaaaaaam"
|
||||||
/* 11 */ "bbbbbbbbaaaaaaam"
|
/* 11 */ "mmmmmmmmaaaaaaam"
|
||||||
/* 12 */ "bbbbbbbbaaaaaaam"
|
/* 12 */ "mmmmmmmmaaaaaaam"
|
||||||
/* 13 */ "bbbbbbbbaaaaaaam"
|
/* 13 */ "mmmmmmmmaaaaaaam"
|
||||||
/* 14 */ "bbbbbbbbaaaaaaam"
|
/* 14 */ "mmmmmmmmaaaaaaam"
|
||||||
/* 15 */ "bbbbbbbbmmmmmmmm"
|
/* 15 */ "mmmmmmmmmmmmmmmm"
|
||||||
|
|
||||||
// Level 1
|
// Level 1
|
||||||
/* z\x* 111111 */
|
/* z\x* 111111 */
|
||||||
/* * 0123456789012345 */
|
/* * 0123456789012345 */
|
||||||
/* 0 */ "........cde....."
|
/* 0 */ "........bcd....."
|
||||||
/* 1 */ ".aaaaaaaaaaaaaa."
|
/* 1 */ ".aaaaaaaaaaaaaa."
|
||||||
/* 2 */ ".affffffffffffa."
|
/* 2 */ ".aeeeeeeeeeeeea."
|
||||||
/* 3 */ ".affffffffffffa."
|
/* 3 */ ".aeeeeeeeeeeeea."
|
||||||
/* 4 */ ".affffffffffffa."
|
/* 4 */ ".aeeeeeeeeeeeea."
|
||||||
/* 5 */ ".affffffffffffa."
|
/* 5 */ ".aeeeeeeeeeeeea."
|
||||||
/* 6 */ ".affffffffffffa."
|
/* 6 */ ".aeeeeeeeeeeeea."
|
||||||
/* 7 */ ".aaaaaaaafffffa."
|
/* 7 */ ".aaaaaaaaeeeeea."
|
||||||
/* 8 */ ".....cgeafffffa."
|
/* 8 */ ".....bfdaeeeeea."
|
||||||
/* 9 */ "........afffffa."
|
/* 9 */ "mmmm....aeeeeea."
|
||||||
/* 10 */ "........afffffa."
|
/* 10 */ "mmmmmmm.aeeeeea."
|
||||||
/* 11 */ "........afffffa."
|
/* 11 */ "mmmmmmm.aeeeeea."
|
||||||
/* 12 */ "........afffffa."
|
/* 12 */ "mmmmmmm.aeeeeea."
|
||||||
/* 13 */ "........afffffa."
|
/* 13 */ "mmmmmmm.aeeeeea."
|
||||||
/* 14 */ "........aaaaaaa."
|
/* 14 */ "mmmmmmm.aaaaaaa."
|
||||||
/* 15 */ "................"
|
/* 15 */ "mmmmmmm........."
|
||||||
|
|
||||||
// Level 2
|
// Level 2
|
||||||
/* z\x* 111111 */
|
/* z\x* 111111 */
|
||||||
/* * 0123456789012345 */
|
/* * 0123456789012345 */
|
||||||
/* 0 */ "................"
|
/* 0 */ "................"
|
||||||
/* 1 */ ".hffffffhihfffh."
|
/* 1 */ ".geeeeeeghgeeeg."
|
||||||
/* 2 */ ".f............f."
|
/* 2 */ ".e............e."
|
||||||
/* 3 */ ".f............f."
|
/* 3 */ ".e............e."
|
||||||
/* 4 */ ".f............f."
|
/* 4 */ ".e............e."
|
||||||
/* 5 */ ".f............f."
|
/* 5 */ ".e............e."
|
||||||
/* 6 */ ".f............f."
|
/* 6 */ ".e............e."
|
||||||
/* 7 */ ".hffffjfh.....f."
|
/* 7 */ ".geeeeieg.....e."
|
||||||
/* 8 */ "........f.....f."
|
/* 8 */ "........e.....e."
|
||||||
/* 9 */ "........f.....f."
|
/* 9 */ "mmmm....e.....e."
|
||||||
/* 10 */ "........f.....f."
|
/* 10 */ "mmmmmmm.e.....e."
|
||||||
/* 11 */ "........f.....f."
|
/* 11 */ "mmmmmmm.e.....e."
|
||||||
/* 12 */ "........f.....f."
|
/* 12 */ "mmmmmmm.e.....e."
|
||||||
/* 13 */ "........f.....f."
|
/* 13 */ "mmmmmmm.e.....e."
|
||||||
/* 14 */ "........hfffffh."
|
/* 14 */ "mmmmmmm.geeeeeg."
|
||||||
/* 15 */ "................"
|
/* 15 */ "mmmmmmm........."
|
||||||
|
|
||||||
// Level 3
|
// Level 3
|
||||||
/* z\x* 111111 */
|
/* z\x* 111111 */
|
||||||
/* * 0123456789012345 */
|
/* * 0123456789012345 */
|
||||||
/* 0 */ "................"
|
/* 0 */ "................"
|
||||||
/* 1 */ ".hfkkfkkhlhkkfh."
|
/* 1 */ ".gejjejjgkgjjeg."
|
||||||
/* 2 */ ".k............f."
|
/* 2 */ ".j............e."
|
||||||
/* 3 */ ".k............k."
|
/* 3 */ ".j............j."
|
||||||
/* 4 */ ".k............k."
|
/* 4 */ ".j............j."
|
||||||
/* 5 */ ".k............f."
|
/* 5 */ ".j............e."
|
||||||
/* 6 */ ".k............k."
|
/* 6 */ ".j............j."
|
||||||
/* 7 */ ".hfkkflfh.....k."
|
/* 7 */ ".gejjekeg.....j."
|
||||||
/* 8 */ "........f.....f."
|
/* 8 */ "........e.....e."
|
||||||
/* 9 */ "........k.....k."
|
/* 9 */ "mmmm....j.....j."
|
||||||
/* 10 */ "........k.....k."
|
/* 10 */ "mmmmmmm.j.....j."
|
||||||
/* 11 */ "........f.....f."
|
/* 11 */ "mmmmmmm.e.....e."
|
||||||
/* 12 */ "........k.....k."
|
/* 12 */ "mmmmmmm.j.....j."
|
||||||
/* 13 */ "........k.....k."
|
/* 13 */ "mmmmmmm.j.....j."
|
||||||
/* 14 */ "........hkkkkkh."
|
/* 14 */ "mmmmmmm.gjjjjjg."
|
||||||
/* 15 */ "................"
|
/* 15 */ "mmmmmmm........."
|
||||||
|
|
||||||
// Level 4
|
// Level 4
|
||||||
/* z\x* 111111 */
|
/* z\x* 111111 */
|
||||||
/* * 0123456789012345 */
|
/* * 0123456789012345 */
|
||||||
/* 0 */ "nnnnnnnnnnnnnnno"
|
/* 0 */ "llllllllllllllln"
|
||||||
/* 1 */ "phffffffhfhfffho"
|
/* 1 */ "ogeeeeeegegeeegn"
|
||||||
/* 2 */ ".f............fo"
|
/* 2 */ ".e............en"
|
||||||
/* 3 */ ".f............fo"
|
/* 3 */ ".e............en"
|
||||||
/* 4 */ ".f............fo"
|
/* 4 */ ".e............en"
|
||||||
/* 5 */ ".f............fo"
|
/* 5 */ ".e............en"
|
||||||
/* 6 */ ".f............fo"
|
/* 6 */ ".e............en"
|
||||||
/* 7 */ "qhffffffh.....fo"
|
/* 7 */ "pgeeeeeeg.....en"
|
||||||
/* 8 */ "rrrrrrrsf.....fo"
|
/* 8 */ "qqqqqqqre.....en"
|
||||||
/* 9 */ ".......sf.....fo"
|
/* 9 */ "mmmm...re.....en"
|
||||||
/* 10 */ ".......sf.....fo"
|
/* 10 */ "mmmmmmmre.....en"
|
||||||
/* 11 */ ".......sf.....fo"
|
/* 11 */ "mmmmmmmre.....en"
|
||||||
/* 12 */ ".......sf.....fo"
|
/* 12 */ "mmmmmmmre.....en"
|
||||||
/* 13 */ ".......sf.....fo"
|
/* 13 */ "mmmmmmmre.....en"
|
||||||
/* 14 */ ".......shfffffho"
|
/* 14 */ "mmmmmmmrgeeeeegn"
|
||||||
/* 15 */ ".......st.....uo"
|
/* 15 */ "mmmmmmmrs.....tn"
|
||||||
|
|
||||||
// Level 5
|
// Level 5
|
||||||
/* z\x* 111111 */
|
/* z\x* 111111 */
|
||||||
/* * 0123456789012345 */
|
/* * 0123456789012345 */
|
||||||
/* 0 */ "................"
|
/* 0 */ "................"
|
||||||
/* 1 */ "nnnnnnnnnnnnnnn."
|
/* 1 */ "lllllllllllllll."
|
||||||
/* 2 */ "pfffffffffffffo."
|
/* 2 */ "oeeeeeeeeeeeeen."
|
||||||
/* 3 */ ".f.........v.fo."
|
/* 3 */ ".e.........u.en."
|
||||||
/* 4 */ ".f..........wfo."
|
/* 4 */ ".e..........ven."
|
||||||
/* 5 */ ".f......x....fo."
|
/* 5 */ ".e......w....en."
|
||||||
/* 6 */ "qfffffffff...fo."
|
/* 6 */ "peeeeeeeee...en."
|
||||||
/* 7 */ "rrrrrrrrsfy..fo."
|
/* 7 */ "qqqqqqqqrex..en."
|
||||||
/* 8 */ "........sf...fo."
|
/* 8 */ "........re...en."
|
||||||
/* 9 */ "........sf...fo."
|
/* 9 */ "mmmm....re...en."
|
||||||
/* 10 */ "........sf...fo."
|
/* 10 */ "mmmmmmm.re...en."
|
||||||
/* 11 */ "........sf...fo."
|
/* 11 */ "mmmmmmm.re...en."
|
||||||
/* 12 */ "........sf...fo."
|
/* 12 */ "mmmmmmm.re...en."
|
||||||
/* 13 */ "........sf...fo."
|
/* 13 */ "mmmmmmm.re...en."
|
||||||
/* 14 */ "........sfffffo."
|
/* 14 */ "mmmmmmm.reeeeen."
|
||||||
/* 15 */ "........st...uo."
|
/* 15 */ "mmmmmmm.rs...tn."
|
||||||
|
|
||||||
// Level 6
|
// Level 6
|
||||||
/* z\x* 111111 */
|
/* z\x* 111111 */
|
||||||
/* * 0123456789012345 */
|
/* * 0123456789012345 */
|
||||||
/* 0 */ "................"
|
/* 0 */ "................"
|
||||||
/* 1 */ "................"
|
/* 1 */ "................"
|
||||||
/* 2 */ "nnnnnnnnnnnnno.."
|
/* 2 */ "llllllllllllln.."
|
||||||
/* 3 */ "pffffffffffffo.."
|
/* 3 */ "oeeeeeeeeeeeen.."
|
||||||
/* 4 */ ".fy.........fo.."
|
/* 4 */ ".ex.........en.."
|
||||||
/* 5 */ "qffffffffff.fo.."
|
/* 5 */ "peeeeeeeeee.en.."
|
||||||
/* 6 */ "rrrrrrrrrsf.fo.."
|
/* 6 */ "qqqqqqqqqre.en.."
|
||||||
/* 7 */ ".........sf.fo.."
|
/* 7 */ ".........re.en.."
|
||||||
/* 8 */ ".........sf.fo.."
|
/* 8 */ ".........re.en.."
|
||||||
/* 9 */ ".........sf.fo.."
|
/* 9 */ "mmmm.....re.en.."
|
||||||
/* 10 */ ".........sf.fo.."
|
/* 10 */ "mmmmmmm..re.en.."
|
||||||
/* 11 */ ".........sf.fo.."
|
/* 11 */ "mmmmmmm..re.en.."
|
||||||
/* 12 */ ".........sf.fo.."
|
/* 12 */ "mmmmmmm..re.en.."
|
||||||
/* 13 */ ".........sfxfo.."
|
/* 13 */ "mmmmmmm..rewen.."
|
||||||
/* 14 */ ".........sfffo.."
|
/* 14 */ "mmmmmmm..reeen.."
|
||||||
/* 15 */ ".........st.uo.."
|
/* 15 */ "mmmmmmm..rs.tn.."
|
||||||
|
|
||||||
// Level 7
|
// Level 7
|
||||||
/* z\x* 111111 */
|
/* z\x* 111111 */
|
||||||
@ -4409,19 +4408,19 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
|||||||
/* 0 */ "................"
|
/* 0 */ "................"
|
||||||
/* 1 */ "................"
|
/* 1 */ "................"
|
||||||
/* 2 */ "................"
|
/* 2 */ "................"
|
||||||
/* 3 */ "nnnnnnnnnnnnn..."
|
/* 3 */ "lllllllllllll..."
|
||||||
/* 4 */ "ffffffffffffo..."
|
/* 4 */ "eeeeeeeeeeeen..."
|
||||||
/* 5 */ "rrrrrrrrrrsfo..."
|
/* 5 */ "qqqqqqqqqqren..."
|
||||||
/* 6 */ "..........sfo..."
|
/* 6 */ "..........ren..."
|
||||||
/* 7 */ "..........sfo..."
|
/* 7 */ "..........ren..."
|
||||||
/* 8 */ "..........sfo..."
|
/* 8 */ "..........ren..."
|
||||||
/* 9 */ "..........sfo..."
|
/* 9 */ "mmmm......ren..."
|
||||||
/* 10 */ "..........sfo..."
|
/* 10 */ "mmmmmmm...ren..."
|
||||||
/* 11 */ "..........sfo..."
|
/* 11 */ "mmmmmmm...ren..."
|
||||||
/* 12 */ "..........sfo..."
|
/* 12 */ "mmmmmmm...ren..."
|
||||||
/* 13 */ "..........sfo..."
|
/* 13 */ "mmmmmmm...ren..."
|
||||||
/* 14 */ "..........sfo..."
|
/* 14 */ "mmmmmmm...ren..."
|
||||||
/* 15 */ "..........sfo...",
|
/* 15 */ "mmmmmmm...ren...",
|
||||||
|
|
||||||
// Connectors:
|
// Connectors:
|
||||||
"-1: 9, 1, 0: 2\n" /* Type -1, direction Z- */,
|
"-1: 9, 1, 0: 2\n" /* Type -1, direction Z- */,
|
||||||
|
@ -272,12 +272,12 @@ void inline LOGERROR(const char* a_Format, ...)
|
|||||||
/// Evaluates to the number of elements in an array (compile-time!)
|
/// Evaluates to the number of elements in an array (compile-time!)
|
||||||
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
|
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
|
||||||
|
|
||||||
/// Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)" )
|
/// Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)")
|
||||||
#define KiB * 1024
|
#define KiB * 1024
|
||||||
#define MiB * 1024 * 1024
|
#define MiB * 1024 * 1024
|
||||||
|
|
||||||
/// Faster than (int)floorf((float)x / (float)div)
|
/// Faster than (int)floorf((float)x / (float)div)
|
||||||
#define FAST_FLOOR_DIV( x, div ) (((x) - (((x) < 0) ? ((div) - 1) : 0)) / (div))
|
#define FAST_FLOOR_DIV( x, div) (((x) - (((x) < 0) ? ((div) - 1) : 0)) / (div))
|
||||||
|
|
||||||
// Own version of assert() that writes failed assertions to the log for review
|
// Own version of assert() that writes failed assertions to the log for review
|
||||||
#ifdef TEST_GLOBALS
|
#ifdef TEST_GLOBALS
|
||||||
@ -309,19 +309,19 @@ void inline LOGERROR(const char* a_Format, ...)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#define ASSERT(x) do { if (!(x)) { throw cAssertFailure();} } while (0)
|
#define ASSERT(x) do { if (!(x)) { throw cAssertFailure();} } while (0)
|
||||||
#define testassert(x) do { if(!(x)) { REPORT_ERROR("Test failure: %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } } while (0)
|
#define testassert(x) do { if (!(x)) { REPORT_ERROR("Test failure: %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } } while (0)
|
||||||
#define CheckAsserts(x) do { try {x} catch (cAssertFailure) { break; } REPORT_ERROR("Test failure: assert didn't fire for %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } while (0)
|
#define CheckAsserts(x) do { try {x} catch (cAssertFailure) { break; } REPORT_ERROR("Test failure: assert didn't fire for %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } while (0)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define ASSERT( x ) ( !!(x) || ( LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__ ), assert(0), 0 ) )
|
#define ASSERT( x) ( !!(x) || ( LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__), assert(0), 0))
|
||||||
#else
|
#else
|
||||||
#define ASSERT(x) ((void)(x))
|
#define ASSERT(x) ((void)(x))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Pretty much the same as ASSERT() but stays in Release builds
|
// Pretty much the same as ASSERT() but stays in Release builds
|
||||||
#define VERIFY( x ) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__ ), exit(1), 0 ) )
|
#define VERIFY( x) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__), exit(1), 0))
|
||||||
|
|
||||||
// Same as assert but in all Self test builds
|
// Same as assert but in all Self test builds
|
||||||
#ifdef SELF_TEST
|
#ifdef SELF_TEST
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cGroup::AddCommand( const AString & a_Command )
|
void cGroup::AddCommand( const AString & a_Command)
|
||||||
{
|
{
|
||||||
m_Commands[ a_Command ] = true;
|
m_Commands[ a_Command ] = true;
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@ void cGroup::AddCommand( const AString & a_Command )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cGroup::AddPermission( const AString & a_Permission )
|
void cGroup::AddPermission( const AString & a_Permission)
|
||||||
{
|
{
|
||||||
m_Permissions[ a_Permission ] = true;
|
m_Permissions[ a_Permission ] = true;
|
||||||
}
|
}
|
||||||
@ -25,10 +25,10 @@ void cGroup::AddPermission( const AString & a_Permission )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cGroup::InheritFrom( cGroup* a_Group )
|
void cGroup::InheritFrom( cGroup* a_Group)
|
||||||
{
|
{
|
||||||
m_Inherits.remove( a_Group );
|
m_Inherits.remove( a_Group);
|
||||||
m_Inherits.push_back( a_Group );
|
m_Inherits.push_back( a_Group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
10
src/Group.h
10
src/Group.h
@ -14,12 +14,12 @@ public:
|
|||||||
~cGroup() {}
|
~cGroup() {}
|
||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
void SetName( const AString & a_Name ) { m_Name = a_Name; }
|
void SetName( const AString & a_Name) { m_Name = a_Name; }
|
||||||
const AString & GetName() const { return m_Name; }
|
const AString & GetName() const { return m_Name; }
|
||||||
void SetColor( const AString & a_Color ) { m_Color = a_Color; }
|
void SetColor( const AString & a_Color) { m_Color = a_Color; }
|
||||||
void AddCommand( const AString & a_Command );
|
void AddCommand( const AString & a_Command);
|
||||||
void AddPermission( const AString & a_Permission );
|
void AddPermission( const AString & a_Permission);
|
||||||
void InheritFrom( cGroup* a_Group );
|
void InheritFrom( cGroup* a_Group);
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
typedef std::map< AString, bool > PermissionMap;
|
typedef std::map< AString, bool > PermissionMap;
|
||||||
|
@ -27,7 +27,7 @@ struct cGroupManager::sGroupManagerState
|
|||||||
|
|
||||||
cGroupManager::~cGroupManager()
|
cGroupManager::~cGroupManager()
|
||||||
{
|
{
|
||||||
for( GroupMap::iterator itr = m_pState->Groups.begin(); itr != m_pState->Groups.end(); ++itr )
|
for (GroupMap::iterator itr = m_pState->Groups.begin(); itr != m_pState->Groups.end(); ++itr)
|
||||||
{
|
{
|
||||||
delete itr->second;
|
delete itr->second;
|
||||||
itr->second = NULL;
|
itr->second = NULL;
|
||||||
@ -43,7 +43,7 @@ cGroupManager::~cGroupManager()
|
|||||||
|
|
||||||
|
|
||||||
cGroupManager::cGroupManager()
|
cGroupManager::cGroupManager()
|
||||||
: m_pState( new sGroupManagerState )
|
: m_pState( new sGroupManagerState)
|
||||||
{
|
{
|
||||||
LOGD("-- Loading Groups --");
|
LOGD("-- Loading Groups --");
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ bool cGroupManager::LoadGroups()
|
|||||||
AString Color = IniFile.GetValue(KeyName, "Color", "-");
|
AString Color = IniFile.GetValue(KeyName, "Color", "-");
|
||||||
if ((Color != "-") && (Color.length() >= 1))
|
if ((Color != "-") && (Color.length() >= 1))
|
||||||
{
|
{
|
||||||
Group->SetColor(cChatColor::Color + Color[0]);
|
Group->SetColor(cChatColor::Delimiter + Color[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -198,20 +198,20 @@ bool cGroupManager::LoadGroups()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cGroupManager::ExistsGroup( const AString & a_Name )
|
bool cGroupManager::ExistsGroup( const AString & a_Name)
|
||||||
{
|
{
|
||||||
GroupMap::iterator itr = m_pState->Groups.find( a_Name );
|
GroupMap::iterator itr = m_pState->Groups.find( a_Name);
|
||||||
return ( itr != m_pState->Groups.end() );
|
return ( itr != m_pState->Groups.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cGroup* cGroupManager::GetGroup( const AString & a_Name )
|
cGroup* cGroupManager::GetGroup( const AString & a_Name)
|
||||||
{
|
{
|
||||||
GroupMap::iterator itr = m_pState->Groups.find( a_Name );
|
GroupMap::iterator itr = m_pState->Groups.find( a_Name);
|
||||||
if( itr != m_pState->Groups.end() )
|
if (itr != m_pState->Groups.end())
|
||||||
{
|
{
|
||||||
return itr->second;
|
return itr->second;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ void cHTTPConnection::AwaitNextRequest(void)
|
|||||||
{
|
{
|
||||||
case wcsRecvHeaders:
|
case wcsRecvHeaders:
|
||||||
{
|
{
|
||||||
// Nothing has been received yet, or a special response was given (SendStatusAndReason() or SendNeedAuth() )
|
// Nothing has been received yet, or a special response was given (SendStatusAndReason() or SendNeedAuth())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,21 +497,21 @@ int cInventory::ArmorSlotNumToEntityEquipmentID(short a_ArmorSlotNum)
|
|||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode /* = 0 */ )
|
bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode /* = 0 */)
|
||||||
{
|
{
|
||||||
// Fill already present stacks
|
// Fill already present stacks
|
||||||
if( a_Mode < 2 )
|
if (a_Mode < 2)
|
||||||
{
|
{
|
||||||
int MaxStackSize = cItemHandler::GetItemHandler(a_Item.m_ItemType)->GetMaxStackSize();
|
int MaxStackSize = cItemHandler::GetItemHandler(a_Item.m_ItemType)->GetMaxStackSize();
|
||||||
for(int i = 0; i < a_Size; i++)
|
for (int i = 0; i < a_Size; i++)
|
||||||
{
|
{
|
||||||
if( m_Slots[i + a_Offset].m_ItemType == a_Item.m_ItemType && m_Slots[i + a_Offset].m_ItemCount < MaxStackSize && m_Slots[i + a_Offset].m_ItemDamage == a_Item.m_ItemDamage )
|
if (m_Slots[i + a_Offset].m_ItemType == a_Item.m_ItemType && m_Slots[i + a_Offset].m_ItemCount < MaxStackSize && m_Slots[i + a_Offset].m_ItemDamage == a_Item.m_ItemDamage)
|
||||||
{
|
{
|
||||||
int NumFree = MaxStackSize - m_Slots[i + a_Offset].m_ItemCount;
|
int NumFree = MaxStackSize - m_Slots[i + a_Offset].m_ItemCount;
|
||||||
if( NumFree >= a_Item.m_ItemCount )
|
if (NumFree >= a_Item.m_ItemCount)
|
||||||
{
|
{
|
||||||
|
|
||||||
// printf("1. Adding %i items ( free: %i )\n", a_Item.m_ItemCount, NumFree );
|
// printf("1. Adding %i items ( free: %i)\n", a_Item.m_ItemCount, NumFree);
|
||||||
m_Slots[i + a_Offset].m_ItemCount += a_Item.m_ItemCount;
|
m_Slots[i + a_Offset].m_ItemCount += a_Item.m_ItemCount;
|
||||||
a_Item.m_ItemCount = 0;
|
a_Item.m_ItemCount = 0;
|
||||||
a_bChangedSlots[i + a_Offset] = true;
|
a_bChangedSlots[i + a_Offset] = true;
|
||||||
@ -519,7 +519,7 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// printf("2. Adding %i items\n", NumFree );
|
// printf("2. Adding %i items\n", NumFree);
|
||||||
m_Slots[i + a_Offset].m_ItemCount += (char)NumFree;
|
m_Slots[i + a_Offset].m_ItemCount += (char)NumFree;
|
||||||
a_Item.m_ItemCount -= (char)NumFree;
|
a_Item.m_ItemCount -= (char)NumFree;
|
||||||
a_bChangedSlots[i + a_Offset] = true;
|
a_bChangedSlots[i + a_Offset] = true;
|
||||||
@ -528,12 +528,12 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( a_Mode > 0 )
|
if (a_Mode > 0)
|
||||||
{
|
{
|
||||||
// If we got more left, find first empty slot
|
// If we got more left, find first empty slot
|
||||||
for(int i = 0; i < a_Size && a_Item.m_ItemCount > 0; i++)
|
for (int i = 0; i < a_Size && a_Item.m_ItemCount > 0; i++)
|
||||||
{
|
{
|
||||||
if( m_Slots[i + a_Offset].m_ItemType == -1 )
|
if (m_Slots[i + a_Offset].m_ItemType == -1)
|
||||||
{
|
{
|
||||||
m_Slots[i + a_Offset] = a_Item;
|
m_Slots[i + a_Offset] = a_Item;
|
||||||
a_Item.m_ItemCount = 0;
|
a_Item.m_ItemCount = 0;
|
||||||
|
@ -169,7 +169,7 @@ public:
|
|||||||
bool LoadFromJson(Json::Value & a_Value);
|
bool LoadFromJson(Json::Value & a_Value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode = 0 );
|
bool AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode = 0);
|
||||||
|
|
||||||
cItemGrid m_ArmorSlots;
|
cItemGrid m_ArmorSlots;
|
||||||
cItemGrid m_InventorySlots;
|
cItemGrid m_InventorySlots;
|
||||||
|
@ -162,11 +162,11 @@ void cItem::GetJson(Json::Value & a_OutValue) const
|
|||||||
|
|
||||||
void cItem::FromJson(const Json::Value & a_Value)
|
void cItem::FromJson(const Json::Value & a_Value)
|
||||||
{
|
{
|
||||||
m_ItemType = (ENUM_ITEM_ID)a_Value.get("ID", -1 ).asInt();
|
m_ItemType = (ENUM_ITEM_ID)a_Value.get("ID", -1).asInt();
|
||||||
if (m_ItemType > 0)
|
if (m_ItemType > 0)
|
||||||
{
|
{
|
||||||
m_ItemCount = (char)a_Value.get("Count", -1 ).asInt();
|
m_ItemCount = (char)a_Value.get("Count", -1).asInt();
|
||||||
m_ItemDamage = (short)a_Value.get("Health", -1 ).asInt();
|
m_ItemDamage = (short)a_Value.get("Health", -1).asInt();
|
||||||
m_Enchantments.Clear();
|
m_Enchantments.Clear();
|
||||||
m_Enchantments.AddFromString(a_Value.get("ench", "").asString());
|
m_Enchantments.AddFromString(a_Value.get("ench", "").asString());
|
||||||
m_CustomName = a_Value.get("Name", "").asString();
|
m_CustomName = a_Value.get("Name", "").asString();
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
virtual FoodInfo GetFoodInfo(void) override
|
virtual FoodInfo GetFoodInfo(void) override
|
||||||
{
|
{
|
||||||
switch(m_ItemType)
|
switch (m_ItemType)
|
||||||
{
|
{
|
||||||
// Please keep alpha-sorted.
|
// Please keep alpha-sorted.
|
||||||
case E_ITEM_BAKED_POTATO: return FoodInfo(6, 7.2);
|
case E_ITEM_BAKED_POTATO: return FoodInfo(6, 7.2);
|
||||||
|
@ -94,7 +94,7 @@ cItemHandler * cItemHandler::GetItemHandler(int a_ItemType)
|
|||||||
|
|
||||||
cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
|
cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
|
||||||
{
|
{
|
||||||
switch(a_ItemType)
|
switch (a_ItemType)
|
||||||
{
|
{
|
||||||
default: return new cItemHandler(a_ItemType);
|
default: return new cItemHandler(a_ItemType);
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
|
|||||||
|
|
||||||
void cItemHandler::Deinit()
|
void cItemHandler::Deinit()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 2267; i++)
|
for (int i = 0; i < 2267; i++)
|
||||||
{
|
{
|
||||||
delete m_ItemHandler[i];
|
delete m_ItemHandler[i];
|
||||||
m_ItemHandler[i] = NULL;
|
m_ItemHandler[i] = NULL;
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
|
|
||||||
char PickaxeLevel()
|
char PickaxeLevel()
|
||||||
{
|
{
|
||||||
switch(m_ItemType)
|
switch (m_ItemType)
|
||||||
{
|
{
|
||||||
case E_ITEM_WOODEN_PICKAXE: return 1;
|
case E_ITEM_WOODEN_PICKAXE: return 1;
|
||||||
case E_ITEM_GOLD_PICKAXE: return 1;
|
case E_ITEM_GOLD_PICKAXE: return 1;
|
||||||
@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
||||||
{
|
{
|
||||||
switch(a_BlockType)
|
switch (a_BlockType)
|
||||||
{
|
{
|
||||||
case E_BLOCK_OBSIDIAN:
|
case E_BLOCK_OBSIDIAN:
|
||||||
{
|
{
|
||||||
|
@ -212,6 +212,26 @@ bool cLineBlockTracer::Item(cChunk * a_Chunk)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m_CurrentY < 0) || (m_CurrentY >= cChunkDef::Height))
|
||||||
|
{
|
||||||
|
// We've gone out of the world, that's the end of this trace
|
||||||
|
double IntersectX, IntersectZ;
|
||||||
|
CalcXZIntersection(m_CurrentY, IntersectX, IntersectZ);
|
||||||
|
if (m_Callbacks->OnOutOfWorld(IntersectX, m_CurrentY, IntersectZ))
|
||||||
|
{
|
||||||
|
// The callback terminated the trace
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Callbacks->OnNoMoreHits();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the current chunk
|
||||||
|
if (a_Chunk != NULL)
|
||||||
|
{
|
||||||
|
a_Chunk = a_Chunk->GetNeighborChunk(m_CurrentX, m_CurrentZ);
|
||||||
|
}
|
||||||
|
|
||||||
if (a_Chunk->IsValid())
|
if (a_Chunk->IsValid())
|
||||||
{
|
{
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
@ -233,26 +253,6 @@ bool cLineBlockTracer::Item(cChunk * a_Chunk)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the current chunk
|
|
||||||
if (a_Chunk != NULL)
|
|
||||||
{
|
|
||||||
a_Chunk = a_Chunk->GetNeighborChunk(m_CurrentX, m_CurrentZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((m_CurrentY < 0) || (m_CurrentY >= cChunkDef::Height))
|
|
||||||
{
|
|
||||||
// We've gone out of the world, that's the end of this trace
|
|
||||||
double IntersectX, IntersectZ;
|
|
||||||
CalcXZIntersection(m_CurrentY, IntersectX, IntersectZ);
|
|
||||||
if (m_Callbacks->OnOutOfWorld(IntersectX, m_CurrentY, IntersectZ))
|
|
||||||
{
|
|
||||||
// The callback terminated the trace
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
m_Callbacks->OnNoMoreHits();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
src/Log.cpp
30
src/Log.cpp
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
cLog* cLog::s_Log = NULL;
|
cLog* cLog::s_Log = NULL;
|
||||||
|
|
||||||
cLog::cLog(const AString & a_FileName )
|
cLog::cLog(const AString & a_FileName)
|
||||||
: m_File(NULL)
|
: m_File(NULL)
|
||||||
{
|
{
|
||||||
s_Log = this;
|
s_Log = this;
|
||||||
@ -25,7 +25,7 @@ cLog::cLog(const AString & a_FileName )
|
|||||||
// create logs directory
|
// create logs directory
|
||||||
cFile::CreateFolder(FILE_IO_PREFIX + AString("logs"));
|
cFile::CreateFolder(FILE_IO_PREFIX + AString("logs"));
|
||||||
|
|
||||||
OpenLog((FILE_IO_PREFIX + AString("logs/") + a_FileName).c_str() );
|
OpenLog((FILE_IO_PREFIX + AString("logs/") + a_FileName).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ cLog * cLog::GetInstance()
|
|||||||
|
|
||||||
void cLog::CloseLog()
|
void cLog::CloseLog()
|
||||||
{
|
{
|
||||||
if( m_File )
|
if (m_File)
|
||||||
fclose (m_File);
|
fclose (m_File);
|
||||||
m_File = 0;
|
m_File = 0;
|
||||||
}
|
}
|
||||||
@ -68,13 +68,13 @@ void cLog::CloseLog()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cLog::OpenLog( const char* a_FileName )
|
void cLog::OpenLog( const char* a_FileName)
|
||||||
{
|
{
|
||||||
if(m_File) fclose (m_File);
|
if (m_File) fclose (m_File);
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
fopen_s( &m_File, a_FileName, "a+" );
|
fopen_s( &m_File, a_FileName, "a+");
|
||||||
#else
|
#else
|
||||||
m_File = fopen(a_FileName, "a+" );
|
m_File = fopen(a_FileName, "a+");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,11 +85,11 @@ void cLog::OpenLog( const char* a_FileName )
|
|||||||
void cLog::ClearLog()
|
void cLog::ClearLog()
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
if( fopen_s( &m_File, "log.txt", "w" ) == 0)
|
if (fopen_s( &m_File, "log.txt", "w") == 0)
|
||||||
fclose (m_File);
|
fclose (m_File);
|
||||||
#else
|
#else
|
||||||
m_File = fopen("log.txt", "w" );
|
m_File = fopen("log.txt", "w");
|
||||||
if( m_File )
|
if (m_File)
|
||||||
fclose (m_File);
|
fclose (m_File);
|
||||||
#endif
|
#endif
|
||||||
m_File = NULL;
|
m_File = NULL;
|
||||||
@ -105,15 +105,15 @@ void cLog::Log(const char * a_Format, va_list argList)
|
|||||||
AppendVPrintf(Message, a_Format, argList);
|
AppendVPrintf(Message, a_Format, argList);
|
||||||
|
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
time ( &rawtime );
|
time ( &rawtime);
|
||||||
|
|
||||||
struct tm* timeinfo;
|
struct tm* timeinfo;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
struct tm timeinforeal;
|
struct tm timeinforeal;
|
||||||
timeinfo = &timeinforeal;
|
timeinfo = &timeinforeal;
|
||||||
localtime_s(timeinfo, &rawtime );
|
localtime_s(timeinfo, &rawtime);
|
||||||
#else
|
#else
|
||||||
timeinfo = localtime( &rawtime );
|
timeinfo = localtime( &rawtime);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AString Line;
|
AString Line;
|
||||||
@ -131,8 +131,8 @@ void cLog::Log(const char * a_Format, va_list argList)
|
|||||||
// Print to console:
|
// Print to console:
|
||||||
#if defined(ANDROID_NDK)
|
#if defined(ANDROID_NDK)
|
||||||
// __android_log_vprint(ANDROID_LOG_ERROR, "MCServer", a_Format, argList);
|
// __android_log_vprint(ANDROID_LOG_ERROR, "MCServer", a_Format, argList);
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "MCServer", "%s", Line.c_str() );
|
__android_log_print(ANDROID_LOG_ERROR, "MCServer", "%s", Line.c_str());
|
||||||
// CallJavaFunction_Void_String(g_JavaThread, "AddToLog", Line );
|
// CallJavaFunction_Void_String(g_JavaThread, "AddToLog", Line);
|
||||||
#else
|
#else
|
||||||
printf("%s", Line.c_str());
|
printf("%s", Line.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
@ -234,7 +234,7 @@ void LOG(const char* a_Format, ...)
|
|||||||
{
|
{
|
||||||
va_list argList;
|
va_list argList;
|
||||||
va_start(argList, a_Format);
|
va_start(argList, a_Format);
|
||||||
cMCLogger::GetInstance()->Log( a_Format, argList );
|
cMCLogger::GetInstance()->Log( a_Format, argList);
|
||||||
va_end(argList);
|
va_end(argList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ void LOGINFO(const char* a_Format, ...)
|
|||||||
{
|
{
|
||||||
va_list argList;
|
va_list argList;
|
||||||
va_start(argList, a_Format);
|
va_start(argList, a_Format);
|
||||||
cMCLogger::GetInstance()->Info( a_Format, argList );
|
cMCLogger::GetInstance()->Info( a_Format, argList);
|
||||||
va_end(argList);
|
va_end(argList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ void LOGWARN(const char* a_Format, ...)
|
|||||||
{
|
{
|
||||||
va_list argList;
|
va_list argList;
|
||||||
va_start(argList, a_Format);
|
va_start(argList, a_Format);
|
||||||
cMCLogger::GetInstance()->Warn( a_Format, argList );
|
cMCLogger::GetInstance()->Warn( a_Format, argList);
|
||||||
va_end(argList);
|
va_end(argList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ void LOGERROR(const char* a_Format, ...)
|
|||||||
{
|
{
|
||||||
va_list argList;
|
va_list argList;
|
||||||
va_start(argList, a_Format);
|
va_start(argList, a_Format);
|
||||||
cMCLogger::GetInstance()->Error( a_Format, argList );
|
cMCLogger::GetInstance()->Error( a_Format, argList);
|
||||||
va_end(argList);
|
va_end(argList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ void cMobProximityCounter::CollectMob(cEntity& a_Monster, cChunk& a_Chunk, doubl
|
|||||||
|
|
||||||
void cMobProximityCounter::convertMaps()
|
void cMobProximityCounter::convertMaps()
|
||||||
{
|
{
|
||||||
for(tMonsterToDistance::const_iterator itr = m_MonsterToDistance.begin(); itr != m_MonsterToDistance.end(); ++itr)
|
for (tMonsterToDistance::const_iterator itr = m_MonsterToDistance.begin(); itr != m_MonsterToDistance.end(); ++itr)
|
||||||
{
|
{
|
||||||
m_DistanceToMonster.insert(tDistanceToMonster::value_type(itr->second.m_Distance, sMonsterAndChunk(*itr->first, *itr->second.m_Chunk)));
|
m_DistanceToMonster.insert(tDistanceToMonster::value_type(itr->second.m_Distance, sMonsterAndChunk(*itr->first, *itr->second.m_Chunk)));
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ cMobProximityCounter::sIterablePair cMobProximityCounter::getMobWithinThosesDist
|
|||||||
convertMaps();
|
convertMaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(tDistanceToMonster::const_iterator itr = m_DistanceToMonster.begin(); itr != m_DistanceToMonster.end(); ++itr)
|
for (tDistanceToMonster::const_iterator itr = m_DistanceToMonster.begin(); itr != m_DistanceToMonster.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (toReturn.m_Begin == m_DistanceToMonster.end())
|
if (toReturn.m_Begin == m_DistanceToMonster.end())
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_R
|
|||||||
|
|
||||||
SkyLight = a_Chunk->GetTimeAlteredLight(SkyLight);
|
SkyLight = a_Chunk->GetTimeAlteredLight(SkyLight);
|
||||||
|
|
||||||
switch(a_MobType)
|
switch (a_MobType)
|
||||||
{
|
{
|
||||||
case cMonster::mtSquid:
|
case cMonster::mtSquid:
|
||||||
{
|
{
|
||||||
@ -208,7 +208,7 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_R
|
|||||||
bool HasFloor = false;
|
bool HasFloor = false;
|
||||||
for (int x = 0; x < 2; ++x)
|
for (int x = 0; x < 2; ++x)
|
||||||
{
|
{
|
||||||
for(int z = 0; z < 2; ++z)
|
for (int z = 0; z < 2; ++z)
|
||||||
{
|
{
|
||||||
CanSpawn = a_Chunk->UnboundedRelGetBlockType(a_RelX + x, a_RelY, a_RelZ + z, TargetBlock);
|
CanSpawn = a_Chunk->UnboundedRelGetBlockType(a_RelX + x, a_RelY, a_RelZ + z, TargetBlock);
|
||||||
CanSpawn = CanSpawn && (TargetBlock == E_BLOCK_AIR);
|
CanSpawn = CanSpawn && (TargetBlock == E_BLOCK_AIR);
|
||||||
|
@ -281,7 +281,7 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector3f Distance = m_Destination - GetPosition();
|
Vector3f Distance = m_Destination - GetPosition();
|
||||||
if(!ReachedDestination() && !ReachedFinalDestination()) // If we haven't reached any sort of destination, move
|
if (!ReachedDestination() && !ReachedFinalDestination()) // If we haven't reached any sort of destination, move
|
||||||
{
|
{
|
||||||
Distance.y = 0;
|
Distance.y = 0;
|
||||||
Distance.Normalize();
|
Distance.Normalize();
|
||||||
|
@ -30,7 +30,7 @@ void cSnowGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer)
|
|||||||
void cSnowGolem::Tick(float a_Dt, cChunk & a_Chunk)
|
void cSnowGolem::Tick(float a_Dt, cChunk & a_Chunk)
|
||||||
{
|
{
|
||||||
super::Tick(a_Dt, a_Chunk);
|
super::Tick(a_Dt, a_Chunk);
|
||||||
if (IsBiomeNoDownfall(m_World->GetBiomeAt((int) floor(GetPosX()), (int) floor(GetPosZ())) ))
|
if (IsBiomeNoDownfall(m_World->GetBiomeAt((int) floor(GetPosX()), (int) floor(GetPosZ()))))
|
||||||
{
|
{
|
||||||
TakeDamage(*this);
|
TakeDamage(*this);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ struct cMonsterConfig::sMonsterConfigState
|
|||||||
|
|
||||||
|
|
||||||
cMonsterConfig::cMonsterConfig(void)
|
cMonsterConfig::cMonsterConfig(void)
|
||||||
: m_pState( new sMonsterConfigState )
|
: m_pState( new sMonsterConfigState)
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
@ -528,10 +528,10 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
|
|||||||
};
|
};
|
||||||
|
|
||||||
const NOISE_DATATYPE FracX = (a_X) - BaseX;
|
const NOISE_DATATYPE FracX = (a_X) - BaseX;
|
||||||
const NOISE_DATATYPE x1interp1 = CubicInterpolate( points1[0][0], points1[0][1], points1[0][2], points1[0][3], FracX );
|
const NOISE_DATATYPE x1interp1 = CubicInterpolate( points1[0][0], points1[0][1], points1[0][2], points1[0][3], FracX);
|
||||||
const NOISE_DATATYPE x1interp2 = CubicInterpolate( points1[1][0], points1[1][1], points1[1][2], points1[1][3], FracX );
|
const NOISE_DATATYPE x1interp2 = CubicInterpolate( points1[1][0], points1[1][1], points1[1][2], points1[1][3], FracX);
|
||||||
const NOISE_DATATYPE x1interp3 = CubicInterpolate( points1[2][0], points1[2][1], points1[2][2], points1[2][3], FracX );
|
const NOISE_DATATYPE x1interp3 = CubicInterpolate( points1[2][0], points1[2][1], points1[2][2], points1[2][3], FracX);
|
||||||
const NOISE_DATATYPE x1interp4 = CubicInterpolate( points1[3][0], points1[3][1], points1[3][2], points1[3][3], FracX );
|
const NOISE_DATATYPE x1interp4 = CubicInterpolate( points1[3][0], points1[3][1], points1[3][2], points1[3][3], FracX);
|
||||||
|
|
||||||
const NOISE_DATATYPE points2[4][4] =
|
const NOISE_DATATYPE points2[4][4] =
|
||||||
{
|
{
|
||||||
@ -541,45 +541,45 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
|
|||||||
{ IntNoise3D(BaseX - 1, BaseY + 2, BaseZ), IntNoise3D(BaseX, BaseY + 2, BaseZ), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ), },
|
{ IntNoise3D(BaseX - 1, BaseY + 2, BaseZ), IntNoise3D(BaseX, BaseY + 2, BaseZ), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ), },
|
||||||
};
|
};
|
||||||
|
|
||||||
const NOISE_DATATYPE x2interp1 = CubicInterpolate( points2[0][0], points2[0][1], points2[0][2], points2[0][3], FracX );
|
const NOISE_DATATYPE x2interp1 = CubicInterpolate( points2[0][0], points2[0][1], points2[0][2], points2[0][3], FracX);
|
||||||
const NOISE_DATATYPE x2interp2 = CubicInterpolate( points2[1][0], points2[1][1], points2[1][2], points2[1][3], FracX );
|
const NOISE_DATATYPE x2interp2 = CubicInterpolate( points2[1][0], points2[1][1], points2[1][2], points2[1][3], FracX);
|
||||||
const NOISE_DATATYPE x2interp3 = CubicInterpolate( points2[2][0], points2[2][1], points2[2][2], points2[2][3], FracX );
|
const NOISE_DATATYPE x2interp3 = CubicInterpolate( points2[2][0], points2[2][1], points2[2][2], points2[2][3], FracX);
|
||||||
const NOISE_DATATYPE x2interp4 = CubicInterpolate( points2[3][0], points2[3][1], points2[3][2], points2[3][3], FracX );
|
const NOISE_DATATYPE x2interp4 = CubicInterpolate( points2[3][0], points2[3][1], points2[3][2], points2[3][3], FracX);
|
||||||
|
|
||||||
const NOISE_DATATYPE points3[4][4] =
|
const NOISE_DATATYPE points3[4][4] =
|
||||||
{
|
{
|
||||||
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY-1, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY-1, BaseZ + 1), },
|
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+1), IntNoise3D( BaseX, BaseY-1, BaseZ+1), IntNoise3D( BaseX+1, BaseY-1, BaseZ+1), IntNoise3D( BaseX+2, BaseY-1, BaseZ + 1), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY, BaseZ+1 ), IntNoise3D( BaseX, BaseY, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY, BaseZ + 1), },
|
{ IntNoise3D( BaseX-1, BaseY, BaseZ+1), IntNoise3D( BaseX, BaseY, BaseZ+1), IntNoise3D( BaseX+1, BaseY, BaseZ+1), IntNoise3D( BaseX+2, BaseY, BaseZ + 1), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY+1, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY+1, BaseZ + 1), },
|
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+1), IntNoise3D( BaseX, BaseY+1, BaseZ+1), IntNoise3D( BaseX+1, BaseY+1, BaseZ+1), IntNoise3D( BaseX+2, BaseY+1, BaseZ + 1), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX+1, BaseY+2, BaseZ+1 ), IntNoise3D( BaseX+2, BaseY+2, BaseZ + 1), },
|
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+1), IntNoise3D( BaseX, BaseY+2, BaseZ+1), IntNoise3D( BaseX+1, BaseY+2, BaseZ+1), IntNoise3D( BaseX+2, BaseY+2, BaseZ + 1), },
|
||||||
};
|
};
|
||||||
|
|
||||||
const NOISE_DATATYPE x3interp1 = CubicInterpolate( points3[0][0], points3[0][1], points3[0][2], points3[0][3], FracX );
|
const NOISE_DATATYPE x3interp1 = CubicInterpolate( points3[0][0], points3[0][1], points3[0][2], points3[0][3], FracX);
|
||||||
const NOISE_DATATYPE x3interp2 = CubicInterpolate( points3[1][0], points3[1][1], points3[1][2], points3[1][3], FracX );
|
const NOISE_DATATYPE x3interp2 = CubicInterpolate( points3[1][0], points3[1][1], points3[1][2], points3[1][3], FracX);
|
||||||
const NOISE_DATATYPE x3interp3 = CubicInterpolate( points3[2][0], points3[2][1], points3[2][2], points3[2][3], FracX );
|
const NOISE_DATATYPE x3interp3 = CubicInterpolate( points3[2][0], points3[2][1], points3[2][2], points3[2][3], FracX);
|
||||||
const NOISE_DATATYPE x3interp4 = CubicInterpolate( points3[3][0], points3[3][1], points3[3][2], points3[3][3], FracX );
|
const NOISE_DATATYPE x3interp4 = CubicInterpolate( points3[3][0], points3[3][1], points3[3][2], points3[3][3], FracX);
|
||||||
|
|
||||||
const NOISE_DATATYPE points4[4][4] =
|
const NOISE_DATATYPE points4[4][4] =
|
||||||
{
|
{
|
||||||
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY-1, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY-1, BaseZ+2 ), },
|
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+2), IntNoise3D( BaseX, BaseY-1, BaseZ+2), IntNoise3D( BaseX+1, BaseY-1, BaseZ+2), IntNoise3D( BaseX+2, BaseY-1, BaseZ+2), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY, BaseZ+2 ), IntNoise3D( BaseX, BaseY, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY, BaseZ+2 ), },
|
{ IntNoise3D( BaseX-1, BaseY, BaseZ+2), IntNoise3D( BaseX, BaseY, BaseZ+2), IntNoise3D( BaseX+1, BaseY, BaseZ+2), IntNoise3D( BaseX+2, BaseY, BaseZ+2), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY+1, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY+1, BaseZ+2 ), },
|
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+2), IntNoise3D( BaseX, BaseY+1, BaseZ+2), IntNoise3D( BaseX+1, BaseY+1, BaseZ+2), IntNoise3D( BaseX+2, BaseY+1, BaseZ+2), },
|
||||||
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX+1, BaseY+2, BaseZ+2 ), IntNoise3D( BaseX+2, BaseY+2, BaseZ+2 ), },
|
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+2), IntNoise3D( BaseX, BaseY+2, BaseZ+2), IntNoise3D( BaseX+1, BaseY+2, BaseZ+2), IntNoise3D( BaseX+2, BaseY+2, BaseZ+2), },
|
||||||
};
|
};
|
||||||
|
|
||||||
const NOISE_DATATYPE x4interp1 = CubicInterpolate( points4[0][0], points4[0][1], points4[0][2], points4[0][3], FracX );
|
const NOISE_DATATYPE x4interp1 = CubicInterpolate( points4[0][0], points4[0][1], points4[0][2], points4[0][3], FracX);
|
||||||
const NOISE_DATATYPE x4interp2 = CubicInterpolate( points4[1][0], points4[1][1], points4[1][2], points4[1][3], FracX );
|
const NOISE_DATATYPE x4interp2 = CubicInterpolate( points4[1][0], points4[1][1], points4[1][2], points4[1][3], FracX);
|
||||||
const NOISE_DATATYPE x4interp3 = CubicInterpolate( points4[2][0], points4[2][1], points4[2][2], points4[2][3], FracX );
|
const NOISE_DATATYPE x4interp3 = CubicInterpolate( points4[2][0], points4[2][1], points4[2][2], points4[2][3], FracX);
|
||||||
const NOISE_DATATYPE x4interp4 = CubicInterpolate( points4[3][0], points4[3][1], points4[3][2], points4[3][3], FracX );
|
const NOISE_DATATYPE x4interp4 = CubicInterpolate( points4[3][0], points4[3][1], points4[3][2], points4[3][3], FracX);
|
||||||
|
|
||||||
const NOISE_DATATYPE FracY = (a_Y) - BaseY;
|
const NOISE_DATATYPE FracY = (a_Y) - BaseY;
|
||||||
const NOISE_DATATYPE yinterp1 = CubicInterpolate( x1interp1, x1interp2, x1interp3, x1interp4, FracY );
|
const NOISE_DATATYPE yinterp1 = CubicInterpolate( x1interp1, x1interp2, x1interp3, x1interp4, FracY);
|
||||||
const NOISE_DATATYPE yinterp2 = CubicInterpolate( x2interp1, x2interp2, x2interp3, x2interp4, FracY );
|
const NOISE_DATATYPE yinterp2 = CubicInterpolate( x2interp1, x2interp2, x2interp3, x2interp4, FracY);
|
||||||
const NOISE_DATATYPE yinterp3 = CubicInterpolate( x3interp1, x3interp2, x3interp3, x3interp4, FracY );
|
const NOISE_DATATYPE yinterp3 = CubicInterpolate( x3interp1, x3interp2, x3interp3, x3interp4, FracY);
|
||||||
const NOISE_DATATYPE yinterp4 = CubicInterpolate( x4interp1, x4interp2, x4interp3, x4interp4, FracY );
|
const NOISE_DATATYPE yinterp4 = CubicInterpolate( x4interp1, x4interp2, x4interp3, x4interp4, FracY);
|
||||||
|
|
||||||
const NOISE_DATATYPE FracZ = (a_Z) - BaseZ;
|
const NOISE_DATATYPE FracZ = (a_Z) - BaseZ;
|
||||||
return CubicInterpolate( yinterp1, yinterp2, yinterp3, yinterp4, FracZ );
|
return CubicInterpolate( yinterp1, yinterp2, yinterp3, yinterp4, FracZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "Errors.h"
|
#include "Errors.h"
|
||||||
|
|
||||||
AString GetOSErrorString( int a_ErrNo )
|
AString GetOSErrorString( int a_ErrNo)
|
||||||
{
|
{
|
||||||
char buffer[ 1024 ];
|
char buffer[ 1024 ];
|
||||||
AString Out;
|
AString Out;
|
||||||
@ -22,10 +22,10 @@ AString GetOSErrorString( int a_ErrNo )
|
|||||||
|
|
||||||
// According to http://linux.die.net/man/3/strerror_r there are two versions of strerror_r():
|
// According to http://linux.die.net/man/3/strerror_r there are two versions of strerror_r():
|
||||||
|
|
||||||
#if !defined(__APPLE__) && ( _GNU_SOURCE ) && !defined(ANDROID_NDK) // GNU version of strerror_r()
|
#if !defined(__APPLE__) && ( _GNU_SOURCE) && !defined(ANDROID_NDK) // GNU version of strerror_r()
|
||||||
|
|
||||||
char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
|
char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer));
|
||||||
if( res != NULL )
|
if (res != NULL)
|
||||||
{
|
{
|
||||||
Printf(Out, "%d: %s", a_ErrNo, res);
|
Printf(Out, "%d: %s", a_ErrNo, res);
|
||||||
return Out;
|
return Out;
|
||||||
@ -33,8 +33,8 @@ AString GetOSErrorString( int a_ErrNo )
|
|||||||
|
|
||||||
#else // XSI version of strerror_r():
|
#else // XSI version of strerror_r():
|
||||||
|
|
||||||
int res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
|
int res = strerror_r( errno, buffer, ARRAYCOUNT(buffer));
|
||||||
if( res == 0 )
|
if (res == 0)
|
||||||
{
|
{
|
||||||
Printf(Out, "%d: %s", a_ErrNo, buffer);
|
Printf(Out, "%d: %s", a_ErrNo, buffer);
|
||||||
return Out;
|
return Out;
|
||||||
|
@ -32,7 +32,7 @@ cEvent::cEvent(void)
|
|||||||
|
|
||||||
AString EventName;
|
AString EventName;
|
||||||
Printf(EventName, "cEvent%p", this);
|
Printf(EventName, "cEvent%p", this);
|
||||||
m_Event = sem_open(EventName.c_str(), O_CREAT, 777, 0 );
|
m_Event = sem_open(EventName.c_str(), O_CREAT, 777, 0);
|
||||||
if (m_Event == SEM_FAILED)
|
if (m_Event == SEM_FAILED)
|
||||||
{
|
{
|
||||||
AString error = GetOSErrorString(errno);
|
AString error = GetOSErrorString(errno);
|
||||||
@ -90,7 +90,7 @@ void cEvent::Wait(void)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
int res = sem_wait(m_Event);
|
int res = sem_wait(m_Event);
|
||||||
if (res != 0 )
|
if (res != 0)
|
||||||
{
|
{
|
||||||
AString error = GetOSErrorString(errno);
|
AString error = GetOSErrorString(errno);
|
||||||
LOGWARN("cEvent: waiting for the event failed: %i, err = %s. Continuing, but server may be unstable.", res, error.c_str());
|
LOGWARN("cEvent: waiting for the event failed: %i, err = %s. Continuing, but server may be unstable.", res, error.c_str());
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /* = 0 */ )
|
cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /* = 0 */)
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
: m_bNamed( false )
|
: m_bNamed( false)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -20,15 +20,15 @@ cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /*
|
|||||||
m_bNamed = true;
|
m_bNamed = true;
|
||||||
|
|
||||||
AString Name;
|
AString Name;
|
||||||
Printf(Name, "cSemaphore%p", this );
|
Printf(Name, "cSemaphore%p", this);
|
||||||
m_Handle = sem_open(Name.c_str(), O_CREAT, 777, a_InitialCount);
|
m_Handle = sem_open(Name.c_str(), O_CREAT, 777, a_InitialCount);
|
||||||
if( m_Handle == SEM_FAILED )
|
if (m_Handle == SEM_FAILED)
|
||||||
{
|
{
|
||||||
LOG("ERROR: Could not create Semaphore. (%i)", errno );
|
LOG("ERROR: Could not create Semaphore. (%i)", errno);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( sem_unlink(Name.c_str()) != 0 )
|
if (sem_unlink(Name.c_str()) != 0)
|
||||||
{
|
{
|
||||||
LOG("ERROR: Could not unlink cSemaphore. (%i)", errno);
|
LOG("ERROR: Could not unlink cSemaphore. (%i)", errno);
|
||||||
}
|
}
|
||||||
@ -51,18 +51,18 @@ cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /*
|
|||||||
cSemaphore::~cSemaphore()
|
cSemaphore::~cSemaphore()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CloseHandle( m_Handle );
|
CloseHandle( m_Handle);
|
||||||
#else
|
#else
|
||||||
if( m_bNamed )
|
if (m_bNamed)
|
||||||
{
|
{
|
||||||
if( sem_close( (sem_t*)m_Handle ) != 0 )
|
if (sem_close( (sem_t*)m_Handle) != 0)
|
||||||
{
|
{
|
||||||
LOG("ERROR: Could not close cSemaphore. (%i)", errno);
|
LOG("ERROR: Could not close cSemaphore. (%i)", errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sem_destroy( (sem_t*)m_Handle );
|
sem_destroy( (sem_t*)m_Handle);
|
||||||
delete (sem_t*)m_Handle;
|
delete (sem_t*)m_Handle;
|
||||||
}
|
}
|
||||||
m_Handle = 0;
|
m_Handle = 0;
|
||||||
@ -77,7 +77,7 @@ cSemaphore::~cSemaphore()
|
|||||||
void cSemaphore::Wait()
|
void cSemaphore::Wait()
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if( sem_wait( (sem_t*)m_Handle ) != 0)
|
if (sem_wait( (sem_t*)m_Handle) != 0)
|
||||||
{
|
{
|
||||||
LOG("ERROR: Could not wait for cSemaphore. (%i)", errno);
|
LOG("ERROR: Could not wait for cSemaphore. (%i)", errno);
|
||||||
}
|
}
|
||||||
@ -93,12 +93,12 @@ void cSemaphore::Wait()
|
|||||||
void cSemaphore::Signal()
|
void cSemaphore::Signal()
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if( sem_post( (sem_t*)m_Handle ) != 0 )
|
if (sem_post( (sem_t*)m_Handle) != 0)
|
||||||
{
|
{
|
||||||
LOG("ERROR: Could not signal cSemaphore. (%i)", errno);
|
LOG("ERROR: Could not signal cSemaphore. (%i)", errno);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ReleaseSemaphore( m_Handle, 1, NULL );
|
ReleaseSemaphore( m_Handle, 1, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
class cSemaphore
|
class cSemaphore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount = 0 );
|
cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount = 0);
|
||||||
~cSemaphore();
|
~cSemaphore();
|
||||||
|
|
||||||
void Wait();
|
void Wait();
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cSleep::MilliSleep( unsigned int a_MilliSeconds )
|
void cSleep::MilliSleep( unsigned int a_MilliSeconds)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Sleep(a_MilliSeconds); // Don't tick too much
|
Sleep(a_MilliSeconds); // Don't tick too much
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
class cSleep
|
class cSleep
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void MilliSleep( unsigned int a_MilliSeconds );
|
static void MilliSleep( unsigned int a_MilliSeconds);
|
||||||
};
|
};
|
||||||
|
@ -47,13 +47,13 @@ static void SetThreadName(DWORD dwThreadID, const char * threadName)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cThread::cThread( ThreadFunc a_ThreadFunction, void* a_Param, const char* a_ThreadName /* = 0 */ )
|
cThread::cThread( ThreadFunc a_ThreadFunction, void* a_Param, const char* a_ThreadName /* = 0 */)
|
||||||
: m_ThreadFunction( a_ThreadFunction )
|
: m_ThreadFunction( a_ThreadFunction)
|
||||||
, m_Param( a_Param )
|
, m_Param( a_Param)
|
||||||
, m_Event( new cEvent() )
|
, m_Event( new cEvent())
|
||||||
, m_StopEvent( 0 )
|
, m_StopEvent( 0)
|
||||||
{
|
{
|
||||||
if( a_ThreadName )
|
if (a_ThreadName)
|
||||||
{
|
{
|
||||||
m_ThreadName.assign(a_ThreadName);
|
m_ThreadName.assign(a_ThreadName);
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ cThread::~cThread()
|
|||||||
delete m_Event;
|
delete m_Event;
|
||||||
m_Event = NULL;
|
m_Event = NULL;
|
||||||
|
|
||||||
if( m_StopEvent )
|
if (m_StopEvent)
|
||||||
{
|
{
|
||||||
m_StopEvent->Wait();
|
m_StopEvent->Wait();
|
||||||
delete m_StopEvent;
|
delete m_StopEvent;
|
||||||
@ -80,14 +80,14 @@ cThread::~cThread()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cThread::Start( bool a_bWaitOnDelete /* = true */ )
|
void cThread::Start( bool a_bWaitOnDelete /* = true */)
|
||||||
{
|
{
|
||||||
if( a_bWaitOnDelete )
|
if (a_bWaitOnDelete)
|
||||||
m_StopEvent = new cEvent();
|
m_StopEvent = new cEvent();
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
pthread_t SndThread;
|
pthread_t SndThread;
|
||||||
if( pthread_create( &SndThread, NULL, MyThread, this) )
|
if (pthread_create( &SndThread, NULL, MyThread, this))
|
||||||
LOGERROR("ERROR: Could not create thread!");
|
LOGERROR("ERROR: Could not create thread!");
|
||||||
#else
|
#else
|
||||||
DWORD ThreadID = 0;
|
DWORD ThreadID = 0;
|
||||||
@ -96,8 +96,8 @@ void cThread::Start( bool a_bWaitOnDelete /* = true */ )
|
|||||||
, (LPTHREAD_START_ROUTINE) MyThread // function name
|
, (LPTHREAD_START_ROUTINE) MyThread // function name
|
||||||
, this // parameters
|
, this // parameters
|
||||||
, 0 // flags
|
, 0 // flags
|
||||||
, &ThreadID ); // thread id
|
, &ThreadID); // thread id
|
||||||
CloseHandle( hThread );
|
CloseHandle( hThread);
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
if (!m_ThreadName.empty())
|
if (!m_ThreadName.empty())
|
||||||
@ -116,9 +116,9 @@ void cThread::Start( bool a_bWaitOnDelete /* = true */ )
|
|||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
unsigned long cThread::MyThread(void* a_Param )
|
unsigned long cThread::MyThread(void* a_Param)
|
||||||
#else
|
#else
|
||||||
void *cThread::MyThread( void *a_Param )
|
void *cThread::MyThread( void *a_Param)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
cThread* self = (cThread*)a_Param;
|
cThread* self = (cThread*)a_Param;
|
||||||
@ -130,8 +130,8 @@ void *cThread::MyThread( void *a_Param )
|
|||||||
// Set event to let other thread know this thread has been created and it's safe to delete the cThread object
|
// Set event to let other thread know this thread has been created and it's safe to delete the cThread object
|
||||||
self->m_Event->Set();
|
self->m_Event->Set();
|
||||||
|
|
||||||
ThreadFunction( ThreadParam );
|
ThreadFunction( ThreadParam);
|
||||||
|
|
||||||
if( StopEvent ) StopEvent->Set();
|
if (StopEvent) StopEvent->Set();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -4,18 +4,18 @@ class cThread
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef void (ThreadFunc)(void*);
|
typedef void (ThreadFunc)(void*);
|
||||||
cThread( ThreadFunc a_ThreadFunction, void* a_Param, const char* a_ThreadName = 0 );
|
cThread( ThreadFunc a_ThreadFunction, void* a_Param, const char* a_ThreadName = 0);
|
||||||
~cThread();
|
~cThread();
|
||||||
|
|
||||||
void Start( bool a_bWaitOnDelete = true );
|
void Start( bool a_bWaitOnDelete = true);
|
||||||
void WaitForThread();
|
void WaitForThread();
|
||||||
private:
|
private:
|
||||||
ThreadFunc* m_ThreadFunction;
|
ThreadFunc* m_ThreadFunction;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static unsigned long MyThread(void* a_Param );
|
static unsigned long MyThread(void* a_Param);
|
||||||
#else
|
#else
|
||||||
static void *MyThread( void *lpParam );
|
static void *MyThread( void *lpParam);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void* m_Param;
|
void* m_Param;
|
||||||
|
@ -120,7 +120,7 @@ public:
|
|||||||
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) = 0;
|
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) = 0;
|
||||||
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) = 0;
|
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) = 0;
|
||||||
virtual void SendUpdateSign (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) = 0;
|
virtual void SendUpdateSign (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) = 0;
|
||||||
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) = 0;
|
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) = 0;
|
||||||
virtual void SendWeather (eWeather a_Weather) = 0;
|
virtual void SendWeather (eWeather a_Weather) = 0;
|
||||||
virtual void SendWholeInventory (const cWindow & a_Window) = 0;
|
virtual void SendWholeInventory (const cWindow & a_Window) = 0;
|
||||||
virtual void SendWindowClose (const cWindow & a_Window) = 0;
|
virtual void SendWindowClose (const cWindow & a_Window) = 0;
|
||||||
|
@ -1116,7 +1116,7 @@ void cProtocol125::SendUpdateSign(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cProtocol125::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ )
|
void cProtocol125::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSPacket);
|
cCSLock Lock(m_CSPacket);
|
||||||
WriteByte(PACKET_USE_BED);
|
WriteByte(PACKET_USE_BED);
|
||||||
@ -1135,7 +1135,7 @@ void cProtocol125::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_Bloc
|
|||||||
void cProtocol125::SendWeather(eWeather a_Weather)
|
void cProtocol125::SendWeather(eWeather a_Weather)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSPacket);
|
cCSLock Lock(m_CSPacket);
|
||||||
switch( a_Weather )
|
switch (a_Weather)
|
||||||
{
|
{
|
||||||
case eWeather_Sunny:
|
case eWeather_Sunny:
|
||||||
{
|
{
|
||||||
@ -1454,7 +1454,7 @@ int cProtocol125::ParseHandshake(void)
|
|||||||
|
|
||||||
LOGD("HANDSHAKE %s", Username.c_str());
|
LOGD("HANDSHAKE %s", Username.c_str());
|
||||||
|
|
||||||
if (!m_Client->HandleHandshake( m_Username ))
|
if (!m_Client->HandleHandshake( m_Username))
|
||||||
{
|
{
|
||||||
return PARSE_OK; // Player is not allowed into the server
|
return PARSE_OK; // Player is not allowed into the server
|
||||||
}
|
}
|
||||||
@ -1916,7 +1916,7 @@ void cProtocol125::WriteEntityMetadata(const cEntity & a_Entity)
|
|||||||
{
|
{
|
||||||
WriteByte(0x51);
|
WriteByte(0x51);
|
||||||
// No idea how Mojang makes their carts shakey shakey, so here is a complicated one-liner expression that does something similar
|
// No idea how Mojang makes their carts shakey shakey, so here is a complicated one-liner expression that does something similar
|
||||||
WriteInt( (((a_Entity.GetMaxHealth() / 2) - (a_Entity.GetHealth() - (a_Entity.GetMaxHealth() / 2))) * ((const cMinecart &)a_Entity).LastDamage()) * 4 );
|
WriteInt( (((a_Entity.GetMaxHealth() / 2) - (a_Entity.GetHealth() - (a_Entity.GetMaxHealth() / 2))) * ((const cMinecart &)a_Entity).LastDamage()) * 4);
|
||||||
WriteByte(0x52);
|
WriteByte(0x52);
|
||||||
WriteInt(1); // Shaking direction, doesn't seem to affect anything
|
WriteInt(1); // Shaking direction, doesn't seem to affect anything
|
||||||
WriteByte(0x73);
|
WriteByte(0x73);
|
||||||
|
@ -92,7 +92,7 @@ public:
|
|||||||
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
|
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
|
||||||
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override {};
|
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override {};
|
||||||
virtual void SendUpdateSign (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) override;
|
virtual void SendUpdateSign (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) override;
|
||||||
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
|
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||||
virtual void SendWeather (eWeather a_Weather) override;
|
virtual void SendWeather (eWeather a_Weather) override;
|
||||||
virtual void SendWholeInventory (const cWindow & a_Window) override;
|
virtual void SendWholeInventory (const cWindow & a_Window) override;
|
||||||
virtual void SendWindowClose (const cWindow & a_Window) override;
|
virtual void SendWindowClose (const cWindow & a_Window) override;
|
||||||
@ -124,7 +124,7 @@ protected:
|
|||||||
/// Sends the Handshake packet
|
/// Sends the Handshake packet
|
||||||
void SendHandshake(const AString & a_ConnectionHash);
|
void SendHandshake(const AString & a_ConnectionHash);
|
||||||
|
|
||||||
/// Parse the packet of the specified type from m_ReceivedData (switch into ParseXYZ() )
|
/// Parse the packet of the specified type from m_ReceivedData (switch into ParseXYZ())
|
||||||
virtual int ParsePacket(unsigned char a_PacketType);
|
virtual int ParsePacket(unsigned char a_PacketType);
|
||||||
|
|
||||||
// Specific packet parsers:
|
// Specific packet parsers:
|
||||||
|
@ -474,7 +474,7 @@ int cProtocol132::ParseHandshake(void)
|
|||||||
HANDLE_PACKET_READ(ReadBEInt, int, ServerPort);
|
HANDLE_PACKET_READ(ReadBEInt, int, ServerPort);
|
||||||
m_Username = Username;
|
m_Username = Username;
|
||||||
|
|
||||||
if (!m_Client->HandleHandshake( m_Username ))
|
if (!m_Client->HandleHandshake( m_Username))
|
||||||
{
|
{
|
||||||
return PARSE_OK; // Player is not allowed into the server
|
return PARSE_OK; // Player is not allowed into the server
|
||||||
}
|
}
|
||||||
|
@ -1587,7 +1587,7 @@ void cProtocol172::AddReceivedData(const char * a_Data, size_t a_Size)
|
|||||||
ASSERT(!"Read wrong number of bytes!");
|
ASSERT(!"Read wrong number of bytes!");
|
||||||
m_Client->PacketError(PacketType);
|
m_Client->PacketError(PacketType);
|
||||||
}
|
}
|
||||||
} // for(ever)
|
} // for (ever)
|
||||||
|
|
||||||
// Log any leftover bytes into the logfile:
|
// Log any leftover bytes into the logfile:
|
||||||
if (g_ShouldLogCommIn && (m_ReceivedData.GetReadableSpace() > 0))
|
if (g_ShouldLogCommIn && (m_ReceivedData.GetReadableSpace() > 0))
|
||||||
|
@ -124,7 +124,7 @@ public:
|
|||||||
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
|
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
|
||||||
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
|
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
|
||||||
virtual void SendUpdateSign (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) override;
|
virtual void SendUpdateSign (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) override;
|
||||||
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
|
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||||
virtual void SendWeather (eWeather a_Weather) override;
|
virtual void SendWeather (eWeather a_Weather) override;
|
||||||
virtual void SendWholeInventory (const cWindow & a_Window) override;
|
virtual void SendWholeInventory (const cWindow & a_Window) override;
|
||||||
virtual void SendWindowClose (const cWindow & a_Window) override;
|
virtual void SendWindowClose (const cWindow & a_Window) override;
|
||||||
|
@ -756,7 +756,7 @@ void cProtocolRecognizer::SendUpdateSign(int a_BlockX, int a_BlockY, int a_Block
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cProtocolRecognizer::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ )
|
void cProtocolRecognizer::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
ASSERT(m_Protocol != NULL);
|
ASSERT(m_Protocol != NULL);
|
||||||
m_Protocol->SendUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ);
|
m_Protocol->SendUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
@ -1021,9 +1021,9 @@ void cProtocolRecognizer::SendLengthlessServerPing(void)
|
|||||||
// http://wiki.vg/wiki/index.php?title=Protocol&oldid=3099#Server_List_Ping_.280xFE.29
|
// http://wiki.vg/wiki/index.php?title=Protocol&oldid=3099#Server_List_Ping_.280xFE.29
|
||||||
Printf(Reply, "%s%s%i%s%i",
|
Printf(Reply, "%s%s%i%s%i",
|
||||||
Server->GetDescription().c_str(),
|
Server->GetDescription().c_str(),
|
||||||
cChatColor::Delimiter.c_str(),
|
cChatColor::Delimiter,
|
||||||
Server->GetNumPlayers(),
|
Server->GetNumPlayers(),
|
||||||
cChatColor::Delimiter.c_str(),
|
cChatColor::Delimiter,
|
||||||
Server->GetMaxPlayers()
|
Server->GetMaxPlayers()
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
@ -127,7 +127,7 @@ public:
|
|||||||
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
|
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
|
||||||
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
|
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
|
||||||
virtual void SendUpdateSign (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) override;
|
virtual void SendUpdateSign (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) override;
|
||||||
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
|
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||||
virtual void SendWeather (eWeather a_Weather) override;
|
virtual void SendWeather (eWeather a_Weather) override;
|
||||||
virtual void SendWholeInventory (const cWindow & a_Window) override;
|
virtual void SendWholeInventory (const cWindow & a_Window) override;
|
||||||
virtual void SendWindowClose (const cWindow & a_Window) override;
|
virtual void SendWindowClose (const cWindow & a_Window) override;
|
||||||
|
24
src/Root.cpp
24
src/Root.cpp
@ -191,8 +191,8 @@ void cRoot::Start(void)
|
|||||||
|
|
||||||
#if !defined(ANDROID_NDK)
|
#if !defined(ANDROID_NDK)
|
||||||
LOGD("Starting InputThread...");
|
LOGD("Starting InputThread...");
|
||||||
m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" );
|
m_InputThread = new cThread( InputThread, this, "cRoot::InputThread");
|
||||||
m_InputThread->Start( false ); // We should NOT wait? Otherwise we can't stop the server from other threads than the input thread
|
m_InputThread->Start( false); // We should NOT wait? Otherwise we can't stop the server from other threads than the input thread
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
long long finishmseconds = Time.GetNowTime();
|
long long finishmseconds = Time.GetNowTime();
|
||||||
@ -269,12 +269,12 @@ void cRoot::LoadWorlds(cIniFile & IniFile)
|
|||||||
{
|
{
|
||||||
// First get the default world
|
// First get the default world
|
||||||
AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world");
|
AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world");
|
||||||
m_pDefaultWorld = new cWorld( DefaultWorldName.c_str() );
|
m_pDefaultWorld = new cWorld( DefaultWorldName.c_str());
|
||||||
m_WorldsByName[ DefaultWorldName ] = m_pDefaultWorld;
|
m_WorldsByName[ DefaultWorldName ] = m_pDefaultWorld;
|
||||||
|
|
||||||
// Then load the other worlds
|
// Then load the other worlds
|
||||||
unsigned int KeyNum = IniFile.FindKey("Worlds");
|
unsigned int KeyNum = IniFile.FindKey("Worlds");
|
||||||
unsigned int NumWorlds = IniFile.GetNumValues( KeyNum );
|
unsigned int NumWorlds = IniFile.GetNumValues( KeyNum);
|
||||||
if (NumWorlds <= 0)
|
if (NumWorlds <= 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -283,18 +283,18 @@ void cRoot::LoadWorlds(cIniFile & IniFile)
|
|||||||
bool FoundAdditionalWorlds = false;
|
bool FoundAdditionalWorlds = false;
|
||||||
for (unsigned int i = 0; i < NumWorlds; i++)
|
for (unsigned int i = 0; i < NumWorlds; i++)
|
||||||
{
|
{
|
||||||
AString ValueName = IniFile.GetValueName(KeyNum, i );
|
AString ValueName = IniFile.GetValueName(KeyNum, i);
|
||||||
if (ValueName.compare("World") != 0)
|
if (ValueName.compare("World") != 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
AString WorldName = IniFile.GetValue(KeyNum, i );
|
AString WorldName = IniFile.GetValue(KeyNum, i);
|
||||||
if (WorldName.empty())
|
if (WorldName.empty())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
FoundAdditionalWorlds = true;
|
FoundAdditionalWorlds = true;
|
||||||
cWorld* NewWorld = new cWorld( WorldName.c_str() );
|
cWorld* NewWorld = new cWorld( WorldName.c_str());
|
||||||
m_WorldsByName[ WorldName ] = NewWorld;
|
m_WorldsByName[ WorldName ] = NewWorld;
|
||||||
} // for i - Worlds
|
} // for i - Worlds
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ void cRoot::StopWorlds(void)
|
|||||||
void cRoot::UnloadWorlds(void)
|
void cRoot::UnloadWorlds(void)
|
||||||
{
|
{
|
||||||
m_pDefaultWorld = NULL;
|
m_pDefaultWorld = NULL;
|
||||||
for( WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr )
|
for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr)
|
||||||
{
|
{
|
||||||
delete itr->second;
|
delete itr->second;
|
||||||
}
|
}
|
||||||
@ -379,10 +379,10 @@ cWorld* cRoot::GetDefaultWorld()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cWorld* cRoot::GetWorld( const AString & a_WorldName )
|
cWorld* cRoot::GetWorld( const AString & a_WorldName)
|
||||||
{
|
{
|
||||||
WorldMap::iterator itr = m_WorldsByName.find( a_WorldName );
|
WorldMap::iterator itr = m_WorldsByName.find( a_WorldName);
|
||||||
if( itr != m_WorldsByName.end() )
|
if (itr != m_WorldsByName.end())
|
||||||
return itr->second;
|
return itr->second;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -509,7 +509,7 @@ void cRoot::AuthenticateUser(int a_ClientID, const AString & a_Name, const AStri
|
|||||||
int cRoot::GetTotalChunkCount(void)
|
int cRoot::GetTotalChunkCount(void)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
for ( WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr )
|
for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr)
|
||||||
{
|
{
|
||||||
res += itr->second->GetNumChunks();
|
res += itr->second->GetNumChunks();
|
||||||
}
|
}
|
||||||
|
@ -222,12 +222,14 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
|
|||||||
|
|
||||||
bool HasAnyPorts = false;
|
bool HasAnyPorts = false;
|
||||||
AString Ports = a_SettingsIni.GetValueSet("Server", "Port", "25565");
|
AString Ports = a_SettingsIni.GetValueSet("Server", "Port", "25565");
|
||||||
|
m_ListenThreadIPv4.SetReuseAddr(true);
|
||||||
if (m_ListenThreadIPv4.Initialize(Ports))
|
if (m_ListenThreadIPv4.Initialize(Ports))
|
||||||
{
|
{
|
||||||
HasAnyPorts = true;
|
HasAnyPorts = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ports = a_SettingsIni.GetValueSet("Server", "PortsIPv6", "25565");
|
Ports = a_SettingsIni.GetValueSet("Server", "PortsIPv6", "25565");
|
||||||
|
m_ListenThreadIPv6.SetReuseAddr(true);
|
||||||
if (m_ListenThreadIPv6.Initialize(Ports))
|
if (m_ListenThreadIPv6.Initialize(Ports))
|
||||||
{
|
{
|
||||||
HasAnyPorts = true;
|
HasAnyPorts = true;
|
||||||
@ -396,7 +398,7 @@ void cServer::TickClients(float a_Dt)
|
|||||||
{
|
{
|
||||||
if ((*itr)->IsDestroyed())
|
if ((*itr)->IsDestroyed())
|
||||||
{
|
{
|
||||||
// Remove the client later, when CS is not held, to avoid deadlock ( http://forum.mc-server.org/showthread.php?tid=374 )
|
// Remove the client later, when CS is not held, to avoid deadlock: http://forum.mc-server.org/showthread.php?tid=374
|
||||||
RemoveClients.push_back(*itr);
|
RemoveClients.push_back(*itr);
|
||||||
itr = m_Clients.erase(itr);
|
itr = m_Clients.erase(itr);
|
||||||
continue;
|
continue;
|
||||||
@ -629,7 +631,7 @@ void cServer::Shutdown(void)
|
|||||||
cRoot::Get()->SaveAllChunks();
|
cRoot::Get()->SaveAllChunks();
|
||||||
|
|
||||||
cCSLock Lock(m_CSClients);
|
cCSLock Lock(m_CSClients);
|
||||||
for( ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr )
|
for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr)
|
||||||
{
|
{
|
||||||
(*itr)->Destroy();
|
(*itr)->Destroy();
|
||||||
delete *itr;
|
delete *itr;
|
||||||
|
@ -140,7 +140,7 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((itr->y > 0) && (!DoesBurnForever(a_Chunk->GetBlock(itr->x, itr->y - 1, itr->z))))
|
if ((itr->y > 0) && (!DoesBurnForever(a_Chunk->GetBlock(itr->x, itr->y - 1, itr->z))))
|
||||||
{
|
{
|
||||||
a_Chunk->SetMeta(x, y, z, BlockMeta + 1);
|
a_Chunk->SetMeta(x, y, z, BlockMeta + 1);
|
||||||
}
|
}
|
||||||
|
@ -159,18 +159,18 @@ Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a
|
|||||||
{
|
{
|
||||||
Vector3i *Pos = (*it);
|
Vector3i *Pos = (*it);
|
||||||
char BlockID = m_World.GetBlock(Pos->x, Pos->y, Pos->z);
|
char BlockID = m_World.GetBlock(Pos->x, Pos->y, Pos->z);
|
||||||
if(IsAllowedBlock(BlockID))
|
if (IsAllowedBlock(BlockID))
|
||||||
{
|
{
|
||||||
char Meta = m_World.GetBlockMeta(Pos->x, Pos->y, Pos->z);
|
char Meta = m_World.GetBlockMeta(Pos->x, Pos->y, Pos->z);
|
||||||
|
|
||||||
if(Meta > LowestPoint)
|
if (Meta > LowestPoint)
|
||||||
{
|
{
|
||||||
LowestPoint = Meta;
|
LowestPoint = Meta;
|
||||||
X = Pos->x;
|
X = Pos->x;
|
||||||
Z = Pos->z;
|
Z = Pos->z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(BlockID == E_BLOCK_AIR)
|
else if (BlockID == E_BLOCK_AIR)
|
||||||
{
|
{
|
||||||
LowestPoint = 9; // This always dominates
|
LowestPoint = 9; // This always dominates
|
||||||
X = Pos->x;
|
X = Pos->x;
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
UNUSED(a_ChunkZ);
|
UNUSED(a_ChunkZ);
|
||||||
UNUSED(a_Chunk);
|
UNUSED(a_Chunk);
|
||||||
}
|
}
|
||||||
virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) override { return false; }
|
virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType) override { return false; }
|
||||||
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override
|
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override
|
||||||
{
|
{
|
||||||
UNUSED(a_BlockX);
|
UNUSED(a_BlockX);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user