mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 17:53:55 +01:00
Merge pull request #147 from jjclark1982/patch-1
Only append one number to make unique hostname
This commit is contained in:
commit
5768068065
@ -15,12 +15,13 @@ function Server(ip=createRandomIp(), hostname="", organizationName="",
|
|||||||
//Connection information
|
//Connection information
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
while (GetServerByHostname(hostname) != null) {
|
var suffix = "";
|
||||||
|
while (GetServerByHostname(hostname+suffix) != null) {
|
||||||
//Server already exists
|
//Server already exists
|
||||||
hostname = hostname + "-" + i;
|
suffix = "-" + i;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
this.hostname = hostname;
|
this.hostname = hostname + suffix;
|
||||||
this.organizationName = organizationName;
|
this.organizationName = organizationName;
|
||||||
this.isConnectedTo = isConnectedTo; //Whether the player is connected to this server
|
this.isConnectedTo = isConnectedTo; //Whether the player is connected to this server
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user