diff options
| author | Alexander Gavrilov | 2012-01-08 20:02:12 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-01-08 20:02:12 +0400 |
| commit | ea790f1346a3dff8df6331dc84a16a7915bca4fd (patch) | |
| tree | 6b31f4f4df7061c75af9a2d7610d10105841382a /plugins/jobutils.cpp | |
| parent | 64a9a49ec0393a903403b728fe41758ab774ebf8 (diff) | |
| download | dfhack-ea790f1346a3dff8df6331dc84a16a7915bca4fd.tar.gz dfhack-ea790f1346a3dff8df6331dc84a16a7915bca4fd.tar.bz2 dfhack-ea790f1346a3dff8df6331dc84a16a7915bca4fd.tar.xz | |
Move a few functions into the core, and add some more.
Diffstat (limited to 'plugins/jobutils.cpp')
| -rw-r--r-- | plugins/jobutils.cpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/plugins/jobutils.cpp b/plugins/jobutils.cpp index a89fa99c..a908b760 100644 --- a/plugins/jobutils.cpp +++ b/plugins/jobutils.cpp @@ -64,7 +64,7 @@ DFhackCExport command_result plugin_init (Core *c, std::vector <PluginCommand> & " Print details of the current job.\n" " job list\n" " Print details of all jobs in the workshop.\n" - " job item-material <item-idx> <material> [submaterial]\n" + " job item-material <item-idx> <material[:subtoken]>\n" " Replace the exact material id in the job item.\n" ) ); @@ -249,21 +249,6 @@ static command_result job_material(Core * c, vector <string> & parameters) /* job-duplicate implementation */ -static df::job *clone_job(df::job *job) -{ - df::job *pnew = cloneJobStruct(job); - - pnew->id = (*job_next_id)++; - - // Link the job into the global list - pnew->list_link = new df::job_list_link(); - pnew->list_link->item = pnew; - - linked_list_append(&world->job_list, pnew->list_link); - - return pnew; -} - static command_result job_duplicate(Core * c, vector <string> & parameters) { if (!parameters.empty()) @@ -287,10 +272,10 @@ static command_result job_duplicate(Core * c, vector <string> & parameters) } // Actually clone - df::job *pnew = clone_job(job); + df::job *pnew = cloneJobStruct(job); - int pos = ++*ui_workshop_job_cursor; - building->jobs.insert(building->jobs.begin()+pos, pnew); + linkJobIntoWorld(pnew); + vector_insert_at(building->jobs, ++*ui_workshop_job_cursor, pnew); return CR_OK; } @@ -336,9 +321,8 @@ static command_result job_cmd(Core * c, vector <string> & parameters) df::job_item *item = job->job_items[v-1]; - std::string subtoken = (parameters.size()>3 ? parameters[3] : ""); MaterialInfo info; - if (!info.find(parameters[2], subtoken)) { + if (!info.find(parameters[2])) { c->con.printerr("Could not find the specified material.\n"); return CR_FAILURE; } |
