Remove Some Magic Numbers
minecraft-pi-reborn/pipeline/head This commit looks good Details

This commit is contained in:
TheBrokenRail 2021-02-10 15:25:56 -05:00
parent 4d8c8ae3c1
commit b81d29095b
3 changed files with 4 additions and 2 deletions

View File

@ -183,6 +183,8 @@ static void *TextEditScreen_updateEvents_vtable_addr = (void *) 0x10531c;
// ProgressScreen // ProgressScreen
#define PROGRESS_SCREEN_SIZE 0x4c
typedef void *(*ProgressScreen_t)(unsigned char *obj); typedef void *(*ProgressScreen_t)(unsigned char *obj);
static ProgressScreen_t ProgressScreen = (ProgressScreen_t) 0x37044; static ProgressScreen_t ProgressScreen = (ProgressScreen_t) 0x37044;

View File

@ -45,7 +45,7 @@ static int32_t Inventory_setupDefault_FillingContainer_addItem_call_injection(un
// Bonemeal Is Already In The Creative Inventory // Bonemeal Is Already In The Creative Inventory
continue; continue;
} }
unsigned char *item_instance = (unsigned char *) ::operator new(0xc); unsigned char *item_instance = (unsigned char *) ::operator new(ITEM_INSTANCE_SIZE);
item_instance = (*ItemInstance_constructor_item_extra)(item_instance, *Item_dye_powder, 1, i); item_instance = (*ItemInstance_constructor_item_extra)(item_instance, *Item_dye_powder, 1, i);
(*FillingContainer_addItem)(filling_container, item_instance); (*FillingContainer_addItem)(filling_container, item_instance);
} }

View File

@ -86,7 +86,7 @@ static void start_world(unsigned char *minecraft) {
(*Minecraft_hostMultiplayer)(minecraft, port); (*Minecraft_hostMultiplayer)(minecraft, port);
INFO("Listening On: %i", port); INFO("Listening On: %i", port);
void *screen = ::operator new(0x4c); void *screen = ::operator new(PROGRESS_SCREEN_SIZE);
screen = (*ProgressScreen)((unsigned char *) screen); screen = (*ProgressScreen)((unsigned char *) screen);
(*Minecraft_setScreen)(minecraft, (unsigned char *) screen); (*Minecraft_setScreen)(minecraft, (unsigned char *) screen);
} }