Skip to content

Commit c5e1ba9

Browse files
committed
Fix typos and errors in Jass2.
- Fix that FrameSetAnchor has different behavior. - Accidentally removed enumUnitsInRect to enumBuildingsInRect. - Fix typo of GetOrderPointLoc and GetLocalizedHotkey. - Reintroduce a comment in CameraSetuoGetField
1 parent 79181a2 commit c5e1ba9

File tree

1 file changed

+13
-7
lines changed
  • core/src/com/etheller/warsmash/parsers/jass

1 file changed

+13
-7
lines changed

core/src/com/etheller/warsmash/parsers/jass/Jass2.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,15 @@ public JUIEnvironment(final JassProgramVisitor jassProgramVisitor, final DataSou
378378
return new HandleJassValue(frameHandleType, simpleFrame);
379379
});
380380
jassProgramVisitor.getJassNativeManager().createNative("FrameSetAnchor", (arguments, globalScope, triggerScope) -> {
381-
final String templateName = arguments.get(0).visit(StringJassValueVisitor.getInstance());
382-
final int createContext = arguments.get(1).visit(IntegerJassValueVisitor.getInstance());
383-
final UIFrame simpleFrame = JUIEnvironment.this.gameUI.getFrameByName(templateName, createContext);
384-
return new HandleJassValue(frameHandleType, simpleFrame);
381+
final UIFrame frame = arguments.get(0).visit(ObjectJassValueVisitor.<UIFrame>getInstance());
382+
final FramePoint framePoint = arguments.get(1)
383+
.visit(ObjectJassValueVisitor.<FramePoint>getInstance());
384+
final double x = arguments.get(2).visit(RealJassValueVisitor.getInstance());
385+
final double y = arguments.get(3).visit(RealJassValueVisitor.getInstance());
386+
387+
frame.addAnchor(new AnchorDefinition(framePoint, GameUI.convertX(uiViewport, (float) x),
388+
GameUI.convertY(uiViewport, (float) y)));
389+
return null;
385390
});
386391
jassProgramVisitor.getJassNativeManager().createNative("FrameSetAbsPoint", (arguments, globalScope, triggerScope) -> {
387392
final UIFrame frame = arguments.get(0).visit(ObjectJassValueVisitor.<UIFrame>getInstance());
@@ -947,7 +952,7 @@ public JassValue call(final List<JassValue> arguments, final GlobalScope globalS
947952
final List<CUnit> group = arguments.get(0).visit(ObjectJassValueVisitor.<List<CUnit>>getInstance());
948953
final Rectangle rect = arguments.get(1).visit(ObjectJassValueVisitor.<Rectangle>getInstance());
949954
final TriggerBooleanExpression filter = nullable(arguments, 2, ObjectJassValueVisitor.<TriggerBooleanExpression>getInstance());
950-
CommonEnvironment.this.simulation.getWorldCollision().enumBuildingsInRect(rect, (unit) -> {
955+
CommonEnvironment.this.simulation.getWorldCollision().enumUnitsInRect(rect, (unit) -> {
951956
if ((filter == null) || filter.evaluate(globalScope, CommonTriggerExecutionScope.filterScope(triggerScope, unit))) {
952957
// TODO the trigger scope for evaluation here might need to be a clean one?
953958
group.add(unit);
@@ -2430,6 +2435,7 @@ public JassValue call(final List<JassValue> arguments, final GlobalScope globalS
24302435
return null;
24312436
});
24322437
jassProgramVisitor.getJassNativeManager().createNative("CameraSetupGetField", (arguments, globalScope, triggerScope) -> {
2438+
// TODO NYI
24332439
return new RealJassValue(0.0f);
24342440
});
24352441
jassProgramVisitor.getJassNativeManager().createNative("LeaderboardGetItemCount", (arguments, globalScope, triggerScope) -> {
@@ -2658,7 +2664,7 @@ public JassValue call(final List<JassValue> arguments, final GlobalScope globalS
26582664
jassProgramVisitor.getJassNativeManager().createNative("GetOrderPointY", (arguments, globalScope, triggerScope) -> {
26592665
return new RealJassValue(((CommonTriggerExecutionScope) triggerScope).getOrderPointY());
26602666
});
2661-
jassProgramVisitor.getJassNativeManager().createNative("GetOrderPointLc", (arguments, globalScope, triggerScope) -> {
2667+
jassProgramVisitor.getJassNativeManager().createNative("GetOrderPointLoc", (arguments, globalScope, triggerScope) -> {
26622668
final CommonTriggerExecutionScope commonTriggerExecutionScope = (CommonTriggerExecutionScope) triggerScope;
26632669
final Point2D.Double jassLocation = new Point2D.Double(commonTriggerExecutionScope.getOrderPointX(), commonTriggerExecutionScope.getOrderPointY());
26642670
return new HandleJassValue(locationType, jassLocation);
@@ -4405,7 +4411,7 @@ public static void registerConversionAndStringNatives(final JassProgramVisitor j
44054411
}
44064412
return new StringJassValue(decoratedString);
44074413
});
4408-
jassProgramVisitor.getJassNativeManager().createNative("GetLocalizedHotKey", (arguments, globalScope, triggerScope) -> {
4414+
jassProgramVisitor.getJassNativeManager().createNative("GetLocalizedHotkey", (arguments, globalScope, triggerScope) -> {
44094415
final String key = arguments.get(0).visit(StringJassValueVisitor.getInstance());
44104416
// TODO this might be wrong, or a subset of the needed return values
44114417
final String decoratedString = gameUI.getTemplates().getDecoratedString(key);

0 commit comments

Comments
 (0)