Reverse the param order of these two methods

The current way doesn't match other Job module methods
develop
Stephen Baynham 2016-12-01 20:13:49 -08:00
parent 7920f71517
commit 595f3857b6
2 changed files with 6 additions and 6 deletions

@ -69,13 +69,13 @@ namespace DFHack
// This helpful method only removes the backref from the item to the job, but it doesn't
// remove the item ref from the job's vector, or delete it or anything. Think of it as a method
// that does all the needful to make an item ref ready to delete.
DFHACK_EXPORT void disconnectJobItem(df::job_item_ref *item, df::job *job);
DFHACK_EXPORT void disconnectJobItem(df::job *job, df::job_item_ref *item);
// This helpful method only removes the backref from whatever the general_ref points to,
// it doesn't remove the general_ref from the job's vector, or delete it or anything.
// Think of it as a method that does all the needful to make a ref ready to delete.
// If it returns false, you've found a ref that the method doesn't know how to handle. Congratulations!
// You should report that and/or check in a fix.
DFHACK_EXPORT bool disconnectJobGeneralRef(df::general_ref *ref, df::job *job);
DFHACK_EXPORT bool disconnectJobGeneralRef(df::job *job, df::general_ref *ref);
// Delete a job & remove all refs from everywhere.
// This method DELETES the job object! Everything related to it will be wiped
// clean from the earth, so make sure you pull what you need out before calling this!

@ -304,7 +304,7 @@ void DFHack::Job::setJobCooldown(df::building *workshop, df::unit *worker, int c
}
}
void DFHack::Job::disconnectJobItem(df::job_item_ref *ref, df::job *job) {
void DFHack::Job::disconnectJobItem(df::job *job, df::job_item_ref *ref) {
if (!ref) return;
auto item = ref->item;
@ -329,7 +329,7 @@ void DFHack::Job::disconnectJobItem(df::job_item_ref *ref, df::job *job) {
if (!stillHasJobs) item->flags.bits.in_job = false;
}
bool DFHack::Job::disconnectJobGeneralRef(df::general_ref *ref, df::job *job) {
bool DFHack::Job::disconnectJobGeneralRef(df::job *job, df::general_ref *ref) {
if (ref == NULL) return true;
df::building *building = NULL;
@ -388,7 +388,7 @@ bool DFHack::Job::removeJob(df::job *job) {
//Our code above should have ensured that this won't return false- if it does, there's not
//a great way of recovering since we can't properly destroy the job & we can't leave it
//around. Better to know the moment that becomes a problem.
bool success = disconnectJobGeneralRef(ref, job);
bool success = disconnectJobGeneralRef(job, ref);
assert(success);
vector_erase_at(job->general_refs, 0);
@ -398,7 +398,7 @@ bool DFHack::Job::removeJob(df::job *job) {
//Detach all items from the job
while (job->items.size() > 0) {
auto itemRef = job->items[0];
disconnectJobItem(itemRef, job);
disconnectJobItem(job, itemRef);
vector_erase_at(job->items, 0);
if (itemRef != NULL) delete itemRef;
}