From 8543df7752bfdd43922f8f9377cd94aae71d83b9 Mon Sep 17 00:00:00 2001 From: Paramat Date: Sun, 23 Sep 2018 20:12:39 +0100 Subject: Fix various code issues found by cppcheck (#7741) Mapgen Singlenode: Remove 'flags' that duplicates a 'class Mapgen' member. Dungeongen: Initialise 'MMVManip *vm' to 'nullptr'. Inventorymanager: Remove assignment error 'found = '. --- src/inventorymanager.cpp | 2 +- src/mapgen/dungeongen.h | 2 +- src/mapgen/mapgen_singlenode.cpp | 2 -- src/mapgen/mapgen_singlenode.h | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp index 6c87255f3..51a472a56 100644 --- a/src/inventorymanager.cpp +++ b/src/inventorymanager.cpp @@ -846,7 +846,7 @@ void ICraftAction::apply(InventoryManager *mgr, count_remaining--; // Get next crafting result - found = getCraftingResult(inv_craft, crafted, temp, false, gamedef); + getCraftingResult(inv_craft, crafted, temp, false, gamedef); PLAYER_TO_SA(player)->item_CraftPredict(crafted, player, list_craft, craft_inv); found = !crafted.empty(); } diff --git a/src/mapgen/dungeongen.h b/src/mapgen/dungeongen.h index ad32cf192..2748524c5 100644 --- a/src/mapgen/dungeongen.h +++ b/src/mapgen/dungeongen.h @@ -64,7 +64,7 @@ struct DungeonParams { class DungeonGen { public: - MMVManip *vm; + MMVManip *vm = nullptr; const NodeDefManager *ndef; GenerateNotifier *gennotify; diff --git a/src/mapgen/mapgen_singlenode.cpp b/src/mapgen/mapgen_singlenode.cpp index a4cde7ece..76f7e6e8e 100644 --- a/src/mapgen/mapgen_singlenode.cpp +++ b/src/mapgen/mapgen_singlenode.cpp @@ -33,8 +33,6 @@ MapgenSinglenode::MapgenSinglenode(int mapgenid, MapgenParams *params, EmergeManager *emerge) : Mapgen(mapgenid, params, emerge) { - flags = params->flags; - const NodeDefManager *ndef = emerge->ndef; c_node = ndef->getId("mapgen_singlenode"); diff --git a/src/mapgen/mapgen_singlenode.h b/src/mapgen/mapgen_singlenode.h index 6f13256f1..ebfb3c729 100644 --- a/src/mapgen/mapgen_singlenode.h +++ b/src/mapgen/mapgen_singlenode.h @@ -35,7 +35,6 @@ struct MapgenSinglenodeParams : public MapgenParams class MapgenSinglenode : public Mapgen { public: - u32 flags; content_t c_node; u8 set_light; -- cgit v1.2.3