From 4af0f7d5fc60f2e1a59dead68df463309a72443a Mon Sep 17 00:00:00 2001 From: Wishbringer Date: Wed, 2 Apr 2014 06:38:03 +0200 Subject: [PATCH 1/5] Added tools and parts subsections to electronics category, moved all relevant recipes into new subsections and floodlight into lighting. --- data/json/recipes/recipes.json | 130 +++++++++++++++++---------------- src/crafting.cpp | 4 + 2 files changed, 70 insertions(+), 64 deletions(-) diff --git a/data/json/recipes/recipes.json b/data/json/recipes/recipes.json index a12092065364a..250d27ddf80c0 100644 --- a/data/json/recipes/recipes.json +++ b/data/json/recipes/recipes.json @@ -51,6 +51,8 @@ "recipe_subcategories" : [ "CSC_ALL", "CSC_ELECTRONIC_CBMS", + "CSC_ELECTRONIC_TOOLS", + "CSC_ELECTRONIC_PARTS", "CSC_ELECTRONIC_LIGHTING", "CSC_ELECTRONIC_COMPONENTS", "CSC_ELECTRONIC_OTHER" @@ -2261,8 +2263,8 @@ },{ "type" : "recipe", "result": "carver_off", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "fabrication", "skills_required" : [ "electronics", 3 ], "difficulty": 4, @@ -2308,8 +2310,8 @@ },{ "type" : "recipe", "result": "trimmer_off", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "fabrication", "skills_required" : [ "electronics", 3 ], "difficulty": 5, @@ -2355,8 +2357,8 @@ },{ "type" : "recipe", "result": "circsaw_off", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "fabrication", "skills_required" : [ "electronics", 3 ], "difficulty": 5, @@ -12092,8 +12094,8 @@ },{ "type" : "recipe", "result": "floodlight", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_LIGHTING", "skill_used": "mechanics", "skills_required": [ "electronics", 1 ], "difficulty": 2, @@ -12117,8 +12119,8 @@ },{ "type" : "recipe", "result": "soldering_iron", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 1, "time": 20000, @@ -12209,7 +12211,7 @@ "type" : "recipe", "result": "rechargeable_battery", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "fabrication", "skills_required": [ "electronics", 3 ], "difficulty": 5, @@ -12242,7 +12244,7 @@ "type" : "recipe", "result": "battery_atomic", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "electronics", "skills_required": [ "fabrication", 6 ], "difficulty": 6, @@ -12315,7 +12317,7 @@ "result": "noise_emitter", "id_suffix": "radio-mod", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 1, "time": 15000, @@ -12343,7 +12345,7 @@ "result": "noise_emitter", "id_suffix": "from-scratch", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 2, "time": 30000, @@ -12376,7 +12378,7 @@ "type" : "recipe", "result": "radio", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 2, "time": 25000, @@ -12408,8 +12410,8 @@ },{ "type" : "recipe", "result": "water_purifier", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "mechanics", "skills_required": [ "electronics", 1 ], "difficulty": 3, @@ -12441,8 +12443,8 @@ },{ "type" : "recipe", "result": "hotplate", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 3, "time": 30000, @@ -12475,8 +12477,8 @@ },{ "type" : "recipe", "result": "coffeemaker", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 3, "time": 30000, @@ -12516,7 +12518,7 @@ "type" : "recipe", "result": "tazer", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 3, "time": 25000, @@ -12576,8 +12578,8 @@ },{ "type" : "recipe", "result": "veh_tracker", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "electronics", "difficulty": 4, "time": 30000, @@ -12611,7 +12613,7 @@ "type" : "recipe", "result": "two_way_radio", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 4, "time": 30000, @@ -12649,7 +12651,7 @@ "type" : "recipe", "result": "electrohack", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "skills_required": [ "computer", 1 ], "difficulty": 4, @@ -12722,7 +12724,7 @@ "type" : "recipe", "result": "mp3", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "skills_required": [ "computer", 1 ], "difficulty": 5, @@ -12757,7 +12759,7 @@ "type" : "recipe", "result": "portable_game", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "skills_required": ["computer", 5], "difficulty": 8, @@ -12800,8 +12802,8 @@ },{ "type" : "recipe", "result": "geiger_off", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 5, "time": 35000, @@ -12834,8 +12836,8 @@ },{ "type" : "recipe", "result": "rad_monitor", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 7, "time": 35000, @@ -13595,8 +13597,8 @@ },{ "type" : "recipe", "result": "recharge_station", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "electronics", "difficulty": 8, "time": 50000, @@ -13629,8 +13631,8 @@ },{ "type" : "recipe", "result": "solar_panel", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "electronics", "difficulty": 8, "time": 50000, @@ -13663,8 +13665,8 @@ },{ "type" : "recipe", "result": "solar_panel_v2", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "electronics", "difficulty": 10, "time": 50000, @@ -13839,7 +13841,7 @@ "type" : "recipe", "result": "teleporter", "category": "CC_ELECTRONIC", - "subcategory": "CSC_ELECTRONIC_OTHER", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 8, "time": 50000, @@ -17784,8 +17786,8 @@ },{ "type" : "recipe", "result": "water_faucet", - "subcategory": "CSC_OTHER_PARTS", "category": "CC_OTHER", + "subcategory": "CSC_OTHER_PARTS", "skill_used": "fabrication", "skills_required": [ "mechanics", 1 ], "difficulty": 2, @@ -17855,8 +17857,8 @@ },{ "type" : "recipe", "result": "forgerig", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "fabrication", "skills_required": ["electronics",4], "difficulty": 4, @@ -17887,8 +17889,8 @@ },{ "type" : "recipe", "result": "weldrig", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "fabrication", "skills_required": ["electronics",4], "difficulty": 4, @@ -17929,8 +17931,8 @@ },{ "type" : "recipe", "result": "craftrig", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "fabrication", "skills_required": ["electronics",3], "difficulty": 4, @@ -17976,8 +17978,8 @@ },{ "type" : "recipe", "result": "chemlab", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "fabrication", "skills_required": ["electronics",3], "difficulty": 4, @@ -18075,8 +18077,8 @@ },{ "type" : "recipe", "result": "small_storage_battery", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "electronics", "skills_required": [ "fabrication", 1 ], "difficulty": 3, @@ -18127,8 +18129,8 @@ },{ "type" : "recipe", "result": "battery_motorbike", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "electronics", "skills_required": [ "fabrication", 1 ], "difficulty": 3, @@ -18179,8 +18181,8 @@ },{ "type" : "recipe", "result": "battery_car", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "electronics", "skills_required": [ "fabrication", 1 ], "difficulty": 3, @@ -18231,8 +18233,8 @@ },{ "type" : "recipe", "result": "battery_truck", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "electronics", "skills_required": [ "fabrication", 1 ], "difficulty": 3, @@ -19882,8 +19884,8 @@ },{ "type" : "recipe", "result": "bot_turret", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "mechanics", "skills_required": [[ "electronics", 5 ], [ "computer", 5 ], [ "gun", 3 ]], "difficulty": 7, @@ -19925,8 +19927,8 @@ },{ "type" : "recipe", "result": "bot_laserturret", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_PARTS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_PARTS", "skill_used": "mechanics", "skills_required": [[ "electronics", 8 ], [ "computer", 5 ], [ "gun", 3 ]], "difficulty": 8, @@ -27576,8 +27578,8 @@ },{ "type" : "recipe", "result": "dehydrator", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC__ELECTRONIC", + "subcategory": "CSC__ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 4, "time": 36000, @@ -27886,8 +27888,8 @@ },{ "type" : "recipe", "result": "atomic_coffeepot", - "category": "CC_OTHER", - "subcategory": "CSC_OTHER_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 4, "time": 3000, diff --git a/src/crafting.cpp b/src/crafting.cpp index bee6a37f3a2b6..c40cacca8a2fe 100644 --- a/src/crafting.cpp +++ b/src/crafting.cpp @@ -1165,6 +1165,10 @@ static void draw_recipe_subtabs(WINDOW *w, craft_cat tab, craft_subcat subtab, b } else if (tab == "CC_ELECTRONIC") { draw_subtab(w, pos_x, _("CBMS"), (subtab == "CSC_ELECTRONIC_CBMS") ? true : false); pos_x += utf8_width(_("CBMS")) + tab_step; + draw_subtab(w, pos_x, _("TOOLS"), (subtab == "CSC_ELECTRONIC_TOOLS") ? true : false); + pos_x += utf8_width(_("TOOLS")) + tab_step; + draw_subtab(w, pos_x, _("PARTS"), (subtab == "CSC_ELECTRONIC_PARTS") ? true : false); + pos_x += utf8_width(_("PARTS")) + tab_step; draw_subtab(w, pos_x, _("LIGHTING"), (subtab == "CSC_ELECTRONIC_LIGHTING") ? true : false); pos_x += utf8_width(_("LIGHTING")) + tab_step; draw_subtab(w, pos_x, _("COMPONENTS"), (subtab == "CSC_ELECTRONIC_COMPONENTS") ? true : false); From 67345b3f88558882702c5e547c42c135b682314a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Travostino?= Date: Wed, 2 Apr 2014 18:10:59 +0100 Subject: [PATCH 2/5] Speed up construction menu, when checking if the player has the required components --- src/construction.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/construction.cpp b/src/construction.cpp index 33a82529c81a8..5e2ababdcbf5a 100644 --- a/src/construction.cpp +++ b/src/construction.cpp @@ -46,8 +46,8 @@ std::vector constructions; static bool can_construct( const std::string &desc ); static bool can_construct( construction *con, int x, int y ); static bool can_construct( construction *con); -static bool player_can_build( player &p, inventory inv, construction *con ); -static bool player_can_build( player &p, inventory pinv, const std::string &desc ); +static bool player_can_build( player &p, const inventory &inv, construction *con ); +static bool player_can_build( player &p, const inventory &pinv, const std::string &desc ); static void place_construction(const std::string &desc); std::vector constructions_by_desc(const std::string &description) @@ -396,7 +396,7 @@ void construction_menu() g->refresh_all(); } -static bool player_can_build(player &p, inventory pinv, const std::string &desc) +static bool player_can_build(player &p, const inventory &pinv, const std::string &desc) { // check all with the same desc to see if player can build any std::vector cons = constructions_by_desc(desc); @@ -408,7 +408,7 @@ static bool player_can_build(player &p, inventory pinv, const std::string &desc) return false; } -static bool player_can_build(player &p, inventory pinv, construction *con) +static bool player_can_build(player &p, const inventory &pinv, construction *con) { if (p.skillLevel(con->skill) < con->difficulty) { return false; @@ -458,7 +458,7 @@ static bool player_can_build(player &p, inventory pinv, construction *con) con->components[j][k].count)) )) { has_component = true; con->components[j][k].available = 1; - + } else { con->components[j][k].available = -1; } From ea7f45d2a2ec976bae7ffcc7767a4d95c8c8ab17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Travostino?= Date: Wed, 2 Apr 2014 18:25:47 +0100 Subject: [PATCH 3/5] Adding myself to SIGNOFF file --- SIGNOFF | 1 + 1 file changed, 1 insertion(+) diff --git a/SIGNOFF b/SIGNOFF index c57540dd1341d..af576b9f44c86 100644 --- a/SIGNOFF +++ b/SIGNOFF @@ -40,3 +40,4 @@ Vidar Engh Skaugen Brandon Bergren (Bdragon) / Henrik "Tivec" Bergvin FryCarson +Stéphane Travostino From 32295015dc733063db75abb0744bf8344300c3bd Mon Sep 17 00:00:00 2001 From: Wishbringer Date: Wed, 2 Apr 2014 20:33:51 +0200 Subject: [PATCH 4/5] Renaming ELECTRONICS category to ELECTRICAL makes more sense. --- src/crafting.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crafting.cpp b/src/crafting.cpp index c40cacca8a2fe..348ed7275ed98 100644 --- a/src/crafting.cpp +++ b/src/crafting.cpp @@ -1081,8 +1081,8 @@ static void draw_recipe_tabs(WINDOW *w, craft_cat tab, bool filtered) pos_x += utf8_width(_("FOOD")) + tab_step; draw_tab(w, pos_x, _("CHEMS"), (tab == "CC_CHEM") ? true : false); pos_x += utf8_width(_("CHEMS")) + tab_step; - draw_tab(w, pos_x, _("ELECTRONICS"), (tab == "CC_ELECTRONIC") ? true : false); - pos_x += utf8_width(_("ELECTRONICS")) + tab_step; + draw_tab(w, pos_x, _("ELECTRICAL"), (tab == "CC_ELECTRONIC") ? true : false); + pos_x += utf8_width(_("ELECTRICAL")) + tab_step; draw_tab(w, pos_x, _("ARMOR"), (tab == "CC_ARMOR") ? true : false); pos_x += utf8_width(_("ARMOR")) + tab_step; draw_tab(w, pos_x, _("OTHER"), (tab == "CC_OTHER") ? true : false); From cb589f581e5c55d8c70ce6db1ed3d2576f8f707d Mon Sep 17 00:00:00 2001 From: Wishbringer Date: Wed, 2 Apr 2014 20:45:16 +0200 Subject: [PATCH 5/5] Thanks for noticing @OzoneH3. :) --- data/json/recipes/recipes.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/json/recipes/recipes.json b/data/json/recipes/recipes.json index 250d27ddf80c0..f4f3fce340b5d 100644 --- a/data/json/recipes/recipes.json +++ b/data/json/recipes/recipes.json @@ -27578,8 +27578,8 @@ },{ "type" : "recipe", "result": "dehydrator", - "category": "CC__ELECTRONIC", - "subcategory": "CSC__ELECTRONIC_TOOLS", + "category": "CC_ELECTRONIC", + "subcategory": "CSC_ELECTRONIC_TOOLS", "skill_used": "electronics", "difficulty": 4, "time": 36000,