Skip to content

Commit 4c41666

Browse files
committed
Check scene name also in CURRENT_SCENE ifSceneAttr.
1 parent 68e0a13 commit 4c41666

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

blade-engine/src/com/bladecoder/engine/actions/IfSceneAttrAction.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,36 @@ public enum SceneAttr {
4040
@ActionProperty
4141
@ActionPropertyDescription("The attribute value")
4242
private String value;
43-
43+
4444
private World w;
45-
45+
4646
@Override
4747
public void init(World w) {
4848
this.w = w;
4949
}
5050

5151
@Override
5252
public boolean run(VerbRunner cb) {
53-
Scene s = (scene != null && !scene.isEmpty()) ? w.getScene(scene) : w
54-
.getCurrentScene();
53+
Scene s = (scene != null && !scene.isEmpty()) ? w.getScene(scene) : w.getCurrentScene();
5554

5655
if (attr == SceneAttr.STATE) {
5756
if (!ActionUtils.compareNullStr(value, s.getState())) {
58-
gotoElse((VerbRunner) cb);
57+
gotoElse(cb);
5958
}
6059
} else if (attr == SceneAttr.CURRENT_SCENE) {
6160
String scn = w.getCurrentScene().getId();
62-
63-
if (!ActionUtils.compareNullStr(value, scn)) {
64-
gotoElse((VerbRunner) cb);
61+
62+
if (!ActionUtils.compareNullStr(value, scn) && !ActionUtils.compareNullStr(s.getId(), scn)) {
63+
gotoElse(cb);
6564
}
6665
} else if (attr == SceneAttr.PLAYER) {
6766
CharacterActor player = s.getPlayer();
68-
69-
String id = player!=null?player.getId():null;
70-
67+
68+
String id = player != null ? player.getId() : null;
69+
7170
if (!ActionUtils.compareNullStr(value, id)) {
72-
gotoElse((VerbRunner) cb);
73-
}
71+
gotoElse(cb);
72+
}
7473
}
7574

7675
return false;

0 commit comments

Comments
 (0)