code: fix warnings

isolation_bkp/dynres
Dominik Madarász 2022-07-31 11:35:07 +02:00
parent 5fec9574c8
commit 3b40354054
2 changed files with 7 additions and 4 deletions

View File

@ -1,12 +1,15 @@
#include "zpl.h" #include "zpl.h"
#define ENET_IMPLEMENTATION #define ENET_IMPLEMENTATION
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#pragma warning(push, 0)
#include "enet.h" #include "enet.h"
#define LIBRG_IMPL #define LIBRG_IMPL
#define LIBRG_CUSTOM_ZPL #define LIBRG_CUSTOM_ZPL
#define LIBRG_ENTITY_MAXCHUNKS 1 #define LIBRG_ENTITY_MAXCHUNKS 1
#include "librg.h" #include "librg.h"
#pragma warning(pop)
#include "network.h" #include "network.h"
#include "packet.h" #include "packet.h"
@ -80,7 +83,7 @@ int32_t network_client_tick() {
} break; } break;
case ENET_EVENT_TYPE_RECEIVE: { case ENET_EVENT_TYPE_RECEIVE: {
if (!world_read(event.packet->data, event.packet->dataLength, event.peer)) { if (!world_read(event.packet->data, (uint32_t)event.packet->dataLength, event.peer)) {
zpl_printf("[INFO] Server sent us an unsupported packet.\n"); zpl_printf("[INFO] Server sent us an unsupported packet.\n");
} }
@ -202,7 +205,7 @@ int32_t network_server_tick(void) {
} break; } break;
case ENET_EVENT_TYPE_RECEIVE: { case ENET_EVENT_TYPE_RECEIVE: {
if (!world_read(event.packet->data, event.packet->dataLength, event.peer)) { if (!world_read(event.packet->data, (uint32_t)event.packet->dataLength, event.peer)) {
zpl_printf("[INFO] User %d sent us a malformed packet.\n", event.peer->incomingPeerID); zpl_printf("[INFO] User %d sent us a malformed packet.\n", event.peer->incomingPeerID);
} }
@ -236,7 +239,7 @@ uint64_t network_server_get_entity(void *peer_id) {
static int32_t network_msg_send_raw(ENetPeer *peer_id, void *data, size_t datalen, uint32_t flags, uint16_t channel_id) { static int32_t network_msg_send_raw(ENetPeer *peer_id, void *data, size_t datalen, uint32_t flags, uint16_t channel_id) {
if (peer_id == 0) peer_id = peer; if (peer_id == 0) peer_id = peer;
ENetPacket *packet = enet_packet_create(data, datalen, flags); ENetPacket *packet = enet_packet_create(data, datalen, flags);
return enet_peer_send(peer_id, channel_id, packet); return enet_peer_send(peer_id, (enet_uint8)channel_id, packet);
} }
int32_t network_msg_send(void *peer_id, void *data, size_t datalen, uint16_t channel_id) { int32_t network_msg_send(void *peer_id, void *data, size_t datalen, uint16_t channel_id) {

View File

@ -143,7 +143,7 @@ void world_setup_pkt_handlers(world_pkt_reader_proc *reader_proc, world_pkt_writ
} }
static inline static inline
world_chunk_setup_grid(void) { void world_chunk_setup_grid(void) {
for (int i = 0; i < zpl_square(world.chunk_amount); ++i) { for (int i = 0; i < zpl_square(world.chunk_amount); ++i) {
ecs_entity_t e = ecs_new(world.ecs, 0); ecs_entity_t e = ecs_new(world.ecs, 0);
ecs_set(world.ecs, e, Classify, {.id = EKIND_CHUNK }); ecs_set(world.ecs, e, Classify, {.id = EKIND_CHUNK });