update structures

develop
Ben Lubar 2020-03-02 23:12:03 -06:00
parent e5c597f869
commit e356925795
No known key found for this signature in database
GPG Key ID: 92939677AB59EDA4
6 changed files with 12 additions and 12 deletions

@ -127,7 +127,7 @@ bool DFHack::removeRef(std::vector<df::specific_ref*> &vec, df::specific_ref_typ
for (int i = vec.size()-1; i >= 0; i--) for (int i = vec.size()-1; i >= 0; i--)
{ {
df::specific_ref *ref = vec[i]; df::specific_ref *ref = vec[i];
if (ref->type != type || ref->object != ptr) if (ref->type != type || ref->data.object != ptr)
continue; continue;
vector_erase_at(vec, i); vector_erase_at(vec, i);

@ -658,7 +658,7 @@ df::coord Items::getPosition(df::item *item)
switch (ref->type) switch (ref->type)
{ {
case specific_ref_type::VERMIN_ESCAPED_PET: case specific_ref_type::VERMIN_ESCAPED_PET:
return ref->vermin->pos; return ref->data.VERMIN_ESCAPED_PET->pos;
default: default:
break; break;

@ -311,7 +311,7 @@ void DFHack::Job::disconnectJobItem(df::job *job, df::job_item_ref *ref) {
auto ref = item->specific_refs[refIndex]; auto ref = item->specific_refs[refIndex];
if (ref->type == df::specific_ref_type::JOB) { if (ref->type == df::specific_ref_type::JOB) {
if (ref->job == job) { if (ref->data.JOB == job) {
vector_erase_at(item->specific_refs, refIndex); vector_erase_at(item->specific_refs, refIndex);
delete ref; delete ref;
} else { } else {
@ -579,7 +579,7 @@ bool DFHack::Job::attachJobItem(df::job *job, df::item *item,
auto item_link = new df::specific_ref(); auto item_link = new df::specific_ref();
item_link->type = specific_ref_type::JOB; item_link->type = specific_ref_type::JOB;
item_link->job = job; item_link->data.JOB = job;
item->specific_refs.push_back(item_link); item->specific_refs.push_back(item_link);
auto job_link = new df::job_item_ref(); auto job_link = new df::job_item_ref();

@ -1 +1 @@
Subproject commit 5653a57e0978a78c1f1ef125b63359fefa7660f2 Subproject commit 61eed9280adfb51dde777c9e8f8549a4d72e868b

@ -179,8 +179,8 @@ static map<df::item *, bool> items_in_cages;
static df::job *get_item_job(df::item *item) static df::job *get_item_job(df::item *item)
{ {
auto ref = Items::getSpecificRef(item, specific_ref_type::JOB); auto ref = Items::getSpecificRef(item, specific_ref_type::JOB);
if (ref && ref->job) if (ref && ref->data.JOB)
return ref->job; return ref->data.JOB;
return nullptr; return nullptr;
} }
@ -1008,12 +1008,12 @@ private:
if (item->flags.bits.in_job) if (item->flags.bits.in_job)
{ {
auto ref = Items::getSpecificRef(item, specific_ref_type::JOB); auto ref = Items::getSpecificRef(item, specific_ref_type::JOB);
if (ref && ref->job) if (ref && ref->data.JOB)
{ {
if (ref->job->job_type == job_type::Eat || ref->job->job_type == job_type::Drink) if (ref->data.JOB->job_type == job_type::Eat || ref->data.JOB->job_type == job_type::Drink)
return pos; return pos;
auto unit = Job::getWorker(ref->job); auto unit = Job::getWorker(ref->data.JOB);
if (unit) if (unit)
return unit->pos; return unit->pos;
} }

@ -1151,10 +1151,10 @@ static bool itemInRealJob(df::item *item)
return false; return false;
auto ref = Items::getSpecificRef(item, specific_ref_type::JOB); auto ref = Items::getSpecificRef(item, specific_ref_type::JOB);
if (!ref || !ref->job) if (!ref || !ref->data.JOB)
return true; return true;
return ENUM_ATTR(job_type, type, ref->job->job_type) return ENUM_ATTR(job_type, type, ref->data.JOB->job_type)
!= job_type_class::Hauling; != job_type_class::Hauling;
} }