Skip to content

Commit e356925

Browse files
committed
update structures
1 parent e5c597f commit e356925

6 files changed

Lines changed: 12 additions & 12 deletions

File tree

library/Types.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ bool DFHack::removeRef(std::vector<df::specific_ref*> &vec, df::specific_ref_typ
127127
for (int i = vec.size()-1; i >= 0; i--)
128128
{
129129
df::specific_ref *ref = vec[i];
130-
if (ref->type != type || ref->object != ptr)
130+
if (ref->type != type || ref->data.object != ptr)
131131
continue;
132132

133133
vector_erase_at(vec, i);

library/modules/Items.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ df::coord Items::getPosition(df::item *item)
658658
switch (ref->type)
659659
{
660660
case specific_ref_type::VERMIN_ESCAPED_PET:
661-
return ref->vermin->pos;
661+
return ref->data.VERMIN_ESCAPED_PET->pos;
662662

663663
default:
664664
break;

library/modules/Job.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ void DFHack::Job::disconnectJobItem(df::job *job, df::job_item_ref *ref) {
311311
auto ref = item->specific_refs[refIndex];
312312

313313
if (ref->type == df::specific_ref_type::JOB) {
314-
if (ref->job == job) {
314+
if (ref->data.JOB == job) {
315315
vector_erase_at(item->specific_refs, refIndex);
316316
delete ref;
317317
} else {
@@ -579,7 +579,7 @@ bool DFHack::Job::attachJobItem(df::job *job, df::item *item,
579579

580580
auto item_link = new df::specific_ref();
581581
item_link->type = specific_ref_type::JOB;
582-
item_link->job = job;
582+
item_link->data.JOB = job;
583583
item->specific_refs.push_back(item_link);
584584

585585
auto job_link = new df::job_item_ref();

library/xml

plugins/stocks.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ static map<df::item *, bool> items_in_cages;
179179
static df::job *get_item_job(df::item *item)
180180
{
181181
auto ref = Items::getSpecificRef(item, specific_ref_type::JOB);
182-
if (ref && ref->job)
183-
return ref->job;
182+
if (ref && ref->data.JOB)
183+
return ref->data.JOB;
184184

185185
return nullptr;
186186
}
@@ -1008,12 +1008,12 @@ class ViewscreenStocks : public dfhack_viewscreen
10081008
if (item->flags.bits.in_job)
10091009
{
10101010
auto ref = Items::getSpecificRef(item, specific_ref_type::JOB);
1011-
if (ref && ref->job)
1011+
if (ref && ref->data.JOB)
10121012
{
1013-
if (ref->job->job_type == job_type::Eat || ref->job->job_type == job_type::Drink)
1013+
if (ref->data.JOB->job_type == job_type::Eat || ref->data.JOB->job_type == job_type::Drink)
10141014
return pos;
10151015

1016-
auto unit = Job::getWorker(ref->job);
1016+
auto unit = Job::getWorker(ref->data.JOB);
10171017
if (unit)
10181018
return unit->pos;
10191019
}

plugins/workflow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,10 +1151,10 @@ static bool itemInRealJob(df::item *item)
11511151
return false;
11521152

11531153
auto ref = Items::getSpecificRef(item, specific_ref_type::JOB);
1154-
if (!ref || !ref->job)
1154+
if (!ref || !ref->data.JOB)
11551155
return true;
11561156

1157-
return ENUM_ATTR(job_type, type, ref->job->job_type)
1157+
return ENUM_ATTR(job_type, type, ref->data.JOB->job_type)
11581158
!= job_type_class::Hauling;
11591159
}
11601160

0 commit comments

Comments
 (0)