Fixed 64-bit related compiler warnings.

This commit is contained in:
hiker 2017-04-07 23:43:01 +10:00
parent 668fdd3b49
commit 5af4ea35a7
12 changed files with 21 additions and 20 deletions

View File

@ -55,7 +55,8 @@ Camera::CameraType Camera::m_default_type = Camera::CM_TYPE_NORMAL;
*/
Camera* Camera::createCamera(AbstractKart* kart)
{
Camera *camera = createCamera(m_all_cameras.size(), m_default_type, kart);
Camera *camera = createCamera((int)m_all_cameras.size(),
m_default_type, kart );
m_all_cameras.push_back(camera);
return camera;
} // createCamera(kart)

View File

@ -110,7 +110,7 @@ public:
void clearButtons();
/** Returns the number of created buttons */
unsigned int getButtonsCount() {return m_buttons.size();}
unsigned int getButtonsCount() { return (unsigned int)m_buttons.size();}
/** Returns pointer to the selected button */
MultitouchButton* getButton(unsigned int i) {return m_buttons.at(i);}

View File

@ -817,7 +817,7 @@ float Kart::getSpeedForTurnRadius(float radius) const
{
InterpolationArray turn_angle_at_speed = m_kart_properties->getTurnRadius();
// Convert the turn radius into turn angle
for(std::size_t i = 0; i < turn_angle_at_speed.size(); i++)
for(int i = 0; i < (int)turn_angle_at_speed.size(); i++)
turn_angle_at_speed.setY(i, sin(m_kart_properties->getWheelBase() /
turn_angle_at_speed.getY(i)));
@ -831,7 +831,7 @@ float Kart::getMaxSteerAngle(float speed) const
{
InterpolationArray turn_angle_at_speed = m_kart_properties->getTurnRadius();
// Convert the turn radius into turn angle
for(std::size_t i = 0; i < turn_angle_at_speed.size(); i++)
for(int i = 0; i < (int)turn_angle_at_speed.size(); i++)
turn_angle_at_speed.setY(i, sin(m_kart_properties->getWheelBase() /
turn_angle_at_speed.getY(i)));

View File

@ -251,7 +251,7 @@ void FollowTheLeaderRace::terminateRace()
endSetKartPositions();
// Mark all still racing karts to be finished.
for (int i = m_karts.size(); i>0; i--)
for (int i = (int)m_karts.size(); i>0; i--)
{
AbstractKart *kart = getKartAtPosition(i);
if (kart->isEliminated() || kart->hasFinishedRace())

View File

@ -626,7 +626,7 @@ void SoccerWorld::enterRaceOverState()
std::sort(m_goal_frame.begin(), m_goal_frame.end());
const int mean = std::accumulate(m_goal_frame.begin(),
m_goal_frame.end(), 0) / m_goal_frame.size();
m_goal_frame.end(), 0) / (int)m_goal_frame.size();
// Prevent overflow if there is a large frame in vector
double squared_sum = 0;
@ -668,9 +668,9 @@ void SoccerWorld::enterRaceOverState()
}
int red_goal = ((int(m_red_scorers.size()) - blue_own_goal) >= 0 ?
m_red_scorers.size() - blue_own_goal : 0);
(int)m_red_scorers.size() - blue_own_goal : 0);
int blue_goal = ((int(m_blue_scorers.size()) - red_own_goal) >= 0 ?
m_blue_scorers.size() - red_own_goal : 0);
(int)m_blue_scorers.size() - red_own_goal : 0);
Log::verbose("Soccer AI profiling", "Red goal: %d, Red own goal: %d,"
"Blue goal: %d, Blue own goal: %d", red_goal, red_own_goal,

View File

@ -660,7 +660,7 @@ void ThreeStrikesBattle::spawnSpareTireKarts()
if (ratio < 1.5f) return;
unsigned int spawn_sta = unsigned(ratio);
if (spawn_sta > m_spare_tire_karts.size())
spawn_sta = m_spare_tire_karts.size();
spawn_sta = (int)m_spare_tire_karts.size();
m_race_gui->addMessage(_P("%i spare tire kart has been spawned!",
"%i spare tire karts have been spawned!",
spawn_sta), NULL, 2.0f);
@ -719,15 +719,15 @@ void ThreeStrikesBattle::loadCustomModels()
// Compute a random kart list
std::vector<std::string> sta_list;
kart_properties_manager->getRandomKartList(pos.size(), NULL,
&sta_list);
kart_properties_manager->getRandomKartList((int)pos.size(), NULL,
&sta_list);
assert(sta_list.size() == pos.size());
// Now add them
for (unsigned int i = 0; i < pos.size(); i++)
{
AbstractKart* sta = new Kart(sta_list[i], m_karts.size(),
m_karts.size() + 1, pos[i], PLAYER_DIFFICULTY_NORMAL,
AbstractKart* sta = new Kart(sta_list[i], (int)m_karts.size(),
(int)m_karts.size() + 1, pos[i], PLAYER_DIFFICULTY_NORMAL,
KRT_RED);
sta->init(RaceManager::KartType::KT_SPARE_TIRE);
sta->setController(new SpareTireAI(sta));

View File

@ -53,7 +53,7 @@ Protocol::~Protocol()
/** Returns a network string with the given type.
* \capacity Default preallocated size for the message.
*/
NetworkString* Protocol::getNetworkString(int capacity)
NetworkString* Protocol::getNetworkString(size_t capacity)
{
return new NetworkString(m_type, capacity);
} // getNetworkString

View File

@ -128,7 +128,7 @@ public:
virtual void asynchronousUpdate() = 0;
/// functions to check incoming data easily
NetworkString* getNetworkString(int capacity=16);
NetworkString* getNetworkString(size_t capacity=16);
bool checkDataSize(Event* event, unsigned int minimum_size);
void sendMessageToPeersChangingToken(NetworkString *message,
bool reliable = true);

View File

@ -499,9 +499,9 @@ bool GrandPrixData::isEditable() const
unsigned int GrandPrixData::getNumberOfTracks(bool includeLocked) const
{
if (includeLocked)
return m_tracks.size();
return (unsigned int)m_tracks.size();
else
return getTrackNames(false).size();
return (unsigned int)getTrackNames(false).size();
} // getNumberOfTracks
// ----------------------------------------------------------------------------

View File

@ -53,7 +53,7 @@ namespace Scripting
/** Get total number of challenges */
int getChallengeCount()
{
return ::Track::getCurrentTrack()->getChallengeList().size();
return (int)::Track::getCurrentTrack()->getChallengeList().size();
} // getChallengeCount
// --------------------------------------------------------------------

View File

@ -342,7 +342,7 @@ void ArenasScreen::buildTrackList()
if (m_unsupported_arena.size() > 0)
w->setText( _P("%d arena unavailable in single player.",
"%d arenas unavailable in single player.",
m_unsupported_arena.size()) );
(int)m_unsupported_arena.size()) );
}
// ------------------------------------------------------------------------------------------------------

View File

@ -137,7 +137,7 @@ void GPInfoScreen::beforeAddingWidget()
race_manager->getMinorMode(),
race_manager->getNumLocalPlayers());
int tracks = m_gp.getTrackNames().size();
int tracks = (int)m_gp.getTrackNames().size();
bool continue_visible = saved_gp && saved_gp->getNextTrack() > 0 &&
saved_gp->getNextTrack() < tracks;