1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | |
3 | * |
4 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra 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 | * Deliantra 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 3 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, see <http://www.gnu.org/licenses/>. |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * |
21 | |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
|
|
23 | */ |
22 | */ |
24 | |
23 | |
25 | #include <global.h> |
24 | #include <global.h> |
26 | #include <sproto.h> |
25 | #include <sproto.h> |
27 | #include <spells.h> |
26 | #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 | |
27 | |
38 | static partylist *firstparty = NULL; /* Keeps track of first party in list */ |
28 | static partylist *firstparty = NULL; /* Keeps track of first party in list */ |
39 | static partylist *lastparty = NULL; /*Keeps track of last party in list */ |
29 | static partylist *lastparty = NULL; /*Keeps track of last party in list */ |
40 | |
30 | |
41 | partylist * |
31 | partylist * |
… | |
… | |
71 | remove_party (partylist *target_party) |
61 | remove_party (partylist *target_party) |
72 | { |
62 | { |
73 | partylist *tmpparty; |
63 | partylist *tmpparty; |
74 | partylist *previousparty; |
64 | partylist *previousparty; |
75 | partylist *nextparty; |
65 | partylist *nextparty; |
76 | player *pl; |
|
|
77 | |
66 | |
78 | if (firstparty == NULL) |
67 | if (firstparty == NULL) |
79 | { |
68 | { |
80 | LOG (llevError, "remove_party(): I was asked to remove party %s, but no parties are defined", target_party->partyname); |
69 | LOG (llevError, "remove_party(): I was asked to remove party %s, but no parties are defined", target_party->partyname); |
81 | return; |
70 | return; |
… | |
… | |
139 | /* Remove unused parties, this could be made to scale a lot better. */ |
128 | /* Remove unused parties, this could be made to scale a lot better. */ |
140 | void |
129 | void |
141 | obsolete_parties (void) |
130 | obsolete_parties (void) |
142 | { |
131 | { |
143 | int player_count; |
132 | int player_count; |
144 | player *pl; |
|
|
145 | partylist *party; |
133 | partylist *party; |
146 | partylist *next = NULL; |
134 | partylist *next = NULL; |
147 | |
135 | |
148 | if (!firstparty) |
136 | if (!firstparty) |
149 | return; /* we can't obsolete parties if there aren't any */ |
137 | return; /* we can't obsolete parties if there aren't any */ |
… | |
… | |
158 | remove_party (party); |
146 | remove_party (party); |
159 | } |
147 | } |
160 | } |
148 | } |
161 | |
149 | |
162 | void |
150 | void |
163 | add_kill_to_party (partylist *party, char *killer, char *dead, long exp) |
151 | add_kill_to_party (partylist *party, const char *killer, const char *dead, long exp) |
164 | { |
152 | { |
165 | int i, pos; |
153 | int i, pos; |
166 | |
154 | |
167 | if (party == NULL) |
155 | if (party == NULL) |
168 | return; |
156 | return; |
… | |
… | |
230 | } |
218 | } |
231 | |
219 | |
232 | void |
220 | void |
233 | send_party_message (object *op, char *msg) |
221 | send_party_message (object *op, char *msg) |
234 | { |
222 | { |
235 | player *pl; |
|
|
236 | |
|
|
237 | for_all_players (pl) |
223 | for_all_players (pl) |
238 | if (pl->ob->contr->party == op->contr->party && pl->ob != op) |
224 | if (pl->ob->contr->party == op->contr->party && pl->ob != op) |
239 | new_draw_info (NDI_WHITE, 0, pl->ob, msg); |
225 | new_draw_info (NDI_WHITE, 0, pl->ob, msg); |
240 | } |
226 | } |
241 | |
227 | |
… | |
… | |
364 | } |
350 | } |
365 | |
351 | |
366 | if (strncmp (params, "form ", 5) == 0) |
352 | if (strncmp (params, "form ", 5) == 0) |
367 | { |
353 | { |
368 | int player_count; |
354 | int player_count; |
369 | player *pl; |
|
|
370 | |
355 | |
371 | params += 5; |
356 | params += 5; |
372 | if (op->contr->party) |
357 | if (op->contr->party) |
373 | oldparty = op->contr->party; |
358 | oldparty = op->contr->party; |
374 | else |
359 | else |
… | |
… | |
425 | return 1; |
410 | return 1; |
426 | } |
411 | } |
427 | |
412 | |
428 | if (strcmp (params, "who") == 0) |
413 | if (strcmp (params, "who") == 0) |
429 | { |
414 | { |
430 | player *pl; |
|
|
431 | |
|
|
432 | tmpparty = op->contr->party; |
415 | tmpparty = op->contr->party; |
433 | if (op->contr->party == NULL) |
416 | if (op->contr->party == NULL) |
434 | { |
417 | { |
435 | new_draw_info (NDI_UNIQUE, 0, op, "You are not a member of any party."); |
418 | new_draw_info (NDI_UNIQUE, 0, op, "You are not a member of any party."); |
436 | return 1; |
419 | return 1; |