Fix compiler warnings

This commit is contained in:
Benau 2019-03-14 14:03:41 +08:00
parent 96d4ffb1f3
commit 92ffcb22bc
8 changed files with 11 additions and 15 deletions

View File

@ -599,7 +599,7 @@ void Attachment::updateGraphics(float dt)
World::getWorld()->getTicksSinceStart()) / 0.7f;
if (scale_ratio > 0.0f)
{
float scale = 0.3 * scale_ratio +
float scale = 0.3f * scale_ratio +
wanted_node_scale * (1.0f - scale_ratio);
m_node->setScale(core::vector3df(scale, scale, scale));
}

View File

@ -475,7 +475,7 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count)
// be the larger group (confirmed: when a new item was dropped
// by a remote kart; all_items: if an item is predicted on
// the client, but not yet confirmed). So
unsigned int max_index = std::max(m_confirmed_state.size(),
size_t max_index = std::max(m_confirmed_state.size(),
m_all_items.size() );
m_all_items.resize(max_index, NULL);

View File

@ -277,7 +277,7 @@ std::shared_ptr<Rewinder>
{
if (uid.size() != 6)
return nullptr;
BareNetworkString data(uid.data(), uid.size());
BareNetworkString data(uid.data(), (int)uid.size());
RewinderName rn = (RewinderName)data.getUInt8();
if (!(rn == RN_BOWLING || rn == RN_PLUNGER ||

View File

@ -70,8 +70,8 @@ public:
/** Resets all controls. */
void reset()
{
m_steer = 0.0f;
m_accel = 0.0f;
m_steer = 0;
m_accel = 0;
m_brake = false;
m_nitro = false;
m_skid = SC_NONE;
@ -93,10 +93,6 @@ public:
m_fire == other.m_fire &&
m_look_back == other.m_look_back;
} // operator==
// ------------------------------------------------------------------------
/** Return the serialised size in bytes. */
static int getLength() { return 9; }
// ------------------------------------------------------------------------
/** Copies the important data from this objects into a memory buffer. */
void saveState(BareNetworkString *buffer) const;

View File

@ -182,8 +182,8 @@ void RescueAnimation::updateGraphics(float dt)
float dur = stk_config->ticks2Time(
World::getWorld()->getTicksSinceStart() - m_created_ticks);
dur *= 25.0f;
float ref_dur =
Referee::m_st_last_rescue_frame - Referee::m_st_first_rescue_frame;
float ref_dur = (float)
(Referee::m_st_last_rescue_frame - Referee::m_st_first_rescue_frame);
float frame = std::fmod(dur, ref_dur);
frame += (float)Referee::m_st_first_rescue_frame;
m_referee->getSceneNode()->setCurrentFrame(frame);

View File

@ -1069,7 +1069,7 @@ std::pair<uint32_t, uint32_t> LinearWorld::getGameStartedProgress() const
std::numeric_limits<uint32_t>::max(),
std::numeric_limits<uint32_t>::max());
AbstractKart* slowest_kart = NULL;
for (unsigned i = m_karts.size(); i > 0; i--)
for (unsigned i = (unsigned)m_karts.size(); i > 0; i--)
{
slowest_kart = getKartAtPosition(i);
if (slowest_kart && !slowest_kart->isEliminated())

View File

@ -735,7 +735,7 @@ void SoccerWorld::enterRaceOverState()
// ----------------------------------------------------------------------------
void SoccerWorld::saveCompleteState(BareNetworkString* bns)
{
const unsigned red_scorers = m_red_scorers.size();
const unsigned red_scorers = (unsigned)m_red_scorers.size();
bns->addUInt32(red_scorers);
for (unsigned i = 0; i < red_scorers; i++)
{
@ -746,7 +746,7 @@ void SoccerWorld::saveCompleteState(BareNetworkString* bns)
.encodeString(m_red_scorers[i].m_player);
}
const unsigned blue_scorers = m_blue_scorers.size();
const unsigned blue_scorers = (unsigned)m_blue_scorers.size();
bns->addUInt32(blue_scorers);
for (unsigned i = 0; i < blue_scorers; i++)
{

View File

@ -1329,7 +1329,7 @@ void ClientLobby::changeSpectateTarget(PlayerAction action, int value,
});
}
const int num_karts = karts.size();
const int num_karts = (int)karts.size();
int current_idx = -1;
if (cam->getKart())
{