OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
cl_instantAction.h
1/*
2===========================================================================
3Copyright (C) 2025 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23// Added in 2.30
24// Instantly find a server matching common criterias
25
26#pragma once
27
28#include "../gamespy/goaceng.h"
29
30typedef struct {
31 int serverType;
33
34typedef struct {
35 GServer server;
36 ServerGame_t serverGame;
37 bool rejected;
39
40enum IAState_e {
41 IA_NONE,
42 IA_INITIALIZE,
43 IA_WAITING,
44 IA_UPDATE,
45 IA_SEARCHING,
46 IA_FINISHED
47};
48
49class UIInstantAction : public UIWidget
50{
51public:
52 CLASS_PROTOTYPE(UIInstantAction);
53
54public:
55 UIInstantAction();
56 ~UIInstantAction() override;
57
58 void CleanUp();
59 void Init();
60
61 int GetServerIndex(int maxPing, int gameType);
62 void ReadIniFile();
63 void FindServer();
64 void Connect(Event *ev);
65 void Reject(Event *ev);
66 void Draw();
67 void Update();
68 int AddServer(GServer server, const ServerGame_t& serverGame);
69 void CancelRefresh(Event *ev);
70 void Refresh(Event *ev);
71 void EnableServerInfo(bool enable);
72
73private:
74 static void IAServerListCallBack(GServerList serverlist, int msg, void *instance, void *param1, void *param2);
75
76private:
77 //
78 // List
79 //
80 bool doneList[2];
81 GServerList serverList[2];
82 int maxServers;
83
84 //
85 // Current states
86 //
87 IAState_e state;
88 int numServers;
89 int numFoundServers;
90
91 //
92 // Filters
93 //
94 int minPlayers;
95 int startingMaxPing;
96 int endingMaxPing;
97
98 //
99 // Servers
100 //
101 IAServer_t *servers;
102 int currentServer;
103};
Definition listener.h:246
Definition cl_instantAction.h:34
Definition cl_instantAction.h:30