Skip to content

Commit

Permalink
Fix and improve player helpers
Browse files Browse the repository at this point in the history
Use dummy.setpos instead of g->u in the place_player helper function.
Global `g->u` avatar instance is implicit in `place_player`; we want to
set the position of the `dummy` instance, not necessarily `g->u`.

Also reset speed and bonuses in clear_character.
  • Loading branch information
wapcaplet committed Apr 18, 2020
1 parent 074dd18 commit 3812987
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/player_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ void clear_character( player &dummy, bool debug_storage )
dummy.activity.set_to_null();
dummy.reset_chargen_attributes();
dummy.set_pain( 0 );
dummy.reset_bonuses();
dummy.set_speed_base( 100 );
dummy.set_speed_bonus( 0 );

// Restore all stamina and go to walk mode
dummy.set_stamina( dummy.get_stamina_max() );
Expand All @@ -97,7 +100,7 @@ void clear_character( player &dummy, bool debug_storage )
dummy.cash = 0;

const tripoint spot( 60, 60, 0 );
g->place_player( spot );
dummy.setpos( spot );
}

void clear_avatar()
Expand Down

0 comments on commit 3812987

Please sign in to comment.