Skip to content

Commit

Permalink
fix: check to see if requested camera limit is invalid. (#512)
Browse files Browse the repository at this point in the history
Co-authored-by: Balloonpopper <[email protected]>
  • Loading branch information
balloonpopper and Balloonpopper authored Feb 25, 2022
1 parent 5353ad6 commit 348a2b6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions addons/escoria-core/game/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ func _on_wait_finished() -> void:
# * camera_limits_id: The id of the room's camera limits to set
func set_camera_limits(camera_limit_id: int = 0) -> void:
var limits = {}
var last_available_camera_limit = current_scene.camera_limits.size() - 1
if camera_limit_id > last_available_camera_limit:
escoria.logger.report_errors(
"main.gd:set_camera_limits()",
[
"Camera limit %d requested. Last available camera limit is %d." % [
camera_limit_id,
last_available_camera_limit
]
]
)
var scene_camera_limits = current_scene.camera_limits[camera_limit_id]
if scene_camera_limits.size.x == 0 and scene_camera_limits.size.y == 0:
var area = Rect2()
Expand Down

0 comments on commit 348a2b6

Please sign in to comment.