From 596ff01f751264d8cbbbed2fa1674fa7ca318138 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Fri, 22 Nov 2024 00:22:49 -0500 Subject: [PATCH] Remove libreborn.h: Part 3 --- mods/include/mods/chat/chat.h | 1 - mods/src/atlas/atlas.cpp | 5 ++++- mods/src/benchmark/benchmark.cpp | 7 +++++-- mods/src/bucket/bucket.cpp | 11 +++++------ mods/src/cake/cake.cpp | 16 ++++++---------- mods/src/camera/camera.cpp | 3 +-- mods/src/chat/chat.cpp | 6 ++---- mods/src/chat/ui.cpp | 1 - mods/src/classic-ui/classic-ui.cpp | 2 +- mods/src/compat/bcm_host.cpp | 2 +- mods/src/compat/compat.cpp | 5 +++-- mods/src/compat/egl.cpp | 2 +- mods/src/compat/sdl.cpp | 4 ++-- mods/src/compat/x11.cpp | 6 +++--- mods/src/creative/creative.cpp | 9 ++------- mods/src/death/death.cpp | 3 ++- mods/src/f3/f3.cpp | 2 +- mods/src/fps/fps.cpp | 4 +++- mods/src/game-mode/game-mode.cpp | 9 +++++---- mods/src/game-mode/ui.cpp | 5 ++--- mods/src/init/init.cpp | 5 +++-- mods/src/input/attack.cpp | 3 ++- mods/src/input/bow.cpp | 3 ++- mods/src/input/drop.cpp | 2 -- mods/src/input/keys.cpp | 2 +- mods/src/input/misc.cpp | 3 ++- mods/src/input/toggle.cpp | 3 ++- mods/src/misc/api.cpp | 4 +++- mods/src/misc/graphics.cpp | 5 ++++- mods/src/misc/home.cpp | 1 + mods/src/misc/logging.cpp | 5 ++++- mods/src/misc/misc.cpp | 7 ++++++- mods/src/misc/tinting.cpp | 3 ++- mods/src/misc/ui.cpp | 4 +++- mods/src/multidraw/glue.cpp | 5 ++++- mods/src/multidraw/storage.cpp | 2 -- mods/src/multiplayer/multiplayer.cpp | 4 +++- mods/src/options/info.cpp | 6 +++++- mods/src/options/options.cpp | 12 ++++++++---- mods/src/options/ui.cpp | 4 ++-- mods/src/override/override.cpp | 3 ++- mods/src/screenshot/screenshot.cpp | 7 ++++--- mods/src/server/server.cpp | 7 +++++-- mods/src/shading/lighting.cpp | 2 +- mods/src/shading/normals.cpp | 2 +- mods/src/shading/tesselator.cpp | 2 +- mods/src/sign/sign.cpp | 4 ++-- mods/src/skin/loader.cpp | 6 +++++- mods/src/skin/skin.cpp | 2 +- mods/src/sound/repository.cpp | 2 +- mods/src/sound/sound.cpp | 2 +- mods/src/text-input-box/TextInputBox.cpp | 2 +- mods/src/textures/headless.cpp | 2 +- mods/src/textures/lava.cpp | 2 +- mods/src/textures/textures.cpp | 5 ++++- mods/src/title-screen/splashes.cpp | 3 ++- mods/src/title-screen/title-screen.cpp | 2 +- mods/src/title-screen/welcome.cpp | 6 +++++- mods/src/touch/touch.cpp | 3 +-- mods/src/version/version.cpp | 4 +++- 60 files changed, 149 insertions(+), 105 deletions(-) diff --git a/mods/include/mods/chat/chat.h b/mods/include/mods/chat/chat.h index 49d323d2dd..bda3dc5210 100644 --- a/mods/include/mods/chat/chat.h +++ b/mods/include/mods/chat/chat.h @@ -2,7 +2,6 @@ #include -#include #include extern "C" { diff --git a/mods/src/atlas/atlas.cpp b/mods/src/atlas/atlas.cpp index 2e29b1356f..e3db3b40f4 100644 --- a/mods/src/atlas/atlas.cpp +++ b/mods/src/atlas/atlas.cpp @@ -1,7 +1,10 @@ #include -#include +#include +#include + #include + #include #include diff --git a/mods/src/benchmark/benchmark.cpp b/mods/src/benchmark/benchmark.cpp index 516091a25f..7e272adbfe 100644 --- a/mods/src/benchmark/benchmark.cpp +++ b/mods/src/benchmark/benchmark.cpp @@ -1,6 +1,10 @@ #include -#include +#include +#include +#include +#include + #include #include @@ -41,7 +45,6 @@ static void start_world(Minecraft *minecraft) { // Open ProgressScreen ProgressScreen *screen = ProgressScreen::allocate(); - ALLOC_CHECK(screen); screen = screen->constructor(); minecraft->setScreen((Screen *) screen); } diff --git a/mods/src/bucket/bucket.cpp b/mods/src/bucket/bucket.cpp index c87a1d5a02..3ae8a8d369 100644 --- a/mods/src/bucket/bucket.cpp +++ b/mods/src/bucket/bucket.cpp @@ -1,4 +1,5 @@ -#include +#include + #include #include @@ -22,7 +23,7 @@ static std::string BucketItem_getDescriptionId(__attribute__((unused)) FoodItem return "item.bucket"; } } -static int32_t BucketItem_getIcon(__attribute__((unused)) FoodItem *item, int32_t auxiliary) { +static int32_t BucketItem_getIcon(__attribute__((unused)) FoodItem *item, const int32_t auxiliary) { if (auxiliary == Tile::water->id) { return 75; } else if (auxiliary == Tile::lava->id) { @@ -35,7 +36,7 @@ static int32_t BucketItem_getIcon(__attribute__((unused)) FoodItem *item, int32_ } // Filling -static bool fill_bucket(ItemInstance *item_instance, Player *player, int new_auxiliary) { +static bool fill_bucket(ItemInstance *item_instance, const Player *player, const int new_auxiliary) { bool success = false; if (item_instance->count == 1) { item_instance->auxiliary = new_auxiliary; @@ -57,7 +58,7 @@ static bool fill_bucket(ItemInstance *item_instance, Player *player, int new_aux // Use Bucket -static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInstance *item_instance, Player *player, Level *level, int32_t x, int32_t y, int32_t z, int32_t hit_side, __attribute__((unused)) float hit_x, __attribute__((unused)) float hit_y, __attribute__((unused)) float hit_z) { +static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInstance *item_instance, Player *player, Level *level, int32_t x, int32_t y, int32_t z, const int32_t hit_side, __attribute__((unused)) float hit_x, __attribute__((unused)) float hit_y, __attribute__((unused)) float hit_z) { if (item_instance->count < 1 || item_instance->auxiliary == 1) { return 0; } else if (item_instance->auxiliary == 0) { @@ -188,7 +189,6 @@ CUSTOM_VTABLE(bucket, FoodItem) { static FoodItem *create_bucket(const int32_t id, int32_t texture_x, int32_t texture_y, std::string name) { // Construct FoodItem *item = FoodItem::allocate(); - ALLOC_CHECK(item); Item_constructor->get(false)((Item *) item, id); // FoodItem's Constructor Was Inlined // Set VTable @@ -237,7 +237,6 @@ bool Cow_interact_injection(Cow_interact_t original, Cow *self, Player *player) // Creative Inventory static void inventory_add_item(FillingContainer *inventory, FoodItem *item, int32_t auxiliary) { ItemInstance *item_instance = new ItemInstance; - ALLOC_CHECK(item_instance); item_instance = item_instance->constructor_item_extra((Item *) item, 1, auxiliary); inventory->addItem(item_instance); } diff --git a/mods/src/cake/cake.cpp b/mods/src/cake/cake.cpp index dc17aa75b6..1e49da8884 100644 --- a/mods/src/cake/cake.cpp +++ b/mods/src/cake/cake.cpp @@ -1,4 +1,3 @@ -#include #include #include @@ -45,7 +44,7 @@ static int Cake_getTexture3(__attribute__((unused)) Tile *tile, LevelSource *lev // Rendering static bool Cake_isSolidRender(__attribute__((unused)) Tile *tile) { // Stop it from turning other blocks invisable - return 0; + return false; } static int Cake_getRenderLayer(__attribute__((unused)) Tile *tile) { @@ -70,7 +69,7 @@ static AABB *Cake_getAABB(Tile *tile, Level *level, int x, int y, int z) { // Get the size of the slices int data = level->getData(x, y, z); if (data >= 6) data = 0; - const float slice_size = (1.0 / 7.0) * (float) data; + const float slice_size = (1.0f / 7.0f) * (float) data; // Corner 1 AABB *aabb = &tile->aabb; @@ -79,9 +78,9 @@ static AABB *Cake_getAABB(Tile *tile, Level *level, int x, int y, int z) { aabb->z1 = (float) z + CAKE_LEN; // Corner 2 - aabb->x2 = (float) x + (1.0 - CAKE_LEN); - aabb->y2 = (float) y + 0.5; - aabb->z2 = (float) z + (1.0 - CAKE_LEN) - slice_size; + aabb->x2 = (float) x + (1.0f - CAKE_LEN); + aabb->y2 = (float) y + 0.5f; + aabb->z2 = (float) z + (1.0f - CAKE_LEN) - slice_size; return aabb; } @@ -91,7 +90,7 @@ static void Cake_updateShape(Tile *tile, LevelSource *level, int x, int y, int z int data = level->getData(x, y, z); if (data >= 6) data = 0; // Get slice amount - const float slice_size = (1.0 / 7.0) * (float) data; + const float slice_size = (1.0f / 7.0f) * (float) data; tile->setShape( CAKE_LEN, 0.0, CAKE_LEN, 1.0 - CAKE_LEN, 0.5, (1.0 - CAKE_LEN) - slice_size @@ -118,14 +117,12 @@ static int Cake_use(__attribute__((unused)) Tile *tile, Level *level, int x, int static void make_cake() { // Construct cake = Tile::allocate(); - ALLOC_CHECK(cake); int texture = 122; cake->constructor(92, texture, Material::dirt); cake->texture = texture; // Set VTable cake->vtable = extend_dup_vtable(Tile_vtable::base); - ALLOC_CHECK(cake->vtable); // Set shape cake->setShape( @@ -161,7 +158,6 @@ static void Tile_initTiles_injection() { // Add cake to creative inventory static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) { ItemInstance *cake_instance = new ItemInstance; - ALLOC_CHECK(cake_instance); cake_instance->count = 255; cake_instance->auxiliary = 0; cake_instance->id = 92; diff --git a/mods/src/camera/camera.cpp b/mods/src/camera/camera.cpp index 4bdcb577cf..624a952987 100644 --- a/mods/src/camera/camera.cpp +++ b/mods/src/camera/camera.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -17,7 +17,6 @@ static EntityRenderDispatcher *EntityRenderDispatcher_injection(EntityRenderDisp // Register TripodCameraRenderer TripodCameraRenderer *renderer = TripodCameraRenderer::allocate(); - ALLOC_CHECK(renderer); renderer->constructor(); dispatcher->assign((unsigned char) 0x5, (EntityRenderer *) renderer); diff --git a/mods/src/chat/chat.cpp b/mods/src/chat/chat.cpp index aec91989c6..7940f62980 100644 --- a/mods/src/chat/chat.cpp +++ b/mods/src/chat/chat.cpp @@ -1,8 +1,6 @@ -#include -#include -#include +#include +#include -#include #include #include diff --git a/mods/src/chat/ui.cpp b/mods/src/chat/ui.cpp index dbeef2847c..c38008252c 100644 --- a/mods/src/chat/ui.cpp +++ b/mods/src/chat/ui.cpp @@ -1,6 +1,5 @@ #include "chat-internal.h" -#include #include #include diff --git a/mods/src/classic-ui/classic-ui.cpp b/mods/src/classic-ui/classic-ui.cpp index 15a58b8eef..7d80f1a879 100644 --- a/mods/src/classic-ui/classic-ui.cpp +++ b/mods/src/classic-ui/classic-ui.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/mods/src/compat/bcm_host.cpp b/mods/src/compat/bcm_host.cpp index d236abd0a4..0e3d03d87c 100644 --- a/mods/src/compat/bcm_host.cpp +++ b/mods/src/compat/bcm_host.cpp @@ -1,4 +1,4 @@ -#include +#include #include "compat-internal.h" // Do Nothing Function diff --git a/mods/src/compat/compat.cpp b/mods/src/compat/compat.cpp index 513928911b..4ae8ed0cad 100644 --- a/mods/src/compat/compat.cpp +++ b/mods/src/compat/compat.cpp @@ -3,11 +3,12 @@ #include #include -#include #include #include "compat-internal.h" -#include +#include +#include +#include #include #include diff --git a/mods/src/compat/egl.cpp b/mods/src/compat/egl.cpp index 21f7a6bbe0..6c2a2d62d6 100644 --- a/mods/src/compat/egl.cpp +++ b/mods/src/compat/egl.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include "compat-internal.h" diff --git a/mods/src/compat/sdl.cpp b/mods/src/compat/sdl.cpp index 82f240cc69..e0c8857524 100644 --- a/mods/src/compat/sdl.cpp +++ b/mods/src/compat/sdl.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include "compat-internal.h" // SDL Stub @@ -19,7 +19,7 @@ static int SDL_GetWMInfo_injection(SDL_SysWMinfo *info) { SDL_SysWMinfo ret; ret.info.x11.lock_func = x11_nop; ret.info.x11.unlock_func = x11_nop; - ret.info.x11.display = NULL; + ret.info.x11.display = nullptr; ret.info.x11.window = 0; ret.info.x11.wmwindow = ret.info.x11.window; *info = ret; diff --git a/mods/src/compat/x11.cpp b/mods/src/compat/x11.cpp index b0dadecf7d..d44d97065c 100644 --- a/mods/src/compat/x11.cpp +++ b/mods/src/compat/x11.cpp @@ -1,18 +1,18 @@ #include -#include +#include #include #include "compat-internal.h" // Functions That Have Their Return Values Used static int XTranslateCoordinates_injection(__attribute__((unused)) void *display, __attribute__((unused)) XID src_w, __attribute__((unused)) XID dest_w, int src_x, int src_y, int *dest_x_return, int *dest_y_return, __attribute__((unused)) XID *child_return) { - // Use MCPI Replacemnt Function + // Use MCPI Replacement Function *dest_x_return = src_x; *dest_y_return = src_y; return 1; } static int XGetWindowAttributes_injection(__attribute__((unused)) void *display, __attribute__((unused)) XID w, XWindowAttributes *window_attributes_return) { - // Use MCPI Replacemnt Function + // Use MCPI Replacement Function XWindowAttributes attributes = {}; attributes.x = 0; attributes.y = 0; diff --git a/mods/src/creative/creative.cpp b/mods/src/creative/creative.cpp index 4b91fb796d..e3fe41ec52 100644 --- a/mods/src/creative/creative.cpp +++ b/mods/src/creative/creative.cpp @@ -1,4 +1,5 @@ -#include +#include + #include #include @@ -9,13 +10,11 @@ // Add Item To Inventory static void inventory_add_item(FillingContainer *inventory, Item *item) { ItemInstance *item_instance = new ItemInstance; - ALLOC_CHECK(item_instance); item_instance = item_instance->constructor_item(item); inventory->addItem(item_instance); } static void inventory_add_item(FillingContainer *inventory, Tile *item) { ItemInstance *item_instance = new ItemInstance; - ALLOC_CHECK(item_instance); item_instance = item_instance->constructor_tile(item); inventory->addItem(item_instance); } @@ -34,7 +33,6 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli continue; } ItemInstance *new_item_instance = new ItemInstance; - ALLOC_CHECK(new_item_instance); new_item_instance = new_item_instance->constructor_item_extra(Item::dye_powder, 1, i); filling_container->addItem(new_item_instance); } @@ -59,7 +57,6 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli continue; } ItemInstance *new_item_instance = new ItemInstance; - ALLOC_CHECK(new_item_instance); new_item_instance = new_item_instance->constructor_tile_extra(Tile::netherReactor, 1, i); filling_container->addItem(new_item_instance); } @@ -70,14 +67,12 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli continue; } ItemInstance *new_item_instance = new ItemInstance; - ALLOC_CHECK(new_item_instance); new_item_instance = new_item_instance->constructor_tile_extra(Tile::tallgrass, 1, i); filling_container->addItem(new_item_instance); } // Smooth Stone Slab { ItemInstance *new_item_instance = new ItemInstance; - ALLOC_CHECK(new_item_instance); new_item_instance = new_item_instance->constructor_tile_extra(Tile::stoneSlab, 1, 6); filling_container->addItem(new_item_instance); } diff --git a/mods/src/death/death.cpp b/mods/src/death/death.cpp index 913a1a849e..64c00e0743 100644 --- a/mods/src/death/death.cpp +++ b/mods/src/death/death.cpp @@ -1,6 +1,7 @@ #include -#include +#include + #include #include diff --git a/mods/src/f3/f3.cpp b/mods/src/f3/f3.cpp index 380ed96406..4b96463a3e 100644 --- a/mods/src/f3/f3.cpp +++ b/mods/src/f3/f3.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/mods/src/fps/fps.cpp b/mods/src/fps/fps.cpp index 3e6ef9fa73..94682e57ef 100644 --- a/mods/src/fps/fps.cpp +++ b/mods/src/fps/fps.cpp @@ -1,4 +1,6 @@ -#include +#include +#include + #include #include diff --git a/mods/src/game-mode/game-mode.cpp b/mods/src/game-mode/game-mode.cpp index 26834c28ba..de70c682bb 100644 --- a/mods/src/game-mode/game-mode.cpp +++ b/mods/src/game-mode/game-mode.cpp @@ -1,11 +1,12 @@ #include +#include + +#include + #include #include -#include -#include - #include "game-mode-internal.h" static int is_survival = -1; @@ -17,7 +18,7 @@ static void set_is_survival(const bool new_is_survival) { if (is_survival != new_is_survival) { DEBUG("Setting Game Mode: %s", new_is_survival ? "Survival" : "Creative"); - // Correct Inventpry UI + // Correct Inventory UI unsigned char inventory_patch[4] = {(unsigned char) (new_is_survival ? 0x00 : 0x01), 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" or "mov r3, #0x1" patch((void *) 0x16efc, inventory_patch); diff --git a/mods/src/game-mode/ui.cpp b/mods/src/game-mode/ui.cpp index dbc1877a57..af78d564df 100644 --- a/mods/src/game-mode/ui.cpp +++ b/mods/src/game-mode/ui.cpp @@ -1,9 +1,9 @@ #include #include -#include #include -#include + +#include #include #include @@ -213,7 +213,6 @@ static void create_world(Minecraft *minecraft, std::string name, const bool is_c // Open ProgressScreen ProgressScreen *screen = ProgressScreen::allocate(); - ALLOC_CHECK(screen); screen = screen->constructor(); minecraft->setScreen((Screen *) screen); } diff --git a/mods/src/init/init.cpp b/mods/src/init/init.cpp index a819fa200e..38d49dabf7 100644 --- a/mods/src/init/init.cpp +++ b/mods/src/init/init.cpp @@ -1,6 +1,7 @@ -#include +#include +#include + #include -#include #include __attribute__((constructor)) static void init() { diff --git a/mods/src/input/attack.cpp b/mods/src/input/attack.cpp index 942c50bced..ef3d47f43f 100644 --- a/mods/src/input/attack.cpp +++ b/mods/src/input/attack.cpp @@ -1,6 +1,7 @@ #include -#include +#include + #include #include diff --git a/mods/src/input/bow.cpp b/mods/src/input/bow.cpp index 6b1c2d00a5..aaa3bfd58b 100644 --- a/mods/src/input/bow.cpp +++ b/mods/src/input/bow.cpp @@ -1,4 +1,5 @@ -#include +#include + #include #include diff --git a/mods/src/input/drop.cpp b/mods/src/input/drop.cpp index d08fe17e59..ca19c0a8d1 100644 --- a/mods/src/input/drop.cpp +++ b/mods/src/input/drop.cpp @@ -1,4 +1,3 @@ -#include #include #include "input-internal.h" @@ -29,7 +28,6 @@ static void _handle_drop(Minecraft *minecraft) { if (inventory_item != nullptr && inventory_item->count > 0) { // Copy ItemInstance *dropped_item = new ItemInstance; - ALLOC_CHECK(dropped_item); *dropped_item = *inventory_item; // Update Inventory diff --git a/mods/src/input/keys.cpp b/mods/src/input/keys.cpp index 8489532684..dd4106838a 100644 --- a/mods/src/input/keys.cpp +++ b/mods/src/input/keys.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include "input-internal.h" diff --git a/mods/src/input/misc.cpp b/mods/src/input/misc.cpp index 34f54f2e41..bdcbbe7e5a 100644 --- a/mods/src/input/misc.cpp +++ b/mods/src/input/misc.cpp @@ -1,4 +1,5 @@ -#include +#include + #include #include diff --git a/mods/src/input/toggle.cpp b/mods/src/input/toggle.cpp index 29493d1dfe..c47cc29321 100644 --- a/mods/src/input/toggle.cpp +++ b/mods/src/input/toggle.cpp @@ -1,4 +1,5 @@ -#include +#include + #include #include "input-internal.h" diff --git a/mods/src/misc/api.cpp b/mods/src/misc/api.cpp index fc015523b0..ce8021b176 100644 --- a/mods/src/misc/api.cpp +++ b/mods/src/misc/api.cpp @@ -1,6 +1,8 @@ #include -#include +#include +#include + #include #include diff --git a/mods/src/misc/graphics.cpp b/mods/src/misc/graphics.cpp index 4ae00d652e..a0b4b35b7f 100644 --- a/mods/src/misc/graphics.cpp +++ b/mods/src/misc/graphics.cpp @@ -1,6 +1,9 @@ #include -#include +#include +#include +#include + #include #include diff --git a/mods/src/misc/home.cpp b/mods/src/misc/home.cpp index 72e73c4053..71f165017d 100644 --- a/mods/src/misc/home.cpp +++ b/mods/src/misc/home.cpp @@ -1,6 +1,7 @@ #include #include #include + #include #include "misc-internal.h" diff --git a/mods/src/misc/logging.cpp b/mods/src/misc/logging.cpp index f5d0120ba2..72e47ce5a5 100644 --- a/mods/src/misc/logging.cpp +++ b/mods/src/misc/logging.cpp @@ -1,6 +1,9 @@ #include -#include +#include +#include +#include + #include #include "misc-internal.h" diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index e7c3d00c94..e990ed7d0e 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -11,7 +11,12 @@ #include #include -#include +#include +#include +#include +#include +#include + #include #include diff --git a/mods/src/misc/tinting.cpp b/mods/src/misc/tinting.cpp index 3f8762ae28..e4cd6e4107 100644 --- a/mods/src/misc/tinting.cpp +++ b/mods/src/misc/tinting.cpp @@ -1,4 +1,5 @@ -#include +#include + #include #include diff --git a/mods/src/misc/ui.cpp b/mods/src/misc/ui.cpp index 17e675366a..3ca0befc12 100644 --- a/mods/src/misc/ui.cpp +++ b/mods/src/misc/ui.cpp @@ -1,4 +1,6 @@ -#include +#include +#include + #include #include diff --git a/mods/src/multidraw/glue.cpp b/mods/src/multidraw/glue.cpp index 94c8377256..f1463d1bef 100644 --- a/mods/src/multidraw/glue.cpp +++ b/mods/src/multidraw/glue.cpp @@ -1,7 +1,10 @@ #include #include -#include + +#include +#include + #include #include diff --git a/mods/src/multidraw/storage.cpp b/mods/src/multidraw/storage.cpp index 335f6464f0..75c1d8189d 100644 --- a/mods/src/multidraw/storage.cpp +++ b/mods/src/multidraw/storage.cpp @@ -2,8 +2,6 @@ #include "storage.h" -#include - // Setup #define DEFAULT_SIZE 16777216 // 16 MiB Storage::Storage(const int chunks) { diff --git a/mods/src/multiplayer/multiplayer.cpp b/mods/src/multiplayer/multiplayer.cpp index 5c555c5468..5d2919c202 100644 --- a/mods/src/multiplayer/multiplayer.cpp +++ b/mods/src/multiplayer/multiplayer.cpp @@ -4,7 +4,9 @@ #include #include -#include + +#include +#include #include #include diff --git a/mods/src/options/info.cpp b/mods/src/options/info.cpp index 922b53f3e2..b3027a5020 100644 --- a/mods/src/options/info.cpp +++ b/mods/src/options/info.cpp @@ -1,4 +1,8 @@ -#include +#include +#include +#include +#include + #include #include diff --git a/mods/src/options/options.cpp b/mods/src/options/options.cpp index e43054022e..a224f733b6 100644 --- a/mods/src/options/options.cpp +++ b/mods/src/options/options.cpp @@ -3,7 +3,12 @@ #include #include -#include +#include +#include +#include +#include +#include + #include #include @@ -157,9 +162,8 @@ void init_options() { if (strcmp(Strings::default_username, "StevePi") != 0) { ERR("Default Username Is Invalid"); } - std::string *safe_username = new std::string; - *safe_username = to_cp437(username); - patch_address((void *) &Strings::default_username, (void *) safe_username->c_str()); + static std::string safe_username = to_cp437(username); + patch_address((void *) &Strings::default_username, (void *) safe_username.c_str()); // Disable Autojump By Default if (feature_has("Disable Autojump By Default", server_disabled)) { diff --git a/mods/src/options/ui.cpp b/mods/src/options/ui.cpp index 457137dd16..8efdb23204 100644 --- a/mods/src/options/ui.cpp +++ b/mods/src/options/ui.cpp @@ -1,7 +1,8 @@ #include #include -#include +#include + #include #include @@ -98,7 +99,6 @@ static void OptionsScreen_init_injection(OptionsScreen_init_t original, OptionsS // Add Button Touch_TButton *button = Touch_TButton::allocate(); - ALLOC_CHECK(button); std::string name = "Reborn"; button->constructor(INFO_BUTTON_ID, name); self->rendered_buttons.push_back((Button *) button); diff --git a/mods/src/override/override.cpp b/mods/src/override/override.cpp index 5d1c9061cc..9b57f38cd4 100644 --- a/mods/src/override/override.cpp +++ b/mods/src/override/override.cpp @@ -4,7 +4,8 @@ #include #include -#include +#include +#include #include #include diff --git a/mods/src/screenshot/screenshot.cpp b/mods/src/screenshot/screenshot.cpp index 4671849016..f3b498bb27 100644 --- a/mods/src/screenshot/screenshot.cpp +++ b/mods/src/screenshot/screenshot.cpp @@ -2,14 +2,15 @@ #include #include #include -#include -#include #include #include "stb_image.h" #include "stb_image_write.h" -#include +#include +#include +#include + #include #include diff --git a/mods/src/server/server.cpp b/mods/src/server/server.cpp index 4cf75f63b4..9f52f74627 100644 --- a/mods/src/server/server.cpp +++ b/mods/src/server/server.cpp @@ -11,7 +11,11 @@ #include -#include +#include +#include +#include +#include + #include #include @@ -92,7 +96,6 @@ static void start_world(Minecraft *minecraft) { // Open ProgressScreen ProgressScreen *screen = ProgressScreen::allocate(); - ALLOC_CHECK(screen); screen = screen->constructor(); minecraft->setScreen((Screen *) screen); } diff --git a/mods/src/shading/lighting.cpp b/mods/src/shading/lighting.cpp index 73299e3df8..31b7941da0 100644 --- a/mods/src/shading/lighting.cpp +++ b/mods/src/shading/lighting.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include "shading-internal.h" diff --git a/mods/src/shading/normals.cpp b/mods/src/shading/normals.cpp index afec0ca44e..01945a6926 100644 --- a/mods/src/shading/normals.cpp +++ b/mods/src/shading/normals.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include "shading-internal.h" diff --git a/mods/src/shading/tesselator.cpp b/mods/src/shading/tesselator.cpp index 3bcb25f950..1909ce9861 100644 --- a/mods/src/shading/tesselator.cpp +++ b/mods/src/shading/tesselator.cpp @@ -4,7 +4,7 @@ #include -#include +#include #include #include diff --git a/mods/src/sign/sign.cpp b/mods/src/sign/sign.cpp index 1bf8e2c42f..6506e6a5c4 100644 --- a/mods/src/sign/sign.cpp +++ b/mods/src/sign/sign.cpp @@ -1,6 +1,7 @@ #include -#include +#include + #include #include @@ -12,7 +13,6 @@ static void LocalPlayer_openTextEdit_injection(__attribute__((unused)) LocalPlay if (sign->type == 4) { Minecraft *minecraft = local_player->minecraft; TextEditScreen *screen = TextEditScreen::allocate(); - ALLOC_CHECK(screen); screen = screen->constructor((SignTileEntity *) sign); minecraft->setScreen((Screen *) screen); } diff --git a/mods/src/skin/loader.cpp b/mods/src/skin/loader.cpp index 83feef0960..e9ec8580da 100644 --- a/mods/src/skin/loader.cpp +++ b/mods/src/skin/loader.cpp @@ -1,7 +1,11 @@ #include #include -#include +#include +#include +#include +#include + #include #include diff --git a/mods/src/skin/skin.cpp b/mods/src/skin/skin.cpp index 1d604a72c3..7741584167 100644 --- a/mods/src/skin/skin.cpp +++ b/mods/src/skin/skin.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/mods/src/sound/repository.cpp b/mods/src/sound/repository.cpp index b44736503d..8b9a40d074 100644 --- a/mods/src/sound/repository.cpp +++ b/mods/src/sound/repository.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include "sound-internal.h" diff --git a/mods/src/sound/sound.cpp b/mods/src/sound/sound.cpp index 53f1edaca0..fb1686a614 100644 --- a/mods/src/sound/sound.cpp +++ b/mods/src/sound/sound.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/mods/src/text-input-box/TextInputBox.cpp b/mods/src/text-input-box/TextInputBox.cpp index 940fdfa108..1017e70a2b 100644 --- a/mods/src/text-input-box/TextInputBox.cpp +++ b/mods/src/text-input-box/TextInputBox.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/mods/src/textures/headless.cpp b/mods/src/textures/headless.cpp index e77160a26f..458c177805 100644 --- a/mods/src/textures/headless.cpp +++ b/mods/src/textures/headless.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "textures-internal.h" diff --git a/mods/src/textures/lava.cpp b/mods/src/textures/lava.cpp index d7e86a9642..a4a04ad3c2 100644 --- a/mods/src/textures/lava.cpp +++ b/mods/src/textures/lava.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/mods/src/textures/textures.cpp b/mods/src/textures/textures.cpp index 4a97727f5b..a04a79759a 100644 --- a/mods/src/textures/textures.cpp +++ b/mods/src/textures/textures.cpp @@ -4,7 +4,10 @@ #include -#include +#include +#include +#include + #include #include diff --git a/mods/src/title-screen/splashes.cpp b/mods/src/title-screen/splashes.cpp index 19ae38beaf..02795d6181 100644 --- a/mods/src/title-screen/splashes.cpp +++ b/mods/src/title-screen/splashes.cpp @@ -1,7 +1,8 @@ #include #include -#include +#include + #include #include diff --git a/mods/src/title-screen/title-screen.cpp b/mods/src/title-screen/title-screen.cpp index dfc6be44d9..25239f05ea 100644 --- a/mods/src/title-screen/title-screen.cpp +++ b/mods/src/title-screen/title-screen.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/mods/src/title-screen/welcome.cpp b/mods/src/title-screen/welcome.cpp index b76a59bdc2..21c2d92908 100644 --- a/mods/src/title-screen/welcome.cpp +++ b/mods/src/title-screen/welcome.cpp @@ -1,6 +1,10 @@ #include -#include +#include +#include +#include +#include + #include #include diff --git a/mods/src/touch/touch.cpp b/mods/src/touch/touch.cpp index 76e12c9047..6c5665b493 100644 --- a/mods/src/touch/touch.cpp +++ b/mods/src/touch/touch.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include @@ -48,7 +48,6 @@ int touch_gui = 0; template static Button *create_button(int id, std::string text) { T *button = T::allocate(); - ALLOC_CHECK(button); button->constructor(id, text); return (Button *) button; } diff --git a/mods/src/version/version.cpp b/mods/src/version/version.cpp index 322ddd9918..1eb540c81a 100644 --- a/mods/src/version/version.cpp +++ b/mods/src/version/version.cpp @@ -1,4 +1,6 @@ -#include +#include +#include + #include #include