mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-22 04:15:44 +02:00
Switch player names to std::string
This commit is contained in:
@@ -1594,7 +1594,7 @@ Inventory* Client::getInventory(const InventoryLocation &loc)
|
||||
{
|
||||
// Check if we are working with local player inventory
|
||||
LocalPlayer *player = m_env.getLocalPlayer();
|
||||
if (!player || strcmp(player->getName(), loc.name.c_str()) != 0)
|
||||
if (!player || player->getName() != loc.name)
|
||||
return NULL;
|
||||
return &player->inventory;
|
||||
}
|
||||
|
@@ -385,7 +385,7 @@ void GenericCAO::processInitData(const std::string &data)
|
||||
if (m_is_player) {
|
||||
// Check if it's the current player
|
||||
LocalPlayer *player = m_env->getLocalPlayer();
|
||||
if (player && strcmp(player->getName(), m_name.c_str()) == 0) {
|
||||
if (player && player->getName() == m_name) {
|
||||
m_is_local_player = true;
|
||||
m_is_visible = false;
|
||||
player->setCAO(this);
|
||||
|
@@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
#include "localplayer.h"
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include "mtevent.h"
|
||||
#include "collision.h"
|
||||
#include "nodedef.h"
|
||||
@@ -75,7 +76,7 @@ void PlayerSettings::settingsChangedCallback(const std::string &name, void *data
|
||||
LocalPlayer
|
||||
*/
|
||||
|
||||
LocalPlayer::LocalPlayer(Client *client, const char *name):
|
||||
LocalPlayer::LocalPlayer(Client *client, const std::string &name):
|
||||
Player(name, client->idef()),
|
||||
m_client(client)
|
||||
{
|
||||
|
@@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "constants.h"
|
||||
#include "settings.h"
|
||||
#include "lighting.h"
|
||||
#include <string>
|
||||
|
||||
class Client;
|
||||
class Environment;
|
||||
@@ -63,7 +64,8 @@ private:
|
||||
class LocalPlayer : public Player
|
||||
{
|
||||
public:
|
||||
LocalPlayer(Client *client, const char *name);
|
||||
|
||||
LocalPlayer(Client *client, const std::string &name);
|
||||
virtual ~LocalPlayer();
|
||||
|
||||
// Initialize hp to 0, so that no hearts will be shown if server
|
||||
|
Reference in New Issue
Block a user