Skip to content

Commit

Permalink
Clean GMK Tree Reading
Browse files Browse the repository at this point in the history
* Use Integer.valueOf instead of deprecated Integer constructor.
* Safe because reference equality was not being relied upon for stack.
* Simplify a ternary assignment branch for hasRef boolean.
* Move localization tag to correct line for translated message.
  • Loading branch information
RobertBColton committed Jul 27, 2020
1 parent e1cc25a commit 5de0931
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions org/lateralgm/file/GmFileReader.java
Expand Up @@ -1260,12 +1260,10 @@ private static void readTree(ProjectFileContext c, ResNode root, int ver) throws
type = Include.class;
int ind = in.read4();
String name = in.readStr();
boolean hasRef;
boolean hasRef = false;
if (status == ResNode.STATUS_SECONDARY)
hasRef = type == Font.class ? ver != 500 : (type == null ? false
: InstantiableResource.class.isAssignableFrom(type));
else
hasRef = false;
ResourceList<?> rl = hasRef ? (ResourceList<?>) f.resMap.get(type) : null;
ResNode node = new ResNode(name,status,type,hasRef ? rl.getUnsafe(ind).reference : null);
if (ver == 500 && type == Include.class)
Expand All @@ -1276,15 +1274,15 @@ private static void readTree(ProjectFileContext c, ResNode root, int ver) throws

// GameMaker 5 did not have a dedicated primary fonts group, let's add one.
if (status == ResNode.STATUS_PRIMARY)
path.peek().addChild(ProjectFile.interfaceProvider.translate("LGM.FNT"),
status,Font.class); //$NON-NLS-1$
path.peek().addChild(ProjectFile.interfaceProvider.translate("LGM.FNT"), //$NON-NLS-1$
status,Font.class);
}

path.peek().add(node);
int contents = in.read4();
if (contents > 0)
{
left.push(new Integer(rootnodes));
left.push(Integer.valueOf(rootnodes));
rootnodes = contents;
path.push(node);
}
Expand Down
2 changes: 1 addition & 1 deletion org/lateralgm/main/LGM.java
Expand Up @@ -132,7 +132,7 @@

public final class LGM
{
public static final String version = "1.8.179"; //$NON-NLS-1$
public static final String version = "1.8.180"; //$NON-NLS-1$

// TODO: This list holds the class loader for any loaded plugins which should be
// cleaned up and closed when the application closes.
Expand Down

0 comments on commit 5de0931

Please sign in to comment.