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() endif()
# set up versioning. # set up versioning.
set(DF_VERSION "0.43.05") set(DF_VERSION "0.44.02")
SET(DFHACK_RELEASE "r3") SET(DFHACK_RELEASE "r0")
SET(DFHACK_PRERELEASE FALSE) SET(DFHACK_PRERELEASE TRUE)
set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")

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

@ -138,7 +138,7 @@ void buildings_onUpdate(color_ostream &out)
{ {
buildings_do_onupdate = false; 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) { for (; link; link = link->next) {
df::job *job = link->item; 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) if (block->designation[des_pos.x % 16][des_pos.y % 16].bits.dig == tile_dig_designation::Default)
return true; 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; df::job *job = link->item;
if (!job) 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->designation[des_pos.x % 16][des_pos.y % 16].bits.dig = tile_dig_designation::No;
block->flags.bits.designated = true; block->flags.bits.designated = true;
auto *link = world->job_list.next; auto *link = world->jobs.list.next;
while (link) while (link)
{ {
auto *next = link->next; 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()); 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 ) if ( link->item == NULL )
continue; continue;
if ( link->item->id <= lastJobId ) 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()); multimap<Plugin*,EventHandler> copy(handlers[EventType::JOB_COMPLETED].begin(), handlers[EventType::JOB_COMPLETED].end());
map<int32_t, df::job*> nowJobs; 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 ) if ( link->item == NULL )
continue; continue;
nowJobs[link->item->id] = link->item; 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 = new df::job_list_link();
job->list_link->item = job; 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; return true;
} else { } 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) while (ins_pos->next && ins_pos->next->item->id < job->id)
ins_pos = ins_pos->next; ins_pos = ins_pos->next;
@ -514,15 +514,15 @@ bool DFHack::Job::removePostings(df::job *job, bool remove_all)
bool removed = false; bool removed = false;
if (!remove_all) 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; removed = true;
} }
} }
else 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) 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)); 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) for (; link; link = link->next)
{ {
int id = link->item->id; int id = link->item->id;

@ -89,7 +89,7 @@ void onDig(color_ostream& out, void* ptr) {
return; return;
set<df::coord> jobLocations; 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 ) if ( link->item == NULL )
continue; continue;

@ -598,7 +598,7 @@ void findAndAssignInvasionJob(color_ostream& out, void* tickTime) {
lastInvasionDigger = firstInvader->id; lastInvasionDigger = firstInvader->id;
lastInvasionJob = firstInvader->job.current_job ? firstInvader->job.current_job->id : -1; lastInvasionJob = firstInvader->job.current_job ? firstInvader->job.current_job->id : -1;
invaderJobs.erase(lastInvasionJob); 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 ) if ( link->item == NULL )
continue; continue;
df::job* job = link->item; df::job* job = link->item;

@ -1155,7 +1155,7 @@ private:
void collect_job_list() 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; df::job* j = jll->item;
if (!j) if (!j)
@ -1163,7 +1163,7 @@ private:
process_job(j); 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) if ((*jp)->flags.bits.dead)
continue; continue;

@ -1146,9 +1146,9 @@ void CopyDesignation(df::map_block * DfBlock, RemoteFortressReader::MapBlock * N
} }
} }
#if DF_VERSION_INT > 34011 #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) if (job == nullptr)
continue; continue;
if ( if (
@ -2790,7 +2790,7 @@ static command_result SendDigCommand(color_ostream &stream, const DigCommand *in
#if DF_VERSION_INT >= 43005 #if DF_VERSION_INT >= 43005
//remove and job postings related. //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) if (listing->item == NULL)
continue; continue;

@ -1,9 +1,9 @@
module DFHack module DFHack
class << self class << self
# link a job to the world # 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) def job_link(job)
lastjob = world.job_list lastjob = world.jobs.list
lastjob = lastjob.next while lastjob.next lastjob = lastjob.next while lastjob.next
joblink = JobListLink.cpp_new joblink = JobListLink.cpp_new
joblink.prev = lastjob joblink.prev = lastjob

@ -269,7 +269,7 @@ module DFHack
def dig(mode=:Default) def dig(mode=:Default)
if mode == :Smooth if mode == :Smooth
if (tilemat == :STONE or tilemat == :MINERAL) and caption !~ /smooth|pillar|fortification/i and # XXX caption.. 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 # 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 # 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) (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 mapblock.flags.designated = true
end end
else 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 # someone already enroute to dig here, avoid 'Inappropriate dig square' spam
JobType::Type[j.job_type] == :Digging and df.same_pos?(j, self) 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; CoreSuspender suspend;
bool found = false; 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; df::job *job = cur->item;
if ((job->job_type < job_type::StrangeMoodCrafter) || (job->job_type > job_type::StrangeMoodMechanics)) if ((job->job_type < job_type::StrangeMoodCrafter) || (job->job_type > job_type::StrangeMoodMechanics))

@ -69,7 +69,7 @@ public:
} else { } else {
// Gather orders when the bookkeeper starts updating stockpile records, // Gather orders when the bookkeeper starts updating stockpile records,
// and enqueue them when the job is done. // 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 == NULL) continue;
if (link->item->job_type == job_type::UpdateStockpileRecords) { if (link->item->job_type == job_type::UpdateStockpileRecords) {
found = true; found = true;

@ -429,15 +429,15 @@ public:
static int fix_job_postings (color_ostream *out, bool dry_run) static int fix_job_postings (color_ostream *out, bool dry_run)
{ {
int count = 0; int count = 0;
df::job_list_link *link = &world->job_list; df::job_list_link *link = &world->jobs.list;
while (link) while (link)
{ {
df::job *job = link->item; df::job *job = link->item;
if (job) 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) if (posting->job == job && i != job->posting_index && !posting->flags.bits.dead)
{ {
++count; ++count;
@ -673,7 +673,7 @@ static void check_lost_jobs(color_ostream &out, int ticks)
ProtectedJob::cur_tick_idx++; ProtectedJob::cur_tick_idx++;
if (ticks < 0) ticks = 0; 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) for (; p; p = p->next)
{ {
df::job *job = p->item; 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) 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) for (; p; p = p->next)
{ {
ProtectedJob *pj = get_known(p->item->id); ProtectedJob *pj = get_known(p->item->id);