Fixed English in messages

This commit is contained in:
OLEGSHA 2020-11-19 18:59:41 +03:00
parent 996a244649
commit afa1234ddd
13 changed files with 56 additions and 44 deletions

View File

@ -1,6 +1,8 @@
package ru.windcorp.progressia.client.comms;
import java.io.IOException;
import ru.windcorp.jputil.chars.StringUtil;
import ru.windcorp.progressia.client.Client;
import ru.windcorp.progressia.client.graphics.world.EntityAnchor;
import ru.windcorp.progressia.client.world.ChunkRender;
@ -42,7 +44,11 @@ public class DefaultClientCommsListener implements CommsListener {
);
if (entity == null) {
CrashReports.report(null, "Player entity not found");
CrashReports.report(
null,
"Player entity with ID %s not found",
new String(StringUtil.toFullHex(packet.getLocalPlayerEntityId()))
);
}
getClient().setLocalPlayer(entity);

View File

@ -40,7 +40,7 @@ public class Program implements OpenGLDeletable {
glLinkProgram(handle);
if (glGetProgrami(handle, GL_LINK_STATUS) == GL_FALSE) {
CrashReports.report(null, "Bad program:\n %s", glGetProgramInfoLog(handle));
CrashReports.report(null, "Bad program:\n%s", glGetProgramInfoLog(handle));
}
}

View File

@ -27,7 +27,7 @@ public class Attribute {
public Attribute(int handle, Program program) {
if (handle < 0) {
CrashReports.report(null, "Bad handle: %s", handle);
CrashReports.report(null, "Bad handle: %d", handle);
}
this.handle = handle;

View File

@ -27,7 +27,7 @@ public class Uniform {
public Uniform(int handle, Program program) {
if (handle < 0) {
CrashReports.report(null, "Bad handle: %s", handle);
CrashReports.report(null, "Bad handle: %d", handle);
}
this.handle = handle;

View File

@ -57,7 +57,7 @@ public class GNUUnifontLoader {
return createStream(reader).map(GNUUnifontLoader::parse).map(GNUUnifontLoader::addToAtlas)
.collect(Collectors.collectingAndThen(createMapper(), GNUUnifont::new));
} catch (IOException | UncheckedIOException e) {
CrashReports.report(e, "Problem with load GNUUnifont");
CrashReports.report(e, "Could not load GNUUnifont");
return null;
}
}
@ -72,6 +72,8 @@ public class GNUUnifontLoader {
}
private static ParsedGlyph parse(String declar) {
try {
int width = getWidth(declar);
checkDeclaration(declar, width);
@ -89,6 +91,11 @@ public class GNUUnifontLoader {
}
return new ParsedGlyph(c, editor);
} catch (IOException e) {
CrashReports.report(e, "Could not load GNUUnifont: could not load character \"%s\"", declar);
return null;
}
}
private static char getChar(String declar) {
@ -117,26 +124,25 @@ public class GNUUnifontLoader {
return meaningfulChars / charsPerColumn;
}
private static void checkDeclaration(String declar, int width) {
private static void checkDeclaration(String declar, int width) throws IOException {
if (!GNUUnifont.WIDTHS.contains(width)) {
CrashReports.report(null, "Width %d is not supported (in declar \"%s\")", width, declar);
throw new IOException("Width " + width + " is not supported (in declar \"" + declar + "\")");
}
if ((declar.length() - PREFIX_LENGTH) % width != 0) {
CrashReports.report(null, "Declar \"%s\" has invalid length", declar);
throw new IOException("Declar \"" + declar + "\" has invalid length");
}
for (int i = 0; i < declar.length(); ++i) {
if (i == BITS_PER_HEX_DIGIT) {
if (declar.charAt(i) != ':') {
CrashReports.report(null, "No colon ':' found in declar \"%s\" at index 4", declar);
throw new IOException("No colon ':' found in declar \"" + declar + "\" at index 4");
}
} else {
char c = declar.charAt(i);
if (!((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F'))) {
CrashReports.report(null,
"Illegal char in declar \"%s\" at index " + i + "; expected 0-9A-F", declar);
throw new IOException("Illegal char in declar \"" + declar + "\" at index " + i + "; expected 0-9A-F");
}
}
}

View File

@ -235,7 +235,7 @@ public class Component extends Named {
valid = true;
} catch (Exception e) {
CrashReports.report(e, "__DOC__ME__");
CrashReports.report(e, "Could not layout Component %s", this);
}
}
@ -248,7 +248,7 @@ public class Component extends Named {
try {
return getLayout().calculatePreferredSize(this);
} catch (Exception e) {
CrashReports.report(e, "__DOC__ME__");
CrashReports.report(e, "Could not calculate preferred size for Component %s", this);
}
}
@ -517,7 +517,7 @@ public class Component extends Named {
break;
}
} catch (Exception e) {
CrashReports.report(e, "__DOC__ME__");
CrashReports.report(e, "Could not dispatch input to Component %s", this);
}
}
@ -609,7 +609,7 @@ public class Component extends Named {
try {
assembleSelf(target);
} catch (Exception e) {
CrashReports.report(e, "__DOC__ME__");
CrashReports.report(e, "Could not assemble Component %s", this);
}
assembleChildren(target);
@ -617,7 +617,7 @@ public class Component extends Named {
try {
postAssembleSelf(target);
} catch (Exception e) {
CrashReports.report(e, "__DOC__ME__");
CrashReports.report(e, "Post-assembly failed for Component %s", this);
}
}

View File

@ -157,7 +157,7 @@ public class Atlases {
return loadSprite(data.getData(), group);
} catch (IOException e) {
CrashReports.report(e, "Problem with load atlases sprite");
CrashReports.report(e, "Could not load sprite %s into atlas group %s", resource, group);
return null;
}
}
@ -174,7 +174,7 @@ public class Atlases {
Atlas newAtlas = new Atlas(group);
if (!newAtlas.canAddSprite(data)) {
CrashReports.report(null, "Could not fit tex into atlas of size %d", newAtlas.getSize());
CrashReports.report(null, "Could not fit texture into atlas of size %d", newAtlas.getSize());
}
atlases.add(newAtlas);

View File

@ -31,7 +31,7 @@ public class SimpleTextures {
new Sprite(new TexturePrimitive(data.getData()))
);
} catch (IOException e) {
CrashReports.report(e, "Problem with load texture");
CrashReports.report(e, "Could not load texture %s", resource);
return null;
}

View File

@ -90,7 +90,7 @@ public class TexturePrimitive implements OpenGLDeletable {
OpenGLObjectTracker.register(this);
if (handle < 0) {
CrashReports.report(null, "Failed to create texture");
CrashReports.report(null, "Failed to allocate texture");
}
}

View File

@ -81,7 +81,7 @@ public class Parser {
}
} catch (IOException | EscapeException e) {
CrashReports.report(e, "Problems with parsing");
CrashReports.report(e, "Could not parse language file %s", filePath);
return null;
}
return parsedData;

View File

@ -29,7 +29,7 @@ public class EntityRenderRegistry extends NamespacedRegistry<EntityRender> {
).getData()
);
} catch (IOException e) {
CrashReports.report(e, "__DOC__ME__");
CrashReports.report(e, "Could not load entity texture %s", name);
return null;
}
}

View File

@ -51,7 +51,7 @@ public class Resource extends Named {
try (Reader reader = getReader()) {
return CharStreams.toString(reader);
} catch (IOException e) {
CrashReports.report(e, "__DOC__ME__");
CrashReports.report(e, "Could not read resource %s as text", this);
return null;
}
}
@ -61,7 +61,7 @@ public class Resource extends Named {
try (InputStream stream = getInputStream()) {
byteArray = ByteStreams.toByteArray(stream);
} catch (IOException e) {
CrashReports.report(e, "__DOC__ME__");
CrashReports.report(e, "Could not read resource %s as bytes", this);
return null;
}

View File

@ -134,7 +134,7 @@ public class ImplementedChangeTracker implements Changer {
try {
entity.write(packet.getWriter(), IOContext.COMMS);
} catch (IOException e) {
CrashReports.report(e, "__DOC__ME__");
CrashReports.report(e, "Could not write entity %s", entity);
}
}
@ -146,7 +146,7 @@ public class ImplementedChangeTracker implements Changer {
try {
entity.write(packet.getWriter(), IOContext.COMMS);
} catch (IOException e) {
CrashReports.report(e, "Entity could not be written");
CrashReports.report(e, "Could not write entity %s", entity);
}
}