diff --git a/source/glest_game/main/intro.cpp b/source/glest_game/main/intro.cpp index 6706117c5..4b97b4386 100644 --- a/source/glest_game/main/intro.cpp +++ b/source/glest_game/main/intro.cpp @@ -243,7 +243,7 @@ Intro::Intro(Program *program): int index = rand() % models.size(); if(usedIndex.find(index) != usedIndex.end()) { failedLookups++; - seed = time(NULL) / failedLookups; + seed = (time(NULL) / failedLookups); srand(seed.getCurTicks()); continue; } diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index 53cd871d8..4917bbb52 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -1323,7 +1323,7 @@ void Map::clearUnitCells(Unit *unit, const Vec2i &pos, bool ignoreSkill) { } const UnitType *ut= unit->getType(); - bool currentField=unit->getCurrField(); + Field currentField=unit->getCurrField(); if(ignoreSkill==false && unit->getCurrSkill() != NULL && diff --git a/source/shared_lib/sources/graphics/JPGReader.cpp b/source/shared_lib/sources/graphics/JPGReader.cpp index 24485f84c..ef3348900 100644 --- a/source/shared_lib/sources/graphics/JPGReader.cpp +++ b/source/shared_lib/sources/graphics/JPGReader.cpp @@ -80,7 +80,7 @@ Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const return NULL; } is.seekg(0, ios::beg); - uint8 *buffer = new uint8[length]; + uint8 *buffer = new uint8[(unsigned int)length]; is.read((char*)buffer, (std::streamsize)length); //Check buffer (weak jpeg check) //if (buffer[0] != 0x46 || buffer[1] != 0xA0) { @@ -102,7 +102,7 @@ Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const jmp_buf error_buffer; //Used for saving/restoring context // Set up data pointer - source.bytes_in_buffer = length; + source.bytes_in_buffer = (size_t)length; source.next_input_byte = (JOCTET*)buffer; cinfo.src = &source; diff --git a/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp b/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp index 227af5a43..9ee8fbf9f 100644 --- a/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp +++ b/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp @@ -314,7 +314,7 @@ float TextFTGL::LineHeight(const char* str, const int len) { fflush(stdout); } - result = box.Upper().Y()- box.Lower().Y(); + result = box.Upper().Yf()- box.Lower().Yf(); if(result == 0) { result = ftFont->LineHeight(); @@ -387,7 +387,7 @@ float TextFTGL::LineHeight(const wchar_t* str, const int len) { static float result = -1000; if(result == -1000) { FTBBox box = ftFont->BBox(TextFTGL::langHeightText.c_str()); - result = box.Upper().Y()- box.Lower().Y(); + result = box.Upper().Yf()- box.Lower().Yf(); if(result == 0) { result = ftFont->LineHeight(); } diff --git a/source/shared_lib/sources/graphics/video_player.cpp b/source/shared_lib/sources/graphics/video_player.cpp index d06fa25b7..a7afb2d11 100644 --- a/source/shared_lib/sources/graphics/video_player.cpp +++ b/source/shared_lib/sources/graphics/video_player.cpp @@ -963,7 +963,7 @@ bool VideoPlayer::initPlayer() { break; } if(this->loadingCB != NULL) { - int progress = ((difftime(time(NULL),waitStart) / MAX_VIDEO_START_MILLISECONDS) * 100.0); + int progress = (int)((difftime(time(NULL),waitStart) / MAX_VIDEO_START_MILLISECONDS) * 100.0); this->loadingCB->renderVideoLoading(progress); } SDL_Delay(0); @@ -987,7 +987,7 @@ bool VideoPlayer::initPlayer() { break; } if(this->loadingCB != NULL) { - int progress = ((difftime(time(NULL),waitStart) / MAX_VIDEO_START_MILLISECONDS) * 100.0); + int progress = (int)((difftime(time(NULL),waitStart) / MAX_VIDEO_START_MILLISECONDS) * 100.0); this->loadingCB->renderVideoLoading(progress); } SDL_Delay(0); @@ -1394,13 +1394,13 @@ bool VideoPlayer::playFrame(bool swapBuffers) { glBegin(GL_TRIANGLE_STRIP); glTexCoord2i(0, 1); - glVertex2i(ctxPtr->x, ctxPtr->y + ctxPtr->height * HEIGHT_MULTIPLIER); + glVertex2i(ctxPtr->x, ctxPtr->y + ctxPtr->height * (int)HEIGHT_MULTIPLIER); glTexCoord2i(0, 0); glVertex2i(ctxPtr->x, ctxPtr->y); glTexCoord2i(1, 1); - glVertex2i(ctxPtr->x+ctxPtr->width * WIDTH_MULTIPLIER, ctxPtr->y+ctxPtr->height * HEIGHT_MULTIPLIER); + glVertex2i(ctxPtr->x+ctxPtr->width * (int)WIDTH_MULTIPLIER, ctxPtr->y+ctxPtr->height * (int)HEIGHT_MULTIPLIER); glTexCoord2i(1, 0); - glVertex2i(ctxPtr->x+ctxPtr->width * WIDTH_MULTIPLIER, ctxPtr->y); + glVertex2i(ctxPtr->x+ctxPtr->width * (int)WIDTH_MULTIPLIER, ctxPtr->y); glEnd(); } diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index 679ddf345..b8683f434 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -2166,9 +2166,9 @@ string getFileTextContents(string path) { // Load data and add terminating 0 vector buffer; - buffer.resize(size + (streampos)1); + buffer.resize((unsigned int)size + 1); xmlFile.read(&buffer.front(), static_cast(size)); - buffer[size] = 0; + buffer[(unsigned int)size] = 0; return &buffer.front(); } diff --git a/source/shared_lib/sources/sound/sound_file_loader.cpp b/source/shared_lib/sources/sound/sound_file_loader.cpp index 901837530..a7faf52e5 100644 --- a/source/shared_lib/sources/sound/sound_file_loader.cpp +++ b/source/shared_lib/sources/sound/sound_file_loader.cpp @@ -121,13 +121,13 @@ void WavSoundFileLoader::open(const string &path, SoundInfo *soundInfo){ throw megaglest_runtime_error("Error reading samples: "+ path); } - dataOffset= f.tellg(); + dataOffset= (uint32)f.tellg(); } uint32 WavSoundFileLoader::read(int8 *samples, uint32 size){ f.read(reinterpret_cast (samples), size); - return f.gcount(); + return (uint32)f.gcount(); } void WavSoundFileLoader::close(){ diff --git a/source/shared_lib/sources/util/checksum.cpp b/source/shared_lib/sources/util/checksum.cpp index db78e7348..3441e68ac 100644 --- a/source/shared_lib/sources/util/checksum.cpp +++ b/source/shared_lib/sources/util/checksum.cpp @@ -265,10 +265,10 @@ bool Checksum::addFileToSum(const string &path) { // Determine the file length ifs.seekg(0, ios::end); - std::size_t size=ifs.tellg(); + std::streamoff size=ifs.tellg(); ifs.seekg(0, ios::beg); - int bufSize = size / sizeof(char); + unsigned int bufSize = (unsigned int)size / sizeof(char); // Create a vector to store the data std::vector buf(bufSize); // Load the data diff --git a/source/shared_lib/sources/util/properties.cpp b/source/shared_lib/sources/util/properties.cpp index 26cf4e75c..beed29ff0 100644 --- a/source/shared_lib/sources/util/properties.cpp +++ b/source/shared_lib/sources/util/properties.cpp @@ -427,7 +427,7 @@ const string Properties::getRandomKey(const bool realrandom) const{ if(realrandom == true){ //srand((unsigned int)time(NULL)); Chrono seed(true); - srand(seed.getCurTicks()); + srand((unsigned int)seed.getCurTicks()); randomIndex=rand()%max; } diff --git a/source/shared_lib/sources/xml/xml_parser.cpp b/source/shared_lib/sources/xml/xml_parser.cpp index 885afdc2b..81f52945b 100644 --- a/source/shared_lib/sources/xml/xml_parser.cpp +++ b/source/shared_lib/sources/xml/xml_parser.cpp @@ -291,9 +291,9 @@ XmlNode *XmlIoRapid::load(const string &path, std::map mapTagRepl // Load data and add terminating 0 vector buffer; - buffer.resize(size + (streampos)1); + buffer.resize((unsigned int)size + 1); xmlFile.read(&buffer.front(), static_cast(size)); - buffer[size] = 0; + buffer[(unsigned int)size] = 0; // This is required because rapidxml seems to choke when we load lua // scenarios that have lua + xml style comments