mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 13:23:59 +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();
|
int index = rand() % models.size();
|
||||||
if(usedIndex.find(index) != usedIndex.end()) {
|
if(usedIndex.find(index) != usedIndex.end()) {
|
||||||
failedLookups++;
|
failedLookups++;
|
||||||
seed = time(NULL) / failedLookups;
|
seed = (time(NULL) / failedLookups);
|
||||||
srand(seed.getCurTicks());
|
srand(seed.getCurTicks());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -1323,7 +1323,7 @@ void Map::clearUnitCells(Unit *unit, const Vec2i &pos, bool ignoreSkill) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const UnitType *ut= unit->getType();
|
const UnitType *ut= unit->getType();
|
||||||
bool currentField=unit->getCurrField();
|
Field currentField=unit->getCurrField();
|
||||||
|
|
||||||
if(ignoreSkill==false &&
|
if(ignoreSkill==false &&
|
||||||
unit->getCurrSkill() != NULL &&
|
unit->getCurrSkill() != NULL &&
|
||||||
|
@@ -80,7 +80,7 @@ Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
is.seekg(0, ios::beg);
|
is.seekg(0, ios::beg);
|
||||||
uint8 *buffer = new uint8[length];
|
uint8 *buffer = new uint8[(unsigned int)length];
|
||||||
is.read((char*)buffer, (std::streamsize)length);
|
is.read((char*)buffer, (std::streamsize)length);
|
||||||
//Check buffer (weak jpeg check)
|
//Check buffer (weak jpeg check)
|
||||||
//if (buffer[0] != 0x46 || buffer[1] != 0xA0) {
|
//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
|
jmp_buf error_buffer; //Used for saving/restoring context
|
||||||
// Set up data pointer
|
// Set up data pointer
|
||||||
source.bytes_in_buffer = length;
|
source.bytes_in_buffer = (size_t)length;
|
||||||
source.next_input_byte = (JOCTET*)buffer;
|
source.next_input_byte = (JOCTET*)buffer;
|
||||||
cinfo.src = &source;
|
cinfo.src = &source;
|
||||||
|
|
||||||
|
@@ -314,7 +314,7 @@ float TextFTGL::LineHeight(const char* str, const int len) {
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = box.Upper().Y()- box.Lower().Y();
|
result = box.Upper().Yf()- box.Lower().Yf();
|
||||||
if(result == 0) {
|
if(result == 0) {
|
||||||
result = ftFont->LineHeight();
|
result = ftFont->LineHeight();
|
||||||
|
|
||||||
@@ -387,7 +387,7 @@ float TextFTGL::LineHeight(const wchar_t* str, const int len) {
|
|||||||
static float result = -1000;
|
static float result = -1000;
|
||||||
if(result == -1000) {
|
if(result == -1000) {
|
||||||
FTBBox box = ftFont->BBox(TextFTGL::langHeightText.c_str());
|
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) {
|
if(result == 0) {
|
||||||
result = ftFont->LineHeight();
|
result = ftFont->LineHeight();
|
||||||
}
|
}
|
||||||
|
@@ -963,7 +963,7 @@ bool VideoPlayer::initPlayer() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(this->loadingCB != NULL) {
|
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);
|
this->loadingCB->renderVideoLoading(progress);
|
||||||
}
|
}
|
||||||
SDL_Delay(0);
|
SDL_Delay(0);
|
||||||
@@ -987,7 +987,7 @@ bool VideoPlayer::initPlayer() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(this->loadingCB != NULL) {
|
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);
|
this->loadingCB->renderVideoLoading(progress);
|
||||||
}
|
}
|
||||||
SDL_Delay(0);
|
SDL_Delay(0);
|
||||||
@@ -1394,13 +1394,13 @@ bool VideoPlayer::playFrame(bool swapBuffers) {
|
|||||||
|
|
||||||
glBegin(GL_TRIANGLE_STRIP);
|
glBegin(GL_TRIANGLE_STRIP);
|
||||||
glTexCoord2i(0, 1);
|
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);
|
glTexCoord2i(0, 0);
|
||||||
glVertex2i(ctxPtr->x, ctxPtr->y);
|
glVertex2i(ctxPtr->x, ctxPtr->y);
|
||||||
glTexCoord2i(1, 1);
|
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);
|
glTexCoord2i(1, 0);
|
||||||
glVertex2i(ctxPtr->x+ctxPtr->width * WIDTH_MULTIPLIER, ctxPtr->y);
|
glVertex2i(ctxPtr->x+ctxPtr->width * (int)WIDTH_MULTIPLIER, ctxPtr->y);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2166,9 +2166,9 @@ string getFileTextContents(string path) {
|
|||||||
|
|
||||||
// Load data and add terminating 0
|
// Load data and add terminating 0
|
||||||
vector<char> buffer;
|
vector<char> buffer;
|
||||||
buffer.resize(size + (streampos)1);
|
buffer.resize((unsigned int)size + 1);
|
||||||
xmlFile.read(&buffer.front(), static_cast<streamsize>(size));
|
xmlFile.read(&buffer.front(), static_cast<streamsize>(size));
|
||||||
buffer[size] = 0;
|
buffer[(unsigned int)size] = 0;
|
||||||
|
|
||||||
return &buffer.front();
|
return &buffer.front();
|
||||||
}
|
}
|
||||||
|
@@ -121,13 +121,13 @@ void WavSoundFileLoader::open(const string &path, SoundInfo *soundInfo){
|
|||||||
throw megaglest_runtime_error("Error reading samples: "+ path);
|
throw megaglest_runtime_error("Error reading samples: "+ path);
|
||||||
}
|
}
|
||||||
|
|
||||||
dataOffset= f.tellg();
|
dataOffset= (uint32)f.tellg();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 WavSoundFileLoader::read(int8 *samples, uint32 size){
|
uint32 WavSoundFileLoader::read(int8 *samples, uint32 size){
|
||||||
f.read(reinterpret_cast<char*> (samples), size);
|
f.read(reinterpret_cast<char*> (samples), size);
|
||||||
return f.gcount();
|
return (uint32)f.gcount();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WavSoundFileLoader::close(){
|
void WavSoundFileLoader::close(){
|
||||||
|
@@ -265,10 +265,10 @@ bool Checksum::addFileToSum(const string &path) {
|
|||||||
|
|
||||||
// Determine the file length
|
// Determine the file length
|
||||||
ifs.seekg(0, ios::end);
|
ifs.seekg(0, ios::end);
|
||||||
std::size_t size=ifs.tellg();
|
std::streamoff size=ifs.tellg();
|
||||||
ifs.seekg(0, ios::beg);
|
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
|
// Create a vector to store the data
|
||||||
std::vector<char> buf(bufSize);
|
std::vector<char> buf(bufSize);
|
||||||
// Load the data
|
// Load the data
|
||||||
|
@@ -427,7 +427,7 @@ const string Properties::getRandomKey(const bool realrandom) const{
|
|||||||
if(realrandom == true){
|
if(realrandom == true){
|
||||||
//srand((unsigned int)time(NULL));
|
//srand((unsigned int)time(NULL));
|
||||||
Chrono seed(true);
|
Chrono seed(true);
|
||||||
srand(seed.getCurTicks());
|
srand((unsigned int)seed.getCurTicks());
|
||||||
|
|
||||||
randomIndex=rand()%max;
|
randomIndex=rand()%max;
|
||||||
}
|
}
|
||||||
|
@@ -291,9 +291,9 @@ XmlNode *XmlIoRapid::load(const string &path, std::map<string,string> mapTagRepl
|
|||||||
|
|
||||||
// Load data and add terminating 0
|
// Load data and add terminating 0
|
||||||
vector<char> buffer;
|
vector<char> buffer;
|
||||||
buffer.resize(size + (streampos)1);
|
buffer.resize((unsigned int)size + 1);
|
||||||
xmlFile.read(&buffer.front(), static_cast<streamsize>(size));
|
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
|
// This is required because rapidxml seems to choke when we load lua
|
||||||
// scenarios that have lua + xml style comments
|
// scenarios that have lua + xml style comments
|
||||||
|
Reference in New Issue
Block a user