2012-01-07 08:21:07 -07:00
|
|
|
/*
|
|
|
|
https://github.com/peterix/dfhack
|
2012-09-29 20:03:37 -06:00
|
|
|
Copyright (c) 2009-2012 Petr Mrázek (peterix@gmail.com)
|
2012-01-07 08:21:07 -07:00
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any
|
|
|
|
damages arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any
|
|
|
|
purpose, including commercial applications, and to alter it and
|
|
|
|
redistribute it freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must
|
|
|
|
not claim that you wrote the original software. If you use this
|
|
|
|
software in a product, an acknowledgment in the product documentation
|
|
|
|
would be appreciated but is not required.
|
|
|
|
|
|
|
|
2. Altered source versions must be plainly marked as such, and
|
|
|
|
must not be misrepresented as being the original software.
|
|
|
|
|
|
|
|
3. This notice may not be removed or altered from any source
|
|
|
|
distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#ifndef CL_MOD_JOB
|
|
|
|
#define CL_MOD_JOB
|
|
|
|
|
|
|
|
#include "Export.h"
|
|
|
|
#include "Module.h"
|
|
|
|
#include <ostream>
|
|
|
|
|
2012-04-29 11:07:39 -06:00
|
|
|
#include "DataDefs.h"
|
|
|
|
#include "df/job_item_ref.h"
|
2012-10-17 09:16:18 -06:00
|
|
|
#include "df/item_type.h"
|
2012-04-29 11:07:39 -06:00
|
|
|
|
2012-01-07 08:21:07 -07:00
|
|
|
namespace df
|
|
|
|
{
|
|
|
|
struct job;
|
|
|
|
struct job_item;
|
|
|
|
struct job_item_filter;
|
2012-01-08 09:02:12 -07:00
|
|
|
struct building;
|
2012-04-10 01:43:36 -06:00
|
|
|
struct unit;
|
2012-01-07 08:21:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace DFHack
|
|
|
|
{
|
2012-04-10 01:43:36 -06:00
|
|
|
namespace Job {
|
|
|
|
// Duplicate the job structure. It is not linked into any DF lists.
|
2012-12-14 19:05:38 -07:00
|
|
|
DFHACK_EXPORT df::job *cloneJobStruct(df::job *job, bool keepWorkerData=false);
|
2012-01-07 08:21:07 -07:00
|
|
|
|
2012-04-10 01:43:36 -06:00
|
|
|
// Delete a cloned structure.
|
|
|
|
DFHACK_EXPORT void deleteJobStruct(df::job *job);
|
2012-01-07 08:21:07 -07:00
|
|
|
|
2012-04-10 01:43:36 -06:00
|
|
|
DFHACK_EXPORT void printItemDetails(color_ostream &out, df::job_item *item, int idx);
|
|
|
|
DFHACK_EXPORT void printJobDetails(color_ostream &out, df::job *job);
|
|
|
|
|
|
|
|
DFHACK_EXPORT df::building *getHolder(df::job *job);
|
|
|
|
DFHACK_EXPORT df::unit *getWorker(df::job *job);
|
2012-01-07 08:21:07 -07:00
|
|
|
|
2012-05-12 10:12:09 -06:00
|
|
|
// Instruct the game to check and assign workers
|
|
|
|
DFHACK_EXPORT void checkBuildingsNow();
|
|
|
|
DFHACK_EXPORT void checkDesignationsNow();
|
|
|
|
|
2012-04-10 01:43:36 -06:00
|
|
|
DFHACK_EXPORT bool linkIntoWorld(df::job *job, bool new_id = true);
|
2012-01-08 09:02:12 -07:00
|
|
|
|
2012-04-10 01:43:36 -06:00
|
|
|
// lists jobs with ids >= *id_var, and sets *id_var = *job_next_id;
|
|
|
|
DFHACK_EXPORT bool listNewlyCreated(std::vector<df::job*> *pvec, int *id_var);
|
2012-04-29 11:07:39 -06:00
|
|
|
|
|
|
|
DFHACK_EXPORT bool attachJobItem(df::job *job, df::item *item,
|
|
|
|
df::job_item_ref::T_role role,
|
|
|
|
int filter_idx = -1, int insert_idx = -1);
|
2012-10-17 09:16:18 -06:00
|
|
|
|
|
|
|
DFHACK_EXPORT bool isSuitableItem(df::job_item *item, df::item_type itype, int isubtype);
|
|
|
|
DFHACK_EXPORT bool isSuitableMaterial(df::job_item *item, int mat_type, int mat_index);
|
2012-04-10 01:43:36 -06:00
|
|
|
}
|
2012-01-08 09:02:12 -07:00
|
|
|
|
2012-04-10 01:43:36 -06:00
|
|
|
DFHACK_EXPORT bool operator== (const df::job_item &a, const df::job_item &b);
|
|
|
|
DFHACK_EXPORT bool operator== (const df::job &a, const df::job &b);
|
2012-01-07 08:21:07 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|