Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions library/RemoteTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,22 +336,22 @@ void DFHack::describeUnit(BasicUnitInfo *info, df::unit *unit,
}
}

if (unit->curse.add_tags1.whole ||
unit->curse.add_tags2.whole ||
unit->curse.rem_tags1.whole ||
unit->curse.rem_tags2.whole ||
unit->curse.name_visible)
if (unit->uwss_add_caste_flag.whole ||
unit->uwss_remove_caste_flag.whole ||
unit->uwss_add_property.whole ||
unit->uwss_remove_property.whole ||
unit->uwss_use_display_name)
{
auto curse = info->mutable_curse();

curse->set_add_tags1(unit->curse.add_tags1.whole);
curse->set_rem_tags1(unit->curse.rem_tags1.whole);
curse->set_add_tags2(unit->curse.add_tags2.whole);
curse->set_rem_tags2(unit->curse.rem_tags2.whole);
curse->set_add_tags1(unit->uwss_add_caste_flag.whole);
curse->set_rem_tags1(unit->uwss_add_property.whole);
curse->set_add_tags2(unit->uwss_remove_caste_flag.whole);
curse->set_rem_tags2(unit->uwss_remove_property.whole);

if (unit->curse.name_visible)
describeNameTriple(curse->mutable_name(), unit->curse.name,
unit->curse.name_plural, unit->curse.name_adjective);
if (unit->uwss_use_display_name)
describeNameTriple(curse->mutable_name(), unit->uwss_display_name_sing,
unit->uwss_display_name_plur, unit->uwss_display_name_adj);
}

for (size_t i = 0; i < unit->burrows.size(); i++)
Expand Down
16 changes: 8 additions & 8 deletions library/modules/Units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ using df::global::gametype;
using df::global::plotinfo;
using df::global::world;

#define IS_ACTIVE_CASTE_FLAG(cf) !unit->curse.rem_tags1.bits.cf && \
(unit->curse.add_tags1.bits.cf || casteFlagSet(unit->race, unit->caste, caste_raw_flags::cf))
#define IS_ACTIVE_CASTE_FLAG(cf) !unit->uwss_remove_caste_flag.bits.cf && \
(unit->uwss_add_caste_flag.bits.cf || casteFlagSet(unit->race, unit->caste, caste_raw_flags::cf))

// Common flags to exclude for fort members
constexpr uint32_t exclude_flags1 = (
Expand Down Expand Up @@ -208,7 +208,7 @@ bool Units::isOwnRace(df::unit *unit) {

bool Units::isAlive(df::unit *unit) {
CHECK_NULL_POINTER(unit);
return !isDead(unit) && !unit->curse.add_tags1.bits.NOT_LIVING;
return !isDead(unit) && !unit->uwss_add_caste_flag.bits.NOT_LIVING;
}

bool Units::isDead(df::unit *unit) {
Expand Down Expand Up @@ -606,7 +606,7 @@ bool Units::isInvader(df::unit *unit) {

bool Units::isUndead(df::unit *unit, bool hiding_curse) {
CHECK_NULL_POINTER(unit);
const auto &cb = unit->curse.add_tags1.bits;
const auto &cb = unit->uwss_add_caste_flag.bits;
return unit->flags3.bits.ghostly ||
((cb.OPPOSED_TO_LIFE || cb.NOT_LIVING) && (hiding_curse || !isHidingCurse(unit)));
}
Expand Down Expand Up @@ -1014,7 +1014,7 @@ int Units::getPhysicalAttrValue(df::unit *unit, df::physical_attribute_type attr
auto &aobj = unit->body.physical_attrs[attr];
int value = max(0, aobj.value - aobj.soft_demotion);

if (auto mod = unit->curse.attr_change)
if (auto mod = unit->uwss_att_change)
{
int mvalue = (value * mod->phys_att_perc[attr] / 100) + mod->phys_att_add[attr];
if (isHidingCurse(unit))
Expand All @@ -1033,7 +1033,7 @@ int Units::getMentalAttrValue(df::unit *unit, df::mental_attribute_type attr) {
auto &aobj = soul->mental_attrs[attr];
int value = max(0, aobj.value - aobj.soft_demotion);

if (auto mod = unit->curse.attr_change)
if (auto mod = unit->uwss_att_change)
{
int mvalue = (value * mod->ment_att_perc[attr] / 100) + mod->ment_att_add[attr];
if (isHidingCurse(unit))
Expand Down Expand Up @@ -1192,8 +1192,8 @@ string Units::getReadableName(df::unit *unit, bool skip_english) {
CHECK_NULL_POINTER(unit);
string prof_name = getProfessionName(unit, false, false, true);

if (unit->curse.name_visible) // Necromancer, etc.
prof_name += " " + unit->curse.name;
if (unit->uwss_use_display_name) // Necromancer, etc.
prof_name += " " + unit->uwss_display_name_sing;
else if (isGhost(unit)) // TODO: Should be "Ghost" instead of "Ghostly Peasant"
prof_name = "Ghostly " + prof_name;
// TODO: impersonating deity/force
Expand Down
2 changes: 1 addition & 1 deletion library/xml
Submodule xml updated 2 files
+1 −0 changelog.txt
+36 −38 df.unit.xml
50 changes: 25 additions & 25 deletions plugins/cursecheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ curses determineCurse(df::unit * unit)
cursetype = curses::Ghost;

// zombies: undead or hate life (according to ag), not bloodsuckers
if( (unit->curse.add_tags1.bits.OPPOSED_TO_LIFE || unit->curse.add_tags1.bits.NOT_LIVING)
&& !unit->curse.add_tags1.bits.BLOODSUCKER )
if( (unit->uwss_add_caste_flag.bits.OPPOSED_TO_LIFE || unit->uwss_add_caste_flag.bits.NOT_LIVING)
&& !unit->uwss_add_caste_flag.bits.BLOODSUCKER)
cursetype = curses::Zombie;

// necromancers: alive, don't eat, don't drink, don't age
if(!unit->curse.add_tags1.bits.NOT_LIVING
&& unit->curse.add_tags1.bits.NO_EAT
&& unit->curse.add_tags1.bits.NO_DRINK
&& unit->curse.add_tags2.bits.NO_AGING
if (!unit->uwss_add_caste_flag.bits.NOT_LIVING
&& unit->uwss_add_caste_flag.bits.NO_EAT
&& unit->uwss_add_caste_flag.bits.NO_DRINK
&& unit->uwss_add_property.bits.NO_AGING
)
cursetype = curses::Necromancer;

Expand All @@ -108,21 +108,21 @@ curses determineCurse(df::unit * unit)
auto syndrome = df::syndrome::find(active_syndrome->type);
if (syndrome) {
for (auto classname : syndrome->syn_class)
if (classname && *classname == "WERECURSE") {
cursetype = curses::Werebeast;
break;
}
if (classname && *classname == "WERECURSE") {
cursetype = curses::Werebeast;
break;
}
}
}

// vampires: bloodsucker (obvious enough)
if(unit->curse.add_tags1.bits.BLOODSUCKER)
if (unit->uwss_add_caste_flag.bits.BLOODSUCKER)
cursetype = curses::Vampire;

return cursetype;
}

command_result cursecheck (color_ostream &out, vector <string> & parameters)
command_result cursecheck(color_ostream& out, vector <string>& parameters)
{
df::unit* selected_unit = Gui::getSelectedUnit(out, true);

Expand All @@ -133,19 +133,19 @@ command_result cursecheck (color_ostream &out, vector <string> & parameters)
bool verbose = false;
size_t cursecount = 0;

for(auto parameter : parameters)
for (auto parameter : parameters)
{
if(parameter == "help" || parameter == "?")
if (parameter == "help" || parameter == "?")
return CR_WRONG_USAGE;
if(parameter == "detail")
if (parameter == "detail")
giveDetails = true;
if(parameter == "ids")
if (parameter == "ids")
giveUnitID = true;
if(parameter == "nick")
if (parameter == "nick")
giveNick = true;
if(parameter == "all")
if (parameter == "all")
ignoreDead = false;
if(parameter == "verbose")
if (parameter == "verbose")
{
// verbose makes no sense without enabling details
giveDetails = true;
Expand All @@ -157,11 +157,11 @@ command_result cursecheck (color_ostream &out, vector <string> & parameters)
vector<df::unit*> to_check;
if (selected_unit)
to_check.push_back(selected_unit);
for(df::unit *unit : to_check.size() ? to_check : world->units.all)
for (df::unit* unit : to_check.size() ? to_check : world->units.all)
{
// filter out all "living" units that are currently removed from play
// don't spam all completely dead creatures if not explicitly wanted
if((!Units::isActive(unit) && !Units::isKilled(unit)) || (Units::isKilled(unit) && ignoreDead))
if ((!Units::isActive(unit) && !Units::isKilled(unit)) || (Units::isKilled(unit) && ignoreDead))
{
continue;
}
Expand All @@ -170,9 +170,9 @@ command_result cursecheck (color_ostream &out, vector <string> & parameters)

if (cursetype != curses::None)
{
cursecount++;
cursecount++;

if(giveNick)
if (giveNick)
{
Units::setNickname(unit, curse_names[cursetype]); //"CURSED");
}
Expand All @@ -196,8 +196,8 @@ command_result cursecheck (color_ostream &out, vector <string> & parameters)
if (verbose)
{
out << "Curse flags: "
<< bitfield_to_string(unit->curse.add_tags1) << std::endl
<< bitfield_to_string(unit->curse.add_tags2) << std::endl;
<< bitfield_to_string(unit->uwss_add_caste_flag) << std::endl
<< bitfield_to_string(unit->uwss_add_property) << std::endl;
}
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/lua/sort.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ local function get_active_idx_cache()
end

local function is_original_dwarf(unit)
return df.global.plotinfo.fortress_age == unit.curse.interaction.time_on_site // 10
return df.global.plotinfo.fortress_age == unit.usable_interaction.time_on_site // 10
end

local WAVE_END_GAP = 10000
Expand All @@ -53,7 +53,7 @@ local function get_most_recent_wave_oldest_active_idx(cache)
for idx=#active_units-1,0,-1 do
local unit = active_units[idx]
if not dfhack.units.isCitizen(unit) then goto continue end
if oldest_unit and unit.curse.interaction.time_on_site - oldest_unit.curse.interaction.time_on_site > WAVE_END_GAP then
if oldest_unit and unit.usable_interaction.time_on_site - oldest_unit.usable_interaction.time_on_site > WAVE_END_GAP then
return cache[oldest_unit.id]
else
oldest_unit = unit
Expand Down