Core: fix "comparison of unsigned expression < 0 is always false" warnings

--HG--
branch : trunk
This commit is contained in:
Spp
2010-08-21 23:40:53 +02:00
parent 572f7bbd1d
commit a40cb46e61
4 changed files with 19 additions and 7 deletions
+2 -2
View File
@@ -150,10 +150,10 @@ namespace VMAP
{ {
float tx_f = (pos.x - iCorner.x)/LIQUID_TILE_SIZE; float tx_f = (pos.x - iCorner.x)/LIQUID_TILE_SIZE;
uint32 tx = uint32(tx_f); uint32 tx = uint32(tx_f);
if (tx<0 || tx >= iTilesX) return false; if (tx >= iTilesX) return false;
float ty_f = (pos.y - iCorner.y)/LIQUID_TILE_SIZE; float ty_f = (pos.y - iCorner.y)/LIQUID_TILE_SIZE;
uint32 ty = uint32(ty_f); uint32 ty = uint32(ty_f);
if (ty<0 || ty >= iTilesY) return false; if (ty >= iTilesY) return false;
// check if tile shall be used for liquid level // check if tile shall be used for liquid level
// checking for 0x08 *might* be enough, but disabled tiles always are 0x?F: // checking for 0x08 *might* be enough, but disabled tiles always are 0x?F:
@@ -186,7 +186,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
} }
return true; return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL: case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL:
if (level.minlevel < 0 || level.minlevel > STRONG_MAX_LEVEL) if (level.minlevel > STRONG_MAX_LEVEL)
{ {
sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.", sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.",
criteria->ID, criteria->requiredType,dataType,level.minlevel); criteria->ID, criteria->requiredType,dataType,level.minlevel);
+2 -2
View File
@@ -1161,7 +1161,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char *args)
// Check for invalid specified GM level. // Check for invalid specified GM level.
gm = (isAccountNameGiven) ? atoi(arg2) : atoi(arg1); gm = (isAccountNameGiven) ? atoi(arg2) : atoi(arg1);
if (gm < SEC_PLAYER) if (gm > SEC_CONSOLE)
{ {
SendSysMessage(LANG_BAD_VALUE); SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true); SetSentErrorMessage(true);
@@ -5397,7 +5397,7 @@ bool ChatHandler::HandleQuestComplete(const char *args)
// All creature/GO slain/casted (not required, but otherwise it will display "Creature slain 0/10") // All creature/GO slain/casted (not required, but otherwise it will display "Creature slain 0/10")
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{ {
uint32 creature = pQuest->ReqCreatureOrGOId[i]; int32 creature = pQuest->ReqCreatureOrGOId[i];
uint32 creaturecount = pQuest->ReqCreatureOrGOCount[i]; uint32 creaturecount = pQuest->ReqCreatureOrGOCount[i];
if (uint32 spell_id = pQuest->ReqSpell[i]) if (uint32 spell_id = pQuest->ReqSpell[i])
+14 -2
View File
@@ -836,7 +836,7 @@ void World::LoadConfigSettings(bool reload)
} }
m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = sConfig.GetIntDefault("RecruitAFriend.MaxLevel", 60); m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = sConfig.GetIntDefault("RecruitAFriend.MaxLevel", 60);
if (m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] < 0 || m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_configs[CONFIG_MAX_PLAYER_LEVEL]) if (m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_configs[CONFIG_MAX_PLAYER_LEVEL])
{ {
sLog.outError("RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", sLog.outError("RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL],m_configs[CONFIG_MAX_PLAYER_LEVEL],60); m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL],m_configs[CONFIG_MAX_PLAYER_LEVEL],60);
@@ -844,12 +844,14 @@ void World::LoadConfigSettings(bool reload)
} }
m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE] = sConfig.GetIntDefault("RecruitAFriend.MaxDifference", 3); m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE] = sConfig.GetIntDefault("RecruitAFriend.MaxDifference", 3);
/* "comparison of unsigned expression < 0 is always false"
if (m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE] < 0) if (m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE] < 0)
{ {
sLog.outError("RecruitAFriend.MaxLevel (%i) must be greater than or equal to 0. Set to %u.", sLog.outError("RecruitAFriend.MaxLevel (%i) must be greater than or equal to 0. Set to %u.",
m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE],3); m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE],3);
m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE] = 3; m_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE] = 3;
} }
*/
m_configs[CONFIG_ALL_TAXI_PATHS] = sConfig.GetBoolDefault("AllFlightPaths", false); m_configs[CONFIG_ALL_TAXI_PATHS] = sConfig.GetBoolDefault("AllFlightPaths", false);
m_configs[CONFIG_INSTANT_TAXI] = sConfig.GetBoolDefault("InstantFlightPaths", false); m_configs[CONFIG_INSTANT_TAXI] = sConfig.GetBoolDefault("InstantFlightPaths", false);
@@ -939,32 +941,40 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_SKILL_MILLING] = sConfig.GetBoolDefault("SkillChance.Milling",false); m_configs[CONFIG_SKILL_MILLING] = sConfig.GetBoolDefault("SkillChance.Milling",false);
m_configs[CONFIG_SKILL_GAIN_CRAFTING] = sConfig.GetIntDefault("SkillGain.Crafting", 1); m_configs[CONFIG_SKILL_GAIN_CRAFTING] = sConfig.GetIntDefault("SkillGain.Crafting", 1);
/* "comparison of unsigned expression < 0 is always false"
if (m_configs[CONFIG_SKILL_GAIN_CRAFTING] < 0) if (m_configs[CONFIG_SKILL_GAIN_CRAFTING] < 0)
{ {
sLog.outError("SkillGain.Crafting (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_CRAFTING]); sLog.outError("SkillGain.Crafting (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_CRAFTING]);
m_configs[CONFIG_SKILL_GAIN_CRAFTING] = 1; m_configs[CONFIG_SKILL_GAIN_CRAFTING] = 1;
} }
*/
m_configs[CONFIG_SKILL_GAIN_DEFENSE] = sConfig.GetIntDefault("SkillGain.Defense", 1); m_configs[CONFIG_SKILL_GAIN_DEFENSE] = sConfig.GetIntDefault("SkillGain.Defense", 1);
/* "comparison of unsigned expression < 0 is always false"
if (m_configs[CONFIG_SKILL_GAIN_DEFENSE] < 0) if (m_configs[CONFIG_SKILL_GAIN_DEFENSE] < 0)
{ {
sLog.outError("SkillGain.Defense (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_DEFENSE]); sLog.outError("SkillGain.Defense (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_DEFENSE]);
m_configs[CONFIG_SKILL_GAIN_DEFENSE] = 1; m_configs[CONFIG_SKILL_GAIN_DEFENSE] = 1;
} }
*/
m_configs[CONFIG_SKILL_GAIN_GATHERING] = sConfig.GetIntDefault("SkillGain.Gathering", 1); m_configs[CONFIG_SKILL_GAIN_GATHERING] = sConfig.GetIntDefault("SkillGain.Gathering", 1);
/* "comparison of unsigned expression < 0 is always false"
if (m_configs[CONFIG_SKILL_GAIN_GATHERING] < 0) if (m_configs[CONFIG_SKILL_GAIN_GATHERING] < 0)
{ {
sLog.outError("SkillGain.Gathering (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_GATHERING]); sLog.outError("SkillGain.Gathering (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_GATHERING]);
m_configs[CONFIG_SKILL_GAIN_GATHERING] = 1; m_configs[CONFIG_SKILL_GAIN_GATHERING] = 1;
} }
*/
m_configs[CONFIG_SKILL_GAIN_WEAPON] = sConfig.GetIntDefault("SkillGain.Weapon", 1); m_configs[CONFIG_SKILL_GAIN_WEAPON] = sConfig.GetIntDefault("SkillGain.Weapon", 1);
/* "comparison of unsigned expression < 0 is always false"
if (m_configs[CONFIG_SKILL_GAIN_WEAPON] < 0) if (m_configs[CONFIG_SKILL_GAIN_WEAPON] < 0)
{ {
sLog.outError("SkillGain.Weapon (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_WEAPON]); sLog.outError("SkillGain.Weapon (%i) can't be negative. Set to 1.",m_configs[CONFIG_SKILL_GAIN_WEAPON]);
m_configs[CONFIG_SKILL_GAIN_WEAPON] = 1; m_configs[CONFIG_SKILL_GAIN_WEAPON] = 1;
} }
*/
m_configs[CONFIG_MAX_OVERSPEED_PINGS] = sConfig.GetIntDefault("MaxOverspeedPings",2); m_configs[CONFIG_MAX_OVERSPEED_PINGS] = sConfig.GetIntDefault("MaxOverspeedPings",2);
if (m_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2) if (m_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2)
@@ -1012,7 +1022,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_QUEST_IGNORE_RAID] = sConfig.GetBoolDefault("Quests.IgnoreRaid", false); m_configs[CONFIG_QUEST_IGNORE_RAID] = sConfig.GetBoolDefault("Quests.IgnoreRaid", false);
m_configs[CONFIG_RANDOM_BG_RESET_HOUR] = sConfig.GetIntDefault("Battleground.Random.ResetHour", 6); m_configs[CONFIG_RANDOM_BG_RESET_HOUR] = sConfig.GetIntDefault("Battleground.Random.ResetHour", 6);
if (m_configs[CONFIG_RANDOM_BG_RESET_HOUR] < 0 || m_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23) if (m_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23)
{ {
sLog.outError("Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_configs[CONFIG_RANDOM_BG_RESET_HOUR]); sLog.outError("Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
m_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6; m_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6;
@@ -1206,8 +1216,10 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_BG_START_MUSIC] = sConfig.GetBoolDefault("MusicInBattleground", false); m_configs[CONFIG_BG_START_MUSIC] = sConfig.GetBoolDefault("MusicInBattleground", false);
m_configs[CONFIG_START_ALL_SPELLS] = sConfig.GetBoolDefault("PlayerStart.AllSpells", false); m_configs[CONFIG_START_ALL_SPELLS] = sConfig.GetBoolDefault("PlayerStart.AllSpells", false);
m_configs[CONFIG_HONOR_AFTER_DUEL] = sConfig.GetIntDefault("HonorPointsAfterDuel", 0); m_configs[CONFIG_HONOR_AFTER_DUEL] = sConfig.GetIntDefault("HonorPointsAfterDuel", 0);
/* "comparison of unsigned expression < 0 is always false"
if (m_configs[CONFIG_HONOR_AFTER_DUEL] < 0) if (m_configs[CONFIG_HONOR_AFTER_DUEL] < 0)
m_configs[CONFIG_HONOR_AFTER_DUEL]= 0; m_configs[CONFIG_HONOR_AFTER_DUEL]= 0;
*/
m_configs[CONFIG_START_ALL_EXPLORED] = sConfig.GetBoolDefault("PlayerStart.MapsExplored", false); m_configs[CONFIG_START_ALL_EXPLORED] = sConfig.GetBoolDefault("PlayerStart.MapsExplored", false);
m_configs[CONFIG_START_ALL_REP] = sConfig.GetBoolDefault("PlayerStart.AllReputation", false); m_configs[CONFIG_START_ALL_REP] = sConfig.GetBoolDefault("PlayerStart.AllReputation", false);
m_configs[CONFIG_ALWAYS_MAXSKILL] = sConfig.GetBoolDefault("AlwaysMaxWeaponSkill", false); m_configs[CONFIG_ALWAYS_MAXSKILL] = sConfig.GetBoolDefault("AlwaysMaxWeaponSkill", false);