aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-11-04 17:25:42 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-11-04 17:25:42 +0100
commit75ecaa2173f327c1453bd36c2601b0833ecb905f (patch)
treee11034378ea73cccb862851ae6eabd1248864d21 /src/script/lua_api
parent6ccb5835ff55d85156be91473c598eca9d6cb9a6 (diff)
downloaddragonfireclient-75ecaa2173f327c1453bd36c2601b0833ecb905f.tar.xz
Fix and run the Lint autocorrect script
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_clientobject.cpp7
-rw-r--r--src/script/lua_api/l_clientobject.h2
-rw-r--r--src/script/lua_api/l_inventoryaction.cpp45
-rw-r--r--src/script/lua_api/l_inventoryaction.h34
4 files changed, 44 insertions, 44 deletions
diff --git a/src/script/lua_api/l_clientobject.cpp b/src/script/lua_api/l_clientobject.cpp
index d88b538a1..05b3e2850 100644
--- a/src/script/lua_api/l_clientobject.cpp
+++ b/src/script/lua_api/l_clientobject.cpp
@@ -146,7 +146,7 @@ int ClientObjectRef::l_punch(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- PointedThing pointed(gcao->getId(), v3f(0,0,0), v3s16(0,0,0), 0);
+ PointedThing pointed(gcao->getId(), v3f(0, 0, 0), v3s16(0, 0, 0), 0);
getClient(L)->interact(INTERACT_START_DIGGING, pointed);
return 0;
}
@@ -155,7 +155,7 @@ int ClientObjectRef::l_rightclick(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- PointedThing pointed(gcao->getId(), v3f(0,0,0), v3s16(0,0,0), 0);
+ PointedThing pointed(gcao->getId(), v3f(0, 0, 0), v3s16(0, 0, 0), 0);
getClient(L)->interact(INTERACT_PLACE, pointed);
return 0;
}
@@ -223,6 +223,5 @@ luaL_Reg ClientObjectRef::methods[] = {luamethod(ClientObjectRef, get_pos),
luamethod(ClientObjectRef, get_attach),
luamethod(ClientObjectRef, get_nametag),
luamethod(ClientObjectRef, get_item_textures),
- luamethod(ClientObjectRef, get_max_hp),
- luamethod(ClientObjectRef, punch),
+ luamethod(ClientObjectRef, get_max_hp), luamethod(ClientObjectRef, punch),
luamethod(ClientObjectRef, rightclick), {0, 0}};
diff --git a/src/script/lua_api/l_clientobject.h b/src/script/lua_api/l_clientobject.h
index 521591444..a4516e047 100644
--- a/src/script/lua_api/l_clientobject.h
+++ b/src/script/lua_api/l_clientobject.h
@@ -60,7 +60,7 @@ private:
// is_player(self)
static int l_is_player(lua_State *L);
-
+
// is_local_player(self)
static int l_is_local_player(lua_State *L);
diff --git a/src/script/lua_api/l_inventoryaction.cpp b/src/script/lua_api/l_inventoryaction.cpp
index f3037ba83..f65137465 100644
--- a/src/script/lua_api/l_inventoryaction.cpp
+++ b/src/script/lua_api/l_inventoryaction.cpp
@@ -43,9 +43,9 @@ int LuaInventoryAction::l_apply(lua_State *L)
std::ostringstream os(std::ios::binary);
o->m_action->serialize(os);
-
+
std::istringstream is(os.str(), std::ios_base::binary);
-
+
InventoryAction *a = InventoryAction::deSerialize(is);
getClient(L)->inventoryAction(a);
@@ -69,29 +69,30 @@ int LuaInventoryAction::l_to(lua_State *L)
int LuaInventoryAction::l_craft(lua_State *L)
{
LuaInventoryAction *o = checkobject(L, 1);
-
+
if (o->m_action->getType() != IAction::Craft)
return 0;
-
+
std::string locStr;
InventoryLocation loc;
-
+
locStr = readParam<std::string>(L, 2);
-
+
try {
loc.deSerialize(locStr);
dynamic_cast<ICraftAction *>(o->m_action)->craft_inv = loc;
- } catch (SerializationError &) {}
-
+ } catch (SerializationError &) {
+ }
+
return 0;
}
int LuaInventoryAction::l_set_count(lua_State *L)
{
LuaInventoryAction *o = checkobject(L, 1);
-
+
s16 count = luaL_checkinteger(L, 2);
-
+
switch (o->m_action->getType()) {
case IAction::Move:
((IMoveAction *)o->m_action)->count = count;
@@ -103,7 +104,7 @@ int LuaInventoryAction::l_set_count(lua_State *L)
((ICraftAction *)o->m_action)->count = count;
break;
}
-
+
return 0;
}
@@ -127,23 +128,25 @@ LuaInventoryAction::~LuaInventoryAction()
delete m_action;
}
-void LuaInventoryAction::readFullInventoryLocationInto(lua_State *L, InventoryLocation *loc, std::string *list, s16 *index)
+void LuaInventoryAction::readFullInventoryLocationInto(
+ lua_State *L, InventoryLocation *loc, std::string *list, s16 *index)
{
try {
loc->deSerialize(readParam<std::string>(L, 2));
std::string l = readParam<std::string>(L, 3);
*list = l;
*index = luaL_checkinteger(L, 4) - 1;
- } catch (SerializationError &) {}
+ } catch (SerializationError &) {
+ }
}
int LuaInventoryAction::create_object(lua_State *L)
{
IAction type;
std::string typeStr;
-
+
typeStr = readParam<std::string>(L, 1);
-
+
if (typeStr == "move")
type = IAction::Move;
else if (typeStr == "drop")
@@ -206,11 +209,7 @@ void LuaInventoryAction::Register(lua_State *L)
}
const char LuaInventoryAction::className[] = "InventoryAction";
-const luaL_Reg LuaInventoryAction::methods[] = {
- luamethod(LuaInventoryAction, apply),
- luamethod(LuaInventoryAction, from),
- luamethod(LuaInventoryAction, to),
- luamethod(LuaInventoryAction, craft),
- luamethod(LuaInventoryAction, set_count),
- {0,0}
-};
+const luaL_Reg LuaInventoryAction::methods[] = {luamethod(LuaInventoryAction, apply),
+ luamethod(LuaInventoryAction, from), luamethod(LuaInventoryAction, to),
+ luamethod(LuaInventoryAction, craft),
+ luamethod(LuaInventoryAction, set_count), {0, 0}};
diff --git a/src/script/lua_api/l_inventoryaction.h b/src/script/lua_api/l_inventoryaction.h
index c1a96d010..a4cc6cbe5 100644
--- a/src/script/lua_api/l_inventoryaction.h
+++ b/src/script/lua_api/l_inventoryaction.h
@@ -20,44 +20,46 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "inventorymanager.h"
#include "lua_api/l_base.h"
-#define GET_MOVE_ACTION \
- LuaInventoryAction *o = checkobject(L, 1); \
- if (o->m_action->getType() == IAction::Craft) \
- return 0; \
+#define GET_MOVE_ACTION \
+ LuaInventoryAction *o = checkobject(L, 1); \
+ if (o->m_action->getType() == IAction::Craft) \
+ return 0; \
MoveAction *act = dynamic_cast<MoveAction *>(o->m_action);
-class LuaInventoryAction : public ModApiBase {
+class LuaInventoryAction : public ModApiBase
+{
private:
InventoryAction *m_action;
-
- static void readFullInventoryLocationInto(lua_State *L, InventoryLocation *loc, std::string *list, s16 *index);
-
+
+ static void readFullInventoryLocationInto(lua_State *L, InventoryLocation *loc,
+ std::string *list, s16 *index);
+
static const char className[];
static const luaL_Reg methods[];
-
+
// Exported functions
-
+
// garbage collector
static int gc_object(lua_State *L);
// __tostring metamethod
static int mt_tostring(lua_State *L);
-
+
// apply(self)
static int l_apply(lua_State *L);
-
+
// from(self, location, list, index)
static int l_from(lua_State *L);
-
+
// to(self, location, list, index)
static int l_to(lua_State *L);
-
+
// craft(self, location)
static int l_craft(lua_State *L);
// set_count(self, count)
static int l_set_count(lua_State *L);
-
+
public:
LuaInventoryAction(const IAction &type);
~LuaInventoryAction();
@@ -67,6 +69,6 @@ public:
static int create_object(lua_State *L);
// Not callable from Lua
static int create(lua_State *L, const IAction &type);
- static LuaInventoryAction* checkobject(lua_State *L, int narg);
+ static LuaInventoryAction *checkobject(lua_State *L, int narg);
static void Register(lua_State *L);
};