|
|
|
@ -77,19 +77,19 @@ df::job *DFHack::Job::cloneJobStruct(df::job *job, bool keepEverything)
|
|
|
|
|
//pnew->job_items.clear();
|
|
|
|
|
|
|
|
|
|
if ( keepEverything ) {
|
|
|
|
|
for ( int a = 0; a < pnew->items.size(); a++ )
|
|
|
|
|
for ( size_t a = 0; a < pnew->items.size(); a++ )
|
|
|
|
|
pnew->items[a] = new df::job_item_ref(*pnew->items[a]);
|
|
|
|
|
for ( int a = 0; a < pnew->specific_refs.size(); a++ )
|
|
|
|
|
for ( size_t a = 0; a < pnew->specific_refs.size(); a++ )
|
|
|
|
|
pnew->specific_refs[a] = new df::specific_ref(*pnew->specific_refs[a]);
|
|
|
|
|
} else {
|
|
|
|
|
pnew->items.clear();
|
|
|
|
|
pnew->specific_refs.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( int a = 0; a < pnew->job_items.size(); a++ )
|
|
|
|
|
for ( size_t a = 0; a < pnew->job_items.size(); a++ )
|
|
|
|
|
pnew->job_items[a] = new df::job_item(*pnew->job_items[a]);
|
|
|
|
|
|
|
|
|
|
for ( int a = 0; a < job->general_refs.size(); a++ )
|
|
|
|
|
for ( size_t a = 0; a < job->general_refs.size(); a++ )
|
|
|
|
|
if ( keepEverything || job->general_refs[a]->getType() != df::enums::general_ref_type::UNIT_WORKER )
|
|
|
|
|
pnew->general_refs.push_back(job->general_refs[a]->clone());
|
|
|
|
|
|
|
|
|
@ -108,14 +108,14 @@ void DFHack::Job::deleteJobStruct(df::job *job, bool keptEverything)
|
|
|
|
|
assert(!job->list_link);
|
|
|
|
|
|
|
|
|
|
if ( keptEverything ) {
|
|
|
|
|
for ( int a = 0; a < job->items.size(); a++ )
|
|
|
|
|
for ( size_t a = 0; a < job->items.size(); a++ )
|
|
|
|
|
delete job->items[a];
|
|
|
|
|
for ( int a = 0; a < job->specific_refs.size(); a++ )
|
|
|
|
|
for ( size_t a = 0; a < job->specific_refs.size(); a++ )
|
|
|
|
|
delete job->specific_refs[a];
|
|
|
|
|
}
|
|
|
|
|
for ( int a = 0; a < job->job_items.size(); a++ )
|
|
|
|
|
for ( size_t a = 0; a < job->job_items.size(); a++ )
|
|
|
|
|
delete job->job_items[a];
|
|
|
|
|
for ( int a = 0; a < job->general_refs.size(); a++ )
|
|
|
|
|
for ( size_t a = 0; a < job->general_refs.size(); a++ )
|
|
|
|
|
delete job->general_refs[a];
|
|
|
|
|
|
|
|
|
|
delete job;
|
|
|
|
|