mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 12:54:01 +02:00
- cleaned up some warnings from VC++ compiler
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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 &&
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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();
|
||||
|
||||
}
|
||||
|
@@ -2166,9 +2166,9 @@ string getFileTextContents(string path) {
|
||||
|
||||
// Load data and add terminating 0
|
||||
vector<char> buffer;
|
||||
buffer.resize(size + (streampos)1);
|
||||
buffer.resize((unsigned int)size + 1);
|
||||
xmlFile.read(&buffer.front(), static_cast<streamsize>(size));
|
||||
buffer[size] = 0;
|
||||
buffer[(unsigned int)size] = 0;
|
||||
|
||||
return &buffer.front();
|
||||
}
|
||||
|
@@ -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<char*> (samples), size);
|
||||
return f.gcount();
|
||||
return (uint32)f.gcount();
|
||||
}
|
||||
|
||||
void WavSoundFileLoader::close(){
|
||||
|
@@ -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<char> buf(bufSize);
|
||||
// Load the data
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -291,9 +291,9 @@ XmlNode *XmlIoRapid::load(const string &path, std::map<string,string> mapTagRepl
|
||||
|
||||
// Load data and add terminating 0
|
||||
vector<char> buffer;
|
||||
buffer.resize(size + (streampos)1);
|
||||
buffer.resize((unsigned int)size + 1);
|
||||
xmlFile.read(&buffer.front(), static_cast<streamsize>(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
|
||||
|
Reference in New Issue
Block a user