Merge pull request #132 from tinmanjuggernaut/fix_warnings

Fix build warnings on other platforms
master
Marc 2020-04-03 14:02:58 +01:00 committed by GitHub
commit 1521f0d940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 8 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
*.o
*.autosave
*.bc
*.d

4
SCsub
View File

@ -22,6 +22,10 @@ files = [
for f in files:
env_voxel.add_source_files(env.modules_sources, f)
# Ignored clang warnings because Godot's codebase is old and isn't using override yet
if env['platform'] == 'osx' or env['platform'] == 'android':
env_voxel.Append(CXXFLAGS=['-Wno-inconsistent-missing-override'])
# Doesn't work, because reasons
#if env.msvc:
# env_voxel.Append(CXXFLAGS=['/std:c++17'])

View File

@ -453,7 +453,7 @@ void Voxel::_bind_methods() {
Array Voxel::_b_get_collision_aabbs() const {
Array array;
array.resize(_collision_aabbs.size());
for (int i = 0; i < _collision_aabbs.size(); ++i) {
for (size_t i = 0; i < _collision_aabbs.size(); ++i) {
array[i] = _collision_aabbs[i];
}
return array;

View File

@ -181,7 +181,7 @@ void VoxelLibrary::generate_side_culling_matrix() {
};
std::vector<Pattern> patterns;
uint32_t full_side_pattern_index = -1;
uint32_t full_side_pattern_index = NULL_INDEX;
// Gather patterns
for (uint16_t type_id = 0; type_id < _voxel_types.size(); ++type_id) {
@ -248,7 +248,7 @@ void VoxelLibrary::generate_side_culling_matrix() {
}
// Find if the same pattern already exists
unsigned int pattern_index = -1;
uint32_t pattern_index = NULL_INDEX;
for (unsigned int i = 0; i < patterns.size(); ++i) {
if (patterns[i].bitmap == bitmap) {
pattern_index = i;
@ -258,7 +258,7 @@ void VoxelLibrary::generate_side_culling_matrix() {
// Get or create pattern
Pattern *pattern = nullptr;
if (pattern_index != -1) {
if (pattern_index != NULL_INDEX) {
pattern = &patterns[pattern_index];
} else {
pattern_index = patterns.size();
@ -269,7 +269,7 @@ void VoxelLibrary::generate_side_culling_matrix() {
CRASH_COND(pattern == nullptr);
if (full_side_pattern_index == -1 && bitmap.all()) {
if (full_side_pattern_index == NULL_INDEX && bitmap.all()) {
full_side_pattern_index = pattern_index;
}
if (pattern_index != full_side_pattern_index) {

View File

@ -11,6 +11,7 @@ class VoxelLibrary : public Resource {
public:
// Limit based on maximum supported by VoxelMesherBlocky
static const unsigned int MAX_VOXEL_TYPES = 65536;
static const uint32_t NULL_INDEX = 0xFFFFFFFF;
VoxelLibrary();
~VoxelLibrary();

View File

@ -299,7 +299,7 @@ inline void scale_positions(PoolVector3Array &positions, float scale) {
Array generate_debug_octree_mesh(OctreeNode *root, int scale) {
struct GetMaxDepth {
int max_depth;
int max_depth = 0;
void operator()(OctreeNode *_, int depth) {
if (depth > max_depth) {
max_depth = depth;

View File

@ -83,7 +83,7 @@ static Vector3 get_motion(AABB box, Vector3 motion, const std::vector<AABB> &env
AABB expanded_box = expand_with_vector(box, motion);
Vector<AABB> colliding_boxes;
for (int i = 0; i < environment_boxes.size(); ++i) {
for (size_t i = 0; i < environment_boxes.size(); ++i) {
const AABB &other = environment_boxes[i];
if (expanded_box.intersects(other)) {
colliding_boxes.push_back(other);

View File

@ -80,7 +80,7 @@ void VoxelMemoryPool::debug_print() {
int i = 0;
while ((key = _pools.next(key))) {
Pool *pool = _pools.get(*key);
print_line(String("Pool {0} for size {1}: {2} blocks").format(varray(i, *key, pool->blocks.size())));
print_line(String("Pool {0} for size {1}: {2} blocks").format(varray(i, *key, static_cast<int>(pool->blocks.size()))));
++i;
}
}