Fixed some warnings, set -Wall, -Wextra

This commit is contained in:
MihailRis 2023-09-19 14:14:50 +03:00 committed by GitHub
parent 0837f8945f
commit eaf1fa54cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 10 deletions

View File

@ -7,6 +7,12 @@ file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
endif()
option(VE_USE_SYSTEM_LIBS "Use system installed libraries" ON)
find_package(OpenGL REQUIRED)

View File

@ -3,9 +3,7 @@
#include <map>
#include <unordered_map>
#ifndef std::string
#include <string>
#endif
class Player;
#define REGION_SIZE_BIT 5

View File

@ -1,9 +1,7 @@
#ifndef FILES_FILES_H_
#define FILES_FILES_H_
#ifndef std::string
#include <string>
#endif
extern bool write_binary_file(std::string filename, const char* data, size_t size);
extern unsigned int append_binary_file(std::string filename, const char* data, size_t size);

View File

@ -162,7 +162,7 @@ void mainloop(Level* level, Assets* assets) {
for (int i = 0; i < freeLoaders; i++)
level->chunksController->loadVisible(world->wfile);
worldRenderer.draw(world, camera, occlusion);
worldRenderer.draw(camera, occlusion);
hud.draw(level, assets);
if (level->player->debug) {
hud.drawDebug(level, assets, fps, occlusion);

View File

@ -1,7 +1,10 @@
#include "Level.h"
#include "../lighting/Lighting.h"
#include "../voxels/Chunks.h"
#include "../voxels/ChunksController.h"
#include "../player_control.h"
#include "../physics/PhysicsSolver.h"
#include "../objects/Player.h"
Level::Level(World* world, Player* player, Chunks* chunks, PhysicsSolver* physics) :
world(world),

View File

@ -73,7 +73,7 @@ bool WorldRenderer::drawChunk(size_t index, Camera* camera, Shader* shader, bool
}
void WorldRenderer::draw(World* world, Camera* camera, bool occlusion){
void WorldRenderer::draw(Camera* camera, bool occlusion){
Chunks* chunks = level->chunks;
vec4 skyColor(0.7f, 0.81f, 1.0f, 1.0f);

View File

@ -4,10 +4,7 @@
#include <vector>
#include <algorithm>
#include <GL/glew.h>
#ifndef std::string
#include <string>
#endif
#include <glm/glm.hpp>
#include <glm/ext.hpp>
@ -37,7 +34,7 @@ public:
WorldRenderer(Level* level, Assets* assets);
~WorldRenderer();
void draw(World* world, Camera* camera, bool occlusion);
void draw(Camera* camera, bool occlusion);
};