forked from Mirrorlandia_minetest/minetest
Fix overloading problems mentioned by clang
This commit is contained in:
parent
9d25242c5c
commit
595932a860
@ -507,7 +507,7 @@ void LuaEntitySAO::rightClick(ServerActiveObject *clicker)
|
||||
m_env->getScriptIface()->luaentity_Rightclick(m_id, clicker);
|
||||
}
|
||||
|
||||
void LuaEntitySAO::setPos(v3f pos)
|
||||
void LuaEntitySAO::setPos(const v3f &pos)
|
||||
{
|
||||
if(isAttached())
|
||||
return;
|
||||
@ -1078,26 +1078,31 @@ void PlayerSAO::moveTo(v3f pos, bool continuous)
|
||||
((Server*)m_env->getGameDef())->SendMovePlayer(m_peer_id);
|
||||
}
|
||||
|
||||
void PlayerSAO::setYaw(const float yaw, bool send_data)
|
||||
void PlayerSAO::setYaw(const float yaw)
|
||||
{
|
||||
if (m_player && yaw != m_yaw)
|
||||
m_player->setDirty(true);
|
||||
|
||||
UnitSAO::setYaw(yaw);
|
||||
}
|
||||
|
||||
// Datas should not be sent at player initialization
|
||||
if (send_data)
|
||||
void PlayerSAO::setYawAndSend(const float yaw)
|
||||
{
|
||||
setYaw(yaw);
|
||||
((Server*)m_env->getGameDef())->SendMovePlayer(m_peer_id);
|
||||
}
|
||||
|
||||
void PlayerSAO::setPitch(const float pitch, bool send_data)
|
||||
void PlayerSAO::setPitch(const float pitch)
|
||||
{
|
||||
if (m_player && pitch != m_pitch)
|
||||
m_player->setDirty(true);
|
||||
|
||||
m_pitch = pitch;
|
||||
}
|
||||
|
||||
if (send_data)
|
||||
void PlayerSAO::setPitchAndSend(const float pitch)
|
||||
{
|
||||
setPitch(pitch);
|
||||
((Server*)m_env->getGameDef())->SendMovePlayer(m_peer_id);
|
||||
}
|
||||
|
||||
@ -1173,13 +1178,8 @@ s16 PlayerSAO::readDamage()
|
||||
return damage;
|
||||
}
|
||||
|
||||
void PlayerSAO::setHP(s16 hp, bool direct)
|
||||
void PlayerSAO::setHP(s16 hp)
|
||||
{
|
||||
if (direct) {
|
||||
m_hp = hp;
|
||||
return;
|
||||
}
|
||||
|
||||
s16 oldhp = m_hp;
|
||||
|
||||
s16 hp_change = m_env->getScriptIface()->on_player_hpchange(this, hp - oldhp);
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
ServerActiveObject *puncher=NULL,
|
||||
float time_from_last_punch=1000000);
|
||||
void rightClick(ServerActiveObject *clicker);
|
||||
void setPos(v3f pos);
|
||||
void setPos(const v3f &pos);
|
||||
void moveTo(v3f pos, bool continuous);
|
||||
float getMinimumSavedMovement();
|
||||
std::string getDescription();
|
||||
@ -204,8 +204,12 @@ public:
|
||||
void setBasePosition(const v3f &position);
|
||||
void setPos(const v3f &pos);
|
||||
void moveTo(v3f pos, bool continuous);
|
||||
void setYaw(const float yaw, bool send_data = true);
|
||||
void setPitch(const float pitch, bool send_data = true);
|
||||
void setYaw(const float yaw);
|
||||
// Data should not be sent at player initialization
|
||||
void setYawAndSend(const float yaw);
|
||||
void setPitch(const float pitch);
|
||||
// Data should not be sent at player initialization
|
||||
void setPitchAndSend(const float pitch);
|
||||
f32 getPitch() const { return m_pitch; }
|
||||
f32 getRadPitch() const { return m_pitch * core::DEGTORAD; }
|
||||
// Deprecated
|
||||
@ -220,7 +224,8 @@ public:
|
||||
ServerActiveObject *puncher,
|
||||
float time_from_last_punch);
|
||||
void rightClick(ServerActiveObject *clicker);
|
||||
void setHP(s16 hp, bool direct = false);
|
||||
void setHP(s16 hp);
|
||||
void setHPRaw(s16 hp) { m_hp = hp; }
|
||||
s16 readDamage();
|
||||
u16 getBreath() const { return m_breath; }
|
||||
void setBreath(const u16 breath);
|
||||
|
@ -827,8 +827,8 @@ void Server::handleCommand_PlayerPos(NetworkPacket* pkt)
|
||||
|
||||
playersao->setBasePosition(position);
|
||||
player->setSpeed(speed);
|
||||
playersao->setPitch(pitch, false);
|
||||
playersao->setYaw(yaw, false);
|
||||
playersao->setPitch(pitch);
|
||||
playersao->setYaw(yaw);
|
||||
player->keyPressed = keyPressed;
|
||||
player->control.up = (keyPressed & 1);
|
||||
player->control.down = (keyPressed & 2);
|
||||
|
@ -131,9 +131,9 @@ void RemotePlayer::deSerialize(std::istream &is, const std::string &playername,
|
||||
|
||||
if (sao) {
|
||||
try {
|
||||
sao->setHP(args.getS32("hp"), true);
|
||||
sao->setHPRaw(args.getS32("hp"));
|
||||
} catch(SettingNotFoundException &e) {
|
||||
sao->setHP(PLAYER_MAX_HP, true);
|
||||
sao->setHPRaw(PLAYER_MAX_HP);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -141,10 +141,10 @@ void RemotePlayer::deSerialize(std::istream &is, const std::string &playername,
|
||||
} catch (SettingNotFoundException &e) {}
|
||||
|
||||
try {
|
||||
sao->setPitch(args.getFloat("pitch"), false);
|
||||
sao->setPitch(args.getFloat("pitch"));
|
||||
} catch (SettingNotFoundException &e) {}
|
||||
try {
|
||||
sao->setYaw(args.getFloat("yaw"), false);
|
||||
sao->setYaw(args.getFloat("yaw"));
|
||||
} catch (SettingNotFoundException &e) {}
|
||||
|
||||
try {
|
||||
|
@ -1090,7 +1090,7 @@ int ObjectRef::l_set_look_vertical(lua_State *L)
|
||||
if (co == NULL) return 0;
|
||||
float pitch = luaL_checknumber(L, 2) * core::RADTODEG;
|
||||
// Do it
|
||||
co->setPitch(pitch);
|
||||
co->setPitchAndSend(pitch);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1103,7 +1103,7 @@ int ObjectRef::l_set_look_horizontal(lua_State *L)
|
||||
if (co == NULL) return 0;
|
||||
float yaw = luaL_checknumber(L, 2) * core::RADTODEG;
|
||||
// Do it
|
||||
co->setYaw(yaw);
|
||||
co->setYawAndSend(yaw);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1121,7 +1121,7 @@ int ObjectRef::l_set_look_pitch(lua_State *L)
|
||||
if (co == NULL) return 0;
|
||||
float pitch = luaL_checknumber(L, 2) * core::RADTODEG;
|
||||
// Do it
|
||||
co->setPitch(pitch);
|
||||
co->setPitchAndSend(pitch);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1139,7 +1139,7 @@ int ObjectRef::l_set_look_yaw(lua_State *L)
|
||||
if (co == NULL) return 0;
|
||||
float yaw = luaL_checknumber(L, 2) * core::RADTODEG;
|
||||
// Do it
|
||||
co->setYaw(yaw);
|
||||
co->setYawAndSend(yaw);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,9 @@ void TestPlayer::testSave(IGameDef *gamedef)
|
||||
sao.initialize(&rplayer, std::set<std::string>());
|
||||
rplayer.setPlayerSAO(&sao);
|
||||
sao.setBreath(10);
|
||||
sao.setHP(8, true);
|
||||
sao.setYaw(0.1f, false);
|
||||
sao.setPitch(0.6f, false);
|
||||
sao.setHPRaw(8);
|
||||
sao.setYaw(0.1f);
|
||||
sao.setPitch(0.6f);
|
||||
sao.setBasePosition(v3f(450.2f, -15.7f, 68.1f));
|
||||
rplayer.save(".", gamedef);
|
||||
UASSERT(fs::PathExists("testplayer_save"));
|
||||
@ -65,9 +65,9 @@ void TestPlayer::testLoad(IGameDef *gamedef)
|
||||
sao.initialize(&rplayer, std::set<std::string>());
|
||||
rplayer.setPlayerSAO(&sao);
|
||||
sao.setBreath(10);
|
||||
sao.setHP(8, true);
|
||||
sao.setYaw(0.1f, false);
|
||||
sao.setPitch(0.6f, false);
|
||||
sao.setHPRaw(8);
|
||||
sao.setYaw(0.1f);
|
||||
sao.setPitch(0.6f);
|
||||
sao.setBasePosition(v3f(450.2f, -15.7f, 68.1f));
|
||||
rplayer.save(".", gamedef);
|
||||
UASSERT(fs::PathExists("testplayer_load"));
|
||||
|
Loading…
Reference in New Issue
Block a user