diff --git a/lib/wiiuse/definitions_os.h b/lib/wiiuse/definitions_os.h index 4ba6e3e77..00271c86f 100644 --- a/lib/wiiuse/definitions_os.h +++ b/lib/wiiuse/definitions_os.h @@ -42,8 +42,14 @@ #ifdef _MSC_VER #include /* windows with visual c */ - #define isnan(x) (_isnan(x)) - #define isinf(x) (!_finite(x)) + #include // For isnan etc, otherwise we get duplicated defines + +#ifndef isnan + #define isnan(x) (_isnan(x)) +#endif +#ifndef isinf + #define isinf(x) (!_finite(x)) +#endif /* disable warnings I don't care about */ /*#pragma warning(disable:4273) */ /* inconsistent dll linkage */ #endif diff --git a/lib/wiiuse/ir.c b/lib/wiiuse/ir.c index 25137fbc2..17c0d672e 100644 --- a/lib/wiiuse/ir.c +++ b/lib/wiiuse/ir.c @@ -709,7 +709,7 @@ static float ir_distance(struct ir_dot_t* dot) { xd = dot[i2].x - dot[i1].x; yd = dot[i2].y - dot[i1].y; - return sqrtf(xd * xd + yd * yd); + return sqrtf((float)(xd * xd + yd * yd)); } diff --git a/src/achievements/achievement_info.cpp b/src/achievements/achievement_info.cpp index 1fea398b1..9bad98eeb 100644 --- a/src/achievements/achievement_info.cpp +++ b/src/achievements/achievement_info.cpp @@ -192,7 +192,7 @@ int AchievementInfo::recursiveGoalCount(goalTree &parent) if (parent.children.size() >= 2 && parent.type != "OR") { - return parent.children.size(); + return (int)parent.children.size(); } else if (parent.children.size() == 1 && (parent.children[0].type == "AND" || diff --git a/src/achievements/achievements_status.cpp b/src/achievements/achievements_status.cpp index 857de0f0a..2fc00ad98 100644 --- a/src/achievements/achievements_status.cpp +++ b/src/achievements/achievements_status.cpp @@ -49,7 +49,8 @@ AchievementsStatus::AchievementsStatus() } // Create one TrackStats instance for all existing tracks - const unsigned int track_amount = track_manager->getNumberOfTracks(); + const unsigned int track_amount = + (unsigned int)track_manager->getNumberOfTracks(); for (unsigned int n = 0; n < track_amount; n++) { diff --git a/src/items/powerup_manager.cpp b/src/items/powerup_manager.cpp index dd61a2b88..f3d7c09cd 100644 --- a/src/items/powerup_manager.cpp +++ b/src/items/powerup_manager.cpp @@ -315,7 +315,7 @@ void PowerupManager::WeightsData::convertRankToSection(int rank, int *prev, // The last kart always uses the data for the last section if (rank == (int)m_num_karts) { - *prev = *next = m_weights_for_section.size() - 1; + *prev = *next = (int)m_weights_for_section.size() - 1; *weight = 1.0f; return; } @@ -343,7 +343,7 @@ void PowerupManager::WeightsData::convertRankToSection(int rank, int *prev, // and the last to the last kart, leaving two inner points defining // 3 sections, i.e. number_of_points - 3 + 1 // In both cases the number of sections is: - int num_sections = (m_weights_for_section.size() - first_section_index); + int num_sections = ((int)m_weights_for_section.size() - first_section_index); float karts_per_fraction = (m_num_karts - first_section_index) / float(num_sections); @@ -407,7 +407,7 @@ int PowerupManager::WeightsData::getRandomItem(int rank, uint64_t random_number) { // E.g. for battle mode with only one entry if(rank>(int)m_summed_weights_for_rank.size()) - rank = m_summed_weights_for_rank.size()-1; + rank = (int)m_summed_weights_for_rank.size()-1; else if (rank<0) rank = 0; // E.g. battle mode, which has rank -1 const std::vector &summed_weights = m_summed_weights_for_rank[rank]; // The last entry is the sum of all previous entries, i.e. the maximum diff --git a/src/karts/controller/skidding_ai.cpp b/src/karts/controller/skidding_ai.cpp index dca7ad5da..68346d241 100644 --- a/src/karts/controller/skidding_ai.cpp +++ b/src/karts/controller/skidding_ai.cpp @@ -1779,13 +1779,12 @@ void SkiddingAI::handleSwitch(int item_skill, const std::vector &i else if(item_skill == 5) { //First step : identify the best available item - int i; int bad = 0; int good = 0; //Good will store 1 for nitro, big or small, 2 for item box //Big nitro are usually hard to take for the AI - for(i=items_to_collect.size()-1; i>=0; i--) + for(int i=(int)items_to_collect.size()-1; i>=0; i--) { if (items_to_collect[i]->getType() == Item::ITEM_BONUS_BOX) { @@ -1800,7 +1799,7 @@ void SkiddingAI::handleSwitch(int item_skill, const std::vector &i } //Bad will store 2 for bananas, 3 for bubble gum - for(i=items_to_avoid.size()-1; i>=0; i--) + for(int i=(int)items_to_avoid.size()-1; i>=0; i--) { if (items_to_avoid[i]->getType() == Item::ITEM_BUBBLEGUM) { @@ -2215,7 +2214,7 @@ void SkiddingAI::handleNitroAndZipper(float max_safe_speed) // just keep enough to help accelerating after an accident if(race_manager->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER) { - energy_reserve = std::min(2, energy_reserve); + energy_reserve = std::min(2.0f, energy_reserve); } // Don't use nitro or zipper if we are braking diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 926c93a20..6691787c9 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -883,9 +883,9 @@ float Kart::getSpeedForTurnRadius(float radius) const InterpolationArray turn_angle_at_speed = m_kart_properties->getTurnRadius(); // Convert the turn radius into turn angle for(int i = 0; i < (int)turn_angle_at_speed.size(); i++) - turn_angle_at_speed.setY(i, sin( 1.0 / turn_angle_at_speed.getY(i))); + turn_angle_at_speed.setY(i, sin( 1.0f / turn_angle_at_speed.getY(i))); - float angle = sin(1.0 / radius); + float angle = sin(1.0f / radius); return turn_angle_at_speed.getReverse(angle); } // getSpeedForTurnRadius @@ -902,7 +902,7 @@ float Kart::getMaxSteerAngle(float speed) const // across karts of different lengths sharing the same // turn radius properties for(int i = 0; i < (int)turn_angle_at_speed.size(); i++) - turn_angle_at_speed.setY(i, sin( 1.0 / turn_angle_at_speed.getY(i)) + turn_angle_at_speed.setY(i, sin( 1.0f / turn_angle_at_speed.getY(i)) * m_kart_properties->getWheelBase()); return turn_angle_at_speed.get(speed); diff --git a/src/race/race_manager.cpp b/src/race/race_manager.cpp index bbd19602b..43392ce23 100644 --- a/src/race/race_manager.cpp +++ b/src/race/race_manager.cpp @@ -512,10 +512,10 @@ void RaceManager::startNextRace() } // not first race // set boosted AI status for AI karts - int boosted_ai_count = std::min(m_ai_kart_list.size(), - (m_kart_status.size()-2)/4 + 1); + int boosted_ai_count = std::min((int)m_ai_kart_list.size(), + ((int)(m_kart_status.size())-2)/4 + 1); if (boosted_ai_count > 4) boosted_ai_count = 4; - int ai_count = m_ai_kart_list.size(); + int ai_count = (int)m_ai_kart_list.size(); for (unsigned int i=0;i diff --git a/src/replay/replay_play.hpp b/src/replay/replay_play.hpp index 768f62b7a..9606fcaa7 100644 --- a/src/replay/replay_play.hpp +++ b/src/replay/replay_play.hpp @@ -172,10 +172,12 @@ public: const unsigned int getNumGhostKart() const { assert(m_replay_file_list.size() > 0); - unsigned int num = m_replay_file_list.at(m_current_replay_file) - .m_kart_list.size(); - unsigned int second_file_num = m_replay_file_list.at(m_second_replay_file) - .m_kart_list.size(); + unsigned int num = + (unsigned int)m_replay_file_list.at(m_current_replay_file) + .m_kart_list.size(); + unsigned int second_file_num = + (unsigned int)m_replay_file_list.at(m_second_replay_file) + .m_kart_list.size(); num = (m_second_replay_enabled) ? num + second_file_num : num; @@ -186,7 +188,9 @@ public: { assert(m_replay_file_list.size() > 0); - unsigned int fkn = m_replay_file_list.at(m_current_replay_file).m_kart_list.size(); + unsigned int fkn = + (unsigned int)m_replay_file_list.at(m_current_replay_file) + .m_kart_list.size(); if (n < fkn) return m_replay_file_list.at(m_current_replay_file).m_kart_list.at(n); else diff --git a/src/states_screens/online/server_selection.cpp b/src/states_screens/online/server_selection.cpp old mode 100644 new mode 100755 index 6ba2f0d87..fc899d94d --- a/src/states_screens/online/server_selection.cpp +++ b/src/states_screens/online/server_selection.cpp @@ -140,7 +140,8 @@ void ServerSelection::init() m_searcher->clearListeners(); m_searcher->addListener(this); m_icon_bank->setScale((float)getHeight() / 15.0f / 128.0f); - m_server_list_widget->setIcons(m_icon_bank, (float)getHeight() / 12.0f); + m_server_list_widget->setIcons(m_icon_bank, + int(getHeight() / 12.0f)); m_sort_desc = false; /** Triggers the loading of the server list in the servers manager. */ refresh(true);