Digging Invaders: actually seems to basically work!

develop
expwnent 2013-01-02 22:11:05 -05:00
parent a0d2f262b0
commit ae43865489
1 changed files with 23 additions and 12 deletions

@ -294,6 +294,9 @@ void doDiggingInvaders(color_ostream& out, void* ptr) {
while ( parentMap.find(pt) != parentMap.end() ) { while ( parentMap.find(pt) != parentMap.end() ) {
out.print("(%d,%d,%d)\n", pt.x, pt.y, pt.z); out.print("(%d,%d,%d)\n", pt.x, pt.y, pt.z);
df::coord parent = parentMap[pt]; df::coord parent = parentMap[pt];
if ( Maps::canStepBetween(pt, parent) ) {
} else {
if ( pt.z < parent.z ) { if ( pt.z < parent.z ) {
requiresZNeg.insert(parent); requiresZNeg.insert(parent);
requiresZPos.insert(pt); requiresZPos.insert(pt);
@ -304,6 +307,7 @@ void doDiggingInvaders(color_ostream& out, void* ptr) {
//if ( workNeeded[pt] > workNeeded[parent] ) { //if ( workNeeded[pt] > workNeeded[parent] ) {
importantEdges.push_front(Edge(pt,parent,0)); importantEdges.push_front(Edge(pt,parent,0));
//} //}
}
pt = parent; pt = parent;
} }
break; break;
@ -448,22 +452,29 @@ out << __LINE__ << endl;
break; break;
}*/ }*/
out << __LINE__ << endl;
bool up = requiresZPos.find(pt2) != requiresZPos.end(); bool up = requiresZPos.find(pt2) != requiresZPos.end();
bool down = requiresZNeg.find(pt2) != requiresZNeg.end(); bool down = requiresZNeg.find(pt2) != requiresZNeg.end();
df::job* job = new df::job; df::job* job = new df::job;
if ( up && down ) { if ( up && down ) {
out << __LINE__ << endl;
job->job_type = df::enums::job_type::CarveUpDownStaircase; job->job_type = df::enums::job_type::CarveUpDownStaircase;
job->pos = pt2; job->pos = pt2;
firstInvader->path.dest = pt2;
} else if ( up && !down ) { } else if ( up && !down ) {
out << __LINE__ << endl;
job->job_type = df::enums::job_type::CarveUpwardStaircase; job->job_type = df::enums::job_type::CarveUpwardStaircase;
job->pos = pt2; job->pos = pt2;
firstInvader->path.dest = pt2;
} else if ( !up && down ) { } else if ( !up && down ) {
out << __LINE__ << endl;
job->job_type = df::enums::job_type::CarveDownwardStaircase; job->job_type = df::enums::job_type::CarveDownwardStaircase;
job->pos = pt2; job->pos = pt2;
firstInvader->path.dest = pt2;
} else { } else {
out << __LINE__ << endl;
job->job_type = df::enums::job_type::Dig; job->job_type = df::enums::job_type::Dig;
job->pos = pt1; job->pos = pt2;
firstInvader->path.dest = pt1;
} }
df::general_ref_unit_workerst* ref = new df::general_ref_unit_workerst; df::general_ref_unit_workerst* ref = new df::general_ref_unit_workerst;
ref->unit_id = firstInvader->id; ref->unit_id = firstInvader->id;
@ -474,7 +485,7 @@ out << __LINE__ << endl;
firstInvader->path.path.x.clear(); firstInvader->path.path.x.clear();
firstInvader->path.path.y.clear(); firstInvader->path.path.y.clear();
firstInvader->path.path.z.clear(); firstInvader->path.path.z.clear();
firstInvader->path.dest = pt2; out.print("Digging at (%d,%d,%d)\n", job->pos.x, job->pos.y, job->pos.z);
Job::linkIntoWorld(job); Job::linkIntoWorld(job);
//create and give a pick //create and give a pick