1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Code modernization: subfolders (#6283)

* Code modernization: subfolders

Modernize various code on subfolders client, network, script, threading, unittests, util

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Make connection.cpp readable in a pointed place + typo
This commit is contained in:
Loïc Blot 2017-08-19 22:23:47 +02:00 committed by GitHub
parent 7528986e44
commit 88b436e6a9
49 changed files with 398 additions and 518 deletions

View file

@ -67,7 +67,7 @@ int LuaItemStack::l_set_name(lua_State *L)
bool status = true;
item.name = luaL_checkstring(L, 2);
if (item.name == "" || item.empty()) {
if (item.name.empty() || item.empty()) {
item.clear();
status = false;
}
@ -231,12 +231,11 @@ int LuaItemStack::l_to_table(lua_State *L)
lua_newtable(L);
const StringMap &fields = item.metadata.getStrings();
for (StringMap::const_iterator it = fields.begin();
it != fields.end(); ++it) {
const std::string &name = it->first;
for (const auto &field : fields) {
const std::string &name = field.first;
if (name.empty())
continue;
const std::string &value = it->second;
const std::string &value = field.second;
lua_pushlstring(L, name.c_str(), name.size());
lua_pushlstring(L, value.c_str(), value.size());
lua_settable(L, -3);
@ -391,10 +390,6 @@ LuaItemStack::LuaItemStack(const ItemStack &item):
{
}
LuaItemStack::~LuaItemStack()
{
}
const ItemStack& LuaItemStack::getItem() const
{
return m_stack;