From 52a96b94f9cb7049d676b7024982ede90ce03128 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 15 Oct 2021 21:03:25 -0400 Subject: [PATCH] fix cancel penalty for company servers --- src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index 62812dda8..2d24d5ea2 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -58,6 +58,7 @@ import { Reputation } from "../../ui/React/Reputation"; import { Money } from "../../ui/React/Money"; import React from "react"; +import { serverMetadata } from "../../Server/data/servers"; export function init(this: IPlayer): void { /* Initialize Player's home computer */ @@ -606,7 +607,9 @@ export function process(this: IPlayer, router: IRouter, numCycles = 1): void { } export function cancelationPenalty(this: IPlayer): number { - const server = GetServer(this.companyName); + const data = serverMetadata.find((s) => s.specialName === this.companyName); + if (!data) throw new Error("Couldn't find server for company " + this.companyName); + const server = GetServer(data.hostname); if (server instanceof Server) { if (server && server.backdoorInstalled) return 0.75; }