-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServerMain.cpp
More file actions
41 lines (32 loc) · 1.03 KB
/
Copy pathServerMain.cpp
File metadata and controls
41 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "Player.h"
#include <map>
using namespace std;
class ServerMain {
public:
ServerMain() {
}
private:
int lobby_id;
map<int, Player> lobby_cars = {};
map<int, string> player_list = {};
int lobby_members_max = 32;
int listen_socket = 0;
map<int, float> last_exploded = {};
void AssociateCarWithID(int steam_id, string username, string color_name, bool crowned, bool headlights) {
if(lobby_cars.count(steam_id)) {
return;
}
Player new_car = Player(username, color_name, crowned, headlights);
lobby_cars[steam_id] = new_car;
player_list[steam_id] = username;
}
void DisassociateCarWithID(int steam_id) {
if(!lobby_cars.count(steam_id)) {
return;
}
Player* car = &lobby_cars[steam_id];
lobby_cars.erase(steam_id);
player_list.erase(steam_id);
delete car; //bye bye
}
};