From ebda2d8472ac405ecd51907ba2f3afb7b5233623 Mon Sep 17 00:00:00 2001 From: Quietust Date: Fri, 15 Aug 2014 08:13:15 -0500 Subject: [PATCH] Fix ageItem to work correctly, and update XML --- library/xml | 2 +- plugins/tweak.cpp | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/library/xml b/library/xml index 8bad0805f..79039faae 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 8bad0805fdb3d2429a2c2f120d23b53ae0bad5ec +Subproject commit 79039faae62c88e59898264d4f50672995e83ed6 diff --git a/plugins/tweak.cpp b/plugins/tweak.cpp index b2f2c36ed..819639e1a 100644 --- a/plugins/tweak.cpp +++ b/plugins/tweak.cpp @@ -1010,18 +1010,18 @@ IMPLEMENT_VMETHOD_INTERPOSE(military_training_id_hook, process); struct craft_age_wear_hook : df::item_crafted { typedef df::item_crafted interpose_base; - DEFINE_VMETHOD_INTERPOSE(void, ageItem, (int amount)) + DEFINE_VMETHOD_INTERPOSE(bool, ageItem, (int amount)) { int orig_age = age; age += amount; if (age > 200000000) age = 200000000; if (age == orig_age) - return; + return false; MaterialInfo mat(mat_type, mat_index); if (!mat.isValid()) - return; + return false; int wear = 0; if (mat.material->flags.is_set(material_flags::WOOD)) @@ -1032,10 +1032,12 @@ struct craft_age_wear_hook : df::item_crafted { mat.material->flags.is_set(material_flags::YARN)) wear = 1; else - return; + return false; wear = ((orig_age % wear) + (age - orig_age)) / wear; if (wear > 0) - addWear(wear, false, false); + return incWearTimer(wear); + else + return false; } }; IMPLEMENT_VMETHOD_INTERPOSE(craft_age_wear_hook, ageItem);