Update code style to C++11
parent
b41a2e9ba2
commit
107081988e
30
src/client.h
30
src/client.h
|
@ -67,7 +67,7 @@ public:
|
|||
MeshUpdateQueue();
|
||||
|
||||
~MeshUpdateQueue();
|
||||
|
||||
|
||||
/*
|
||||
peer_id=0 adds with nobody to send to
|
||||
*/
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
JMutexAutoLock lock(m_mutex);
|
||||
return m_queue.size();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
core::list<QueuedMeshUpdate*> m_queue;
|
||||
JMutex m_mutex;
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
IWritableItemDefManager *itemdef,
|
||||
IWritableNodeDefManager *nodedef
|
||||
);
|
||||
|
||||
|
||||
~Client();
|
||||
/*
|
||||
The name of the local player should already be set when
|
||||
|
@ -214,16 +214,16 @@ public:
|
|||
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 @@ public:
|
|||
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 @@ public:
|
|||
{
|
||||
try{
|
||||
return m_con.GetPeerAvgRTT(PEER_ID_SERVER);
|
||||
} catch(con::PeerNotFoundException){
|
||||
} catch(con::PeerNotFoundException &){
|
||||
return 1337;
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ public:
|
|||
|
||||
// Get event from queue. CE_NONE is returned if queue is empty.
|
||||
ClientEvent getClientEvent();
|
||||
|
||||
|
||||
bool accessDenied()
|
||||
{ return m_access_denied; }
|
||||
|
||||
|
@ -322,7 +322,7 @@ public:
|
|||
{ return m_itemdef_received; }
|
||||
bool nodedefReceived()
|
||||
{ return m_nodedef_received; }
|
||||
|
||||
|
||||
void afterContentReceived();
|
||||
|
||||
float getRTT(void);
|
||||
|
@ -335,20 +335,20 @@ public:
|
|||
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;
|
||||
|
|
|
@ -70,7 +70,7 @@ core::list<SharedBuffer<u8> > makeSplitPacket(
|
|||
{
|
||||
// Chunk packets, containing the TYPE_SPLIT header
|
||||
core::list<SharedBuffer<u8> > chunks;
|
||||
|
||||
|
||||
u32 chunk_header_size = 7;
|
||||
u32 maximum_data_size = chunksize_max - chunk_header_size;
|
||||
u32 start = 0;
|
||||
|
@ -80,12 +80,12 @@ core::list<SharedBuffer<u8> > 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<u8> 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<SharedBuffer<u8> > makeSplitPacket(
|
|||
memcpy(&chunk[chunk_header_size], &data[start], payload_size);
|
||||
|
||||
chunks.push_back(chunk);
|
||||
|
||||
|
||||
start = end + 1;
|
||||
chunk_num++;
|
||||
}
|
||||
|
@ -340,9 +340,9 @@ SharedBuffer<u8> 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="<<chunk_count
|
||||
|
@ -356,15 +356,15 @@ SharedBuffer<u8> 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<u8> 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<u8>();
|
||||
|
@ -377,7 +377,7 @@ SharedBuffer<u8> IncomingSplitBuffer::insert(BufferedPacket &p, bool reliable)
|
|||
{
|
||||
totalsize += i.getNode()->getValue().getSize();
|
||||
}
|
||||
|
||||
|
||||
SharedBuffer<u8> 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"<<std::endl;
|
||||
|
||||
|
||||
u32 curtime = porting::getTimeMs();
|
||||
u32 lasttime = curtime;
|
||||
|
||||
while(getRun())
|
||||
{
|
||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||
|
||||
|
||||
lasttime = curtime;
|
||||
curtime = porting::getTimeMs();
|
||||
float dtime = (float)(curtime - lasttime) / 1000.;
|
||||
|
@ -562,7 +562,7 @@ void * Connection::Thread()
|
|||
dtime = 0.1;
|
||||
if(dtime < 0.0)
|
||||
dtime = 0.0;
|
||||
|
||||
|
||||
runTimeouts(dtime);
|
||||
|
||||
while(m_command_queue.size() != 0){
|
||||
|
@ -573,7 +573,7 @@ void * Connection::Thread()
|
|||
send(dtime);
|
||||
|
||||
receive();
|
||||
|
||||
|
||||
END_DEBUG_EXCEPTION_HANDLER(derr_con);
|
||||
}
|
||||
|
||||
|
@ -673,7 +673,7 @@ void Connection::receive()
|
|||
SharedBuffer<u8> 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="<<peer_id<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
The peer was not found in our lists. Add it.
|
||||
*/
|
||||
|
@ -792,19 +792,19 @@ void Connection::receive()
|
|||
// Create a peer
|
||||
Peer *peer = new Peer(peer_id_new, sender);
|
||||
m_peers.insert(peer->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<u8> 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."<<std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
peer->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<u8> 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<u8> resultdata = processPacket
|
||||
(channel, strippeddata, peer_id, channelnum, false);
|
||||
|
||||
|
||||
PrintInfo();
|
||||
dout_con<<"ProcessPacket returned data of size "
|
||||
<<resultdata.getSize()<<std::endl;
|
||||
|
||||
|
||||
ConnectionEvent e;
|
||||
e.dataReceived(peer_id, resultdata);
|
||||
putEvent(e);
|
||||
|
@ -875,7 +875,7 @@ void Connection::runTimeouts(float dtime)
|
|||
for(; j.atEnd() == false; j++)
|
||||
{
|
||||
Peer *peer = j.getNode()->getValue();
|
||||
|
||||
|
||||
/*
|
||||
Check peer timeout
|
||||
*/
|
||||
|
@ -898,12 +898,12 @@ void Connection::runTimeouts(float dtime)
|
|||
{
|
||||
core::list<BufferedPacket> timed_outs;
|
||||
core::list<BufferedPacket>::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<u8> data(0);
|
||||
|
@ -1024,7 +1024,7 @@ void Connection::disconnect()
|
|||
SharedBuffer<u8> data(2);
|
||||
writeU8(&data[0], TYPE_CONTROL);
|
||||
writeU8(&data[1], CONTROLTYPE_DISCO);
|
||||
|
||||
|
||||
// Send to all
|
||||
core::map<u16, Peer*>::Iterator j;
|
||||
j = m_peers.getIterator();
|
||||
|
@ -1052,7 +1052,7 @@ void Connection::send(u16 peer_id, u8 channelnum,
|
|||
dout_con<<getDesc()<<" sending to peer_id="<<peer_id<<std::endl;
|
||||
|
||||
assert(channelnum < CHANNEL_COUNT);
|
||||
|
||||
|
||||
Peer *peer = getPeerNoEx(peer_id);
|
||||
if(peer == NULL)
|
||||
return;
|
||||
|
@ -1065,13 +1065,13 @@ void Connection::send(u16 peer_id, u8 channelnum,
|
|||
core::list<SharedBuffer<u8> > originals;
|
||||
originals = makeAutoSplitPacket(data, chunksize_max,
|
||||
channel->next_outgoing_split_seqnum);
|
||||
|
||||
|
||||
core::list<SharedBuffer<u8> >::Iterator i;
|
||||
i = originals.begin();
|
||||
for(; i != originals.end(); i++)
|
||||
{
|
||||
SharedBuffer<u8> original = *i;
|
||||
|
||||
|
||||
sendAsPacket(peer_id, channelnum, original, reliable);
|
||||
}
|
||||
}
|
||||
|
@ -1101,7 +1101,7 @@ void Connection::rawSendAsPacket(u16 peer_id, u8 channelnum,
|
|||
// Add base headers and make a packet
|
||||
BufferedPacket p = makePacket(peer->address, reliable,
|
||||
m_protocol_id, m_peer_id, channelnum);
|
||||
|
||||
|
||||
try{
|
||||
// Buffer the packet
|
||||
channel->outgoing_reliables.insert(p);
|
||||
|
@ -1114,7 +1114,7 @@ void Connection::rawSendAsPacket(u16 peer_id, u8 channelnum,
|
|||
"in outgoing buffer"<<std::endl;
|
||||
//assert(0);
|
||||
}
|
||||
|
||||
|
||||
// Send the packet
|
||||
rawSend(p);
|
||||
}
|
||||
|
@ -1215,15 +1215,15 @@ bool Connection::checkIncomingBuffers(Channel *channel, u16 &peer_id,
|
|||
break;
|
||||
}
|
||||
// This happens if all packets are old
|
||||
}catch(con::NotFoundException)
|
||||
}catch(con::NotFoundException &)
|
||||
{}
|
||||
|
||||
|
||||
if(channel->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,
|
|||
<<std::endl;
|
||||
|
||||
channel->next_incoming_seqnum++;
|
||||
|
||||
|
||||
u32 headers_size = BASE_HEADER_SIZE + RELIABLE_HEADER_SIZE;
|
||||
// Get out the inside packet and re-process it
|
||||
SharedBuffer<u8> payload(p.data.getSize() - headers_size);
|
||||
|
@ -1259,7 +1259,7 @@ SharedBuffer<u8> 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<u8> Connection::processPacket(Channel *channel,
|
|||
// the timeout counter
|
||||
PrintInfo();
|
||||
dout_con<<"DISCO: Removing peer "<<(peer_id)<<std::endl;
|
||||
|
||||
|
||||
if(deletePeer(peer_id, false) == false)
|
||||
{
|
||||
PrintInfo(derr_con);
|
||||
|
@ -1407,7 +1407,7 @@ SharedBuffer<u8> 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<u8> Connection::processPacket(Channel *channel,
|
|||
dout_con<<" [sending CONTROLTYPE_ACK"
|
||||
" to peer_id="<<peer_id<<"]";
|
||||
dout_con<<std::endl;
|
||||
|
||||
|
||||
//DEBUG
|
||||
//assert(channel->incoming_reliables.size() < 100);
|
||||
|
||||
|
@ -1437,7 +1437,7 @@ SharedBuffer<u8> Connection::processPacket(Channel *channel,
|
|||
/*PrintInfo();
|
||||
dout_con<<"Buffering reliable packet (seqnum="
|
||||
<<seqnum<<")"<<std::endl;*/
|
||||
|
||||
|
||||
// This one comes later, buffer it.
|
||||
// Actually we have to make a packet to buffer one.
|
||||
// Well, we have all the ingredients, so just do it.
|
||||
|
@ -1449,7 +1449,7 @@ SharedBuffer<u8> Connection::processPacket(Channel *channel,
|
|||
channelnum);
|
||||
try{
|
||||
channel->incoming_reliables.insert(packet);
|
||||
|
||||
|
||||
/*PrintInfo();
|
||||
dout_con<<"INCOMING: ";
|
||||
channel->incoming_reliables.print();
|
||||
|
@ -1482,7 +1482,7 @@ SharedBuffer<u8> Connection::processPacket(Channel *channel,
|
|||
derr_con<<"Got invalid type="<<((int)type&0xff)<<std::endl;
|
||||
throw InvalidIncomingDataException("Invalid packet type");
|
||||
}
|
||||
|
||||
|
||||
// We should never get here.
|
||||
// If you get here, add an exception or a return to some of the
|
||||
// above conditionals.
|
||||
|
@ -1494,7 +1494,7 @@ bool Connection::deletePeer(u16 peer_id, bool timeout)
|
|||
{
|
||||
if(m_peers.find(peer_id) == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
Peer *peer = m_peers[peer_id];
|
||||
|
||||
// Create event
|
||||
|
@ -1555,14 +1555,14 @@ bool Connection::Connected()
|
|||
|
||||
if(m_peers.size() != 1)
|
||||
return false;
|
||||
|
||||
|
||||
core::map<u16, Peer*>::Node *node = m_peers.find(PEER_ID_SERVER);
|
||||
if(node == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
if(m_peer_id == PEER_ID_INEXISTENT)
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ModSpec> getMods(core::list<std::string> &modspaths)
|
||||
throw(ModError)
|
||||
{
|
||||
std::queue<ModSpec> mods_satisfied;
|
||||
core::list<ModSpec> mods_unsorted;
|
||||
|
|
|
@ -59,8 +59,7 @@ struct ModSpec
|
|||
};
|
||||
|
||||
// Get a dependency-sorted list of ModSpecs
|
||||
core::list<ModSpec> getMods(core::list<std::string> &modspaths)
|
||||
throw(ModError);
|
||||
core::list<ModSpec> getMods(core::list<std::string> &modspaths);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -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 @@ private:
|
|||
static const luaL_reg methods[];
|
||||
|
||||
// Exported functions
|
||||
|
||||
|
||||
// garbage collector
|
||||
static int gc_object(lua_State *L)
|
||||
{
|
||||
|
@ -1313,7 +1313,7 @@ public:
|
|||
{
|
||||
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 @@ private:
|
|||
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 @@ private:
|
|||
// 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 @@ private:
|
|||
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 @@ private:
|
|||
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 @@ private:
|
|||
}
|
||||
|
||||
/* IGenericNodeMetadata interface */
|
||||
|
||||
|
||||
// set_infotext(self, text)
|
||||
static int l_set_infotext(lua_State *L)
|
||||
{
|
||||
|
@ -2128,13 +2128,13 @@ private:
|
|||
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 @@ private:
|
|||
return NULL;
|
||||
return (LuaEntitySAO*)obj;
|
||||
}
|
||||
|
||||
|
||||
static ServerRemotePlayer* getplayer(ObjectRef *ref)
|
||||
{
|
||||
ServerActiveObject *obj = getobject(ref);
|
||||
|
@ -2154,9 +2154,9 @@ private:
|
|||
return NULL;
|
||||
return static_cast<ServerRemotePlayer*>(obj);
|
||||
}
|
||||
|
||||
|
||||
// Exported functions
|
||||
|
||||
|
||||
// garbage collector
|
||||
static int gc_object(lua_State *L) {
|
||||
ObjectRef *o = *(ObjectRef **)(lua_touserdata(L, 1));
|
||||
|
@ -2175,7 +2175,7 @@ private:
|
|||
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 @@ private:
|
|||
lua_setfield(L, -2, "z");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// setpos(self, pos)
|
||||
static int l_setpos(lua_State *L)
|
||||
{
|
||||
|
@ -2211,7 +2211,7 @@ private:
|
|||
get_server(L)->SendMovePlayer(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// moveto(self, pos, continuous=false)
|
||||
static int l_moveto(lua_State *L)
|
||||
{
|
||||
|
@ -2365,7 +2365,7 @@ private:
|
|||
co->setVelocity(pos);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// getvelocity(self)
|
||||
static int l_getvelocity(lua_State *L)
|
||||
{
|
||||
|
@ -2377,7 +2377,7 @@ private:
|
|||
pushFloatPos(L, v);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// setacceleration(self, {x=num, y=num, z=num})
|
||||
static int l_setacceleration(lua_State *L)
|
||||
{
|
||||
|
@ -2390,7 +2390,7 @@ private:
|
|||
co->setAcceleration(pos);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// getacceleration(self)
|
||||
static int l_getacceleration(lua_State *L)
|
||||
{
|
||||
|
@ -2402,7 +2402,7 @@ private:
|
|||
pushFloatPos(L, v);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// setyaw(self, radians)
|
||||
static int l_setyaw(lua_State *L)
|
||||
{
|
||||
|
@ -2415,7 +2415,7 @@ private:
|
|||
co->setYaw(yaw);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// getyaw(self)
|
||||
static int l_getyaw(lua_State *L)
|
||||
{
|
||||
|
@ -2427,7 +2427,7 @@ private:
|
|||
lua_pushnumber(L, yaw);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// settexturemod(self, mod)
|
||||
static int l_settexturemod(lua_State *L)
|
||||
{
|
||||
|
@ -2439,7 +2439,7 @@ private:
|
|||
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 @@ private:
|
|||
lua_pushstring(L, name.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// get_luaentity(self)
|
||||
static int l_get_luaentity(lua_State *L)
|
||||
{
|
||||
|
@ -2487,9 +2487,9 @@ private:
|
|||
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 @@ private:
|
|||
lua_pushstring(L, player->getName());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// get_look_dir(self)
|
||||
static int l_get_look_dir(lua_State *L)
|
||||
{
|
||||
|
@ -2572,7 +2572,7 @@ public:
|
|||
ObjectRef *o = checkobject(L, -1);
|
||||
o->m_object = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void Register(lua_State *L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
@ -2666,7 +2666,7 @@ private:
|
|||
if(!ud) luaL_typerror(L, narg, className);
|
||||
return *(EnvRef**)ud; // unbox pointer
|
||||
}
|
||||
|
||||
|
||||
// Exported functions
|
||||
|
||||
// EnvRef:add_node(pos, node)
|
||||
|
@ -2947,7 +2947,7 @@ public:
|
|||
EnvRef *o = checkobject(L, -1);
|
||||
o->m_env = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void Register(lua_State *L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
@ -3040,7 +3040,7 @@ public:
|
|||
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 @@ public:
|
|||
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."<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool success = false;
|
||||
|
||||
try{
|
||||
|
@ -3639,7 +3639,7 @@ void scriptapi_add_environment(lua_State *L, ServerEnvironment *env)
|
|||
lua_getfield(L, -1, "registered_abms");
|
||||
luaL_checktype(L, -1, LUA_TTABLE);
|
||||
int registered_abms = lua_gettop(L);
|
||||
|
||||
|
||||
if(lua_istable(L, registered_abms)){
|
||||
int table = lua_gettop(L);
|
||||
lua_pushnil(L);
|
||||
|
@ -3690,7 +3690,7 @@ void scriptapi_add_environment(lua_State *L, ServerEnvironment *env)
|
|||
|
||||
LuaABM *abm = new LuaABM(L, id, trigger_contents,
|
||||
required_neighbors, trigger_interval, trigger_chance);
|
||||
|
||||
|
||||
env->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="<<id<<" name=\""
|
||||
<<name<<"\""<<std::endl;
|
||||
StackUnroller stack_unroller(L);
|
||||
|
||||
|
||||
// Get minetest.registered_entities[name]
|
||||
lua_getglobal(L, "minetest");
|
||||
lua_getfield(L, -1, "registered_entities");
|
||||
|
@ -4130,7 +4130,7 @@ bool scriptapi_luaentity_add(lua_State *L, u16 id, const char *name,
|
|||
}
|
||||
int prototype_table = lua_gettop(L);
|
||||
//dump2(L, "prototype_table");
|
||||
|
||||
|
||||
// Create entity object
|
||||
lua_newtable(L);
|
||||
int object = lua_gettop(L);
|
||||
|
@ -4138,7 +4138,7 @@ bool scriptapi_luaentity_add(lua_State *L, u16 id, const char *name,
|
|||
// Set object metatable
|
||||
lua_pushvalue(L, prototype_table);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
|
||||
// Add object reference
|
||||
// This should be userdata with metatable ObjectRef
|
||||
objectref_get(L, id);
|
||||
|
@ -4154,7 +4154,7 @@ bool scriptapi_luaentity_add(lua_State *L, u16 id, const char *name,
|
|||
lua_pushnumber(L, id); // Push id
|
||||
lua_pushvalue(L, object); // Copy object to top of stack
|
||||
lua_settable(L, -3);
|
||||
|
||||
|
||||
// Get on_activate function
|
||||
lua_pushvalue(L, object);
|
||||
lua_getfield(L, -1, "on_activate");
|
||||
|
@ -4167,7 +4167,7 @@ bool scriptapi_luaentity_add(lua_State *L, u16 id, const char *name,
|
|||
script_error(L, "error running function %s:on_activate: %s\n",
|
||||
name, lua_tostring(L, -1));
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4182,12 +4182,12 @@ void scriptapi_luaentity_rm(lua_State *L, u16 id)
|
|||
lua_getfield(L, -1, "luaentities");
|
||||
luaL_checktype(L, -1, LUA_TTABLE);
|
||||
int objectstable = lua_gettop(L);
|
||||
|
||||
|
||||
// Set luaentities[id] = nil
|
||||
lua_pushnumber(L, id); // Push id
|
||||
lua_pushnil(L);
|
||||
lua_settable(L, objectstable);
|
||||
|
||||
|
||||
lua_pop(L, 2); // pop luaentities, minetest
|
||||
}
|
||||
|
||||
|
@ -4201,20 +4201,20 @@ std::string scriptapi_luaentity_get_staticdata(lua_State *L, u16 id)
|
|||
// Get minetest.luaentities[id]
|
||||
luaentity_get(L, id);
|
||||
int object = lua_gettop(L);
|
||||
|
||||
|
||||
// Get get_staticdata function
|
||||
lua_pushvalue(L, object);
|
||||
lua_getfield(L, -1, "get_staticdata");
|
||||
if(lua_isnil(L, -1))
|
||||
return "";
|
||||
|
||||
|
||||
luaL_checktype(L, -1, LUA_TFUNCTION);
|
||||
lua_pushvalue(L, object); // self
|
||||
// Call with 1 arguments, 1 results
|
||||
if(lua_pcall(L, 1, 1, 0))
|
||||
script_error(L, "error running function get_staticdata: %s\n",
|
||||
lua_tostring(L, -1));
|
||||
|
||||
|
||||
size_t len=0;
|
||||
const char *s = lua_tolstring(L, -1, &len);
|
||||
return std::string(s, len);
|
||||
|
@ -4233,7 +4233,7 @@ void scriptapi_luaentity_get_properties(lua_State *L, u16 id,
|
|||
//int object = lua_gettop(L);
|
||||
|
||||
/* Read stuff */
|
||||
|
||||
|
||||
getboolfield(L, -1, "physical", prop->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);
|
||||
|
|
|
@ -54,14 +54,14 @@ void cmd_privs(std::wostringstream &os,
|
|||
os<<L"-!- You don't have permission to do that";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Player *tp = ctx->env->getPlayer(wide_to_narrow(ctx->parms[1]).c_str());
|
||||
if(tp == NULL)
|
||||
{
|
||||
os<<L"-!- No such player";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
os<<L"-!- " + narrow_to_wide(privsToString(ctx->server->getPlayerAuthPrivs(tp->getName())));
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ void cmd_grantrevoke(std::wostringstream &os,
|
|||
os<<L"-!- No such player";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::string playername = wide_to_narrow(ctx->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<<L"-!- Privileges change to ";
|
||||
os<<narrow_to_wide(privsToString(privs));
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ void cmd_shutdown(std::wostringstream &os,
|
|||
<<" shuts down server"<<std::endl;
|
||||
|
||||
ctx->server->requestShutdown();
|
||||
|
||||
|
||||
os<<L"*** Server shutting down (operator request)";
|
||||
ctx->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<<ctx->player->getName()
|
||||
<<" sets: "<<confline<<std::endl;
|
||||
|
||||
g_settings->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<<L"-!- No such player";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
Address address = ctx->server->getPeerAddress(player->peer_id);
|
||||
std::string ip_string = address.serializeString();
|
||||
|
@ -265,7 +265,7 @@ void cmd_banunban(std::wostringstream &os, ServerCommandContext *ctx)
|
|||
|
||||
actionstream<<ctx->player->getName()<<" bans "
|
||||
<<player->getName()<<" / "<<ip_string<<std::endl;
|
||||
} catch(con::PeerNotFoundException){
|
||||
} catch(con::PeerNotFoundException &){
|
||||
dstream<<__FUNCTION_NAME<<": peer was not found"<<std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ void cmd_clearobjects(std::wostringstream &os,
|
|||
|
||||
actionstream<<ctx->player->getName()
|
||||
<<" clears all objects"<<std::endl;
|
||||
|
||||
|
||||
{
|
||||
std::wstring msg;
|
||||
msg += L"Clearing all objects. This may take long.";
|
||||
|
@ -355,9 +355,9 @@ void cmd_clearobjects(std::wostringstream &os,
|
|||
}
|
||||
|
||||
ctx->env->clearAllObjects();
|
||||
|
||||
|
||||
actionstream<<"object clearing done"<<std::endl;
|
||||
|
||||
|
||||
os<<L"*** cleared all objects";
|
||||
ctx->flags |= SEND_TO_OTHERS;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ std::wstring processServerCommand(ServerCommandContext *ctx)
|
|||
cmd_clearobjects(os, ctx);
|
||||
else
|
||||
os<<L"-!- Invalid command: " + ctx->parms[0];
|
||||
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue