Merge remote-tracking branch 'DFHack/develop' into RemoteServerUnsafe

develop
Japa Mala Illo 2017-11-25 11:50:56 +05:30
commit a0634f9ee0
16 changed files with 37 additions and 32 deletions

@ -140,9 +140,9 @@ if (NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhac
endif()
# set up versioning.
set(DF_VERSION "0.43.05")
SET(DFHACK_RELEASE "r3")
SET(DFHACK_PRERELEASE FALSE)
set(DF_VERSION "0.44.02")
SET(DFHACK_RELEASE "r0")
SET(DFHACK_PRERELEASE TRUE)
set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")

@ -116,6 +116,10 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem)
// process additional entries
//cout << "Entry " << cstr_version << " " << cstr_os << endl;
if (!entry->FirstChildElement()) {
cerr << "Empty symbol table: " << entry->Attribute("name") << endl;
return;
}
pMemEntry = entry->FirstChildElement()->ToElement();
for(;pMemEntry;pMemEntry=pMemEntry->NextSiblingElement())
{

@ -138,7 +138,7 @@ void buildings_onUpdate(color_ostream &out)
{
buildings_do_onupdate = false;
df::job_list_link *link = world->job_list.next;
df::job_list_link *link = world->jobs.list.next;
for (; link; link = link->next) {
df::job *job = link->item;

@ -66,7 +66,7 @@ bool Designations::isPlantMarked(const df::plant *plant)
if (block->designation[des_pos.x % 16][des_pos.y % 16].bits.dig == tile_dig_designation::Default)
return true;
for (auto *link = world->job_list.next; link; link = link->next)
for (auto *link = world->jobs.list.next; link; link = link->next)
{
df::job *job = link->item;
if (!job)
@ -128,7 +128,7 @@ bool Designations::unmarkPlant(const df::plant *plant)
block->designation[des_pos.x % 16][des_pos.y % 16].bits.dig = tile_dig_designation::No;
block->flags.bits.designated = true;
auto *link = world->job_list.next;
auto *link = world->jobs.list.next;
while (link)
{
auto *next = link->next;

@ -381,7 +381,7 @@ static void manageJobInitiatedEvent(color_ostream& out) {
}
multimap<Plugin*,EventHandler> copy(handlers[EventType::JOB_INITIATED].begin(), handlers[EventType::JOB_INITIATED].end());
for ( df::job_list_link* link = &df::global::world->job_list; link != NULL; link = link->next ) {
for ( df::job_list_link* link = &df::global::world->jobs.list; link != NULL; link = link->next ) {
if ( link->item == NULL )
continue;
if ( link->item->id <= lastJobId )
@ -411,7 +411,7 @@ static void manageJobCompletedEvent(color_ostream& out) {
multimap<Plugin*,EventHandler> copy(handlers[EventType::JOB_COMPLETED].begin(), handlers[EventType::JOB_COMPLETED].end());
map<int32_t, df::job*> nowJobs;
for ( df::job_list_link* link = &df::global::world->job_list; link != NULL; link = link->next ) {
for ( df::job_list_link* link = &df::global::world->jobs.list; link != NULL; link = link->next ) {
if ( link->item == NULL )
continue;
nowJobs[link->item->id] = link->item;

@ -490,10 +490,10 @@ bool DFHack::Job::linkIntoWorld(df::job *job, bool new_id)
job->list_link = new df::job_list_link();
job->list_link->item = job;
linked_list_append(&world->job_list, job->list_link);
linked_list_append(&world->jobs.list, job->list_link);
return true;
} else {
df::job_list_link *ins_pos = &world->job_list;
df::job_list_link *ins_pos = &world->jobs.list;
while (ins_pos->next && ins_pos->next->item->id < job->id)
ins_pos = ins_pos->next;
@ -514,15 +514,15 @@ bool DFHack::Job::removePostings(df::job *job, bool remove_all)
bool removed = false;
if (!remove_all)
{
if (job->posting_index >= 0 && job->posting_index < world->job_postings.size())
if (job->posting_index >= 0 && job->posting_index < world->jobs.postings.size())
{
world->job_postings[job->posting_index]->flags.bits.dead = true;
world->jobs.postings[job->posting_index]->flags.bits.dead = true;
removed = true;
}
}
else
{
for (auto it = world->job_postings.begin(); it != world->job_postings.end(); ++it)
for (auto it = world->jobs.postings.begin(); it != world->jobs.postings.end(); ++it)
{
if ((**it).job == job)
{
@ -553,7 +553,7 @@ bool DFHack::Job::listNewlyCreated(std::vector<df::job*> *pvec, int *id_var)
pvec->reserve(std::min(20,cur_id - old_id));
df::job_list_link *link = world->job_list.next;
df::job_list_link *link = world->jobs.list.next;
for (; link; link = link->next)
{
int id = link->item->id;

@ -89,7 +89,7 @@ void onDig(color_ostream& out, void* ptr) {
return;
set<df::coord> jobLocations;
for ( df::job_list_link* link = &world->job_list; link != NULL; link = link->next ) {
for ( df::job_list_link* link = &world->jobs.list; link != NULL; link = link->next ) {
if ( link->item == NULL )
continue;

@ -598,7 +598,7 @@ void findAndAssignInvasionJob(color_ostream& out, void* tickTime) {
lastInvasionDigger = firstInvader->id;
lastInvasionJob = firstInvader->job.current_job ? firstInvader->job.current_job->id : -1;
invaderJobs.erase(lastInvasionJob);
for ( df::job_list_link* link = &world->job_list; link != NULL; link = link->next ) {
for ( df::job_list_link* link = &world->jobs.list; link != NULL; link = link->next ) {
if ( link->item == NULL )
continue;
df::job* job = link->item;

@ -1155,7 +1155,7 @@ private:
void collect_job_list()
{
for (df::job_list_link* jll = world->job_list.next; jll; jll = jll->next)
for (df::job_list_link* jll = world->jobs.list.next; jll; jll = jll->next)
{
df::job* j = jll->item;
if (!j)
@ -1163,7 +1163,7 @@ private:
process_job(j);
}
for (auto jp = world->job_postings.begin(); jp != world->job_postings.end(); jp++)
for (auto jp = world->jobs.postings.begin(); jp != world->jobs.postings.end(); jp++)
{
if ((*jp)->flags.bits.dead)
continue;

@ -1146,9 +1146,9 @@ void CopyDesignation(df::map_block * DfBlock, RemoteFortressReader::MapBlock * N
}
}
#if DF_VERSION_INT > 34011
for (int i = 0; i < world->job_postings.size(); i++)
for (int i = 0; i < world->jobs.postings.size(); i++)
{
auto job = world->job_postings[i]->job;
auto job = world->jobs.postings[i]->job;
if (job == nullptr)
continue;
if (
@ -2790,7 +2790,7 @@ static command_result SendDigCommand(color_ostream &stream, const DigCommand *in
#if DF_VERSION_INT >= 43005
//remove and job postings related.
for (df::job_list_link * listing = &(world->job_list); listing != NULL; listing = listing->next)
for (df::job_list_link * listing = &(world->jobs.list); listing != NULL; listing = listing->next)
{
if (listing->item == NULL)
continue;

@ -1,9 +1,9 @@
module DFHack
class << self
# link a job to the world
# allocate & set job.id, allocate a JobListLink, link to job & world.job_list
# allocate & set job.id, allocate a JobListLink, link to job & world.jobs.list
def job_link(job)
lastjob = world.job_list
lastjob = world.jobs.list
lastjob = lastjob.next while lastjob.next
joblink = JobListLink.cpp_new
joblink.prev = lastjob

@ -269,7 +269,7 @@ module DFHack
def dig(mode=:Default)
if mode == :Smooth
if (tilemat == :STONE or tilemat == :MINERAL) and caption !~ /smooth|pillar|fortification/i and # XXX caption..
designation.smooth == 0 and (designation.hidden or not df.world.job_list.find { |j|
designation.smooth == 0 and (designation.hidden or not df.world.jobs.list.find { |j|
# the game removes 'smooth' designation as soon as it assigns a job, if we
# re-set it the game may queue another :DetailWall that will carve a fortification
(j.job_type == :DetailWall or j.job_type == :DetailFloor) and df.same_pos?(j, self)
@ -279,7 +279,7 @@ module DFHack
mapblock.flags.designated = true
end
else
return if mode != :No and designation.dig == :No and not designation.hidden and df.world.job_list.find { |j|
return if mode != :No and designation.dig == :No and not designation.hidden and df.world.jobs.list.find { |j|
# someone already enroute to dig here, avoid 'Inappropriate dig square' spam
JobType::Type[j.job_type] == :Digging and df.same_pos?(j, self)
}

@ -43,7 +43,7 @@ command_result df_showmood (color_ostream &out, vector <string> & parameters)
CoreSuspender suspend;
bool found = false;
for (df::job_list_link *cur = world->job_list.next; cur != NULL; cur = cur->next)
for (df::job_list_link *cur = world->jobs.list.next; cur != NULL; cur = cur->next)
{
df::job *job = cur->item;
if ((job->job_type < job_type::StrangeMoodCrafter) || (job->job_type > job_type::StrangeMoodMechanics))

@ -69,7 +69,7 @@ public:
} else {
// Gather orders when the bookkeeper starts updating stockpile records,
// and enqueue them when the job is done.
for (df::job_list_link* link = &world->job_list; link != NULL; link = link->next) {
for (df::job_list_link* link = &world->jobs.list; link != NULL; link = link->next) {
if (link->item == NULL) continue;
if (link->item->job_type == job_type::UpdateStockpileRecords) {
found = true;

@ -429,15 +429,15 @@ public:
static int fix_job_postings (color_ostream *out, bool dry_run)
{
int count = 0;
df::job_list_link *link = &world->job_list;
df::job_list_link *link = &world->jobs.list;
while (link)
{
df::job *job = link->item;
if (job)
{
for (size_t i = 0; i < world->job_postings.size(); ++i)
for (size_t i = 0; i < world->jobs.postings.size(); ++i)
{
df::world::T_job_postings *posting = world->job_postings[i];
df::job_handler::T_postings *posting = world->jobs.postings[i];
if (posting->job == job && i != job->posting_index && !posting->flags.bits.dead)
{
++count;
@ -673,7 +673,7 @@ static void check_lost_jobs(color_ostream &out, int ticks)
ProtectedJob::cur_tick_idx++;
if (ticks < 0) ticks = 0;
df::job_list_link *p = world->job_list.next;
df::job_list_link *p = world->jobs.list.next;
for (; p; p = p->next)
{
df::job *job = p->item;
@ -707,7 +707,7 @@ static void check_lost_jobs(color_ostream &out, int ticks)
static void update_job_data(color_ostream &out)
{
df::job_list_link *p = world->job_list.next;
df::job_list_link *p = world->jobs.list.next;
for (; p; p = p->next)
{
ProtectedJob *pj = get_known(p->item->id);