- code cleanup based on additional gcc warnings

This commit is contained in:
Mark Vejvoda 2013-11-19 06:42:32 +00:00
parent 39b41cdfea
commit 66761ba760
11 changed files with 24 additions and 15 deletions

View File

@ -479,7 +479,7 @@ const ResourceType *Ai::getNeededResource(int unitIndex) {
const int maxUnitsToHarvestResource = 5;
vector<int> unitsGettingResource = findUnitsHarvestingResourceType(rt);
if(unitsGettingResource.size() <= maxUnitsToHarvestResource) {
if((int)unitsGettingResource.size() <= maxUnitsToHarvestResource) {
// Now MAKE SURE the unit has a harvest command for this resource
// AND that the resource is within eye-sight to avoid units
// standing around doing nothing.

View File

@ -72,7 +72,7 @@ enum FlagTypes1 {
};
inline static bool isFlagType1BitEnabled(uint32 flagValue,FlagTypes1 type) {
return ((flagValue & type) == type);
return ((flagValue & (uint32)type) == (uint32)type);
}
enum NetworkPlayerStatusType {
@ -359,7 +359,7 @@ public:
throw megaglest_runtime_error(szBuf);
}
for(unsigned int i =0; i < GameConstants::maxPlayers; ++i) {
for(int i =0; i < GameConstants::maxPlayers; ++i) {
if(startLocationIndex[i] == startIndex) {
return i;
}

View File

@ -3131,7 +3131,7 @@ void ScriptManager::saveGame(XmlNode *rootNode) {
// bool gameWon;
scriptManagerNode->addAttribute("gameWon",intToStr(gameWon), mapTagReplacements);
// PlayerModifiers playerModifiers[GameConstants::maxPlayers];
for(unsigned int i = 0; i < GameConstants::maxPlayers; ++i) {
for(unsigned int i = 0; i < (unsigned int)GameConstants::maxPlayers; ++i) {
PlayerModifiers &player = playerModifiers[i];
player.saveGame(scriptManagerNode);
}

View File

@ -171,7 +171,7 @@ void Stats::saveGame(XmlNode *rootNode) {
XmlNode *statsNode = rootNode->addChild("Stats");
// PlayerStats playerStats[GameConstants::maxPlayers];
for(unsigned int i = 0; i < GameConstants::maxPlayers; ++i) {
for(unsigned int i = 0; i < (unsigned int)GameConstants::maxPlayers; ++i) {
PlayerStats &stat = playerStats[i];
XmlNode *statsNodePlayer = statsNode->addChild("Player");

View File

@ -7403,7 +7403,7 @@ vector<Unit *> Renderer::renderUnitsFast(bool renderingShadows, bool colorPickin
assert(game != NULL);
//const World *world= game->getWorld();
assert(world != NULL);
//assert(world != NULL);
VisibleQuadContainerCache &qCache = getQuadCache();
if(qCache.visibleQuadUnitList.empty() == false) {

View File

@ -363,7 +363,7 @@ private:
data_ref.header.messageType = 0;
data_ref.header.commandCount = 0;
data_ref.header.frameCount = 0;
for(unsigned int index = 0; index < GameConstants::maxPlayers; ++index) {
for(int index = 0; index < GameConstants::maxPlayers; ++index) {
data_ref.header.networkPlayerFactionCRC[index] = 0;
}
}

View File

@ -48,7 +48,7 @@ class ScenarioInfo {
public:
ScenarioInfo() {
difficulty = 0;
for(unsigned int i = 0; i < GameConstants::maxPlayers; ++i) {
for(unsigned int i = 0; i < (unsigned int)GameConstants::maxPlayers; ++i) {
factionControls[i] = ctClosed;
teams[i] = 0;
factionTypeNames[i] = "";

View File

@ -755,10 +755,10 @@ void toEndianMapFileHeader(MapFileHeader &header) {
header.height = Shared::PlatformByteOrder::toCommonEndian(header.height);
header.heightFactor = Shared::PlatformByteOrder::toCommonEndian(header.heightFactor);
header.waterLevel = Shared::PlatformByteOrder::toCommonEndian(header.waterLevel);
for(unsigned int i =0; i < MAX_TITLE_LENGTH; ++i) {
for(unsigned int i =0; i < (unsigned int)MAX_TITLE_LENGTH; ++i) {
header.title[i] = Shared::PlatformByteOrder::toCommonEndian(header.title[i]);
}
for(unsigned int i =0; i < MAX_DESCRIPTION_LENGTH; ++i) {
for(unsigned int i =0; i < (unsigned int)MAX_DESCRIPTION_LENGTH; ++i) {
header.description[i] = Shared::PlatformByteOrder::toCommonEndian(header.description[i]);
}
}
@ -769,10 +769,10 @@ void fromEndianMapFileHeader(MapFileHeader &header) {
header.height = Shared::PlatformByteOrder::fromCommonEndian(header.height);
header.heightFactor = Shared::PlatformByteOrder::fromCommonEndian(header.heightFactor);
header.waterLevel = Shared::PlatformByteOrder::fromCommonEndian(header.waterLevel);
for(unsigned int i =0; i < MAX_TITLE_LENGTH; ++i) {
for(unsigned int i =0; i < (unsigned int)MAX_TITLE_LENGTH; ++i) {
header.title[i] = Shared::PlatformByteOrder::fromCommonEndian(header.title[i]);
}
for(unsigned int i =0; i < MAX_DESCRIPTION_LENGTH; ++i) {
for(unsigned int i =0; i < (unsigned int)MAX_DESCRIPTION_LENGTH; ++i) {
header.description[i] = Shared::PlatformByteOrder::fromCommonEndian(header.description[i]);
}
}

View File

@ -130,7 +130,7 @@ void FileCRCPreCacheThread::execute() {
try {
unsigned int consumedWorkers = 0;
for(unsigned int workerIdx = 0; workerIdx < MAX_FileCRCPreCacheThread_WORKER_THREADS; ++workerIdx) {
for(unsigned int workerIdx = 0; workerIdx < (unsigned int)MAX_FileCRCPreCacheThread_WORKER_THREADS; ++workerIdx) {
if(getQuitStatus() == true) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
break;

View File

@ -2863,7 +2863,7 @@ void BroadCastSocketThread::execute() {
// Subnet, IP Address
std::vector<std::string> ipSubnetMaskList;
for(unsigned int idx = 0; idx < ipList.size() && idx < MAX_NIC_COUNT; idx++) {
for(unsigned int idx = 0; idx < (unsigned int)ipList.size() && idx < (unsigned int)MAX_NIC_COUNT; idx++) {
string broadCastAddress = getNetworkInterfaceBroadcastAddress(ipList[idx]);
//printf("idx = %d broadCastAddress [%s]\n",idx,broadCastAddress.c_str());
@ -2876,7 +2876,7 @@ void BroadCastSocketThread::execute() {
port = htons( Socket::getBroadCastPort() );
//for(unsigned int idx = 0; idx < ipList.size() && idx < MAX_NIC_COUNT; idx++) {
for(unsigned int idx = 0; idx < ipSubnetMaskList.size(); idx++) {
for(unsigned int idx = 0; idx < (unsigned int)ipSubnetMaskList.size(); idx++) {
// Create the broadcast socket
memset( &bcLocal[idx], 0, sizeof( struct sockaddr_in));
bcLocal[idx].sin_family = AF_INET;

View File

@ -27,6 +27,15 @@ using namespace Shared::Util;
namespace Shared{ namespace Platform{
// Example values:
// DEFAULT_CHARSET (English) = 1
// GB2312_CHARSET (Chinese) = 134
#ifdef WIN32
DWORD PlatformContextGl::charSet = DEFAULT_CHARSET;
#else
int PlatformContextGl::charSet = 1;
#endif
// ======================================
// Global Fcs
// ======================================