aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/player.h71
-rw-r--r--src/porting.cpp24
-rw-r--r--src/script/common/c_content.cpp14
-rw-r--r--src/script/common/c_content.h73
-rw-r--r--src/script/common/c_converter.h2
-rw-r--r--src/script/cpp_api/s_base.cpp31
-rw-r--r--src/script/cpp_api/s_base.h3
-rw-r--r--src/server.cpp143
-rw-r--r--src/server.h8
9 files changed, 185 insertions, 184 deletions
diff --git a/src/player.h b/src/player.h
index 4db0e4c58..c84cc1c92 100644
--- a/src/player.h
+++ b/src/player.h
@@ -130,13 +130,8 @@ public:
v3f getEyeOffset()
{
- // This is at the height of the eyes of the current figure
- // return v3f(0, BS*1.5, 0);
- // This is more like in minecraft
- if(camera_barely_in_ceiling)
- return v3f(0,BS*1.5,0);
- else
- return v3f(0,BS*1.625,0);
+ float eye_height = camera_barely_in_ceiling ? 1.5f : 1.625f;
+ return v3f(0, BS * eye_height, 0);
}
v3f getEyePosition()
@@ -197,12 +192,13 @@ public:
return (m_yaw + 90.) * core::DEGTORAD;
}
- const char * getName() const
+ const char *getName() const
{
return m_name;
}
- core::aabbox3d<f32> getCollisionbox() {
+ core::aabbox3d<f32> getCollisionbox()
+ {
return m_collisionbox;
}
@@ -215,62 +211,91 @@ public:
return size;
}
- void setHotbarItemcount(s32 hotbar_itemcount) {
+ void setHotbarItemcount(s32 hotbar_itemcount)
+ {
hud_hotbar_itemcount = hotbar_itemcount;
}
- s32 getHotbarItemcount() {
+
+ s32 getHotbarItemcount()
+ {
return hud_hotbar_itemcount;
}
- void setHotbarImage(std::string name) {
+
+ void setHotbarImage(const std::string &name)
+ {
hud_hotbar_image = name;
}
- std::string getHotbarImage() {
+
+ std::string getHotbarImage()
+ {
return hud_hotbar_image;
}
- void setHotbarSelectedImage(std::string name) {
+
+ void setHotbarSelectedImage(const std::string &name)
+ {
hud_hotbar_selected_image = name;
}
+
std::string getHotbarSelectedImage() {
return hud_hotbar_selected_image;
}
void setSky(const video::SColor &bgcolor, const std::string &type,
- const std::vector<std::string> &params) {
+ const std::vector<std::string> &params)
+ {
m_sky_bgcolor = bgcolor;
m_sky_type = type;
m_sky_params = params;
}
+
void getSky(video::SColor *bgcolor, std::string *type,
- std::vector<std::string> *params) {
+ std::vector<std::string> *params)
+ {
*bgcolor = m_sky_bgcolor;
*type = m_sky_type;
*params = m_sky_params;
}
- void overrideDayNightRatio(bool do_override, float ratio) {
+
+ void overrideDayNightRatio(bool do_override, float ratio)
+ {
m_day_night_ratio_do_override = do_override;
m_day_night_ratio = ratio;
}
- void getDayNightRatio(bool *do_override, float *ratio) {
+
+ void getDayNightRatio(bool *do_override, float *ratio)
+ {
*do_override = m_day_night_ratio_do_override;
*ratio = m_day_night_ratio;
}
- void setLocalAnimations(v2s32 frames[4], float frame_speed) {
+
+ void setLocalAnimations(v2s32 frames[4], float frame_speed)
+ {
for (int i = 0; i < 4; i++)
local_animations[i] = frames[i];
local_animation_speed = frame_speed;
}
- void getLocalAnimations(v2s32 *frames, float *frame_speed) {
+
+ void getLocalAnimations(v2s32 *frames, float *frame_speed)
+ {
for (int i = 0; i < 4; i++)
frames[i] = local_animations[i];
*frame_speed = local_animation_speed;
}
virtual bool isLocal() const
- { return false; }
+ {
+ return false;
+ }
+
virtual PlayerSAO *getPlayerSAO()
- { return NULL; }
+ {
+ return NULL;
+ }
+
virtual void setPlayerSAO(PlayerSAO *sao)
- { FATAL_ERROR("FIXME"); }
+ {
+ FATAL_ERROR("FIXME");
+ }
/*
serialize() writes a bunch of text that can contain
diff --git a/src/porting.cpp b/src/porting.cpp
index 29c82fe24..44f1fcff1 100644
--- a/src/porting.cpp
+++ b/src/porting.cpp
@@ -749,25 +749,23 @@ const char *getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type)
static float calcDisplayDensity()
{
- const char* current_display = getenv("DISPLAY");
+ const char *current_display = getenv("DISPLAY");
if (current_display != NULL) {
- Display * x11display = XOpenDisplay(current_display);
+ Display *x11display = XOpenDisplay(current_display);
- if (x11display != NULL) {
- /* try x direct */
- float dpi_height =
- floor(DisplayHeight(x11display, 0) /
- (DisplayHeightMM(x11display, 0) * 0.039370) + 0.5);
- float dpi_width =
- floor(DisplayWidth(x11display, 0) /
- (DisplayWidthMM(x11display, 0) * 0.039370) +0.5);
+ if (x11display != NULL) {
+ /* try x direct */
+ float dpi_height = floor(DisplayHeight(x11display, 0) /
+ (DisplayHeightMM(x11display, 0) * 0.039370) + 0.5);
+ float dpi_width = floor(DisplayWidth(x11display, 0) /
+ (DisplayWidthMM(x11display, 0) * 0.039370) + 0.5);
- XCloseDisplay(x11display);
+ XCloseDisplay(x11display);
- return std::max(dpi_height,dpi_width) / 96.0;
- }
+ return std::max(dpi_height,dpi_width) / 96.0;
}
+ }
/* return manually specified dpi */
return g_settings->getFloat("screen_dpi")/96.0;
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index 94fcdecbb..4db92190b 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -985,11 +985,11 @@ void read_groups(lua_State *L, int index,
}
/******************************************************************************/
-void push_groups(lua_State *L, std::map<std::string, int> groups)
+void push_groups(lua_State *L, const std::map<std::string, int> &groups)
{
lua_newtable(L);
- for (std::map<std::string, int>::iterator it = groups.begin();
- it != groups.end(); ++it) {
+ std::map<std::string, int>::const_iterator it;
+ for (it = groups.begin(); it != groups.end(); ++it) {
lua_pushnumber(L, it->second);
lua_setfield(L, -2, it->first.c_str());
}
@@ -998,12 +998,10 @@ void push_groups(lua_State *L, std::map<std::string, int> groups)
/******************************************************************************/
void push_items(lua_State *L, const std::vector<ItemStack> &items)
{
- // Create and fill table
lua_createtable(L, items.size(), 0);
- std::vector<ItemStack>::const_iterator iter = items.begin();
- for (u32 i = 0; iter != items.end(); iter++) {
- LuaItemStack::create(L, *iter);
- lua_rawseti(L, -2, ++i);
+ for (u32 i = 0; i != items.size(); i++) {
+ LuaItemStack::create(L, items[i]);
+ lua_rawseti(L, -2, i + 1);
}
}
diff --git a/src/script/common/c_content.h b/src/script/common/c_content.h
index 69b2a8355..4547009e7 100644
--- a/src/script/common/c_content.h
+++ b/src/script/common/c_content.h
@@ -62,61 +62,56 @@ struct NoiseParams;
class Schematic;
-ContentFeatures read_content_features (lua_State *L, int index);
-TileDef read_tiledef (lua_State *L, int index);
-void read_soundspec (lua_State *L, int index,
- SimpleSoundSpec &spec);
-NodeBox read_nodebox (lua_State *L, int index);
+ContentFeatures read_content_features (lua_State *L, int index);
+TileDef read_tiledef (lua_State *L, int index);
+void read_soundspec (lua_State *L, int index,
+ SimpleSoundSpec &spec);
+NodeBox read_nodebox (lua_State *L, int index);
-void read_server_sound_params (lua_State *L, int index,
- ServerSoundParams &params);
+void read_server_sound_params (lua_State *L, int index,
+ ServerSoundParams &params);
-void push_dig_params (lua_State *L,const DigParams &params);
-void push_hit_params (lua_State *L,const HitParams &params);
+void push_dig_params (lua_State *L,
+ const DigParams &params);
+void push_hit_params (lua_State *L,
+ const HitParams &params);
-ItemStack read_item (lua_State *L, int index, Server* srv);
+ItemStack read_item (lua_State *L, int index, Server *srv);
-ToolCapabilities read_tool_capabilities (lua_State *L,
- int table);
+ToolCapabilities read_tool_capabilities (lua_State *L, int table);
void push_tool_capabilities (lua_State *L,
const ToolCapabilities &prop);
-ItemDefinition read_item_definition (lua_State *L,
- int index,
+ItemDefinition read_item_definition (lua_State *L, int index,
ItemDefinition default_def);
-void read_object_properties (lua_State *L,
- int index,
+void read_object_properties (lua_State *L, int index,
+ ObjectProperties *prop);
+void push_object_properties (lua_State *L,
ObjectProperties *prop);
-void push_object_properties (lua_State *L,
- ObjectProperties *prop);
void push_inventory_list (lua_State *L,
Inventory *inv,
const char *name);
-void read_inventory_list (lua_State *L,
- int tableindex,
- Inventory *inv,
- const char *name,
- Server* srv,
- int forcesize=-1);
+void read_inventory_list (lua_State *L, int tableindex,
+ Inventory *inv, const char *name,
+ Server *srv, int forcesize=-1);
-MapNode readnode (lua_State *L,
- int index,
+MapNode readnode (lua_State *L, int index,
INodeDefManager *ndef);
-void pushnode (lua_State *L,
- const MapNode &n,
+void pushnode (lua_State *L, const MapNode &n,
INodeDefManager *ndef);
NodeBox read_nodebox (lua_State *L, int index);
-void read_groups (lua_State *L,
- int index,
+void read_groups (lua_State *L, int index,
std::map<std::string, int> &result);
+void push_groups (lua_State *L,
+ const std::map<std::string, int> &groups);
+
//TODO rename to "read_enum_field"
-int getenumfield (lua_State *L,
- int table,
+int getenumfield (lua_State *L, int table,
const char *fieldname,
const EnumString *spec,
int default_);
@@ -129,8 +124,9 @@ bool getflagsfield (lua_State *L, int table,
bool read_flags (lua_State *L, int index,
FlagDesc *flagdesc,
u32 *flags, u32 *flagmask);
-void push_flags_string (lua_State *L, FlagDesc *flagdesc,
- u32 flags, u32 flagmask);
+
+void push_flags_string (lua_State *L, FlagDesc *flagdesc,
+ u32 flags, u32 flagmask);
u32 read_flags_table (lua_State *L, int table,
FlagDesc *flagdesc, u32 *flagmask);
@@ -146,24 +142,21 @@ void read_soundspec (lua_State *L,
int index,
SimpleSoundSpec &spec);
-
bool string_to_enum (const EnumString *spec,
int &result,
const std::string &str);
bool read_noiseparams (lua_State *L, int index,
NoiseParams *np);
-void push_noiseparams (lua_State *L, NoiseParams *np);
+void push_noiseparams (lua_State *L, NoiseParams *np);
void luaentity_get (lua_State *L,u16 id);
bool push_json_value (lua_State *L,
const Json::Value &value,
int nullindex);
-void read_json_value (lua_State *L,
- Json::Value &root,
- int index,
- u8 recursion = 0);
+void read_json_value (lua_State *L, Json::Value &root,
+ int index, u8 recursion = 0);
extern struct EnumString es_TileAnimationType[];
diff --git a/src/script/common/c_converter.h b/src/script/common/c_converter.h
index 8a49c7a73..18a045d2a 100644
--- a/src/script/common/c_converter.h
+++ b/src/script/common/c_converter.h
@@ -104,8 +104,6 @@ void push_ARGB8 (lua_State *L, video::SColor color);
void pushFloatPos (lua_State *L, v3f p);
void push_v3f (lua_State *L, v3f p);
void push_v2f (lua_State *L, v2f p);
-void push_groups (lua_State *L,
- std::map<std::string, int> groups);
void warn_if_field_exists(lua_State *L, int table,
const char *fieldname,
diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp
index e02a6aa0d..2eb7419b5 100644
--- a/src/script/cpp_api/s_base.cpp
+++ b/src/script/cpp_api/s_base.cpp
@@ -142,7 +142,7 @@ bool ScriptApiBase::loadScript(const std::string &script_path, std::string *erro
if (!ok) {
std::string error_msg = lua_tostring(L, -1);
if (error)
- (*error) = error_msg;
+ *error = error_msg;
errorstream << "========== ERROR FROM LUA ===========" << std::endl
<< "Failed to load and run script from " << std::endl
<< script_path << ":" << std::endl << std::endl
@@ -157,8 +157,8 @@ bool ScriptApiBase::loadScript(const std::string &script_path, std::string *erro
void ScriptApiBase::realityCheck()
{
int top = lua_gettop(m_luastack);
- if(top >= 30){
- dstream<<"Stack is over 30:"<<std::endl;
+ if (top >= 30) {
+ dstream << "Stack is over 30:" << std::endl;
stackDump(dstream);
std::string traceback = script_get_backtrace(m_luastack);
throw LuaError("Stack is over 30 (reality check)\n" + traceback);
@@ -172,34 +172,29 @@ void ScriptApiBase::scriptError()
void ScriptApiBase::stackDump(std::ostream &o)
{
- int i;
int top = lua_gettop(m_luastack);
- for (i = 1; i <= top; i++) { /* repeat for each level */
+ for (int i = 1; i <= top; i++) { /* repeat for each level */
int t = lua_type(m_luastack, i);
switch (t) {
-
case LUA_TSTRING: /* strings */
- o<<"\""<<lua_tostring(m_luastack, i)<<"\"";
+ o << "\"" << lua_tostring(m_luastack, i) << "\"";
break;
-
case LUA_TBOOLEAN: /* booleans */
- o<<(lua_toboolean(m_luastack, i) ? "true" : "false");
+ o << (lua_toboolean(m_luastack, i) ? "true" : "false");
break;
-
case LUA_TNUMBER: /* numbers */ {
char buf[10];
snprintf(buf, 10, "%g", lua_tonumber(m_luastack, i));
- o<<buf;
- break; }
-
+ o << buf;
+ break;
+ }
default: /* other values */
- o<<lua_typename(m_luastack, t);
+ o << lua_typename(m_luastack, t);
break;
-
}
- o<<" ";
+ o << " ";
}
- o<<std::endl;
+ o << std::endl;
}
void ScriptApiBase::addObjectReference(ServerActiveObject *cobj)
@@ -251,7 +246,7 @@ void ScriptApiBase::removeObjectReference(ServerActiveObject *cobj)
void ScriptApiBase::objectrefGetOrCreate(lua_State *L,
ServerActiveObject *cobj)
{
- if(cobj == NULL || cobj->getId() == 0){
+ if (cobj == NULL || cobj->getId() == 0) {
ObjectRef::create(L, cobj);
} else {
objectrefGet(L, cobj->getId());
diff --git a/src/script/cpp_api/s_base.h b/src/script/cpp_api/s_base.h
index ee2835da2..13076d3d1 100644
--- a/src/script/cpp_api/s_base.h
+++ b/src/script/cpp_api/s_base.h
@@ -51,7 +51,8 @@ public:
ScriptApiBase();
virtual ~ScriptApiBase();
- bool loadMod(const std::string &script_path, const std::string &mod_name, std::string *error=NULL);
+ bool loadMod(const std::string &script_path, const std::string &mod_name,
+ std::string *error=NULL);
bool loadScript(const std::string &script_path, std::string *error=NULL);
/* object */
diff --git a/src/server.cpp b/src/server.cpp
index f69c5a935..e9aee47b2 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -2838,7 +2838,7 @@ std::string Server::getBanDescription(const std::string &ip_or_name)
void Server::notifyPlayer(const char *name, const std::wstring &msg)
{
Player *player = m_env->getPlayer(name);
- if(!player)
+ if (!player)
return;
if (player->peer_id == PEER_ID_INEXISTENT)
@@ -2847,21 +2847,19 @@ void Server::notifyPlayer(const char *name, const std::wstring &msg)
SendChatMessage(player->peer_id, msg);
}
-bool Server::showFormspec(const char *playername, const std::string &formspec, const std::string &formname)
+bool Server::showFormspec(const char *playername, const std::string &formspec,
+ const std::string &formname)
{
Player *player = m_env->getPlayer(playername);
-
- if(!player)
- {
- infostream<<"showFormspec: couldn't find player:"<<playername<<std::endl;
+ if (!player)
return false;
- }
SendShowFormspecMessage(player->peer_id, formspec, formname);
return true;
}
-u32 Server::hudAdd(Player *player, HudElement *form) {
+u32 Server::hudAdd(Player *player, HudElement *form)
+{
if (!player)
return -1;
@@ -2887,7 +2885,8 @@ bool Server::hudRemove(Player *player, u32 id) {
return true;
}
-bool Server::hudChange(Player *player, u32 id, HudElementStat stat, void *data) {
+bool Server::hudChange(Player *player, u32 id, HudElementStat stat, void *data)
+{
if (!player)
return false;
@@ -2895,7 +2894,8 @@ bool Server::hudChange(Player *player, u32 id, HudElementStat stat, void *data)
return true;
}
-bool Server::hudSetFlags(Player *player, u32 flags, u32 mask) {
+bool Server::hudSetFlags(Player *player, u32 flags, u32 mask)
+{
if (!player)
return false;
@@ -2911,7 +2911,8 @@ bool Server::hudSetFlags(Player *player, u32 flags, u32 mask) {
return true;
}
-bool Server::hudSetHotbarItemcount(Player *player, s32 hotbar_itemcount) {
+bool Server::hudSetHotbarItemcount(Player *player, s32 hotbar_itemcount)
+{
if (!player)
return false;
if (hotbar_itemcount <= 0 || hotbar_itemcount > HUD_HOTBAR_ITEMCOUNT_MAX)
@@ -2924,13 +2925,15 @@ bool Server::hudSetHotbarItemcount(Player *player, s32 hotbar_itemcount) {
return true;
}
-s32 Server::hudGetHotbarItemcount(Player *player) {
+s32 Server::hudGetHotbarItemcount(Player *player)
+{
if (!player)
return 0;
return player->getHotbarItemcount();
}
-void Server::hudSetHotbarImage(Player *player, std::string name) {
+void Server::hudSetHotbarImage(Player *player, std::string name)
+{
if (!player)
return;
@@ -2938,13 +2941,15 @@ void Server::hudSetHotbarImage(Player *player, std::string name) {
SendHUDSetParam(player->peer_id, HUD_PARAM_HOTBAR_IMAGE, name);
}
-std::string Server::hudGetHotbarImage(Player *player) {
+std::string Server::hudGetHotbarImage(Player *player)
+{
if (!player)
return "";
return player->getHotbarImage();
}
-void Server::hudSetHotbarSelectedImage(Player *player, std::string name) {
+void Server::hudSetHotbarSelectedImage(Player *player, std::string name)
+{
if (!player)
return;
@@ -2952,14 +2957,16 @@ void Server::hudSetHotbarSelectedImage(Player *player, std::string name) {
SendHUDSetParam(player->peer_id, HUD_PARAM_HOTBAR_SELECTED_IMAGE, name);
}
-std::string Server::hudGetHotbarSelectedImage(Player *player) {
+std::string Server::hudGetHotbarSelectedImage(Player *player)
+{
if (!player)
return "";
return player->getHotbarSelectedImage();
}
-bool Server::setLocalPlayerAnimations(Player *player, v2s32 animation_frames[4], f32 frame_speed)
+bool Server::setLocalPlayerAnimations(Player *player,
+ v2s32 animation_frames[4], f32 frame_speed)
{
if (!player)
return false;
@@ -2981,7 +2988,7 @@ bool Server::setPlayerEyeOffset(Player *player, v3f first, v3f third)
}
bool Server::setSky(Player *player, const video::SColor &bgcolor,
- const std::string &type, const std::vector<std::string> &params)
+ const std::string &type, const std::vector<std::string> &params)
{
if (!player)
return false;
@@ -2992,7 +2999,7 @@ bool Server::setSky(Player *player, const video::SColor &bgcolor,
}
bool Server::overrideDayNightRatio(Player *player, bool do_override,
- float ratio)
+ float ratio)
{
if (!player)
return false;
@@ -3008,9 +3015,9 @@ void Server::notifyPlayers(const std::wstring &msg)
}
void Server::spawnParticle(const char *playername, v3f pos,
- v3f velocity, v3f acceleration,
- float expirationtime, float size, bool
- collisiondetection, bool vertical, std::string texture)
+ v3f velocity, v3f acceleration,
+ float expirationtime, float size, bool
+ collisiondetection, bool vertical, const std::string &texture)
{
Player *player = m_env->getPlayer(playername);
if(!player)
@@ -3020,21 +3027,17 @@ void Server::spawnParticle(const char *playername, v3f pos,
}
void Server::spawnParticleAll(v3f pos, v3f velocity, v3f acceleration,
- float expirationtime, float size,
- bool collisiondetection, bool vertical, std::string texture)
+ float expirationtime, float size,
+ bool collisiondetection, bool vertical, const std::string &texture)
{
SendSpawnParticle(PEER_ID_INEXISTENT,pos, velocity, acceleration,
expirationtime, size, collisiondetection, vertical, texture);
}
-u32 Server::addParticleSpawner(const char *playername,
- u16 amount, float spawntime,
- v3f minpos, v3f maxpos,
- v3f minvel, v3f maxvel,
- v3f minacc, v3f maxacc,
- float minexptime, float maxexptime,
- float minsize, float maxsize,
- bool collisiondetection, bool vertical, std::string texture)
+u32 Server::addParticleSpawner(const char *playername, u16 amount, float spawntime,
+ v3f minpos, v3f maxpos, v3f minvel, v3f maxvel, v3f minacc, v3f maxacc,
+ float minexptime, float maxexptime, float minsize, float maxsize,
+ bool collisiondetection, bool vertical, const std::string &texture)
{
Player *player = m_env->getPlayer(playername);
if(!player)
@@ -3062,12 +3065,12 @@ u32 Server::addParticleSpawner(const char *playername,
}
u32 Server::addParticleSpawnerAll(u16 amount, float spawntime,
- v3f minpos, v3f maxpos,
- v3f minvel, v3f maxvel,
- v3f minacc, v3f maxacc,
- float minexptime, float maxexptime,
- float minsize, float maxsize,
- bool collisiondetection, bool vertical, std::string texture)
+ v3f minpos, v3f maxpos,
+ v3f minvel, v3f maxvel,
+ v3f minacc, v3f maxacc,
+ float minexptime, float maxexptime,
+ float minsize, float maxsize,
+ bool collisiondetection, bool vertical, const std::string &texture)
{
u32 id = 0;
for(;;) // look for unused particlespawner id
@@ -3128,24 +3131,6 @@ Inventory* Server::createDetachedInventory(const std::string &name)
return inv;
}
-class BoolScopeSet
-{
-public:
- BoolScopeSet(bool *dst, bool val):
- m_dst(dst)
- {
- m_orig_state = *m_dst;
- *m_dst = val;
- }
- ~BoolScopeSet()
- {
- *m_dst = m_orig_state;
- }
-private:
- bool *m_dst;
- bool m_orig_state;
-};
-
// actions: time-reversed list
// Return value: success/failure
bool Server::rollbackRevertActions(const std::list<RollbackAction> &actions,
@@ -3195,27 +3180,29 @@ bool Server::rollbackRevertActions(const std::list<RollbackAction> &actions,
// IGameDef interface
// Under envlock
-IItemDefManager* Server::getItemDefManager()
+IItemDefManager *Server::getItemDefManager()
{
return m_itemdef;
}
-INodeDefManager* Server::getNodeDefManager()
+
+INodeDefManager *Server::getNodeDefManager()
{
return m_nodedef;
}
-ICraftDefManager* Server::getCraftDefManager()
+
+ICraftDefManager *Server::getCraftDefManager()
{
return m_craftdef;
}
-ITextureSource* Server::getTextureSource()
+ITextureSource *Server::getTextureSource()
{
return NULL;
}
-IShaderSource* Server::getShaderSource()
+IShaderSource *Server::getShaderSource()
{
return NULL;
}
-scene::ISceneManager* Server::getSceneManager()
+scene::ISceneManager *Server::getSceneManager()
{
return NULL;
}
@@ -3224,44 +3211,50 @@ u16 Server::allocateUnknownNodeId(const std::string &name)
{
return m_nodedef->allocateDummy(name);
}
-ISoundManager* Server::getSoundManager()
+
+ISoundManager *Server::getSoundManager()
{
return &dummySoundManager;
}
-MtEventManager* Server::getEventManager()
+
+MtEventManager *Server::getEventManager()
{
return m_event;
}
-IWritableItemDefManager* Server::getWritableItemDefManager()
+IWritableItemDefManager *Server::getWritableItemDefManager()
{
return m_itemdef;
}
-IWritableNodeDefManager* Server::getWritableNodeDefManager()
+
+IWritableNodeDefManager *Server::getWritableNodeDefManager()
{
return m_nodedef;
}
-IWritableCraftDefManager* Server::getWritableCraftDefManager()
+
+IWritableCraftDefManager *Server::getWritableCraftDefManager()
{
return m_craftdef;
}
-const ModSpec* Server::getModSpec(const std::string &modname) const
+const ModSpec *Server::getModSpec(const std::string &modname) const
{
- for(std::vector<ModSpec>::const_iterator i = m_mods.begin();
- i != m_mods.end(); i++){
- const ModSpec &mod = *i;
- if(mod.name == modname)
+ std::vector<ModSpec>::const_iterator it;
+ for (it = m_mods.begin(); it != m_mods.end(); ++it) {
+ const ModSpec &mod = *it;
+ if (mod.name == modname)
return &mod;
}
return NULL;
}
+
void Server::getModNames(std::vector<std::string> &modlist)
{
- for(std::vector<ModSpec>::iterator i = m_mods.begin(); i != m_mods.end(); i++) {
- modlist.push_back(i->name);
- }
+ std::vector<ModSpec>::iterator it;
+ for (it = m_mods.begin(); it != m_mods.end(); ++it)
+ modlist.push_back(it->name);
}
+
std::string Server::getBuiltinLuaPath()
{
return porting::path_share + DIR_DELIM + "builtin";
diff --git a/src/server.h b/src/server.h
index 131c3c67b..877109a77 100644
--- a/src/server.h
+++ b/src/server.h
@@ -267,11 +267,11 @@ public:
void spawnParticle(const char *playername,
v3f pos, v3f velocity, v3f acceleration,
float expirationtime, float size,
- bool collisiondetection, bool vertical, std::string texture);
+ bool collisiondetection, bool vertical, const std::string &texture);
void spawnParticleAll(v3f pos, v3f velocity, v3f acceleration,
float expirationtime, float size,
- bool collisiondetection, bool vertical, std::string texture);
+ bool collisiondetection, bool vertical, const std::string &texture);
u32 addParticleSpawner(const char *playername,
u16 amount, float spawntime,
@@ -280,7 +280,7 @@ public:
v3f minacc, v3f maxacc,
float minexptime, float maxexptime,
float minsize, float maxsize,
- bool collisiondetection, bool vertical, std::string texture);
+ bool collisiondetection, bool vertical, const std::string &texture);
u32 addParticleSpawnerAll(u16 amount, float spawntime,
v3f minpos, v3f maxpos,
@@ -288,7 +288,7 @@ public:
v3f minacc, v3f maxacc,
float minexptime, float maxexptime,
float minsize, float maxsize,
- bool collisiondetection, bool vertical, std::string texture);
+ bool collisiondetection, bool vertical, const std::string &texture);
void deleteParticleSpawner(const char *playername, u32 id);
void deleteParticleSpawnerAll(u32 id);