forked from carstene1ns/solarus-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix enemy:on_restarted() called twice
Closes solarus-games#1179. It was called both when the map started and when the map opening transition finished.
- Loading branch information
1 parent
50d7194
commit 3cf7e8c
Showing
7 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/testing_quest/data/enemies/bugs/1179_on_restarted_called_twice.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
local enemy = ... | ||
local game = enemy:get_game() | ||
|
||
local count = 0 | ||
|
||
function enemy:on_restarted() | ||
|
||
count = count + 1 | ||
end | ||
|
||
function enemy:get_on_restarted_count() | ||
return count | ||
end |
36 changes: 36 additions & 0 deletions
36
tests/testing_quest/data/maps/bugs/1179_enemy_on_restarted_called_twice.dat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
properties{ | ||
x = 0, | ||
y = 0, | ||
width = 320, | ||
height = 240, | ||
min_layer = 0, | ||
max_layer = 2, | ||
tileset = "castle", | ||
} | ||
|
||
tile{ | ||
layer = 0, | ||
x = 0, | ||
y = 0, | ||
width = 320, | ||
height = 240, | ||
pattern = "3", | ||
} | ||
|
||
enemy{ | ||
name = "enemy", | ||
layer = 0, | ||
x = 24, | ||
y = 61, | ||
direction = 0, | ||
breed = "bugs/1179_on_restarted_called_twice", | ||
} | ||
|
||
destination{ | ||
name = "destination", | ||
layer = 0, | ||
x = 24, | ||
y = 29, | ||
direction = 1, | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
tests/testing_quest/data/maps/bugs/1179_enemy_on_restarted_called_twice.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
local map = ... | ||
local game = map:get_game() | ||
|
||
function map:on_opening_transition_finished() | ||
|
||
sol.timer.start(map, 100, function() | ||
assert_equal(enemy:get_on_restarted_count(), 1) | ||
sol.main.exit() | ||
end) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters