| 34 | using namespace DFHack; |
| 35 | |
| 36 | void getRidOfOldJob(df::unit* unit) { |
| 37 | if ( unit->job.current_job == NULL ) { |
| 38 | return; |
| 39 | } |
| 40 | |
| 41 | df::job* job = unit->job.current_job; |
| 42 | unit->job.current_job = NULL; |
| 43 | if ( job->list_link->prev != NULL ) { |
| 44 | job->list_link->prev->next = job->list_link->next; |
| 45 | } |
| 46 | if ( job->list_link->next != NULL ) { |
| 47 | job->list_link->next->prev = job->list_link->prev; |
| 48 | } |
| 49 | //TODO: consider building pointers? |
| 50 | //for now, just let the memory leak TODO: fix |
| 51 | //delete job->list_link; |
| 52 | //delete job; |
| 53 | } |
| 54 | |
| 55 | int32_t assignJob(color_ostream& out, Edge firstImportantEdge, unordered_map<df::coord,df::coord,PointHash> parentMap, unordered_map<df::coord,cost_t,PointHash>& costMap, vector<int32_t>& invaders, unordered_set<df::coord,PointHash>& requiresZNeg, unordered_set<df::coord,PointHash>& requiresZPos, MapExtras::MapCache& cache, DigAbilities& abilities ) { |
| 56 | df::unit* firstInvader = df::unit::find(invaders[0]); |