optimize block changes struct

This commit is contained in:
p2r3
2025-08-19 17:42:45 +03:00
parent 20f9856b47
commit 293ed517ea
3 changed files with 5 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ extern uint32_t rng_seed;
typedef struct {
short x;
short y;
uint8_t y;
short z;
uint8_t block;
} BlockChange;

View File

@@ -330,7 +330,7 @@ int givePlayerItem (PlayerData *player, uint16_t item, uint8_t count) {
}
uint8_t getBlockChange (short x, short y, short z) {
uint8_t getBlockChange (short x, uint8_t y, short z) {
for (int i = 0; i < block_changes_count; i ++) {
if (block_changes[i].block == 0xFF) continue;
if (
@@ -342,7 +342,7 @@ uint8_t getBlockChange (short x, short y, short z) {
return 0xFF;
}
void makeBlockChange (short x, short y, short z, uint8_t block) {
void makeBlockChange (short x, uint8_t y, short z, uint8_t block) {
// Transmit block update to all in-game clients
for (int i = 0; i < MAX_PLAYERS; i ++) {

View File

@@ -42,8 +42,8 @@ int givePlayerItem (PlayerData *player, uint16_t item, uint8_t count);
uint8_t serverSlotToClientSlot (int window_id, uint8_t slot);
uint8_t clientSlotToServerSlot (int window_id, uint8_t slot);
uint8_t getBlockChange (short x, short y, short z);
void makeBlockChange (short x, short y, short z, uint8_t block);
uint8_t getBlockChange (short x, uint8_t y, short z);
void makeBlockChange (short x, uint8_t y, short z, uint8_t block);
uint16_t getMiningResult (int client_fd, uint8_t block);