mirror of
https://github.com/p2r3/bareiron.git
synced 2025-10-02 07:35:08 +02:00
address compiler warnings
This commit is contained in:
2
build.sh
2
build.sh
@@ -1,3 +1,3 @@
|
|||||||
rm bareiron
|
rm bareiron
|
||||||
gcc main.c src/*.c -o bareiron
|
gcc src/*.c -o bareiron
|
||||||
./bareiron
|
./bareiron
|
||||||
|
13
src/main.c
13
src/main.c
@@ -20,12 +20,12 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "src/globals.h"
|
#include "globals.h"
|
||||||
#include "src/tools.h"
|
#include "tools.h"
|
||||||
#include "src/varnum.h"
|
#include "varnum.h"
|
||||||
#include "src/packets.h"
|
#include "packets.h"
|
||||||
#include "src/worldgen.h"
|
#include "worldgen.h"
|
||||||
#include "src/registries.h"
|
#include "registries.h"
|
||||||
|
|
||||||
uint64_t world_time = 0;
|
uint64_t world_time = 0;
|
||||||
|
|
||||||
@@ -251,7 +251,6 @@ int main () {
|
|||||||
int server_fd, client_fd, opt = 1;
|
int server_fd, client_fd, opt = 1;
|
||||||
struct sockaddr_in server_addr, client_addr;
|
struct sockaddr_in server_addr, client_addr;
|
||||||
socklen_t addr_len = sizeof(client_addr);
|
socklen_t addr_len = sizeof(client_addr);
|
||||||
struct sockaddr_in addr;
|
|
||||||
|
|
||||||
// Create socket
|
// Create socket
|
||||||
server_fd = socket(AF_INET, SOCK_STREAM, 0);
|
server_fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
@@ -226,7 +226,7 @@ int sc_synchronizePlayerPosition (int client_fd, double x, double y, double z, f
|
|||||||
}
|
}
|
||||||
|
|
||||||
// S->C Set Default Spawn Position
|
// S->C Set Default Spawn Position
|
||||||
int sc_setDefaultSpawnPosition (int client_fd, long x, long y, long z) {
|
int sc_setDefaultSpawnPosition (int client_fd, int64_t x, int64_t y, int64_t z) {
|
||||||
|
|
||||||
writeVarInt(client_fd, sizeVarInt(0x5A) + 12);
|
writeVarInt(client_fd, sizeVarInt(0x5A) + 12);
|
||||||
writeVarInt(client_fd, 0x5A);
|
writeVarInt(client_fd, 0x5A);
|
||||||
|
@@ -17,7 +17,7 @@ int sc_knownPacks (int client_fd);
|
|||||||
int sc_finishConfiguration (int client_fd);
|
int sc_finishConfiguration (int client_fd);
|
||||||
int sc_loginPlay (int client_fd);
|
int sc_loginPlay (int client_fd);
|
||||||
int sc_synchronizePlayerPosition (int client_fd, double x, double y, double z, float yaw, float pitch);
|
int sc_synchronizePlayerPosition (int client_fd, double x, double y, double z, float yaw, float pitch);
|
||||||
int sc_setDefaultSpawnPosition (int client_fd, long x, long y, long z);
|
int sc_setDefaultSpawnPosition (int client_fd, int64_t x, int64_t y, int64_t z);
|
||||||
int sc_startWaitingForChunks (int client_fd);
|
int sc_startWaitingForChunks (int client_fd);
|
||||||
int sc_playerAbilities (int client_fd, uint8_t flags);
|
int sc_playerAbilities (int client_fd, uint8_t flags);
|
||||||
int sc_updateTime (int client_fd, uint64_t ticks);
|
int sc_updateTime (int client_fd, uint64_t ticks);
|
||||||
|
@@ -195,7 +195,7 @@ void clearPlayerFD (int client_fd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t serverSlotToClientSlot (uint8_t slot) {
|
uint8_t serverSlotToClientSlot (uint8_t slot) {
|
||||||
if (slot >= 0 && slot < 9) return slot + 36;
|
if (slot < 9) return slot + 36;
|
||||||
if (slot >= 9 && slot <= 35) return slot;
|
if (slot >= 9 && slot <= 35) return slot;
|
||||||
if (slot == 40) return 45;
|
if (slot == 40) return 45;
|
||||||
if (slot >= 36 && slot <= 39) return 3 - (slot - 36) + 5;
|
if (slot >= 36 && slot <= 39) return 3 - (slot - 36) + 5;
|
||||||
@@ -229,7 +229,7 @@ uint8_t clientSlotToServerSlot (int window_id, uint8_t slot) {
|
|||||||
|
|
||||||
// move furnace items to the player's crafting grid
|
// move furnace items to the player's crafting grid
|
||||||
// this lets us put them back in the inventory once the window closes
|
// this lets us put them back in the inventory once the window closes
|
||||||
if (slot >= 0 && slot <= 2) return 41 + slot;
|
if (slot <= 2) return 41 + slot;
|
||||||
// the rest of the slots are identical, just shifted by 6
|
// the rest of the slots are identical, just shifted by 6
|
||||||
if (slot >= 3 && slot <= 38) return clientSlotToServerSlot(0, slot + 6);
|
if (slot >= 3 && slot <= 38) return clientSlotToServerSlot(0, slot + 6);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user