Digging invaders: comment out debug print statements.

develop
expwnent 2013-01-04 00:43:39 -05:00
parent 038cc91fcd
commit 2ca943ae20
2 changed files with 13 additions and 15 deletions

@ -50,7 +50,7 @@ int32_t assignJob(color_ostream& out, Edge firstImportantEdge, unordered_map<df:
pt1 = pt2; pt1 = pt2;
pt2 = temp; pt2 = temp;
} }
out.print("first important edge: (%d,%d,%d) -> (%d,%d,%d)\n", pt1.x,pt1.y,pt1.z, pt2.x,pt2.y,pt2.z); //out.print("first important edge: (%d,%d,%d) -> (%d,%d,%d)\n", pt1.x,pt1.y,pt1.z, pt2.x,pt2.y,pt2.z);
int32_t jobId = -1; int32_t jobId = -1;
@ -67,7 +67,7 @@ int32_t assignJob(color_ostream& out, Edge firstImportantEdge, unordered_map<df:
} }
if ( building != NULL ) { if ( building != NULL ) {
df::coord destroyFrom = parentMap[buildingPos]; df::coord destroyFrom = parentMap[buildingPos];
out.print("%s, line %d: Destroying building %d at (%d,%d,%d) from (%d,%d,%d).\n", __FILE__, __LINE__, building->id, buildingPos.x,buildingPos.y,buildingPos.z, destroyFrom.x,destroyFrom.y,destroyFrom.z); //out.print("%s, line %d: Destroying building %d at (%d,%d,%d) from (%d,%d,%d).\n", __FILE__, __LINE__, building->id, buildingPos.x,buildingPos.y,buildingPos.z, destroyFrom.x,destroyFrom.y,destroyFrom.z);
df::job* job = new df::job; df::job* job = new df::job;
job->job_type = df::enums::job_type::DestroyBuilding; job->job_type = df::enums::job_type::DestroyBuilding;

@ -187,7 +187,7 @@ int32_t manageInvasion(color_ostream& out) {
int32_t lastInvasion = df::global::ui->invasions.next_id-1; int32_t lastInvasion = df::global::ui->invasions.next_id-1;
if ( lastInvasion < 0 || df::global::ui->invasions.list[lastInvasion]->flags.bits.active == 0 ) { if ( lastInvasion < 0 || df::global::ui->invasions.list[lastInvasion]->flags.bits.active == 0 ) {
//if the invasion is over, we're done //if the invasion is over, we're done
out.print("Invasion is over. Stopping diggingInvaders.\n"); //out.print("Invasion is over. Stopping diggingInvaders.\n");
return -2; return -2;
} }
if ( lastInvasionJob != -1 ) { if ( lastInvasionJob != -1 ) {
@ -198,9 +198,9 @@ int32_t manageInvasion(color_ostream& out) {
return -1; return -1;
} }
df::job* job = df::global::world->units.all[index]->job.current_job; df::job* job = df::global::world->units.all[index]->job.current_job;
out.print("job id: old = %d, new = %d\n", lastInvasionJob, job == NULL ? -1 : job->id); //out.print("job id: old = %d, new = %d\n", lastInvasionJob, job == NULL ? -1 : job->id);
if ( job != NULL && lastInvasionJob == job->id ) { if ( job != NULL && lastInvasionJob == job->id ) {
out.print("Still working on the previous job.\n"); //out.print("Still working on the previous job.\n");
return -1; return -1;
} }
@ -209,9 +209,7 @@ int32_t manageInvasion(color_ostream& out) {
int32_t unitId = findAndAssignInvasionJob(out); int32_t unitId = findAndAssignInvasionJob(out);
if ( unitId == -1 ) { if ( unitId == -1 ) {
//might need to do more digging later, after we've killed off a few locals //might need to do more digging later, after we've killed off a few locals
//EventManager::EventHandler checkPeriodically(initiateDigging, 1000); //out.print("DiggingInvaders is waiting.\n");
//EventManager::registerTick(checkPeriodically, checkPeriodically.freq, diggingInvadersPlugin);
out.print("DiggingInvaders is waiting.\n");
return -1; return -1;
} }
@ -226,7 +224,7 @@ int32_t manageInvasion(color_ostream& out) {
} }
EventManager::registerListener(EventManager::EventType::JOB_COMPLETED, jobCompleteHandler, diggingInvadersPlugin); EventManager::registerListener(EventManager::EventType::JOB_COMPLETED, jobCompleteHandler, diggingInvadersPlugin);
out.print("DiggingInvaders: job assigned.\n"); //out.print("DiggingInvaders: job assigned.\n");
return 0; //did something return 0; //did something
} }
@ -244,7 +242,7 @@ command_result diggingInvadersFunc(color_ostream& out, std::vector<std::string>&
for ( size_t b = 0; b < df::global::world->raws.creatures.all.size(); b++ ) { for ( size_t b = 0; b < df::global::world->raws.creatures.all.size(); b++ ) {
df::creature_raw* raw = df::global::world->raws.creatures.all[b]; df::creature_raw* raw = df::global::world->raws.creatures.all[b];
if ( race == raw->creature_id ) { if ( race == raw->creature_id ) {
out.print("%s = %s\n", race.c_str(), raw->creature_id.c_str()); //out.print("%s = %s\n", race.c_str(), raw->creature_id.c_str());
if ( parameters[a] == "add" ) { if ( parameters[a] == "add" ) {
diggingRaces.insert(b); diggingRaces.insert(b);
} else { } else {
@ -335,8 +333,8 @@ int32_t findAndAssignInvasionJob(color_ostream& out) {
return -1; return -1;
} }
df::unit* firstInvader = invaders[0]; df::unit* firstInvader = invaders[0];
out << firstInvader->id << endl; //out << firstInvader->id << endl;
out << firstInvader->pos.x << ", " << firstInvader->pos.y << ", " << firstInvader->pos.z << endl; //out << firstInvader->pos.x << ", " << firstInvader->pos.y << ", " << firstInvader->pos.z << endl;
int32_t localPtsFound = 0; int32_t localPtsFound = 0;
unordered_set<df::coord,PointHash> closedSet; unordered_set<df::coord,PointHash> closedSet;
@ -350,7 +348,7 @@ int32_t findAndAssignInvasionJob(color_ostream& out) {
fringe.erase(fringe.begin()); fringe.erase(fringe.begin());
//out.print("line %d: fringe size = %d, localPtsFound = %d / %d, closedSetSize = %d\n", __LINE__, fringe.size(), localPtsFound, localPts.size(), closedSet.size()); //out.print("line %d: fringe size = %d, localPtsFound = %d / %d, closedSetSize = %d\n", __LINE__, fringe.size(), localPtsFound, localPts.size(), closedSet.size());
if ( closedSet.find(pt) != closedSet.end() ) { if ( closedSet.find(pt) != closedSet.end() ) {
out.print("Double closure! Bad!\n"); out.print("%s, line %d: Double closure! Bad!\n", __FILE__, __LINE__);
break; break;
} }
closedSet.insert(pt); closedSet.insert(pt);
@ -394,7 +392,7 @@ int32_t findAndAssignInvasionJob(color_ostream& out) {
delete myEdges; delete myEdges;
} }
clock_t time = clock() - t0; clock_t time = clock() - t0;
out.print("time = %d, totalEdgeTime = %d\n", time, totalEdgeTime); //out.print("time = %d, totalEdgeTime = %d\n", time, totalEdgeTime);
if ( !foundTarget ) if ( !foundTarget )
return -1; return -1;
@ -431,7 +429,7 @@ int32_t findAndAssignInvasionJob(color_ostream& out) {
//importantEdges.push_front(Edge(pt,parent,0)); //importantEdges.push_front(Edge(pt,parent,0));
//} //}
firstImportantEdge = Edge(pt,parent,0); firstImportantEdge = Edge(pt,parent,0);
out.print("(%d,%d,%d) -> (%d,%d,%d)\n", parent.x,parent.y,parent.z, pt.x,pt.y,pt.z); //out.print("(%d,%d,%d) -> (%d,%d,%d)\n", parent.x,parent.y,parent.z, pt.x,pt.y,pt.z);
} }
pt = parent; pt = parent;
} }