Skip to content

Commit

Permalink
Update vehicle.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosvolt committed Jun 6, 2024
1 parent afff487 commit 968b4bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,8 @@ void vehicle::init_state( int init_veh_fuel, int init_veh_status )
// destroy a random number of tires, vehicles with more wheels are more likely to survive
if( destroyTires && !wheelcache.empty() ) {
int tries = 0;
while( valid_wheel_config() && tries < wheelcache.size() ) {
int maxtries = wheelcache.size();
while( valid_wheel_config() && tries < maxtries ) {
// keep going until either we've ruined all wheels or made one attempt for every wheel
set_hp( parts[random_entry( wheelcache )], 0 );
tries++;
Expand Down

0 comments on commit 968b4bb

Please sign in to comment.