From 7a5e7c7c86a70fbcdeb20403720345ecb2c52364 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 21 Jun 2018 11:17:09 -0400 Subject: [PATCH] Rename unit_flags1.dead to killed, update submodules/changelog Follow-up for dfhack/df-structures#247 --- docs/changelog.txt | 3 +++ library/modules/EventManager.cpp | 6 +++--- library/modules/Units.cpp | 2 +- library/xml | 2 +- plugins/mousequery.cpp | 2 +- plugins/ruby/unit.rb | 5 +++-- plugins/tweak/tweak.cpp | 2 +- scripts | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 1ea571df2..a450e8b90 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -80,6 +80,9 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - Added ``profiler`` module to measure lua performance - Enabled shift+cursor movement in WorkshopOverlay-derived screens +## Structures +- ``unit_flags1``: renamed ``dead`` to ``inactive`` to better reflect its use + ## Internals - Added fallback for YouCompleteMe database lookup failures (e.g. for newly-created files) - jsoncpp: fixed constructor with ``long`` on Linux diff --git a/library/modules/EventManager.cpp b/library/modules/EventManager.cpp index 798ac1eaf..404d2342c 100644 --- a/library/modules/EventManager.cpp +++ b/library/modules/EventManager.cpp @@ -676,7 +676,7 @@ static void manageSyndromeEvent(color_ostream& out) { for ( auto a = df::global::world->units.all.begin(); a != df::global::world->units.all.end(); a++ ) { df::unit* unit = *a; /* - if ( unit->flags1.bits.dead ) + if ( unit->flags1.bits.inactive ) continue; */ for ( size_t b = 0; b < unit->syndromes.active.size(); b++ ) { @@ -723,7 +723,7 @@ static void manageEquipmentEvent(color_ostream& out) { itemIdToInventoryItem.clear(); currentlyEquipped.clear(); df::unit* unit = *a; - /*if ( unit->flags1.bits.dead ) + /*if ( unit->flags1.bits.inactive ) continue; */ @@ -952,7 +952,7 @@ static void manageUnitAttackEvent(color_ostream& out) { } if ( !wound1 && !wound2 ) { - //if ( unit1->flags1.bits.dead || unit2->flags1.bits.dead ) + //if ( unit1->flags1.bits.inactive || unit2->flags1.bits.inactive ) // continue; if ( reportStr.find("severed part") ) continue; diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index e8c7cfa88..8a2aa76c8 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -1579,7 +1579,7 @@ bool Units::isActive(df::unit *unit) { CHECK_NULL_POINTER(unit); - return !unit->flags1.bits.dead; + return !unit->flags1.bits.inactive; } bool Units::isKilled(df::unit *unit) diff --git a/library/xml b/library/xml index 7daa862b5..321bd48b1 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 7daa862b57856098cd7b0fde1f578196df740634 +Subproject commit 321bd48b10c4c3f694cc801a7dee6be392c09b7b diff --git a/plugins/mousequery.cpp b/plugins/mousequery.cpp index 160fa3eb5..d9bba78b6 100644 --- a/plugins/mousequery.cpp +++ b/plugins/mousequery.cpp @@ -95,7 +95,7 @@ static vector get_units_at(const df::coord pos, bool only_one) df::unit_flags1 bad_flags; bad_flags.whole = 0; - bad_flags.bits.dead = true; + bad_flags.bits.inactive = true; bad_flags.bits.hidden_ambusher = true; bad_flags.bits.hidden_in_ambush = true; diff --git a/plugins/ruby/unit.rb b/plugins/ruby/unit.rb index 3aaaf7653..13c01095d 100644 --- a/plugins/ruby/unit.rb +++ b/plugins/ruby/unit.rb @@ -57,8 +57,9 @@ module DFHack def unit_category(u) return if u.flags1.left or u.flags1.incoming # return if hostile & unit_invisible(u) (hidden_in_ambush or caged+mapblock.hidden or caged+holder.ambush - return :Dead if u.flags1.dead + return :Dead if u.flags2.killed return :Dead if u.flags3.ghostly # hostile ? + return if u.flags1.inactive return :Others if !unit_isfortmember(u) casteflags = u.race_tg.caste[u.caste].flags if u.caste >= 0 return :Livestock if casteflags and (casteflags[:PET] or casteflags[:PET_EXOTIC]) @@ -132,7 +133,7 @@ module DFHack # returns if an unit is openly hostile # does not include ghosts / wildlife def unit_ishostile(u) - # return true if u.flags3.ghostly and not u.flags1.dead + # return true if u.flags3.ghostly and not u.flags1.inactive return unless unit_category(u) == :Others case unit_other_category(u) diff --git a/plugins/tweak/tweak.cpp b/plugins/tweak/tweak.cpp index 35f0f4705..49d96cc74 100644 --- a/plugins/tweak/tweak.cpp +++ b/plugins/tweak/tweak.cpp @@ -831,7 +831,7 @@ static command_result tweak(color_ostream &out, vector ¶meters) { // remove ghostly, set to dead instead unit->flags3.bits.ghostly = 0; - unit->flags1.bits.dead = 1; + unit->flags1.bits.inactive = 1; } else { diff --git a/scripts b/scripts index b065ce444..56a209a9b 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit b065ce4442da88a749f1b90f35d5102ed13b9afb +Subproject commit 56a209a9b460b7eec4f5b3d0c48a18f5235f08db