1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
3 | |
3 | * |
4 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | |
7 | * |
8 | This program is free software; you can redistribute it and/or modify |
8 | * Crossfire TRT is free software; you can redistribute it and/or modify it |
9 | it under the terms of the GNU General Public License as published by |
9 | * under the terms of the GNU General Public License as published by the Free |
10 | the Free Software Foundation; either version 2 of the License, or |
10 | * Software Foundation; either version 2 of the License, or (at your option) |
11 | (at your option) any later version. |
11 | * 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, but |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
16 | GNU General Public License for more details. |
16 | * 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 along |
19 | along with this program; if not, write to the Free Software |
19 | * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 to <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 | |
|
|
29 | #ifdef COZY_SERVER |
|
|
30 | // used for pet monster logic etc. |
|
|
31 | int |
|
|
32 | same_party (partylist *a, partylist *b) |
|
|
33 | { |
|
|
34 | return a == b && a; |
|
|
35 | } |
|
|
36 | #endif |
|
|
37 | |
28 | |
38 | static partylist *firstparty = NULL; /* Keeps track of first party in list */ |
29 | static partylist *firstparty = NULL; /* Keeps track of first party in list */ |
39 | static partylist *lastparty = NULL; /*Keeps track of last party in list */ |
30 | static partylist *lastparty = NULL; /*Keeps track of last party in list */ |
40 | |
31 | |
41 | partylist * |
32 | partylist * |
… | |
… | |
71 | remove_party (partylist *target_party) |
62 | remove_party (partylist *target_party) |
72 | { |
63 | { |
73 | partylist *tmpparty; |
64 | partylist *tmpparty; |
74 | partylist *previousparty; |
65 | partylist *previousparty; |
75 | partylist *nextparty; |
66 | partylist *nextparty; |
76 | player *pl; |
|
|
77 | |
67 | |
78 | if (firstparty == NULL) |
68 | if (firstparty == NULL) |
79 | { |
69 | { |
80 | LOG (llevError, "remove_party(): I was asked to remove party %s, but no parties are defined", target_party->partyname); |
70 | LOG (llevError, "remove_party(): I was asked to remove party %s, but no parties are defined", target_party->partyname); |
81 | return; |
71 | return; |
… | |
… | |
139 | /* Remove unused parties, this could be made to scale a lot better. */ |
129 | /* Remove unused parties, this could be made to scale a lot better. */ |
140 | void |
130 | void |
141 | obsolete_parties (void) |
131 | obsolete_parties (void) |
142 | { |
132 | { |
143 | int player_count; |
133 | int player_count; |
144 | player *pl; |
|
|
145 | partylist *party; |
134 | partylist *party; |
146 | partylist *next = NULL; |
135 | partylist *next = NULL; |
147 | |
136 | |
148 | if (!firstparty) |
137 | if (!firstparty) |
149 | return; /* we can't obsolete parties if there aren't any */ |
138 | return; /* we can't obsolete parties if there aren't any */ |
… | |
… | |
158 | remove_party (party); |
147 | remove_party (party); |
159 | } |
148 | } |
160 | } |
149 | } |
161 | |
150 | |
162 | void |
151 | void |
163 | add_kill_to_party (partylist *party, char *killer, char *dead, long exp) |
152 | add_kill_to_party (partylist *party, const char *killer, const char *dead, long exp) |
164 | { |
153 | { |
165 | int i, pos; |
154 | int i, pos; |
166 | |
155 | |
167 | if (party == NULL) |
156 | if (party == NULL) |
168 | return; |
157 | return; |
… | |
… | |
230 | } |
219 | } |
231 | |
220 | |
232 | void |
221 | void |
233 | send_party_message (object *op, char *msg) |
222 | send_party_message (object *op, char *msg) |
234 | { |
223 | { |
235 | player *pl; |
|
|
236 | |
|
|
237 | for_all_players (pl) |
224 | for_all_players (pl) |
238 | if (pl->ob->contr->party == op->contr->party && pl->ob != op) |
225 | if (pl->ob->contr->party == op->contr->party && pl->ob != op) |
239 | new_draw_info (NDI_WHITE, 0, pl->ob, msg); |
226 | new_draw_info (NDI_WHITE, 0, pl->ob, msg); |
240 | } |
227 | } |
241 | |
228 | |
… | |
… | |
364 | } |
351 | } |
365 | |
352 | |
366 | if (strncmp (params, "form ", 5) == 0) |
353 | if (strncmp (params, "form ", 5) == 0) |
367 | { |
354 | { |
368 | int player_count; |
355 | int player_count; |
369 | player *pl; |
|
|
370 | |
356 | |
371 | params += 5; |
357 | params += 5; |
372 | if (op->contr->party) |
358 | if (op->contr->party) |
373 | oldparty = op->contr->party; |
359 | oldparty = op->contr->party; |
374 | else |
360 | else |
… | |
… | |
425 | return 1; |
411 | return 1; |
426 | } |
412 | } |
427 | |
413 | |
428 | if (strcmp (params, "who") == 0) |
414 | if (strcmp (params, "who") == 0) |
429 | { |
415 | { |
430 | player *pl; |
|
|
431 | |
|
|
432 | tmpparty = op->contr->party; |
416 | tmpparty = op->contr->party; |
433 | if (op->contr->party == NULL) |
417 | if (op->contr->party == NULL) |
434 | { |
418 | { |
435 | new_draw_info (NDI_UNIQUE, 0, op, "You are not a member of any party."); |
419 | new_draw_info (NDI_UNIQUE, 0, op, "You are not a member of any party."); |
436 | return 1; |
420 | return 1; |