1 | /* |
1 | /* |
2 | * static char *rcsid_c_wiz_c = |
2 | * static char *rcsid_c_wiz_c = |
3 | * "$Id: c_wiz.c,v 1.2 2006/05/11 15:43:17 root Exp $"; |
3 | * "$Id: c_wiz.c,v 1.3 2006/05/12 22:29:15 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
247 | struct pl *pl; |
247 | struct pl *pl; |
248 | |
248 | |
249 | for (pl = first_player; pl != NULL; pl = pl->next) { |
249 | for (pl = first_player; pl != NULL; pl = pl->next) { |
250 | if ((params == NULL || !strcmp(pl->ob->name, params)) && pl->ob != op) { |
250 | if ((params == NULL || !strcmp(pl->ob->name, params)) && pl->ob != op) { |
251 | object *op; |
251 | object *op; |
252 | int removed = QUERY_FLAG(op, FLAG_REMOVED); |
|
|
253 | |
252 | |
254 | op = pl->ob; |
253 | op = pl->ob; |
255 | if (!removed) { |
254 | if (!QUERY_FLAG(op, FLAG_REMOVED)) { |
256 | /* Avion : Here we handle the KICK global event */ |
255 | /* Avion : Here we handle the KICK global event */ |
257 | execute_global_event(EVENT_KICK, op, params); |
256 | execute_global_event(EVENT_KICK, op, params); |
|
|
257 | |
|
|
258 | if (!QUERY_FLAG(op, FLAG_FREED)) { |
|
|
259 | check_score(op); /* Always check score */ |
|
|
260 | |
|
|
261 | (void)save_player(op, 0); |
|
|
262 | |
|
|
263 | if (op->map) |
|
|
264 | op->map->players--; |
|
|
265 | } |
|
|
266 | |
|
|
267 | #if MAP_MAXTIMEOUT |
|
|
268 | if (op->map) |
|
|
269 | op->map->timeout = MAP_TIMEOUT(op->map); |
|
|
270 | #endif |
258 | remove_ob(op); |
271 | remove_ob(op); |
259 | } |
272 | } |
|
|
273 | |
260 | op->direction = 0; |
274 | op->direction = 0; |
261 | new_draw_info_format(NDI_UNIQUE|NDI_ALL|NDI_RED, 5, op, |
275 | new_draw_info_format(NDI_UNIQUE|NDI_ALL|NDI_RED, 5, op, |
262 | "%s is kicked out of the game.", op->name); |
276 | "%s is kicked out of the game.", op->name); |
263 | strcpy(op->contr->killer, "left"); |
277 | strcpy(op->contr->killer, "kicked"); |
264 | check_score(op); /* Always check score */ |
|
|
265 | |
278 | |
266 | /* |
|
|
267 | * not sure how the player would be freed, but did see |
|
|
268 | * a crash here - if that is the case, don't save the |
|
|
269 | * the player. |
|
|
270 | */ |
|
|
271 | if (!removed && !QUERY_FLAG(op, FLAG_FREED)) { |
|
|
272 | (void)save_player(op, 0); |
|
|
273 | if (op->map) |
|
|
274 | op->map->players--; |
|
|
275 | } |
|
|
276 | #if MAP_MAXTIMEOUT |
|
|
277 | if (op->map) |
|
|
278 | op->map->timeout = MAP_TIMEOUT(op->map); |
|
|
279 | #endif |
|
|
280 | pl->socket.status = Ns_Dead; |
279 | pl->socket.status = Ns_Dead; |
281 | } |
280 | } |
282 | } |
281 | } |
283 | |
282 | |
284 | return 1; |
283 | return 1; |