1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game for X-windows |
3 | |
3 | * |
4 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | |
7 | * |
8 | This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. |
11 | * (at your option) any later version. |
12 | |
12 | * |
13 | This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | |
17 | * |
18 | You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | |
21 | * |
22 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail at <crossfire@schmorp.de> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | #include <sproto.h> |
26 | #include <sproto.h> |
27 | #include <spells.h> |
27 | #include <spells.h> |
28 | |
28 | |
… | |
… | |
71 | remove_party (partylist *target_party) |
71 | remove_party (partylist *target_party) |
72 | { |
72 | { |
73 | partylist *tmpparty; |
73 | partylist *tmpparty; |
74 | partylist *previousparty; |
74 | partylist *previousparty; |
75 | partylist *nextparty; |
75 | partylist *nextparty; |
76 | player *pl; |
|
|
77 | |
76 | |
78 | if (firstparty == NULL) |
77 | if (firstparty == NULL) |
79 | { |
78 | { |
80 | LOG (llevError, "remove_party(): I was asked to remove party %s, but no parties are defined", target_party->partyname); |
79 | LOG (llevError, "remove_party(): I was asked to remove party %s, but no parties are defined", target_party->partyname); |
81 | return; |
80 | return; |
… | |
… | |
139 | /* Remove unused parties, this could be made to scale a lot better. */ |
138 | /* Remove unused parties, this could be made to scale a lot better. */ |
140 | void |
139 | void |
141 | obsolete_parties (void) |
140 | obsolete_parties (void) |
142 | { |
141 | { |
143 | int player_count; |
142 | int player_count; |
144 | player *pl; |
|
|
145 | partylist *party; |
143 | partylist *party; |
146 | partylist *next = NULL; |
144 | partylist *next = NULL; |
147 | |
145 | |
148 | if (!firstparty) |
146 | if (!firstparty) |
149 | return; /* we can't obsolete parties if there aren't any */ |
147 | return; /* we can't obsolete parties if there aren't any */ |
… | |
… | |
230 | } |
228 | } |
231 | |
229 | |
232 | void |
230 | void |
233 | send_party_message (object *op, char *msg) |
231 | send_party_message (object *op, char *msg) |
234 | { |
232 | { |
235 | player *pl; |
|
|
236 | |
|
|
237 | for_all_players (pl) |
233 | for_all_players (pl) |
238 | if (pl->ob->contr->party == op->contr->party && pl->ob != op) |
234 | if (pl->ob->contr->party == op->contr->party && pl->ob != op) |
239 | new_draw_info (NDI_WHITE, 0, pl->ob, msg); |
235 | new_draw_info (NDI_WHITE, 0, pl->ob, msg); |
240 | } |
236 | } |
241 | |
237 | |
… | |
… | |
364 | } |
360 | } |
365 | |
361 | |
366 | if (strncmp (params, "form ", 5) == 0) |
362 | if (strncmp (params, "form ", 5) == 0) |
367 | { |
363 | { |
368 | int player_count; |
364 | int player_count; |
369 | player *pl; |
|
|
370 | |
365 | |
371 | params += 5; |
366 | params += 5; |
372 | if (op->contr->party) |
367 | if (op->contr->party) |
373 | oldparty = op->contr->party; |
368 | oldparty = op->contr->party; |
374 | else |
369 | else |
… | |
… | |
425 | return 1; |
420 | return 1; |
426 | } |
421 | } |
427 | |
422 | |
428 | if (strcmp (params, "who") == 0) |
423 | if (strcmp (params, "who") == 0) |
429 | { |
424 | { |
430 | player *pl; |
|
|
431 | |
|
|
432 | tmpparty = op->contr->party; |
425 | tmpparty = op->contr->party; |
433 | if (op->contr->party == NULL) |
426 | if (op->contr->party == NULL) |
434 | { |
427 | { |
435 | new_draw_info (NDI_UNIQUE, 0, op, "You are not a member of any party."); |
428 | new_draw_info (NDI_UNIQUE, 0, op, "You are not a member of any party."); |
436 | return 1; |
429 | return 1; |