Digging Invaders: get rid of debug prints.

develop
expwnent 2013-01-02 22:13:23 -05:00
parent ae43865489
commit 5201870356
1 changed files with 0 additions and 28 deletions

@ -337,56 +337,43 @@ void doDiggingInvaders(color_ostream& out, void* ptr) {
bool didSomething = false; bool didSomething = false;
df::coord where; df::coord where;
out << __LINE__ << endl;
for ( auto i = importantEdges.begin(); i != importantEdges.end(); i++ ) { for ( auto i = importantEdges.begin(); i != importantEdges.end(); i++ ) {
out << __LINE__ << endl;
Edge e = *i; Edge e = *i;
df::coord pt1 = e.p1; df::coord pt1 = e.p1;
df::coord pt2 = e.p2; df::coord pt2 = e.p2;
if ( costMap[e.p2] < costMap[e.p1] ) { if ( costMap[e.p2] < costMap[e.p1] ) {
out << __LINE__ << endl;
pt1 = e.p2; pt1 = e.p2;
pt2 = e.p1; pt2 = e.p1;
} }
out << __LINE__ << endl;
bool important = //requireZNeg.find(pt1) != requireZNeg.end() || bool important = //requireZNeg.find(pt1) != requireZNeg.end() ||
//requireZPos.find(pt1) != requireZPos.end() || //requireZPos.find(pt1) != requireZPos.end() ||
requiresZNeg.find(pt2) != requiresZNeg.end() || requiresZNeg.find(pt2) != requiresZNeg.end() ||
requiresZPos.find(pt2) != requiresZPos.end() || requiresZPos.find(pt2) != requiresZPos.end() ||
Buildings::findAtTile(pt2) != NULL; Buildings::findAtTile(pt2) != NULL;
if ( !important ) { if ( !important ) {
out << __LINE__ << endl;
if ( workNeeded[pt2] <= workNeeded[pt1] ) { if ( workNeeded[pt2] <= workNeeded[pt1] ) {
out << __LINE__ << endl;
//definitely not important //definitely not important
continue; continue;
} }
} }
out << __LINE__ << endl;
if ( workNeeded[pt1] > 0 ) if ( workNeeded[pt1] > 0 )
continue; continue;
df::map_block* block1 = Maps::getTileBlock(pt1); df::map_block* block1 = Maps::getTileBlock(pt1);
out << __LINE__ << endl;
df::map_block* block2 = Maps::getTileBlock(pt2); df::map_block* block2 = Maps::getTileBlock(pt2);
bool passable1 = block1->walkable[pt1.x&0x0F][pt1.y&0x0F]; bool passable1 = block1->walkable[pt1.x&0x0F][pt1.y&0x0F];
bool passable2 = block2->walkable[pt2.x&0x0F][pt2.y&0x0F]; bool passable2 = block2->walkable[pt2.x&0x0F][pt2.y&0x0F];
//TODO: if actions required > 1, continue //TODO: if actions required > 1, continue
df::building* building = Buildings::findAtTile(pt2); df::building* building = Buildings::findAtTile(pt2);
out << __LINE__ << endl;
if ( building != NULL && building->getType() == df::enums::building_type::Stockpile ) { if ( building != NULL && building->getType() == df::enums::building_type::Stockpile ) {
out << __LINE__ << endl;
continue; continue;
} }
out << __LINE__ << endl;
if ( building != NULL && passable2 ) { if ( building != NULL && passable2 ) {
//building = NULL; //building = NULL;
} }
out << __LINE__ << endl;
if ( building != NULL ) { if ( building != NULL ) {
out << __LINE__ << endl;
out.print("%s, line %d: Destroying building %d at (%d,%d,%d)\n", __FILE__, __LINE__, building->id, pt2.x,pt2.y,pt2.z); out.print("%s, line %d: Destroying building %d at (%d,%d,%d)\n", __FILE__, __LINE__, building->id, pt2.x,pt2.y,pt2.z);
//building->flags.bits.almost_deleted = true; //building->flags.bits.almost_deleted = true;
@ -413,17 +400,14 @@ out << __LINE__ << endl;
didSomething = true; didSomething = true;
where = pt2; where = pt2;
out << __LINE__ << endl;
break; break;
} else { } else {
out << __LINE__ << endl;
df::tiletype* type1 = Maps::getTileType(pt1); df::tiletype* type1 = Maps::getTileType(pt1);
df::tiletype* type2 = Maps::getTileType(pt2); df::tiletype* type2 = Maps::getTileType(pt2);
df::tiletype_shape shape1 = ENUM_ATTR(tiletype, shape, *type1); df::tiletype_shape shape1 = ENUM_ATTR(tiletype, shape, *type1);
df::tiletype_shape shape2 = ENUM_ATTR(tiletype, shape, *type2); df::tiletype_shape shape2 = ENUM_ATTR(tiletype, shape, *type2);
bool construction2 = ENUM_ATTR(tiletype, material, *type1) == df::enums::tiletype_material::CONSTRUCTION; bool construction2 = ENUM_ATTR(tiletype, material, *type1) == df::enums::tiletype_material::CONSTRUCTION;
if ( construction2 ) { if ( construction2 ) {
out << __LINE__ << endl;
out.print("%s, line %d. Removing construction (%d,%d,%d)\n", __FILE__, __LINE__, pt2.x,pt2.y,pt2.z); out.print("%s, line %d. Removing construction (%d,%d,%d)\n", __FILE__, __LINE__, pt2.x,pt2.y,pt2.z);
df::job* job = new df::job(); df::job* job = new df::job();
job->job_type = df::enums::job_type::RemoveConstruction; job->job_type = df::enums::job_type::RemoveConstruction;
@ -441,7 +425,6 @@ out << __LINE__ << endl;
Job::linkIntoWorld(job); Job::linkIntoWorld(job);
didSomething = true; didSomething = true;
where = pt2; where = pt2;
out << __LINE__ << endl;
break; break;
} }
@ -456,22 +439,18 @@ out << __LINE__ << endl;
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; 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; 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; 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 = pt2; job->pos = pt2;
firstInvader->path.dest = pt1; firstInvader->path.dest = pt1;
@ -512,7 +491,6 @@ out << __LINE__ << endl;
pick->skill_used = (df::enums::job_skill::job_skill)0; pick->skill_used = (df::enums::job_skill::job_skill)0;
pick->maker = -1; pick->maker = -1;
df::itemdef_weaponst* itemdef = NULL; df::itemdef_weaponst* itemdef = NULL;
out << __LINE__ << endl;
for ( size_t a = 0; a < df::global::world->raws.itemdefs.weapons.size(); a++ ) { for ( size_t a = 0; a < df::global::world->raws.itemdefs.weapons.size(); a++ ) {
df::itemdef_weaponst* candidate = df::global::world->raws.itemdefs.weapons[a]; df::itemdef_weaponst* candidate = df::global::world->raws.itemdefs.weapons[a];
if ( candidate->id == "ITEM_WEAPON_PICK" ) { if ( candidate->id == "ITEM_WEAPON_PICK" ) {
@ -520,20 +498,16 @@ out << __LINE__ << endl;
break; break;
} }
} }
out << __LINE__ << endl;
if ( itemdef == NULL ) { if ( itemdef == NULL ) {
out.print("%s, %d: null itemdef.\n", __FILE__, __LINE__); out.print("%s, %d: null itemdef.\n", __FILE__, __LINE__);
return; return;
} }
out << __LINE__ << endl;
pick->subtype = itemdef; pick->subtype = itemdef;
pick->sharpness = 5000; pick->sharpness = 5000;
int32_t part = -1; int32_t part = -1;
part = firstInvader->body.weapon_bp; //weapon_bp part = firstInvader->body.weapon_bp; //weapon_bp
out << __LINE__ << endl;
if ( part == -1 ) { if ( part == -1 ) {
out << __LINE__ << endl;
out.print("%s, %d: no grasp part.\n", __FILE__, __LINE__); out.print("%s, %d: no grasp part.\n", __FILE__, __LINE__);
return; return;
} }
@ -548,11 +522,9 @@ out << __LINE__ << endl;
Items::moveToInventory(cache, pick, firstInvader, df::unit_inventory_item::T_mode::Weapon, part); Items::moveToInventory(cache, pick, firstInvader, df::unit_inventory_item::T_mode::Weapon, part);
didSomething = true; didSomething = true;
where = pt2; where = pt2;
out << __LINE__ << endl;
break; break;
} }
} }
out << __LINE__ << endl;
out << "didSomething = " << didSomething << endl; out << "didSomething = " << didSomething << endl;
if ( !didSomething ) if ( !didSomething )