diff --git a/src/main.ts b/src/main.ts
index 25d3bbe..bd762c4 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -2,11 +2,11 @@ import { ErrorMapper } from "utils/ErrorMapper";
// When compiling TS to JS and bundling with rollup, the line numbers and file names in error messages change
// This utility uses source maps to get the line numbers and file names of the original, TS source code
-export const loop = ErrorMapper.wrapLoop(function() {
+export const loop = ErrorMapper.wrapLoop(() => {
console.log(`Current game tick is ${Game.time}`);
// Automatically delete memory of missing creeps
- for (let name in Memory.creeps) {
+ for (const name in Memory.creeps) {
if (!(name in Game.creeps)) {
delete Memory.creeps[name];
}
diff --git a/src/utils/ErrorMapper.ts b/src/utils/ErrorMapper.ts
index 405f44c..9d93c76 100644
--- a/src/utils/ErrorMapper.ts
+++ b/src/utils/ErrorMapper.ts
@@ -38,8 +38,8 @@ export class ErrorMapper {
while (match = re.exec(stack)) {
if (match[2] === "main") {
const pos = this.consumer.originalPositionFor({
- line: parseInt(match[3], 10),
- column: parseInt(match[4], 10)
+ column: parseInt(match[4], 10),
+ line: parseInt(match[3], 10)
});
if (pos.line != null) {
@@ -75,7 +75,8 @@ export class ErrorMapper {
} catch (e) {
if (e instanceof Error) {
if ("sim" in Game.rooms) {
- console.log(`Source maps don't work in the simulator - displaying original error
${_.escape(e.stack)}`)
+ const message = `Source maps don't work in the simulator - displaying original error`;
+ console.log(`${message}
${_.escape(e.stack)}`);
} else {
console.log(`${_.escape(this.sourceMappedStackTrace(e))}`);
}
@@ -84,6 +85,6 @@ export class ErrorMapper {
throw e;
}
}
- }
+ };
}
}