diff options
| author | Alexander Gavrilov | 2012-02-05 16:13:19 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-02-05 16:13:19 +0400 |
| commit | ec5f3cc4b32710e2873c866c250c56484e5ee437 (patch) | |
| tree | f1553903e1233f432c46193d57d9467939321ee6 /plugins/fixpositions.cpp | |
| parent | 2b4246feb6cf6081d105eab6d41744998ae5208d (diff) | |
| download | dfhack-ec5f3cc4b32710e2873c866c250c56484e5ee437.tar.gz dfhack-ec5f3cc4b32710e2873c866c250c56484e5ee437.tar.bz2 dfhack-ec5f3cc4b32710e2873c866c250c56484e5ee437.tar.xz | |
Update fixpositions to match the new data definition naming.
Diffstat (limited to 'plugins/fixpositions.cpp')
| -rw-r--r-- | plugins/fixpositions.cpp | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/plugins/fixpositions.cpp b/plugins/fixpositions.cpp index d15cf3e8..5e75cc7f 100644 --- a/plugins/fixpositions.cpp +++ b/plugins/fixpositions.cpp @@ -41,9 +41,9 @@ command_result df_fixdiplomats (Core *c, vector<string> ¶meters) bool update = true; df::entity_position *pos = NULL; // see if we need to add a new position or modify an existing one - for (int j = 0; j < ent->positions.size(); j++) + for (int j = 0; j < ent->positions.own.size(); j++) { - pos = ent->positions[j]; + pos = ent->positions.own[j]; if (pos->responsibilities[entity_position_responsibility::MAKE_INTRODUCTIONS] && pos->responsibilities[entity_position_responsibility::MAKE_PEACE_AGREEMENTS] && pos->responsibilities[entity_position_responsibility::MAKE_TOPIC_AGREEMENTS]) @@ -64,10 +64,10 @@ command_result df_fixdiplomats (Core *c, vector<string> ¶meters) { // there was no diplomat - create it pos = new df::entity_position; - ent->positions.push_back(pos); + ent->positions.own.push_back(pos); pos->code = "DIPLOMAT"; - pos->id = ent->next_position_id++; + pos->id = ent->positions.next_position_id++; pos->flags.set(entity_position_flags::DO_NOT_CULL); pos->flags.set(entity_position_flags::MENIAL_WORK_EXEMPTION); pos->flags.set(entity_position_flags::SLEEP_PRETENSION); @@ -97,9 +97,9 @@ command_result df_fixdiplomats (Core *c, vector<string> ¶meters) // make sure the diplomat position, whether we created it or not, is set up for proper assignment bool assign = true; - for (int j = 0; j < ent->position_assignment.size(); j++) + for (int j = 0; j < ent->positions.assignments.size(); j++) { - if (ent->position_assignment[j]->position_id == pos->id) + if (ent->positions.assignments[j]->position_id == pos->id) { // it is - nothing more to do here assign = false; @@ -110,16 +110,12 @@ command_result df_fixdiplomats (Core *c, vector<string> ¶meters) { // it isn't - set it up df::entity_position_assignment *asn = new df::entity_position_assignment; - ent->position_assignment.push_back(asn); + ent->positions.assignments.push_back(asn); - asn->id = ent->next_position_assignment_id++; - asn->histfig = -1; + asn->id = ent->positions.next_assignment_id++; asn->position_id = pos->id; asn->flags.extend(0x1F); // make room for 32 flags asn->flags.set(0); // and set the first one - asn->anon_1 = -1; - asn->anon_2 = -1; - asn->anon_3 = -1; } if (update || assign) fixed++; @@ -149,9 +145,9 @@ command_result df_fixmerchants (Core *c, vector<string> ¶meters) bool update = true; df::entity_position *pos = NULL; // see if we need to add a new position or modify an existing one - for (int j = 0; j < ent->positions.size(); j++) + for (int j = 0; j < ent->positions.own.size(); j++) { - pos = ent->positions[j]; + pos = ent->positions.own[j]; if (pos->responsibilities[entity_position_responsibility::TRADE]) { // a guild rep exists with the proper responsibilities - skip to the end @@ -170,10 +166,10 @@ command_result df_fixmerchants (Core *c, vector<string> ¶meters) { // there was no guild rep - create it pos = new df::entity_position; - ent->positions.push_back(pos); + ent->positions.own.push_back(pos); pos->code = "GUILD_REPRESENTATIVE"; - pos->id = ent->next_position_id++; + pos->id = ent->positions.next_position_id++; pos->flags.set(entity_position_flags::DO_NOT_CULL); pos->flags.set(entity_position_flags::MENIAL_WORK_EXEMPTION); pos->flags.set(entity_position_flags::SLEEP_PRETENSION); @@ -201,9 +197,9 @@ command_result df_fixmerchants (Core *c, vector<string> ¶meters) // make sure the guild rep position, whether we created it or not, is set up for proper assignment bool assign = true; - for (int j = 0; j < ent->position_assignment.size(); j++) + for (int j = 0; j < ent->positions.assignments.size(); j++) { - if (ent->position_assignment[j]->position_id == pos->id) + if (ent->positions.assignments[j]->position_id == pos->id) { // it is - nothing more to do here assign = false; @@ -214,16 +210,12 @@ command_result df_fixmerchants (Core *c, vector<string> ¶meters) { // it isn't - set it up df::entity_position_assignment *asn = new df::entity_position_assignment; - ent->position_assignment.push_back(asn); + ent->positions.assignments.push_back(asn); - asn->id = ent->next_position_assignment_id++; - asn->histfig = -1; + asn->id = ent->positions.next_assignment_id++; asn->position_id = pos->id; asn->flags.extend(0x1F); // make room for 32 flags asn->flags.set(0); // and set the first one - asn->anon_1 = -1; - asn->anon_2 = -1; - asn->anon_3 = -1; } if (update || assign) fixed++; |
