diff --git a/SConscript b/SConscript index 8247d5e10..0137e6dac 100644 --- a/SConscript +++ b/SConscript @@ -68,7 +68,7 @@ AddSconsOption('opengl-renderer', False, False, "Build with OpenGL renderer supp AddSconsOption('renderer', False, False, "Build the save renderer.") AddSconsOption('wall', False, False, "Error on all warnings.") -AddSconsOption('no-warnings', True, False, "Disable all compiler warnings (default).") +AddSconsOption('no-warnings', False, False, "Disable all compiler warnings.") AddSconsOption('nolua', False, False, "Disable Lua.") AddSconsOption('nofft', False, False, "Disable FFT.") AddSconsOption("output", False, True, "Executable output name.") diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp index 78da45825..81f522421 100644 --- a/src/PowderToySDL.cpp +++ b/src/PowderToySDL.cpp @@ -948,8 +948,8 @@ int main(int argc, char * argv[]) { std::string saveIdPart = ""; int saveId; - unsigned int hashPos = ptsaveArg.find('#'); - if(hashPos != std::string::npos) + size_t hashPos = ptsaveArg.find('#'); + if (hashPos != std::string::npos) { saveIdPart = ptsaveArg.substr(7, hashPos-7); } @@ -957,7 +957,7 @@ int main(int argc, char * argv[]) { saveIdPart = ptsaveArg.substr(7); } - if(saveIdPart.length()) + if (saveIdPart.length()) { #ifdef DEBUG std::cout << "Got Ptsave: id: " << saveIdPart << std::endl; @@ -967,7 +967,7 @@ int main(int argc, char * argv[]) throw std::runtime_error("Invalid Save ID"); SaveInfo * newSave = Client::Ref().GetSave(saveId, 0); - if(!newSave) + if (!newSave) throw std::runtime_error("Could not load save"); GameSave * newGameSave = new GameSave(Client::Ref().GetSaveData(saveId, 0)); newSave->SetGameSave(newGameSave); diff --git a/src/SDLMain.m b/src/SDLMain.m index 78ef1fe46..63bb32837 100644 --- a/src/SDLMain.m +++ b/src/SDLMain.m @@ -395,6 +395,7 @@ void writeUserPreferences(const char * prefData) [prefDataNSString release]; } +//doesn't work on OS X 10.5 or below char * readClipboard() { NSPasteboard *clipboard = [NSPasteboard generalPasteboard]; @@ -416,6 +417,7 @@ char * readClipboard() return clipboardDataCopy; } +//doesn't work on OS X 10.5 or below void writeClipboard(const char * clipboardData) { NSPasteboard *clipboard = [NSPasteboard generalPasteboard]; diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 241f3b451..b85639a79 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -772,7 +772,7 @@ void GameSave::readOPS(char * data, int dataLength) fanVelY[blockY+y][blockX+x] = (fanData[j++]-127.0f)/64.0f; } - if (blockMap[y][x] < 0 || blockMap[y][x] >= UI_WALLCOUNT) + if (blockMap[y][x] >= UI_WALLCOUNT) blockMap[y][x] = 0; } } @@ -825,8 +825,6 @@ void GameSave::readOPS(char * data, int dataLength) fprintf(stderr, "Out of range [%d]: %d %d, [%d, %d], [%d, %d]\n", i, x, y, (unsigned)partsData[i+1], (unsigned)partsData[i+2], (unsigned)partsData[i+3], (unsigned)partsData[i+4]); goto fail; } - if (partsData[i] >= PT_NUM) - partsData[i] = PT_DMND; //Replace all invalid elements with diamond if (newIndex < 0 || newIndex >= NPART) goto fail; @@ -1295,7 +1293,7 @@ void GameSave::readPSv(char * data, int dataLength) blockMap[y][x]=WL_ALLOWENERGY; } - if (blockMap[y][x] < 0 || blockMap[y][x] >= UI_WALLCOUNT) + if (blockMap[y][x] >= UI_WALLCOUNT) blockMap[y][x] = 0; } diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index 5164f4c7c..f40383e73 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -201,7 +201,7 @@ void Renderer::clearScreen(float alpha) #endif } #ifdef OGLR -void Renderer::checkShader(GLuint shader, char * shname) +void Renderer::checkShader(GLuint shader, const char * shname) { GLint status; glGetShaderiv(shader, GL_COMPILE_STATUS, &status); @@ -214,7 +214,7 @@ void Renderer::checkShader(GLuint shader, char * shname) exit(1); } } -void Renderer::checkProgram(GLuint program, char * progname) +void Renderer::checkProgram(GLuint program, const char * progname) { GLint status; glGetProgramiv(program, GL_LINK_STATUS, &status); @@ -706,7 +706,7 @@ void Renderer::DrawWalls() if (bmap[y][x]) { wt = bmap[y][x]; - if (wt<0 || wt>=UI_WALLCOUNT) + if (wt >= UI_WALLCOUNT) continue; pc = wtypes[wt].colour; gc = wtypes[wt].eglow; diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h index 574ab072c..3f1392b86 100644 --- a/src/graphics/Renderer.h +++ b/src/graphics/Renderer.h @@ -99,8 +99,8 @@ public: void SetSample(int x, int y); #ifdef OGLR - void checkShader(GLuint shader, char * shname); - void checkProgram(GLuint program, char * progname); + void checkShader(GLuint shader, const char * shname); + void checkProgram(GLuint program, const char * progname); void loadShaders(); GLuint vidBuf,textTexture; GLint prevFbo; diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 36f52feca..3a6eac3db 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -81,8 +81,10 @@ int Simulation::Load(int fullX, int fullY, GameSave * save) x = int(tempPart.x + 0.5f); y = int(tempPart.y + 0.5f); - if(tempPart.type >= 0 && tempPart.type < PT_NUM) + if (tempPart.type >= 0 && tempPart.type < PT_NUM) tempPart.type = partMap[tempPart.type]; + else + continue; if ((player.spwn == 1 && tempPart.type==PT_STKM) || (player2.spwn == 1 && tempPart.type==PT_STKM2)) continue;