Skip to content

Commit df456f8

Browse files
committed
Autohosts are spawned on server start, reincarnation of Springie
1 parent 61addee commit df456f8

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

ZkLobbyServer/ZkLobbyServer.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public ZkLobbyServer(string geoIPpath, IPlanetwarsEventCreator creator)
8383
LadderListManager = new LadderListManager(this);
8484
ForumListManager = new ForumListManager(this);
8585

86-
86+
SpawnAutohosts();
8787

8888
RatingSystems.GetRatingSystems().ForEach(x => x.RatingsUpdated += (sender, data) =>
8989
{
@@ -97,6 +97,19 @@ public ZkLobbyServer(string geoIPpath, IPlanetwarsEventCreator creator)
9797
});
9898
}
9999

100+
private async Task SpawnAutohosts()
101+
{
102+
using (var db = new ZkDataContext())
103+
{
104+
foreach (var autohost in db.Autohosts)
105+
{
106+
var battle = new ServerBattle(this, "Autohost");
107+
battle.UpdateWith(autohost);
108+
await AddBattle(battle);
109+
}
110+
}
111+
}
112+
100113
/// <summary>
101114
/// Broadcast to all targets in paralell
102115
/// </summary>

0 commit comments

Comments
 (0)