author | Medo <smaxein@googlemail.com> |
Mon, 25 Jun 2012 00:42:07 +0200 | |
changeset 7271 | 5608ac657362 |
parent 7269 | 5b0aeef8ba2a |
child 7275 | 15f722e0b96f |
permissions | -rw-r--r-- |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
1 |
#include "roomlist.h" |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
2 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
3 |
#include "../util/util.h" |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
4 |
#include "../util/list.h" |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
5 |
#include "../util/logging.h" |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
6 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
7 |
#include <stdlib.h> |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
8 |
#include <string.h> |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
9 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
10 |
flib_roomlist *flib_roomlist_create() { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
11 |
return flib_calloc(1, sizeof(flib_roomlist)); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
12 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
13 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
14 |
static void flib_roomlist_room_destroy(flib_roomlist_room *room) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
15 |
if(room) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
16 |
free(room->map); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
17 |
free(room->name); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
18 |
free(room->owner); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
19 |
free(room->scheme); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
20 |
free(room->weapons); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
21 |
free(room); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
22 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
23 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
24 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
25 |
void flib_roomlist_destroy(flib_roomlist *list) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
26 |
if(list) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
27 |
for(int i=0; i<list->roomCount; i++) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
28 |
flib_roomlist_room_destroy(list->rooms[i]); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
29 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
30 |
free(list); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
31 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
32 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
33 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
34 |
static flib_roomlist_room *fillRoomFromParams(char **params) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
35 |
flib_roomlist_room *result = NULL; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
36 |
flib_roomlist_room *tmpRoom = flib_calloc(1, sizeof(flib_roomlist_room)); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
37 |
if(tmpRoom) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
38 |
tmpRoom->inProgress = !strcmp(params[0], "True"); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
39 |
tmpRoom->name = flib_strdupnull(params[1]); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
40 |
tmpRoom->playerCount = atoi(params[2]); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
41 |
tmpRoom->teamCount = atoi(params[3]); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
42 |
tmpRoom->owner = flib_strdupnull(params[4]); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
43 |
tmpRoom->map = flib_strdupnull(params[5]); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
44 |
tmpRoom->scheme = flib_strdupnull(params[6]); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
45 |
tmpRoom->weapons = flib_strdupnull(params[7]); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
46 |
if(tmpRoom->name && tmpRoom->owner && tmpRoom->map && tmpRoom->scheme && tmpRoom->weapons) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
47 |
result = tmpRoom; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
48 |
tmpRoom = NULL; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
49 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
50 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
51 |
flib_roomlist_room_destroy(tmpRoom); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
52 |
return result; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
53 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
54 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
55 |
int flib_roomlist_add(flib_roomlist *list, char **params) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
56 |
int result = -1; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
57 |
if(!list || !params) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
58 |
flib_log_e("null parameter in flib_roomlist_add"); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
59 |
} else { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
60 |
flib_roomlist_room *tmpRoom = fillRoomFromParams(params); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
61 |
if(tmpRoom) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
62 |
flib_roomlist_room **rooms = flib_list_insert(list->rooms, &list->roomCount, sizeof(*list->rooms), &tmpRoom, 0); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
63 |
if(rooms) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
64 |
list->rooms = rooms; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
65 |
tmpRoom = NULL; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
66 |
result = 0; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
67 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
68 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
69 |
flib_roomlist_room_destroy(tmpRoom); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
70 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
71 |
return result; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
72 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
73 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
74 |
static int findRoom(flib_roomlist *list, const char *name) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
75 |
for(int i=0; i<list->roomCount; i++) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
76 |
if(!strcmp(name, list->rooms[i]->name)) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
77 |
return i; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
78 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
79 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
80 |
return -1; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
81 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
82 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
83 |
int flib_roomlist_update(flib_roomlist *list, const char *name, char **params) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
84 |
int result = -1; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
85 |
if(!list || !name || !params) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
86 |
flib_log_e("null parameter in flib_roomlist_update"); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
87 |
} else { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
88 |
flib_roomlist_room *tmpRoom = fillRoomFromParams(params); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
89 |
int roomid = findRoom(list, name); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
90 |
if(tmpRoom && roomid>=0) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
91 |
flib_roomlist_room_destroy(list->rooms[roomid]); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
92 |
list->rooms[roomid] = tmpRoom; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
93 |
tmpRoom = NULL; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
94 |
result = 0; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
95 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
96 |
flib_roomlist_room_destroy(tmpRoom); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
97 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
98 |
return result; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
99 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
100 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
101 |
flib_roomlist_room *flib_roomlist_find(flib_roomlist *list, const char *name) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
102 |
flib_roomlist_room *result = NULL; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
103 |
if(!list || !name) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
104 |
flib_log_e("null parameter in flib_roomlist_find"); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
105 |
} else { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
106 |
int roomid = findRoom(list, name); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
107 |
if(roomid>=0) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
108 |
result = list->rooms[roomid]; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
109 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
110 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
111 |
return result; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
112 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
113 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
114 |
void flib_roomlist_clear(flib_roomlist *list) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
115 |
if(!list) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
116 |
flib_log_e("null parameter in flib_roomlist_clear"); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
117 |
} else { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
118 |
for(int i=0; i<list->roomCount; i++) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
119 |
flib_roomlist_room_destroy(list->rooms[i]); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
120 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
121 |
free(list->rooms); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
122 |
list->rooms = NULL; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
123 |
list->roomCount = 0; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
124 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
125 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
126 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
127 |
int flib_roomlist_delete(flib_roomlist *list, const char *name) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
128 |
int result = -1; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
129 |
if(!list || !name) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
130 |
flib_log_e("null parameter in flib_roomlist_delete"); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
131 |
} else { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
132 |
int roomid = findRoom(list, name); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
133 |
if(roomid<0) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
134 |
flib_log_w("Attempt to delete unknown room %s", name); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
135 |
} else { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
136 |
flib_roomlist_room *room = list->rooms[roomid]; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
137 |
flib_roomlist_room **rooms = flib_list_delete(list->rooms, &list->roomCount, sizeof(*list->rooms), roomid); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
138 |
if(rooms || list->roomCount==0) { |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
139 |
list->rooms = rooms; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
140 |
flib_roomlist_room_destroy(room); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
141 |
result = 0; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
142 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
143 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
144 |
} |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
145 |
return result; |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
146 |
} |