mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 15:43:49 +01:00
Only append one number to make unique hostname
Instead of naming servers like "pserv-0", "pserv-0-1", "pserv-0-1-2", only append a single number like "pserv-3"
This commit is contained in:
parent
98007073b8
commit
aa41db9f3c
@ -15,12 +15,13 @@ function Server(ip=createRandomIp(), hostname="", organizationName="",
|
||||
//Connection information
|
||||
this.ip = ip;
|
||||
var i = 0;
|
||||
while (GetServerByHostname(hostname) != null) {
|
||||
var suffix = "";
|
||||
while (GetServerByHostname(hostname+suffix) != null) {
|
||||
//Server already exists
|
||||
hostname = hostname + "-" + i;
|
||||
suffix = "-" + i;
|
||||
++i;
|
||||
}
|
||||
this.hostname = hostname;
|
||||
this.hostname = hostname + suffix;
|
||||
this.organizationName = organizationName;
|
||||
this.isConnectedTo = isConnectedTo; //Whether the player is connected to this server
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user