unexport AllServers

This commit is contained in:
Olivier Gagnon
2021-10-07 16:04:04 -04:00
parent 1d488565c6
commit be29481689
27 changed files with 185 additions and 159 deletions
+4 -5
View File
@@ -19,8 +19,7 @@ import { HashUpgrades } from "./HashUpgrades";
import { generateRandomContract } from "../CodingContractGenerator";
import { iTutorialSteps, iTutorialNextStep, ITutorial } from "../InteractiveTutorial";
import { IPlayer } from "../PersonObjects/IPlayer";
import { AllServers } from "../Server/AllServers";
import { GetServerByHostname } from "../Server/ServerHelpers";
import { GetServerByHostname, getServer } from "../Server/ServerHelpers";
import { Server } from "../Server/Server";
import { SourceFileFlags } from "../SourceFile/SourceFileFlags";
@@ -416,8 +415,8 @@ function processAllHacknetServerEarnings(player: IPlayer, numCycles: number): nu
// Also, update the hash rate before processing
const ip = player.hacknetNodes[i];
if (ip instanceof HacknetNode) throw new Error(`player nodes should not be HacketNode`);
const hserver = AllServers[ip];
if (hserver instanceof Server) throw new Error(`player nodes shoud not be Server`);
const hserver = getServer(ip);
if (!(hserver instanceof HacknetServer)) throw new Error(`player nodes shoud not be Server`);
hserver.updateHashRate(player.hacknet_node_money_mult);
const h = hserver.process(numCycles);
hashes += h;
@@ -448,7 +447,7 @@ export function updateHashManagerCapacity(player: IPlayer): void {
}
const ip = nodes[i];
if (ip instanceof HacknetNode) throw new Error(`player nodes should be string but isn't`);
const h = AllServers[ip];
const h = getServer(ip);
if (!(h instanceof HacknetServer)) {
player.hashManager.updateCapacity(0);
return;