1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-09 12:22:34 +01:00

Increase warnings to pedantic and fix rwlib/rwengine warnings

This commit is contained in:
Daniel Evans 2016-05-01 22:30:15 +01:00
parent 0057f76630
commit d2f254731a
7 changed files with 28 additions and 26 deletions

View File

@ -4,7 +4,7 @@ project(OpenRW)
# Global Build Configuration
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DRW_DEBUG=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pthread -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pthread -Wextra -Wpedantic")
# Optional components
SET(BUILD_SCRIPT_TOOL TRUE CACHE BOOL "Build script decompiler tool")

View File

@ -6,7 +6,7 @@
struct Name {\
static const char* VertexShader;\
static const char* FragmentShader;\
};
}
/**
* @brief collection of shaders to make managing them a little easier.
@ -16,12 +16,12 @@ namespace GameShaders {
/**
* High Quality Projected-Grid water shader
*/
SHADER_VF(WaterHQ)
SHADER_VF(WaterHQ);
/**
* Simple 3D masking shader
*/
SHADER_VF(Mask3D)
SHADER_VF(Mask3D);
struct Sky {
static const char* VertexShader;

View File

@ -59,6 +59,7 @@ std::string findPathRealCase(const std::string& base, const std::string& path)
}
}
}
closedir(dp);
}
return "";

View File

@ -565,7 +565,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
BlockDword numScripts;
READ_SIZE(numScripts)
Block0RunningScript scripts[numScripts];
std::vector<Block0RunningScript> scripts(numScripts);
for (size_t i = 0; i < numScripts; ++i)
{
READ_VALUE(scripts[i]);
@ -579,7 +579,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
BlockDword playerCount;
READ_SIZE(playerCount)
Block1PlayerPed players[playerCount];
std::vector<Block1PlayerPed> players(playerCount);
for(unsigned int p = 0; p < playerCount; ++p) {
Block1PlayerPed& ped = players[p];
READ_VALUE(ped.unknown0)
@ -620,7 +620,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
READ_VALUE(garageData.GA_21lastTime)
READ_VALUE(garageData.cars)
StructGarage garages[garageData.garageCount];
std::vector<StructGarage> garages(garageData.garageCount);
for (size_t i = 0; i < garageData.garageCount; ++i)
{
READ_VALUE(garages[i]);
@ -652,7 +652,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
READ_VALUE(vehicleCount)
READ_VALUE(boatCount)
Block3Vehicle vehicles[vehicleCount];
std::vector<Block3Vehicle> vehicles(vehicleCount);
for(size_t v = 0; v < vehicleCount; ++v) {
Block3Vehicle& veh = vehicles[v];
READ_VALUE(veh.unknown1)
@ -663,7 +663,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
std::cout << " v " << veh.modelId << " " << veh.state.position.x << " " << veh.state.position.y << " " << veh.state.position.z << std::endl;
#endif
}
Block3Boat boats[boatCount];
std::vector<Block3Boat> boats(boatCount);
for(size_t v = 0; v < boatCount; ++v) {
Block3Boat& veh = boats[v];
READ_VALUE(veh.unknown1)
@ -684,7 +684,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
BlockDword objectCount;
READ_VALUE(objectCount);
Block4Object objects[objectCount];
std::vector<Block4Object> objects(objectCount);
for(size_t o = 0; o < objectCount; ++o)
{
Block4Object &obj = objects[o];
@ -772,7 +772,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
Block8Data phoneData;
READ_VALUE(phoneData);
Block8Phone phones[phoneData.numPhones];
std::vector<Block8Phone> phones(phoneData.numPhones);
for (size_t p = 0; p < phoneData.numPhones; ++p) {
Block8Phone &phone = phones[p];
READ_VALUE(phone)
@ -922,7 +922,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
Block13Data carGeneratorData;
READ_VALUE(carGeneratorData);
Block13CarGenerator carGenerators[carGeneratorData.generatorCount];
std::vector<Block13CarGenerator> carGenerators(carGeneratorData.generatorCount);
for(size_t g = 0; g < carGeneratorData.generatorCount; ++g) {
READ_VALUE(carGenerators[g])
}
@ -943,7 +943,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
BlockDword particleCount;
READ_VALUE(particleCount);
Block14Particle particles[particleCount];
std::vector<Block14Particle> particles(particleCount);
for(size_t p = 0; p < particleCount; ++p) {
READ_VALUE(particles[p])
}
@ -963,7 +963,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file)
BlockDword audioCount;
READ_VALUE(audioCount)
Block15AudioObject audioObjects[audioCount];
std::vector<Block15AudioObject> audioObjects(audioCount);
for(size_t a = 0; a < audioCount; ++a) {
READ_VALUE(audioObjects[a])
}

View File

@ -159,7 +159,8 @@ GameRenderer::GameRenderer(Logger* log, GameData* _data)
skyDbuff.setFaceType(GL_TRIANGLES);
glGenBuffers(1, &skydomeIBO);
GLuint skydomeIndBuff[rows*segments*6];
std::vector<GLuint> skydomeIndBuff;
skydomeIndBuff.resize(rows*segments*6);
for( size_t r = 0, i = 0; r < (rows-1); ++r ) {
for( size_t s = 0; s < (segments-1); ++s ) {
skydomeIndBuff[i++] = r * segments + s;
@ -171,7 +172,7 @@ GameRenderer::GameRenderer(Logger* log, GameData* _data)
}
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, skydomeIBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(skydomeIndBuff), skydomeIndBuff, GL_STATIC_DRAW);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint) * skydomeIndBuff.size(), skydomeIndBuff.data(), GL_STATIC_DRAW);
glBindVertexArray(0);

View File

@ -17,7 +17,7 @@ namespace RW
/// Loading the resource failed
Failed = 2
};
};
}
template<class T> class ResourceHandle

View File

@ -42,7 +42,7 @@ void processPalette(uint32_t* fullColor, RW::BinaryStreamSection& rootSection)
for(size_t j = 0; j < raster_size; ++j)
{
fullColor[j] = palette[coldata[j]];
*(fullColor++) = palette[coldata[j]];
}
}
@ -71,16 +71,16 @@ TextureData::Handle createTexture(RW::BSTextureNative& texNative, RW::BinaryStre
if(isPal8)
{
uint32_t fullColor[texNative.width * texNative.height];
std::vector<uint32_t> fullColor(texNative.width * texNative.height);
processPalette(fullColor, rootSection);
processPalette(fullColor.data(), rootSection);
glGenTextures(1, &textureName);
glBindTexture(GL_TEXTURE_2D, textureName);
glTexImage2D(
GL_TEXTURE_2D, 0, GL_RGBA,
texNative.width, texNative.height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, fullColor
GL_RGBA, GL_UNSIGNED_BYTE, fullColor.data()
);
}
else if(isFulc)