From 107081988e3a529eb903cbc04538074293bbd0f2 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sat, 15 May 2021 21:32:06 +0200 Subject: [PATCH] Update code style to C++11 --- src/client.h | 30 +++++----- src/connection.cpp | 122 ++++++++++++++++++++-------------------- src/mods.cpp | 1 - src/mods.h | 3 +- src/scriptapi.cpp | 126 +++++++++++++++++++++--------------------- src/servercommand.cpp | 28 +++++----- 6 files changed, 154 insertions(+), 156 deletions(-) diff --git a/src/client.h b/src/client.h index efdf315..c3219f5 100644 --- a/src/client.h +++ b/src/client.h @@ -67,7 +67,7 @@ class MeshUpdateQueue MeshUpdateQueue(); ~MeshUpdateQueue(); - + /* peer_id=0 adds with nobody to send to */ @@ -82,7 +82,7 @@ class MeshUpdateQueue JMutexAutoLock lock(m_mutex); return m_queue.size(); } - + private: core::list m_queue; JMutex m_mutex; @@ -169,7 +169,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef IWritableItemDefManager *itemdef, IWritableNodeDefManager *nodedef ); - + ~Client(); /* The name of the local player should already be set when @@ -214,16 +214,16 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef const std::wstring newpassword); void sendDamage(u8 damage); void sendRespawn(); - + // locks envlock void removeNode(v3s16 p); // locks envlock void addNode(v3s16 p, MapNode n); - + void updateCamera(v3f pos, v3f dir, f32 fov); - + void renderPostFx(); - + // Returns InvalidPositionException if not found MapNode getNode(v3s16 p); // Wrapper to Map @@ -242,7 +242,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef bool getLocalInventoryUpdated(); // Copies the inventory of the local player to parameter void getLocalInventory(Inventory &dst); - + /* InventoryManager interface */ Inventory* getInventory(const InventoryLocation &loc); void inventoryAction(InventoryAction *a); @@ -269,7 +269,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef { try{ return m_con.GetPeerAvgRTT(PEER_ID_SERVER); - } catch(con::PeerNotFoundException){ + } catch(con::PeerNotFoundException &){ return 1337; } } @@ -306,7 +306,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef // Get event from queue. CE_NONE is returned if queue is empty. ClientEvent getClientEvent(); - + bool accessDenied() { return m_access_denied; } @@ -322,7 +322,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef { return m_itemdef_received; } bool nodedefReceived() { return m_nodedef_received; } - + void afterContentReceived(); float getRTT(void); @@ -335,20 +335,20 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef virtual u16 allocateUnknownNodeId(const std::string &name); private: - + // Virtual methods from con::PeerHandler void peerAdded(con::Peer *peer); void deletingPeer(con::Peer *peer, bool timeout); - + void ReceiveAll(); void Receive(); - + void sendPlayerPos(); // This sends the player's current name etc to the server void sendPlayerInfo(); // Send the item number 'item' as player item to the server void sendPlayerItem(u16 item); - + float m_packetcounter_timer; float m_connection_reinit_timer; float m_avg_rtt_timer; diff --git a/src/connection.cpp b/src/connection.cpp index 8f308c9..8beb84f 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -70,7 +70,7 @@ core::list > makeSplitPacket( { // Chunk packets, containing the TYPE_SPLIT header core::list > chunks; - + u32 chunk_header_size = 7; u32 maximum_data_size = chunksize_max - chunk_header_size; u32 start = 0; @@ -80,12 +80,12 @@ core::list > makeSplitPacket( end = start + maximum_data_size - 1; if(end > data.getSize() - 1) end = data.getSize() - 1; - + u32 payload_size = end - start + 1; u32 packet_size = chunk_header_size + payload_size; SharedBuffer chunk(packet_size); - + writeU8(&chunk[0], TYPE_SPLIT); writeU16(&chunk[1], seqnum); // [3] u16 chunk_count is written at next stage @@ -93,7 +93,7 @@ core::list > makeSplitPacket( memcpy(&chunk[chunk_header_size], &data[start], payload_size); chunks.push_back(chunk); - + start = end + 1; chunk_num++; } @@ -340,9 +340,9 @@ SharedBuffer IncomingSplitBuffer::insert(BufferedPacket &p, bool reliable) sp->reliable = reliable; m_buf[seqnum] = sp; } - + IncomingSplitPacket *sp = m_buf[seqnum]; - + // TODO: These errors should be thrown or something? Dunno. if(chunk_count != sp->chunk_count) derr_con<<"Connection: WARNING: chunk_count="< IncomingSplitBuffer::insert(BufferedPacket &p, bool reliable) // If chunk already exists, cancel if(sp->chunks.find(chunk_num) != NULL) throw AlreadyExistsException("Chunk already in buffer"); - + // Cut chunk data out of packet u32 chunkdatasize = p.data.getSize() - headersize; SharedBuffer chunkdata(chunkdatasize); memcpy(*chunkdata, &(p.data[headersize]), chunkdatasize); - + // Set chunk data in buffer sp->chunks[chunk_num] = chunkdata; - + // If not all chunks are received, return empty buffer if(sp->allReceived() == false) return SharedBuffer(); @@ -377,7 +377,7 @@ SharedBuffer IncomingSplitBuffer::insert(BufferedPacket &p, bool reliable) { totalsize += i.getNode()->getValue().getSize(); } - + SharedBuffer fulldata(totalsize); // Copy chunks to data buffer @@ -481,7 +481,7 @@ void Peer::reportRTT(float rtt) avg_rtt = rtt; else avg_rtt = rtt * 0.1 + avg_rtt * 0.9; - + // Calculate resend_timeout /*int reliable_count = 0; @@ -491,7 +491,7 @@ void Peer::reportRTT(float rtt) } float timeout = avg_rtt * RESEND_TIMEOUT_FACTOR * ((float)reliable_count * 1);*/ - + float timeout = avg_rtt * RESEND_TIMEOUT_FACTOR; if(timeout < RESEND_TIMEOUT_MIN) timeout = RESEND_TIMEOUT_MIN; @@ -499,7 +499,7 @@ void Peer::reportRTT(float rtt) timeout = RESEND_TIMEOUT_MAX; resend_timeout = timeout; } - + /* Connection */ @@ -547,14 +547,14 @@ void * Connection::Thread() log_register_thread("Connection"); dout_con<<"Connection thread started"< packetdata(packet_maxsize); bool single_wait_done = false; - + for(;;) { try{ @@ -689,12 +689,12 @@ void Connection::receive() continue; } } - + if(single_wait_done){ if(m_socket.WaitData(0) == false) break; } - + single_wait_done = true; Address sender; @@ -706,7 +706,7 @@ void Connection::receive() continue; if(readU32(&packetdata[0]) != m_protocol_id) continue; - + u16 peer_id = readPeerId(*packetdata); u8 channelnum = readChannel(*packetdata); if(channelnum > CHANNEL_COUNT-1){ @@ -719,7 +719,7 @@ void Connection::receive() { /* Somebody is trying to send stuff to us with no peer id. - + Check if the same address and port was added to our peer list before. Allow only entries that have has_sent_with_id==false. @@ -735,7 +735,7 @@ void Connection::receive() if(peer->address == sender) break; } - + /* If no peer was found with the same address and port, we shall assume it is a new peer and create an entry. @@ -754,7 +754,7 @@ void Connection::receive() <<"peer_id="<id, peer); - + // Create peer addition event ConnectionEvent e; e.peerAdded(peer_id_new, sender); putEvent(e); - + // Create CONTROL packet to tell the peer id to the new peer. SharedBuffer reply(4); writeU8(&reply[0], TYPE_CONTROL); writeU8(&reply[1], CONTROLTYPE_SET_PEER_ID); writeU16(&reply[2], peer_id_new); sendAsPacket(peer_id_new, 0, reply, true); - + // We're now talking to a valid peer_id peer_id = peer_id_new; @@ -833,27 +833,27 @@ void Connection::receive() " Ignoring."<timeout_counter = 0.0; Channel *channel = &(peer->channels[channelnum]); - + // Throw the received packet to channel->processPacket() // Make a new SharedBuffer from the data without the base headers SharedBuffer strippeddata(received_size - BASE_HEADER_SIZE); memcpy(*strippeddata, &packetdata[BASE_HEADER_SIZE], strippeddata.getSize()); - + try{ // Process it (the result is some data with no headers made by us) SharedBuffer resultdata = processPacket (channel, strippeddata, peer_id, channelnum, false); - + PrintInfo(); dout_con<<"ProcessPacket returned data of size " <getValue(); - + /* Check peer timeout */ @@ -898,12 +898,12 @@ void Connection::runTimeouts(float dtime) { core::list timed_outs; core::list::Iterator j; - + Channel *channel = &peer->channels[i]; // Remove timed out incomplete unreliable split packets channel->incoming_splits.removeUnreliableTimedOuts(dtime, m_timeout); - + // Increment reliable packet times channel->outgoing_reliables.incrementTimeouts(dtime); @@ -922,7 +922,7 @@ void Connection::runTimeouts(float dtime) } // Re-send timed out outgoing reliables - + timed_outs = channel-> outgoing_reliables.getTimedOuts(resend_timeout); @@ -953,7 +953,7 @@ void Connection::runTimeouts(float dtime) peer->reportRTT(resend_timeout); } } - + /* Send pings */ @@ -968,7 +968,7 @@ void Connection::runTimeouts(float dtime) peer->ping_timer = 0.0; } - + nextpeer: continue; } @@ -1007,9 +1007,9 @@ void Connection::connect(Address address) ConnectionEvent e; e.peerAdded(peer->id, peer->address); putEvent(e); - + m_socket.Bind(0); - + // Send a dummy packet to server with peer_id = PEER_ID_INEXISTENT m_peer_id = PEER_ID_INEXISTENT; SharedBuffer data(0); @@ -1024,7 +1024,7 @@ void Connection::disconnect() SharedBuffer data(2); writeU8(&data[0], TYPE_CONTROL); writeU8(&data[1], CONTROLTYPE_DISCO); - + // Send to all core::map::Iterator j; j = m_peers.getIterator(); @@ -1052,7 +1052,7 @@ void Connection::send(u16 peer_id, u8 channelnum, dout_con<incoming_reliables.empty() == false) { if(firstseqnum == channel->next_incoming_seqnum) { BufferedPacket p = channel->incoming_reliables.popFirst(); - + peer_id = readPeerId(*p.data); u8 channelnum = readChannel(*p.data); u16 seqnum = readU16(&p.data[BASE_HEADER_SIZE+1]); @@ -1236,7 +1236,7 @@ bool Connection::checkIncomingBuffers(Channel *channel, u16 &peer_id, <next_incoming_seqnum++; - + u32 headers_size = BASE_HEADER_SIZE + RELIABLE_HEADER_SIZE; // Get out the inside packet and re-process it SharedBuffer payload(p.data.getSize() - headers_size); @@ -1259,7 +1259,7 @@ SharedBuffer Connection::processPacket(Channel *channel, throw InvalidIncomingDataException("packetdata.getSize() < 1"); u8 type = readU8(&packetdata[0]); - + if(type == TYPE_CONTROL) { if(packetdata.getSize() < 2) @@ -1342,7 +1342,7 @@ SharedBuffer Connection::processPacket(Channel *channel, // the timeout counter PrintInfo(); dout_con<<"DISCO: Removing peer "<<(peer_id)< Connection::processPacket(Channel *channel, bool is_future_packet = seqnum_higher(seqnum, channel->next_incoming_seqnum); bool is_old_packet = seqnum_higher(channel->next_incoming_seqnum, seqnum); - + PrintInfo(); if(is_future_packet) dout_con<<"BUFFERING"; @@ -1420,7 +1420,7 @@ SharedBuffer Connection::processPacket(Channel *channel, dout_con<<" [sending CONTROLTYPE_ACK" " to peer_id="<incoming_reliables.size() < 100); @@ -1437,7 +1437,7 @@ SharedBuffer Connection::processPacket(Channel *channel, /*PrintInfo(); dout_con<<"Buffering reliable packet (seqnum=" < Connection::processPacket(Channel *channel, channelnum); try{ channel->incoming_reliables.insert(packet); - + /*PrintInfo(); dout_con<<"INCOMING: "; channel->incoming_reliables.print(); @@ -1482,7 +1482,7 @@ SharedBuffer Connection::processPacket(Channel *channel, derr_con<<"Got invalid type="<<((int)type&0xff)<::Node *node = m_peers.find(PEER_ID_SERVER); if(node == NULL) return false; - + if(m_peer_id == PEER_ID_INEXISTENT) return false; - + return true; } diff --git a/src/mods.cpp b/src/mods.cpp index db878d7..0eb233b 100644 --- a/src/mods.cpp +++ b/src/mods.cpp @@ -28,7 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc., // Get a dependency-sorted list of ModSpecs core::list getMods(core::list &modspaths) - throw(ModError) { std::queue mods_satisfied; core::list mods_unsorted; diff --git a/src/mods.h b/src/mods.h index e85ec2f..ed82c39 100644 --- a/src/mods.h +++ b/src/mods.h @@ -59,8 +59,7 @@ struct ModSpec }; // Get a dependency-sorted list of ModSpecs -core::list getMods(core::list &modspaths) - throw(ModError); +core::list getMods(core::list &modspaths); #endif diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index 5d68793..26d4ea7 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -139,14 +139,14 @@ static Server* get_server(lua_State *L) return server; } -static ServerEnvironment* get_env(lua_State *L) +/*static ServerEnvironment* get_env(lua_State *L) { // Get environment from registry lua_getfield(L, LUA_REGISTRYINDEX, "minetest_env"); ServerEnvironment *env = (ServerEnvironment*)lua_touserdata(L, -1); lua_pop(L, 1); return env; -} +}*/ static void objectref_get(lua_State *L, u16 id) { @@ -871,7 +871,7 @@ static ContentFeatures read_content_features(lua_State *L, int index) f.alpha = getintfield_default(L, index, "alpha", 255); /* Other stuff */ - + lua_getfield(L, index, "post_effect_color"); if(!lua_isnil(L, -1)) f.post_effect_color = readARGB8(L, -1); @@ -893,7 +893,7 @@ static ContentFeatures read_content_features(lua_State *L, int index) "deprecated: use 'drop' field"); warn_if_field_exists(L, index, "extra_dug_item_rarity", "deprecated: use 'drop' field"); - + // True for all ground-like things like stone and mud, false for eg. trees getboolfield(L, index, "is_ground_content", f.is_ground_content); f.light_propagates = (f.param_type == CPT_LIGHT); @@ -930,7 +930,7 @@ static ContentFeatures read_content_features(lua_State *L, int index) "light_source", f.light_source); f.damage_per_second = getintfield_default(L, index, "damage_per_second", f.damage_per_second); - + lua_getfield(L, index, "selection_box"); if(lua_istable(L, -1)){ f.selection_box.type = (NodeBoxType)getenumfield(L, -1, "type", @@ -1060,7 +1060,7 @@ class LuaItemStack static const luaL_reg methods[]; // Exported functions - + // garbage collector static int gc_object(lua_State *L) { @@ -1313,7 +1313,7 @@ class LuaItemStack { return m_stack; } - + // LuaItemStack(itemstack or itemstring or table or nil) // Creates an LuaItemStack and leaves it on top of stack static int create_object(lua_State *L) @@ -1463,7 +1463,7 @@ class InvRef if(!ud) luaL_typerror(L, narg, className); return *(InvRef**)ud; // unbox pointer } - + static Inventory* getinv(lua_State *L, InvRef *ref) { return get_server(L)->getInventory(ref->m_loc); @@ -1483,9 +1483,9 @@ class InvRef // Inform other things that the inventory has changed get_server(L)->setInventoryModified(ref->m_loc); } - + // Exported functions - + // garbage collector static int gc_object(lua_State *L) { InvRef *o = *(InvRef **)(lua_touserdata(L, 1)); @@ -1752,7 +1752,7 @@ class NodeMetaRef if(!ud) luaL_typerror(L, narg, className); return *(NodeMetaRef**)ud; // unbox pointer } - + static NodeMetadata* getmeta(NodeMetaRef *ref) { NodeMetadata *meta = ref->m_env->getMap().getNodeMetadata(ref->m_p); @@ -1783,9 +1783,9 @@ class NodeMetaRef block->raiseModified(MOD_STATE_WRITE_NEEDED, "NodeMetaRef::reportMetadataChange"); } - + // Exported functions - + // garbage collector static int gc_object(lua_State *L) { NodeMetaRef *o = *(NodeMetaRef **)(lua_touserdata(L, 1)); @@ -1883,7 +1883,7 @@ class NodeMetaRef } /* IGenericNodeMetadata interface */ - + // set_infotext(self, text) static int l_set_infotext(lua_State *L) { @@ -2128,13 +2128,13 @@ class ObjectRef if(!ud) luaL_typerror(L, narg, className); return *(ObjectRef**)ud; // unbox pointer } - + static ServerActiveObject* getobject(ObjectRef *ref) { ServerActiveObject *co = ref->m_object; return co; } - + static LuaEntitySAO* getluaobject(ObjectRef *ref) { ServerActiveObject *obj = getobject(ref); @@ -2144,7 +2144,7 @@ class ObjectRef return NULL; return (LuaEntitySAO*)obj; } - + static ServerRemotePlayer* getplayer(ObjectRef *ref) { ServerActiveObject *obj = getobject(ref); @@ -2154,9 +2154,9 @@ class ObjectRef return NULL; return static_cast(obj); } - + // Exported functions - + // garbage collector static int gc_object(lua_State *L) { ObjectRef *o = *(ObjectRef **)(lua_touserdata(L, 1)); @@ -2175,7 +2175,7 @@ class ObjectRef co->m_removed = true; return 0; } - + // getpos(self) // returns: {x=num, y=num, z=num} static int l_getpos(lua_State *L) @@ -2193,7 +2193,7 @@ class ObjectRef lua_setfield(L, -2, "z"); return 1; } - + // setpos(self, pos) static int l_setpos(lua_State *L) { @@ -2211,7 +2211,7 @@ class ObjectRef get_server(L)->SendMovePlayer(player); return 0; } - + // moveto(self, pos, continuous=false) static int l_moveto(lua_State *L) { @@ -2365,7 +2365,7 @@ class ObjectRef co->setVelocity(pos); return 0; } - + // getvelocity(self) static int l_getvelocity(lua_State *L) { @@ -2377,7 +2377,7 @@ class ObjectRef pushFloatPos(L, v); return 1; } - + // setacceleration(self, {x=num, y=num, z=num}) static int l_setacceleration(lua_State *L) { @@ -2390,7 +2390,7 @@ class ObjectRef co->setAcceleration(pos); return 0; } - + // getacceleration(self) static int l_getacceleration(lua_State *L) { @@ -2402,7 +2402,7 @@ class ObjectRef pushFloatPos(L, v); return 1; } - + // setyaw(self, radians) static int l_setyaw(lua_State *L) { @@ -2415,7 +2415,7 @@ class ObjectRef co->setYaw(yaw); return 0; } - + // getyaw(self) static int l_getyaw(lua_State *L) { @@ -2427,7 +2427,7 @@ class ObjectRef lua_pushnumber(L, yaw); return 1; } - + // settexturemod(self, mod) static int l_settexturemod(lua_State *L) { @@ -2439,7 +2439,7 @@ class ObjectRef co->setTextureMod(mod); return 0; } - + // setsprite(self, p={x=0,y=0}, num_frames=1, framelength=0.2, // select_horiz_by_yawpitch=false) static int l_setsprite(lua_State *L) @@ -2476,7 +2476,7 @@ class ObjectRef lua_pushstring(L, name.c_str()); return 1; } - + // get_luaentity(self) static int l_get_luaentity(lua_State *L) { @@ -2487,9 +2487,9 @@ class ObjectRef luaentity_get(L, co->getId()); return 1; } - + /* Player-only */ - + // get_player_name(self) static int l_get_player_name(lua_State *L) { @@ -2503,7 +2503,7 @@ class ObjectRef lua_pushstring(L, player->getName()); return 1; } - + // get_look_dir(self) static int l_get_look_dir(lua_State *L) { @@ -2572,7 +2572,7 @@ class ObjectRef ObjectRef *o = checkobject(L, -1); o->m_object = NULL; } - + static void Register(lua_State *L) { lua_newtable(L); @@ -2666,7 +2666,7 @@ class EnvRef if(!ud) luaL_typerror(L, narg, className); return *(EnvRef**)ud; // unbox pointer } - + // Exported functions // EnvRef:add_node(pos, node) @@ -2947,7 +2947,7 @@ class EnvRef EnvRef *o = checkobject(L, -1); o->m_env = NULL; } - + static void Register(lua_State *L) { lua_newtable(L); @@ -3040,7 +3040,7 @@ class LuaABM : public ActiveBlockModifier u32 active_object_count, u32 active_object_count_wider) { lua_State *L = m_lua; - + realitycheck(L); assert(lua_checkstack(L, 20)); StackUnroller stack_unroller(L); @@ -3056,7 +3056,7 @@ class LuaABM : public ActiveBlockModifier lua_gettable(L, registered_abms); if(lua_isnil(L, -1)) assert(0); - + // Call action luaL_checktype(L, -1, LUA_TTABLE); lua_getfield(L, -1, "action"); @@ -3152,9 +3152,9 @@ static int l_register_alias_raw(lua_State *L) // Get the writable item definition manager from the server IWritableItemDefManager *idef = get_server(L)->getWritableItemDefManager(); - + idef->registerAlias(name, convert_to); - + return 0; /* number of results */ } @@ -3263,7 +3263,7 @@ static int l_register_craft(lua_State *L) // Get the writable craft definition manager from the server IWritableCraftDefManager *craftdef = get_server(L)->getWritableCraftDefManager(); - + std::string type = getstringfield_default(L, table, "type", "shaped"); /* @@ -3471,7 +3471,7 @@ static int l_get_inventory(lua_State *L) v3s16 pos = check_v3s16(L, -1); loc.setNodeMeta(pos); } - + if(get_server(L)->getInventory(loc) != NULL) InvRef::create(L, loc); else @@ -3564,12 +3564,12 @@ void scriptapi_export(lua_State *L, Server *server) lua_newtable(L); luaL_register(L, NULL, minetest_f); lua_setglobal(L, "minetest"); - + // Get the main minetest table lua_getglobal(L, "minetest"); // Add tables to minetest - + lua_newtable(L); lua_setfield(L, -2, "object_refs"); lua_newtable(L); @@ -3595,7 +3595,7 @@ bool scriptapi_loadmod(lua_State *L, const std::string &scriptpath, <<"Only chararacters [a-z0-9_] are allowed."<addActiveBlockModifier(abm); // removes value, keeps key for next iteration @@ -3734,7 +3734,7 @@ void scriptapi_add_object_reference(lua_State *L, ServerActiveObject *cobj) lua_getfield(L, -1, "object_refs"); luaL_checktype(L, -1, LUA_TTABLE); int objectstable = lua_gettop(L); - + // object_refs[id] = object lua_pushnumber(L, cobj->getId()); // Push id lua_pushvalue(L, object); // Copy object to top of stack @@ -3753,7 +3753,7 @@ void scriptapi_rm_object_reference(lua_State *L, ServerActiveObject *cobj) lua_getfield(L, -1, "object_refs"); luaL_checktype(L, -1, LUA_TTABLE); int objectstable = lua_gettop(L); - + // Get object_refs[id] lua_pushnumber(L, cobj->getId()); // Push id lua_gettable(L, objectstable); @@ -3831,7 +3831,7 @@ void scriptapi_on_dieplayer(lua_State *L, ServerActiveObject *player) realitycheck(L); assert(lua_checkstack(L, 20)); StackUnroller stack_unroller(L); - + // Get minetest.registered_on_dieplayers lua_getglobal(L, "minetest"); lua_getfield(L, -1, "registered_on_dieplayers"); @@ -4115,7 +4115,7 @@ bool scriptapi_luaentity_add(lua_State *L, u16 id, const char *name, infostream<<"scriptapi_luaentity_add: id="<physical); getfloatfield(L, -1, "weight", prop->weight); @@ -4244,7 +4244,7 @@ void scriptapi_luaentity_get_properties(lua_State *L, u16 id, lua_pop(L, 1); getstringfield(L, -1, "visual", prop->visual); - + lua_getfield(L, -1, "visual_size"); if(lua_istable(L, -1)) prop->visual_size = read_v2f(L, -1); @@ -4266,7 +4266,7 @@ void scriptapi_luaentity_get_properties(lua_State *L, u16 id, } } lua_pop(L, 1); - + lua_getfield(L, -1, "spritediv"); if(lua_istable(L, -1)) prop->spritediv = read_v2s16(L, -1); diff --git a/src/servercommand.cpp b/src/servercommand.cpp index e2e84ba..8ef4d11 100644 --- a/src/servercommand.cpp +++ b/src/servercommand.cpp @@ -54,14 +54,14 @@ void cmd_privs(std::wostringstream &os, os<env->getPlayer(wide_to_narrow(ctx->parms[1]).c_str()); if(tp == NULL) { os<server->getPlayerAuthPrivs(tp->getName()))); } @@ -93,7 +93,7 @@ void cmd_grantrevoke(std::wostringstream &os, os<parms[1]); u64 privs = ctx->server->getPlayerAuthPrivs(playername); @@ -122,9 +122,9 @@ void cmd_grantrevoke(std::wostringstream &os, msg += L"\""; ctx->server->notifyPlayer(playername.c_str(), msg); } - + ctx->server->setPlayerAuthPrivs(playername, privs); - + os<server->requestShutdown(); - + os<flags |= SEND_TO_OTHERS; } @@ -183,12 +183,12 @@ void cmd_setting(std::wostringstream &os, ctx->parms[1] + L" = " + ctx->params[2]);*/ std::string confline = wide_to_narrow(ctx->paramstring); - + actionstream<player->getName() <<" sets: "<parseConfigLine(confline); - + ctx->server->saveConfig(); os<< L"-!- Setting changed and configuration saved."; @@ -255,7 +255,7 @@ void cmd_banunban(std::wostringstream &os, ServerCommandContext *ctx) os<server->getPeerAddress(player->peer_id); std::string ip_string = address.serializeString(); @@ -265,7 +265,7 @@ void cmd_banunban(std::wostringstream &os, ServerCommandContext *ctx) actionstream<player->getName()<<" bans " <getName()<<" / "<player->getName() <<" clears all objects"<env->clearAllObjects(); - + actionstream<<"object clearing done"<flags |= SEND_TO_OTHERS; } @@ -412,7 +412,7 @@ std::wstring processServerCommand(ServerCommandContext *ctx) cmd_clearobjects(os, ctx); else os<parms[0]; - + return os.str(); } -- 2.44.0