Fixed #4407
This commit is contained in:
@@ -80,6 +80,7 @@ abstract class CommanderComp implements Entityc, Posc{
|
|||||||
|
|
||||||
void command(Formation formation, Seq<Unit> units){
|
void command(Formation formation, Seq<Unit> units){
|
||||||
clearCommand();
|
clearCommand();
|
||||||
|
units.shuffle();
|
||||||
|
|
||||||
float spacing = hitSize * 0.8f;
|
float spacing = hitSize * 0.8f;
|
||||||
minFormationSpeed = type.speed;
|
minFormationSpeed = type.speed;
|
||||||
|
|||||||
@@ -61,9 +61,6 @@ public class LAssembler{
|
|||||||
String[] lines = data.split("\n");
|
String[] lines = data.split("\n");
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for(String line : lines){
|
for(String line : lines){
|
||||||
//comments
|
|
||||||
int commentIdx = line.indexOf('#');
|
|
||||||
if(commentIdx != -1) line = line.substring(0, commentIdx).trim();
|
|
||||||
if(line.isEmpty()) continue;
|
if(line.isEmpty()) continue;
|
||||||
//remove trailing semicolons in case someone adds them in for no reason
|
//remove trailing semicolons in case someone adds them in for no reason
|
||||||
if(line.endsWith(";")) line = line.substring(0, line.length() - 1);
|
if(line.endsWith(";")) line = line.substring(0, line.length() - 1);
|
||||||
@@ -83,7 +80,9 @@ public class LAssembler{
|
|||||||
|
|
||||||
for(int i = 0; i < line.length() + 1; i++){
|
for(int i = 0; i < line.length() + 1; i++){
|
||||||
char c = i == line.length() ? ' ' : line.charAt(i);
|
char c = i == line.length() ? ' ' : line.charAt(i);
|
||||||
if(c == '"'){
|
if(c == '#' && !inString){
|
||||||
|
break;
|
||||||
|
}else if(c == '"'){
|
||||||
inString = !inString;
|
inString = !inString;
|
||||||
}else if(c == ' ' && !inString){
|
}else if(c == ' ' && !inString){
|
||||||
tokens.add(line.substring(lastIdx, Math.min(i, lastIdx + maxTokenLength)));
|
tokens.add(line.substring(lastIdx, Math.min(i, lastIdx + maxTokenLength)));
|
||||||
@@ -96,6 +95,9 @@ public class LAssembler{
|
|||||||
arr = new String[]{line};
|
arr = new String[]{line};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nothing found
|
||||||
|
if(arr.length == 0) continue;
|
||||||
|
|
||||||
String type = arr[0];
|
String type = arr[0];
|
||||||
|
|
||||||
//legacy stuff
|
//legacy stuff
|
||||||
@@ -131,10 +133,7 @@ public class LAssembler{
|
|||||||
String first = arr[0];
|
String first = arr[0];
|
||||||
if(customParsers.containsKey(first)){
|
if(customParsers.containsKey(first)){
|
||||||
statements.add(customParsers.get(first).get(arr));
|
statements.add(customParsers.get(first).get(arr));
|
||||||
}else{
|
} //unparseable statement, skip
|
||||||
//unparseable statement
|
|
||||||
statements.add(new InvalidStatement());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}catch(Exception parseFailed){
|
}catch(Exception parseFailed){
|
||||||
parseFailed.printStackTrace();
|
parseFailed.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user