fix android build not compiling

This commit is contained in:
UnknownShadow200 2020-04-17 22:04:38 +10:00
parent dd3335aa89
commit 2a1837cfc7
6 changed files with 19 additions and 21 deletions

View File

@ -23,7 +23,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall -Werror")
add_library(classicube SHARED
../../src/Program.c
../../src/_fttype1.c
../../src/IsometricDrawer.c
../../src/Builder.c
../../src/ExtMath.c

View File

@ -222,19 +222,6 @@ static void HacksComp_ParseAllFlag(struct HacksComp* hacks, const char* include,
}
}
void HacksComp_SetUserType(struct HacksComp* hacks, cc_uint8 value, cc_bool setBlockPerms) {
cc_bool isOp = value >= 100 && value <= 127;
hacks->IsOp = isOp;
if (!setBlockPerms) return;
Blocks.CanPlace[BLOCK_BEDROCK] = isOp;
Blocks.CanDelete[BLOCK_BEDROCK] = isOp;
Blocks.CanPlace[BLOCK_WATER] = isOp;
Blocks.CanPlace[BLOCK_STILL_WATER] = isOp;
Blocks.CanPlace[BLOCK_LAVA] = isOp;
Blocks.CanPlace[BLOCK_STILL_LAVA] = isOp;
}
void HacksComp_RecheckFlags(struct HacksComp* hacks) {
/* Can use hacks by default (also case with WoM), no need to check +hax */
cc_bool hax = !String_ContainsConst(&hacks->HacksFlags, "-hax");

View File

@ -67,7 +67,6 @@ struct HacksComp {
void HacksComp_Init(struct HacksComp* hacks);
cc_bool HacksComp_CanJumpHigher(struct HacksComp* hacks);
void HacksComp_SetUserType(struct HacksComp* hacks, cc_uint8 value, cc_bool setBlockPerms);
/* Determines hacks permissions based on flags, then calls HacksComp_Update */
/* e.g. +ophax allows all hacks if op, -push disables entity pushing */
void HacksComp_RecheckFlags(struct HacksComp* hacks);

View File

@ -77,7 +77,8 @@ static const cc_uint8 classicInventory[42] = {
BLOCK_GOLD_ORE, BLOCK_IRON, BLOCK_GOLD, BLOCK_BOOKSHELF, BLOCK_TNT, BLOCK_OBSIDIAN,
};
static BlockID Inventory_DefaultMapping(int slot) {
/* Returns default block that should go in the given inventory slot */
static BlockID DefaultMapping(int slot) {
if (Game_ClassicMode) {
if (slot < 9 * 4 + 6) return classicInventory[slot];
}else if (slot < BLOCK_MAX_CPE) {
@ -89,7 +90,7 @@ static BlockID Inventory_DefaultMapping(int slot) {
void Inventory_ApplyDefaultMapping(void) {
int slot;
for (slot = 0; slot < Array_Elems(Inventory.Map); slot++) {
Inventory.Map[slot] = Inventory_DefaultMapping(slot);
Inventory.Map[slot] = DefaultMapping(slot);
}
}
@ -100,7 +101,7 @@ void Inventory_AddDefault(BlockID block) {
}
for (slot = 0; slot < BLOCK_MAX_CPE; slot++) {
if (Inventory_DefaultMapping(slot) != block) continue;
if (DefaultMapping(slot) != block) continue;
Inventory.Map[slot] = block;
return;
}

View File

@ -193,6 +193,19 @@ static void UpdateLocation(EntityID id, struct LocationUpdate* update, cc_bool i
if (e) { e->VTABLE->SetLocation(e, update, interpolate); }
}
static void UpdateUserType(struct HacksComp* hacks, cc_uint8 value) {
cc_bool isOp = value >= 100 && value <= 127;
hacks->IsOp = isOp;
if (cpe_blockPerms) return;
Blocks.CanPlace[BLOCK_BEDROCK] = isOp;
Blocks.CanDelete[BLOCK_BEDROCK] = isOp;
Blocks.CanPlace[BLOCK_WATER] = isOp;
Blocks.CanPlace[BLOCK_STILL_WATER] = isOp;
Blocks.CanPlace[BLOCK_LAVA] = isOp;
Blocks.CanPlace[BLOCK_STILL_LAVA] = isOp;
}
/*########################################################################################################################*
*------------------------------------------------------WoM protocol-------------------------------------------------------*
@ -378,7 +391,7 @@ static void Classic_Handshake(cc_uint8* data) {
Chat_SetLogName(&Server.Name);
hacks = &LocalPlayer_Instance.Hacks;
HacksComp_SetUserType(hacks, *data, !cpe_blockPerms);
UpdateUserType(hacks, *data);
String_Copy(&hacks->HacksFlags, &Server.Name);
String_AppendString(&hacks->HacksFlags, &Server.MOTD);
@ -651,7 +664,7 @@ static void Classic_Kick(cc_uint8* data) {
static void Classic_SetPermission(cc_uint8* data) {
struct HacksComp* hacks = &LocalPlayer_Instance.Hacks;
HacksComp_SetUserType(hacks, data[0], !cpe_blockPerms);
UpdateUserType(hacks, data[0]);
HacksComp_RecheckFlags(hacks);
}

View File

@ -84,7 +84,6 @@
#define ft_memset memset
#define ft_strcat strcat
#define ft_strcmp strcmp
#define ft_strcpy strcpy
#define ft_strlen strlen
#define ft_strncmp strncmp
#define ft_strstr strstr