Refactor for ... in loops

This commit is contained in:
nickofolas
2022-01-15 18:45:03 -06:00
parent d5c3d89613
commit ab841f7530
54 changed files with 128 additions and 130 deletions

View File

@@ -1484,7 +1484,7 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string {
if (determineCrimeSuccess(this, this.crimeType)) {
//Handle Karma and crime statistics
let crime = null;
for (const i in Crimes) {
for (const i of Object.keys(Crimes)) {
if (Crimes[i].type == this.crimeType) {
crime = Crimes[i];
break;
@@ -2556,15 +2556,15 @@ export function setBitNodeNumber(this: IPlayer, n: number): void {
}
export function queueAugmentation(this: IPlayer, name: string): void {
for (const i in this.queuedAugmentations) {
if (this.queuedAugmentations[i].name == name) {
for (const aug of this.queuedAugmentations) {
if (aug.name == name) {
console.warn(`tried to queue ${name} twice, this may be a bug`);
return;
}
}
for (const i in this.augmentations) {
if (this.augmentations[i].name == name) {
for (const aug of this.augmentations) {
if (aug.name == name) {
console.warn(`tried to queue ${name} twice, this may be a bug`);
return;
}