fix all msvc W3 warnings
parent
b6cf690c25
commit
11929260e2
|
@ -9,7 +9,9 @@ function(link_system_libs target_name)
|
||||||
target_link_libraries(${target_name} pthread m dl atomic)
|
target_link_libraries(${target_name} pthread m dl atomic)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT WIN32)
|
if (WIN32)
|
||||||
|
target_compile_options(${target_name} PRIVATE -WX -W3 -wd5105)
|
||||||
|
else()
|
||||||
target_compile_options(${target_name} PRIVATE -Werror -Wall -Wextra -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter)
|
target_compile_options(${target_name} PRIVATE -Werror -Wall -Wextra -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter)
|
||||||
endif ()
|
endif ()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -21,7 +21,7 @@ int32_t tracker_read_update(librg_world *w, librg_event *e) {
|
||||||
size_t actual_length = librg_event_size_get(w, e);
|
size_t actual_length = librg_event_size_get(w, e);
|
||||||
char *buffer = librg_event_buffer_get(w, e);
|
char *buffer = librg_event_buffer_get(w, e);
|
||||||
world_view *view = (world_view*)librg_world_userdata_get(w);
|
world_view *view = (world_view*)librg_world_userdata_get(w);
|
||||||
|
|
||||||
entity_view data = entity_view_unpack_struct(buffer, actual_length);
|
entity_view data = entity_view_unpack_struct(buffer, actual_length);
|
||||||
entity_view *d = entity_view_get(&view->entities, entity_id);
|
entity_view *d = entity_view_get(&view->entities, entity_id);
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -33,8 +33,8 @@ int32_t tracker_read_update(librg_world *w, librg_event *e) {
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
data.last_update = get_cached_time()*1000.0f;
|
data.last_update = (uint64_t)(get_cached_time()*1000.0f);
|
||||||
data.layer_id = view->active_layer_id;
|
data.layer_id = view->active_layer_id;
|
||||||
predict_receive_update(d, &data);
|
predict_receive_update(d, &data);
|
||||||
entity_view_update_or_create(&view->entities, entity_id, data);
|
entity_view_update_or_create(&view->entities, entity_id, data);
|
||||||
|
@ -48,7 +48,7 @@ int32_t tracker_read_create(librg_world *w, librg_event *e) {
|
||||||
size_t actual_length = librg_event_size_get(w, e);
|
size_t actual_length = librg_event_size_get(w, e);
|
||||||
char *buffer = librg_event_buffer_get(w, e);
|
char *buffer = librg_event_buffer_get(w, e);
|
||||||
world_view *view = (world_view*)librg_world_userdata_get(w);
|
world_view *view = (world_view*)librg_world_userdata_get(w);
|
||||||
|
|
||||||
entity_view data = entity_view_unpack_struct(buffer, actual_length);
|
entity_view data = entity_view_unpack_struct(buffer, actual_length);
|
||||||
data.ent_id = entity_id;
|
data.ent_id = entity_id;
|
||||||
data.layer_id = view->active_layer_id;
|
data.layer_id = view->active_layer_id;
|
||||||
|
@ -80,11 +80,11 @@ void world_view_init(world_view *view, uint32_t seed, uint64_t ent_id, uint16_t
|
||||||
view->chunk_amount = chunk_amount;
|
view->chunk_amount = chunk_amount;
|
||||||
view->dim = WORLD_BLOCK_SIZE * chunk_size * chunk_amount;
|
view->dim = WORLD_BLOCK_SIZE * chunk_size * chunk_amount;
|
||||||
view->size = view->dim * view->dim;
|
view->size = view->dim * view->dim;
|
||||||
|
|
||||||
librg_config_chunksize_set(view->tracker, WORLD_BLOCK_SIZE * chunk_size, WORLD_BLOCK_SIZE * chunk_size, 1);
|
librg_config_chunksize_set(view->tracker, WORLD_BLOCK_SIZE * chunk_size, WORLD_BLOCK_SIZE * chunk_size, 1);
|
||||||
librg_config_chunkamount_set(view->tracker, chunk_amount, chunk_amount, 1);
|
librg_config_chunkamount_set(view->tracker, chunk_amount, chunk_amount, 1);
|
||||||
librg_config_chunkoffset_set(view->tracker, LIBRG_OFFSET_BEG, LIBRG_OFFSET_BEG, LIBRG_OFFSET_BEG);
|
librg_config_chunkoffset_set(view->tracker, LIBRG_OFFSET_BEG, LIBRG_OFFSET_BEG, LIBRG_OFFSET_BEG);
|
||||||
|
|
||||||
librg_event_set(view->tracker, LIBRG_READ_CREATE, tracker_read_create);
|
librg_event_set(view->tracker, LIBRG_READ_CREATE, tracker_read_create);
|
||||||
librg_event_set(view->tracker, LIBRG_READ_REMOVE, tracker_read_remove);
|
librg_event_set(view->tracker, LIBRG_READ_REMOVE, tracker_read_remove);
|
||||||
librg_event_set(view->tracker, LIBRG_READ_UPDATE, tracker_read_update);
|
librg_event_set(view->tracker, LIBRG_READ_UPDATE, tracker_read_update);
|
||||||
|
|
|
@ -19,7 +19,7 @@ typedef WORLD_BLOCK_OBSERVER(world_block_observer_proc);
|
||||||
// ensure it is set in worldgen_build
|
// ensure it is set in worldgen_build
|
||||||
|
|
||||||
int worldgen_in_circle(int x, int y, int radius) {
|
int worldgen_in_circle(int x, int y, int radius) {
|
||||||
return (zpl_pow(x, 2) + zpl_pow(y, 2)) < zpl_pow(radius, 2);
|
return (zpl_pow((float)x, 2.0f) + zpl_pow((float)y, 2.0f)) < zpl_pow((float)radius, 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void world_fill_rect(block_id *data, block_id id, uint32_t x, uint32_t y, uint32_t w, uint32_t h, world_block_observer_proc *proc) {
|
static void world_fill_rect(block_id *data, block_id id, uint32_t x, uint32_t y, uint32_t w, uint32_t h, world_block_observer_proc *proc) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ int32_t worldgen_build(world_data *wld) {
|
||||||
world_fill_circle(world->data, dirt_id, world->dim / 2, world->dim / 2, radius, NULL);
|
world_fill_circle(world->data, dirt_id, world->dim / 2, world->dim / 2, radius, NULL);
|
||||||
|
|
||||||
// narrow boy cirlce
|
// narrow boy cirlce
|
||||||
world_fill_circle(world->data, grnd_id, world->dim / 2, world->dim / 2, radius * 0.7f, NULL);
|
world_fill_circle(world->data, grnd_id, world->dim / 2, world->dim / 2, (uint32_t)(radius * 0.7f), NULL);
|
||||||
|
|
||||||
|
|
||||||
return WORLD_ERROR_NONE;
|
return WORLD_ERROR_NONE;
|
||||||
|
|
Loading…
Reference in New Issue