if(counter <= 0.0) {
counter = 2.0;
- Player *myplayer = m_env.getLocalPlayer();
+ LocalPlayer *myplayer = m_env.getLocalPlayer();
FATAL_ERROR_IF(myplayer == NULL, "Local player not found in environment.");
u16 proto_version_min = g_settings->getFlag("send_pre_v25_init") ?
{
// Do this every <interval> seconds after TOCLIENT_INVENTORY
// Reset the locally changed inventory to the authoritative inventory
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
player->inventory = *m_inventory_from_server;
m_inventory_updated = true;
}
void Client::sendChangePassword(const std::string &oldpassword,
const std::string &newpassword)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
if (player == NULL)
return;
void Client::sendPlayerItem(u16 item)
{
- Player *myplayer = m_env.getLocalPlayer();
+ LocalPlayer *myplayer = m_env.getLocalPlayer();
if(myplayer == NULL)
return;
// Copies the inventory of the local player to parameter
void Client::getLocalInventory(Inventory &dst)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
dst = player->inventory;
}
break;
case InventoryLocation::CURRENT_PLAYER:
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
return &player->inventory;
}
u16 Client::getHP()
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
return player->hp;
}
-u16 Client::getBreath()
-{
- Player *player = m_env.getLocalPlayer();
- assert(player != NULL);
- return player->getBreath();
-}
-
bool Client::getChatMessage(std::wstring &message)
{
if(m_chat_queue.size() == 0)
void setCrack(int level, v3s16 pos);
u16 getHP();
- u16 getBreath();
bool checkPrivilege(const std::string &priv) const
{ return (m_privileges.count(priv) != 0); }
if(m_nothing_to_send_pause_timer >= 0)
return;
- Player *player = env->getPlayer(peer_id);
+ RemotePlayer *player = env->getPlayer(peer_id);
// This can happen sometimes; clients and players are not in perfect sync.
- if(player == NULL)
+ if (player == NULL)
return;
// Won't send anything if already sending
void ClientInterface::UpdatePlayerList()
{
- if (m_env != NULL)
- {
+ if (m_env != NULL) {
std::vector<u16> clients = getClientIDs();
m_clients_names.clear();
if(!clients.empty())
infostream<<"Players:"<<std::endl;
- for(std::vector<u16>::iterator
- i = clients.begin();
- i != clients.end(); ++i) {
- Player *player = m_env->getPlayer(*i);
+ for (std::vector<u16>::iterator i = clients.begin(); i != clients.end(); ++i) {
+ RemotePlayer *player = m_env->getPlayer(*i);
if (player == NULL)
continue;
if(m_is_player)
{
- Player *player = m_env->getPlayer(m_name.c_str());
- if(player && player->isLocal())
- {
+ LocalPlayer *player = m_env->getPlayer(m_name.c_str());
+ if (player && player->isLocal()) {
m_is_local_player = true;
m_is_visible = false;
- LocalPlayer* localplayer = dynamic_cast<LocalPlayer*>(player);
+ LocalPlayer* localplayer = player;
assert( localplayer != NULL );
localplayer->setCAO(this);
}
}
-Player * Environment::getPlayer(u16 peer_id)
+Player *Environment::getPlayer(u16 peer_id)
{
- for(std::vector<Player*>::iterator i = m_players.begin();
+ for (std::vector<Player*>::iterator i = m_players.begin();
i != m_players.end(); ++i) {
Player *player = *i;
- if(player->peer_id == peer_id)
+ if (player->peer_id == peer_id)
return player;
}
return NULL;
}
-Player * Environment::getPlayer(const char *name)
+Player *Environment::getPlayer(const char *name)
{
- for(std::vector<Player*>::iterator i = m_players.begin();
+ for (std::vector<Player*>::iterator i = m_players.begin();
i != m_players.end(); ++i) {
Player *player = *i;
if(strcmp(player->getName(), name) == 0)
const std::string &str_reason, bool reconnect)
{
for (std::vector<Player*>::iterator it = m_players.begin();
- it != m_players.end();
- ++it) {
+ it != m_players.end(); ++it) {
((Server*)m_gamedef)->DenyAccessVerCompliant((*it)->peer_id,
- (*it)->protocol_version, (AccessDeniedCode)reason,
- str_reason, reconnect);
+ (*it)->protocol_version, reason, str_reason, reconnect);
}
}
player->save(players_path);
}
-Player *ServerEnvironment::loadPlayer(const std::string &playername)
+RemotePlayer *ServerEnvironment::loadPlayer(const std::string &playername)
{
bool newplayer = false;
bool found = false;
std::string players_path = m_path_world + DIR_DELIM "players" DIR_DELIM;
std::string path = players_path + playername;
- RemotePlayer *player = static_cast<RemotePlayer *>(getPlayer(playername.c_str()));
+ RemotePlayer *player = getPlayer(playername.c_str());
if (!player) {
player = new RemotePlayer(m_gamedef, "");
newplayer = true;
*/
{
ScopeProfiler sp(g_profiler, "SEnv: handle players avg", SPT_AVG);
- for(std::vector<Player*>::iterator i = m_players.begin();
- i != m_players.end(); ++i)
- {
- Player *player = *i;
+ for (std::vector<Player*>::iterator i = m_players.begin();
+ i != m_players.end(); ++i) {
+ RemotePlayer *player = dynamic_cast<RemotePlayer *>(*i);
+ assert(player);
// Ignore disconnected players
if(player->peer_id == 0)
Get player block positions
*/
std::vector<v3s16> players_blockpos;
- for(std::vector<Player*>::iterator
- i = m_players.begin();
+ for (std::vector<Player*>::iterator i = m_players.begin();
i != m_players.end(); ++i) {
- Player *player = *i;
+ RemotePlayer *player = dynamic_cast<RemotePlayer *>(*i);
+ assert(player);
// Ignore disconnected players
- if(player->peer_id == 0)
+ if (player->peer_id == 0)
continue;
v3s16 blockpos = getNodeBlockPos(
block->m_node_timers.step((float)dtime);
if (!elapsed_timers.empty()) {
MapNode n;
- for (std::vector<NodeTimer>::iterator
- i = elapsed_timers.begin();
+ for (std::vector<NodeTimer>::iterator i = elapsed_timers.begin();
i != elapsed_timers.end(); ++i) {
n = block->getNodeNoEx(i->position);
p = i->position + block->getPosRelative();
Finds out what new objects have been added to
inside a radius around a position
*/
-void ServerEnvironment::getAddedActiveObjects(Player *player, s16 radius,
+void ServerEnvironment::getAddedActiveObjects(RemotePlayer *player, s16 radius,
s16 player_radius,
std::set<u16> ¤t_objects,
std::queue<u16> &added_objects)
Finds out what objects have been removed from
inside a radius around a position
*/
-void ServerEnvironment::getRemovedActiveObjects(Player *player, s16 radius,
+void ServerEnvironment::getRemovedActiveObjects(RemotePlayer *player, s16 radius,
s16 player_radius,
std::set<u16> ¤t_objects,
std::queue<u16> &removed_objects)
ClientEnvironment::~ClientEnvironment()
{
// delete active objects
- for(std::map<u16, ClientActiveObject*>::iterator
- i = m_active_objects.begin();
- i != m_active_objects.end(); ++i)
- {
+ for (UNORDERED_MAP<u16, ClientActiveObject*>::iterator i = m_active_objects.begin();
+ i != m_active_objects.end(); ++i) {
delete i->second;
}
It is a failure if player is local and there already is a local
player
*/
- FATAL_ERROR_IF(player->isLocal() == true && getLocalPlayer() != NULL,
- "Player is local but there is already a local player");
+ FATAL_ERROR_IF(player->isLocal() && getLocalPlayer() != NULL,
+ "Player is local but there is already a local player");
Environment::addPlayer(player);
}
-LocalPlayer * ClientEnvironment::getLocalPlayer()
+LocalPlayer *ClientEnvironment::getLocalPlayer()
{
for(std::vector<Player*>::iterator i = m_players.begin();
i != m_players.end(); ++i) {
Player *player = *i;
- if(player->isLocal())
+ if (player->isLocal())
return (LocalPlayer*)player;
}
return NULL;
{
// Apply physics
- if(free_move == false && is_climbing == false)
+ if(!free_move && !is_climbing)
{
// Gravity
v3f speed = lplayer->getSpeed();
- if(lplayer->in_liquid == false)
+ if(!lplayer->in_liquid)
speed.Y -= lplayer->movement_gravity * lplayer->physics_override_gravity * dtime_part * 2;
// Liquid floating / sinking
/*
Stuff that can be done in an arbitarily large dtime
*/
- for(std::vector<Player*>::iterator i = m_players.begin();
+ for (std::vector<Player*>::iterator i = m_players.begin();
i != m_players.end(); ++i) {
- Player *player = *i;
+ LocalPlayer *player = dynamic_cast<LocalPlayer *>(*i);
+ assert(player);
/*
Handle non-local players
*/
- if(player->isLocal() == false) {
+ if (!player->isLocal()) {
// Move
player->move(dtime, this, 100*BS);
g_profiler->avg("CEnv: num of objects", m_active_objects.size());
bool update_lighting = m_active_object_light_update_interval.step(dtime, 0.21);
- for(std::map<u16, ClientActiveObject*>::iterator
- i = m_active_objects.begin();
- i != m_active_objects.end(); ++i)
- {
+ for (UNORDERED_MAP<u16, ClientActiveObject*>::iterator i = m_active_objects.begin();
+ i != m_active_objects.end(); ++i) {
ClientActiveObject* obj = i->second;
// Step object
obj->step(dtime, this);
ClientActiveObject* ClientEnvironment::getActiveObject(u16 id)
{
- std::map<u16, ClientActiveObject*>::iterator n;
- n = m_active_objects.find(id);
- if(n == m_active_objects.end())
+ UNORDERED_MAP<u16, ClientActiveObject*>::iterator n = m_active_objects.find(id);
+ if (n == m_active_objects.end())
return NULL;
return n->second;
}
-bool isFreeClientActiveObjectId(u16 id,
- std::map<u16, ClientActiveObject*> &objects)
+bool isFreeClientActiveObjectId(const u16 id,
+ UNORDERED_MAP<u16, ClientActiveObject*> &objects)
{
if(id == 0)
return false;
return objects.find(id) == objects.end();
}
-u16 getFreeClientActiveObjectId(
- std::map<u16, ClientActiveObject*> &objects)
+u16 getFreeClientActiveObjectId(UNORDERED_MAP<u16, ClientActiveObject*> &objects)
{
//try to reuse id's as late as possible
static u16 last_used_id = 0;
u16 startid = last_used_id;
- for(;;)
- {
+ for(;;) {
last_used_id ++;
- if(isFreeClientActiveObjectId(last_used_id, objects))
+ if (isFreeClientActiveObjectId(last_used_id, objects))
return last_used_id;
- if(last_used_id == startid)
+ if (last_used_id == startid)
return 0;
}
}
}
object->setId(new_id);
}
- if(isFreeClientActiveObjectId(object->getId(), m_active_objects) == false)
- {
+ if(!isFreeClientActiveObjectId(object->getId(), m_active_objects)) {
infostream<<"ClientEnvironment::addActiveObject(): "
<<"id is not free ("<<object->getId()<<")"<<std::endl;
delete object;
verbosestream<<"ClientEnvironment::removeActiveObject(): "
<<"id="<<id<<std::endl;
ClientActiveObject* obj = getActiveObject(id);
- if(obj == NULL)
- {
+ if (obj == NULL) {
infostream<<"ClientEnvironment::removeActiveObject(): "
<<"id="<<id<<" not found"<<std::endl;
return;
void ClientEnvironment::getActiveObjects(v3f origin, f32 max_d,
std::vector<DistanceSortedActiveObject> &dest)
{
- for(std::map<u16, ClientActiveObject*>::iterator
- i = m_active_objects.begin();
- i != m_active_objects.end(); ++i)
- {
+ for (UNORDERED_MAP<u16, ClientActiveObject*>::iterator i = m_active_objects.begin();
+ i != m_active_objects.end(); ++i) {
ClientActiveObject* obj = i->second;
f32 d = (obj->getPosition() - origin).getLength();
u32 m_added_objects;
protected:
- Player * getPlayer(u16 peer_id);
- Player * getPlayer(const char *name);
+ Player *getPlayer(u16 peer_id);
+ Player *getPlayer(const char *name);
// peer_ids in here should be unique, except that there may be many 0s
std::vector<Player*> m_players;
// Save players
void saveLoadedPlayers();
void savePlayer(RemotePlayer *player);
- Player *loadPlayer(const std::string &playername);
+ RemotePlayer *loadPlayer(const std::string &playername);
/*
Save and load time of day and game timer
Find out what new objects have been added to
inside a radius around a position
*/
- void getAddedActiveObjects(Player *player, s16 radius,
+ void getAddedActiveObjects(RemotePlayer *player, s16 radius,
s16 player_radius,
std::set<u16> ¤t_objects,
std::queue<u16> &added_objects);
Find out what new objects have been removed from
inside a radius around a position
*/
- void getRemovedActiveObjects(Player* player, s16 radius,
+ void getRemovedActiveObjects(RemotePlayer* player, s16 radius,
s16 player_radius,
std::set<u16> ¤t_objects,
std::queue<u16> &removed_objects);
ITextureSource *m_texturesource;
IGameDef *m_gamedef;
IrrlichtDevice *m_irr;
- std::map<u16, ClientActiveObject*> m_active_objects;
+ UNORDERED_MAP<u16, ClientActiveObject*> m_active_objects;
std::vector<ClientSimpleObject*> m_simple_objects;
std::queue<ClientEnvEvent> m_client_event_queue;
IntervalLimiter m_active_object_light_update_interval;
playerpos -= v3f(0, BS / 2, 0);
// Set player position
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
player->setPosition(playerpos);
// Set player position
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
player->setPosition(playerpos_f);
std::string datastring(pkt->getString(0), pkt->getSize());
std::istringstream is(datastring, std::ios_base::binary);
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
player->inventory.deSerialize(is);
void Client::handleCommand_Movement(NetworkPacket* pkt)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
float mad, maa, maf, msw, mscr, msf, mscl, msj, lf, lfs, ls, g;
void Client::handleCommand_HP(NetworkPacket* pkt)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
u8 oldhp = player->hp;
void Client::handleCommand_Breath(NetworkPacket* pkt)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
u16 breath;
void Client::handleCommand_MovePlayer(NetworkPacket* pkt)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
v3f pos;
void Client::handleCommand_InventoryFormSpec(NetworkPacket* pkt)
{
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
// Store formspec in LocalPlayer
*pkt >> flags >> mask;
- Player *player = m_env.getLocalPlayer();
+ LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
bool was_minimap_visible = player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE;
message += (wchar_t)tmp_wchar;
}
- Player *player = m_env->getPlayer(pkt->getPeerId());
+ RemotePlayer *player = m_env->getPlayer(pkt->getPeerId());
if (player == NULL) {
errorstream << "Server::ProcessData(): Canceling: "
"No player for peer_id=" << pkt->getPeerId()
newpwd += c;
}
- Player *player = m_env->getPlayer(pkt->getPeerId());
+ RemotePlayer *player = m_env->getPlayer(pkt->getPeerId());
if (player == NULL) {
errorstream << "Server::ProcessData(): Canceling: "
"No player for peer_id=" << pkt->getPeerId()
void Server::handleCommand_Respawn(NetworkPacket* pkt)
{
- Player *player = m_env->getPlayer(pkt->getPeerId());
+ RemotePlayer *player = m_env->getPlayer(pkt->getPeerId());
if (player == NULL) {
errorstream << "Server::ProcessData(): Canceling: "
"No player for peer_id=" << pkt->getPeerId()
{
NO_MAP_LOCK_REQUIRED
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL)
return 0;
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL)
return 0;
// Do it
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
lua_pushboolean(L, (player != NULL));
return 1;
}
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
lua_pushboolean(L, (player != NULL && player->peer_id != 0));
return 1;
}
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) {
lua_pushlstring(L, "", 0);
return 1;
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) {
lua_pushnil(L);
return 1;
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) return 0;
// Do it
float pitch = player->getRadPitchDep();
"Deprecated call to get_look_pitch, use get_look_vertical instead");
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) return 0;
// Do it
lua_pushnumber(L, player->getRadPitchDep());
"Deprecated call to get_look_yaw, use get_look_horizontal instead");
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) return 0;
// Do it
lua_pushnumber(L, player->getRadYawDep());
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) return 0;
// Do it
lua_pushnumber(L, player->getRadPitch());
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) return 0;
// Do it
lua_pushnumber(L, player->getRadYaw());
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) return 0;
std::string formspec = luaL_checkstring(L, 2);
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) return 0;
std::string formspec = player->inventory_formspec;
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) {
lua_pushlstring(L, "", 0);
return 1;
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL) {
lua_pushlstring(L, "", 0);
return 1;
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL)
return 0;
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL)
return 0;
{
NO_MAP_LOCK_REQUIRED;
ObjectRef *ref = checkobject(L, 1);
- Player *player = getplayer(ref);
+ RemotePlayer *player = getplayer(ref);
if (player == NULL)
return 0;
video::SColor bgcolor(255, 255, 255, 255);
if (client->getState() < CS_DefinitionsSent)
continue;
- Player *player = m_env->getPlayer(client->peer_id);
+ RemotePlayer *player = m_env->getPlayer(client->peer_id);
if (player == NULL) {
// This can happen if the client timeouts somehow
/*warningstream<<FUNCTION_NAME<<": Client "
void Server::SendMovePlayer(u16 peer_id)
{
DSTACK(FUNCTION_NAME);
- Player *player = m_env->getPlayer(peer_id);
+ RemotePlayer *player = m_env->getPlayer(peer_id);
assert(player);
NetworkPacket pkt(TOCLIENT_MOVE_PLAYER, sizeof(v3f) + sizeof(f32) * 2, peer_id);
}
void Server::SendPlayerPrivileges(u16 peer_id)
{
- Player *player = m_env->getPlayer(peer_id);
+ RemotePlayer *player = m_env->getPlayer(peer_id);
assert(player);
if(player->peer_id == PEER_ID_INEXISTENT)
return;
void Server::SendPlayerInventoryFormspec(u16 peer_id)
{
- Player *player = m_env->getPlayer(peer_id);
+ RemotePlayer *player = m_env->getPlayer(peer_id);
assert(player);
if(player->peer_id == PEER_ID_INEXISTENT)
return;
std::vector<u16> dst_clients;
if(params.to_player != "")
{
- Player *player = m_env->getPlayer(params.to_player.c_str());
+ RemotePlayer *player = m_env->getPlayer(params.to_player.c_str());
if(!player){
infostream<<"Server::playSound: Player \""<<params.to_player
<<"\" not found"<<std::endl;
else {
std::vector<u16> clients = m_clients.getClientIDs();
- for(std::vector<u16>::iterator
- i = clients.begin(); i != clients.end(); ++i) {
- Player *player = m_env->getPlayer(*i);
- if(!player)
+ for (std::vector<u16>::iterator i = clients.begin(); i != clients.end(); ++i) {
+ RemotePlayer *player = m_env->getPlayer(*i);
+ if (!player)
continue;
- if(pos_exists) {
+ if (pos_exists) {
if(player->getPosition().getDistanceFrom(pos) >
params.max_hear_distance)
continue;
i != clients.end(); ++i) {
if (far_players) {
// Get player
- if(Player *player = m_env->getPlayer(*i)) {
+ if (RemotePlayer *player = m_env->getPlayer(*i)) {
// If player is far away, only set modified blocks not sent
v3f player_pos = player->getPosition();
if(player_pos.getDistanceFrom(p_f) > maxd) {
if(far_players) {
// Get player
- if(Player *player = m_env->getPlayer(*i)) {
+ if (RemotePlayer *player = m_env->getPlayer(*i)) {
// If player is far away, only set modified blocks not sent
v3f player_pos = player->getPosition();
if(player_pos.getDistanceFrom(p_f) > maxd) {
for(std::vector<u16>::iterator i = clients.begin();
i != clients.end(); ++i) {
// Get player
- Player *player = m_env->getPlayer(*i);
- if(!player)
+ RemotePlayer *player = m_env->getPlayer(*i);
+ if (!player)
continue;
// Get name of player
std::string Server::getPlayerName(u16 peer_id)
{
- Player *player = m_env->getPlayer(peer_id);
- if(player == NULL)
+ RemotePlayer *player = m_env->getPlayer(peer_id);
+ if (player == NULL)
return "[id="+itos(peer_id)+"]";
return player->getName();
}
bool first = true;
os<<L", clients={";
std::vector<u16> clients = m_clients.getClientIDs();
- for(std::vector<u16>::iterator i = clients.begin();
- i != clients.end(); ++i) {
+ for (std::vector<u16>::iterator i = clients.begin(); i != clients.end(); ++i) {
// Get player
- Player *player = m_env->getPlayer(*i);
+ RemotePlayer *player = m_env->getPlayer(*i);
// Get name of player
std::wstring name = L"unknown";
- if(player != NULL)
+ if (player != NULL)
name = narrow_to_wide(player->getName());
// Add name to information string
if(!first)
std::vector<u16> clients = m_clients.getClientIDs();
for(std::vector<u16>::iterator i = clients.begin();
i != clients.end(); ++i) {
- Player *player = m_env->getPlayer(*i);
+ RemotePlayer *player = m_env->getPlayer(*i);
reportPrivsModified(player->getName());
}
} else {
- RemotePlayer *player =
- dynamic_cast<RemotePlayer *>(m_env->getPlayer(name.c_str()));
+ RemotePlayer *player = m_env->getPlayer(name.c_str());
if (!player)
return;
SendPlayerPrivileges(player->peer_id);
void Server::reportInventoryFormspecModified(const std::string &name)
{
- Player *player = m_env->getPlayer(name.c_str());
- if(!player)
+ RemotePlayer *player = m_env->getPlayer(name.c_str());
+ if (!player)
return;
SendPlayerInventoryFormspec(player->peer_id);
}
m_admin_chat->outgoing_queue.push_back(new ChatEventChat("", msg));
}
- Player *player = m_env->getPlayer(name);
+ RemotePlayer *player = m_env->getPlayer(name);
if (!player) {
return;
}
if (!m_env)
return false;
- Player *player = m_env->getPlayer(playername);
+ RemotePlayer *player = m_env->getPlayer(playername);
if (!player)
return false;
u16 peer_id = PEER_ID_INEXISTENT;
if (playername != "") {
- Player* player = m_env->getPlayer(playername.c_str());
+ RemotePlayer* player = m_env->getPlayer(playername.c_str());
if (!player)
return;
peer_id = player->peer_id;
u16 peer_id = PEER_ID_INEXISTENT;
if (playername != "") {
- Player* player = m_env->getPlayer(playername.c_str());
+ RemotePlayer* player = m_env->getPlayer(playername.c_str());
if (!player)
return -1;
peer_id = player->peer_id;
u16 peer_id = PEER_ID_INEXISTENT;
if (playername != "") {
- Player* player = m_env->getPlayer(playername.c_str());
+ RemotePlayer* player = m_env->getPlayer(playername.c_str());
if (!player)
return;
peer_id = player->peer_id;