From f3cbf07a0130a1f41c3e14ce320516425604d01f Mon Sep 17 00:00:00 2001 From: Quietust Date: Sun, 15 Jan 2012 13:59:34 -0600 Subject: [PATCH] Use general_ref::getType() instead of strict_virtual_cast<> --- plugins/autodump.cpp | 2 +- plugins/workflow.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/autodump.cpp b/plugins/autodump.cpp index 109253dc5..5fc9adfc2 100644 --- a/plugins/autodump.cpp +++ b/plugins/autodump.cpp @@ -338,7 +338,7 @@ DFhackCExport command_result df_autodump_destroy_item(Core * c, vector for (unsigned i = 0; i < item->itemrefs.size(); i++) { df::general_ref *ref = item->itemrefs[i]; - if (strict_virtual_cast(ref)) + if (ref->getType() == df::general_ref_type::unit_holder) { c->con.printerr("Choosing not to destroy items in unit inventory.\n"); return CR_FAILURE; diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index 38e2313cd..104604ce6 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -977,7 +977,7 @@ static void dryBucket(df::item *item) for (unsigned i = 0; i < item->itemrefs.size(); i++) { df::general_ref *ref = item->itemrefs[i]; - if (strict_virtual_cast(ref)) + if (ref->getType() == df::general_ref_type::contains_item) { df::item *obj = ref->getItem(); @@ -999,20 +999,20 @@ static bool itemBusy(df::item *item) for (unsigned i = 0; i < item->itemrefs.size(); i++) { df::general_ref *ref = item->itemrefs[i]; - if (strict_virtual_cast(ref)) + if (ref->getType() == df::general_ref_type::contains_item) { df::item *obj = ref->getItem(); if (obj && !obj->flags.bits.garbage_colect) return true; } - else if (strict_virtual_cast(ref)) + else if (ref->getType() == df::general_ref_type::contains_unit) return true; - else if (strict_virtual_cast(ref)) + else if (ref->getType() == df::general_ref_type::unit_holder) { if (!item->flags.bits.in_job) return true; } - else if (strict_virtual_cast(ref)) + else if (ref->getType() == df::general_ref_type::contained_in_item) { df::item *obj = ref->getItem(); if (!obj)