Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speedup move test #36664

Merged
merged 2 commits into from
Jan 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions tests/monster_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using move_statistics = statistics<int>;
static int moves_to_destination( const std::string &monster_type,
const tripoint &start, const tripoint &end )
{
clear_map();
clear_creatures();
REQUIRE( g->num_creatures() == 1 ); // the player
monster &test_monster = spawn_test_monster( monster_type, start );
// Get it riled up and give it a goal.
Expand Down Expand Up @@ -91,7 +91,8 @@ static int can_catch_player( const std::string &monster_type, const tripoint &di
std::list<item> temp;
while( test_player.takeoff( test_player.i_at( -2 ), &temp ) );

test_player.setpos( { 65, 65, 0 } );
const tripoint center{ 65, 65, 0 };
test_player.setpos( center );
test_player.set_moves( 0 );
// Give the player a head start.
const tripoint monster_start = { -10 * direction_of_flight + test_player.pos()
Expand All @@ -114,15 +115,9 @@ static int can_catch_player( const std::string &monster_type, const tripoint &di
test_player.pos().y < SEEY * int( MAPSIZE / 2 ) ||
test_player.pos().x >= SEEX * ( 1 + int( MAPSIZE / 2 ) ) ||
test_player.pos().y >= SEEY * ( 1 + int( MAPSIZE / 2 ) ) ) {
g->update_map( test_player );
wipe_map_terrain();
clear_npcs();
for( monster &critter : g->all_monsters() ) {
if( &critter != &test_monster ) {
g->remove_zombie( critter );
}
}
g->m.clear_traps();
tripoint offset = center - test_player.pos();
test_player.setpos( center );
test_monster.setpos( test_monster.pos() + offset );
// Verify that only the player and one monster are present.
REQUIRE( g->num_creatures() == 2 );
}
Expand Down Expand Up @@ -155,7 +150,6 @@ static int can_catch_player( const std::string &monster_type, const tripoint &di
}
}
WARN( tracker );
clear_map();
return -1000;
}

Expand Down