diff --git a/src/Episode3/PlayerState.cc b/src/Episode3/PlayerState.cc index 25812132..adcff7c7 100644 --- a/src/Episode3/PlayerState.cc +++ b/src/Episode3/PlayerState.cc @@ -1352,17 +1352,21 @@ void PlayerState::set_initial_location() { this->start_facing_direction = facing_direction; mr->start_facing_directions |= (static_cast(this->start_facing_direction) << (this->client_id << 2)); - for (size_t y = 0; y < 0x10; y++) { - for (size_t x = 0; x < 0x10; x++) { + bool start_tile_found = false; + for (size_t y = 0; (y < 0x10) && !start_tile_found; y++) { + for (size_t x = 0; (x < 0x10) && !start_tile_found; x++) { if (mr->map.tiles[y][x] == (player_start_tile & 0x3F)) { this->sc_card->loc.x = x; this->sc_card->loc.y = y; this->sc_card->loc.direction = facing_direction; - y = 0x10; + start_tile_found = true; break; } } } + if (!start_tile_found) { + throw runtime_error("player start location not set"); + } } void PlayerState::set_map_occupied_bit_for_card_on_warp_tile(