ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/plugins.C
(Generate patch)

Comparing deliantra/server/server/plugins.C (file contents):
Revision 1.42 by root, Mon Feb 5 01:47:23 2007 UTC vs.
Revision 1.46 by root, Mon May 28 21:28:36 2007 UTC

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) 2000 Mark Wedel */ 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
5/* Copyright (C) 1992 Frank Tore Johansen */ 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6/* */ 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 *
7/* 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
8/* 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
9/* the Free Software Foundation; either version 2 of the License, or */ 10 * Software Foundation; either version 2 of the License, or (at your option)
10/* (at your option) any later version. */ 11 * any later version.
11/* */ 12 *
12/* 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
13/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ 15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15/* GNU General Public License for more details. */ 16 * for more details.
16/* */ 17 *
17/* 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
18/* 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
19/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20/* */ 21 *
22 * The authors can be reached via e-mail to <crossfire@schmorp.de>
23 */
24
21/*****************************************************************************/ 25/*****************************************************************************/
22/* This is the server-side plugin management part. */ 26/* This is the server-side plugin management part. */
23/*****************************************************************************/ 27/*****************************************************************************/
24/* Original code by Yann Chachkoff (yann.chachkoff@mailandnews.com). */ 28/* Original code by Yann Chachkoff (yann.chachkoff@mailandnews.com). */
25/* Special thanks to: */ 29/* Special thanks to: */
26/* David Delbecq (david.delbecq@mailandnews.com); */ 30/* David Delbecq (david.delbecq@mailandnews.com); */
27/* Joris Bontje (jbontje@suespammers.org); */ 31/* Joris Bontje (jbontje@suespammers.org); */
28/* Philip Currlin (?); */ 32/* Philip Currlin (?); */
29/*****************************************************************************/ 33/*****************************************************************************/
34
30/*****************************************************************************/ 35/*****************************************************************************/
31/* First, the headers. We only include plugin.h, because all other includes */ 36/* First, the headers. We only include plugin.h, because all other includes */
32/* are done into it, and plugproto.h (which is used only by this file). */ 37/* are done into it, and plugproto.h (which is used only by this file). */
33/*****************************************************************************/ 38/*****************************************************************************/
34 39
122/* NEW PLUGIN STUFF STARTS HERE */ 127/* NEW PLUGIN STUFF STARTS HERE */
123 128
124/*****************************************************************************/ 129/*****************************************************************************/
125 130
126/** 131/**
127 * Notify clients about a changed object.
128 *
129 * @param op the object that has changed
130 */
131static void
132send_changed_object (object *op)
133{
134 object *tmp;
135
136 if (op->env)
137 {
138 tmp = op->in_player ();
139
140 if (!tmp)
141 {
142 for_all_players (pl)
143 if (pl->ob->container == op->env)
144 {
145 tmp = pl->ob;
146 break;
147 }
148 }
149
150 if (tmp)
151 esrv_send_item (tmp, op);
152 }
153 else
154 {
155 for (tmp = op->above; tmp != NULL; tmp = tmp->above)
156 if (tmp->type == PLAYER)
157 esrv_send_item (tmp, op);
158 }
159}
160
161/**
162 * Notify clients about a removed object. 132 * Notify clients about a removed object.
163 * 133 *
164 * @param op the object about to be removed from its environment; it must still 134 * @param op the object about to be removed from its environment; it must still
165 * be present in its environment 135 * be present in its environment
166 */ 136 */
571 *type = CFAPI_STRING; 541 *type = CFAPI_STRING;
572 542
573 switch (dirtype) 543 switch (dirtype)
574 { 544 {
575 case 0: 545 case 0:
576 return settings.mapdir; 546 return (char *)settings.mapdir;
577 break; 547 break;
578 548
579 case 1: 549 case 1:
580 return settings.uniquedir; 550 return (char *)settings.uniquedir;
581 break; 551 break;
582 552
583 case 2: 553 case 2:
584 return settings.tmpdir; 554 return (char *)settings.tmpdir;
585 break; 555 break;
586 556
587 case 3: 557 case 3:
588 return settings.confdir; 558 return (char *)settings.confdir;
589 break; 559 break;
590 560
591 case 4: 561 case 4:
592 return settings.localdir; 562 return (char *)settings.localdir;
593 break; 563 break;
594 564
595 case 5: 565 case 5:
596 return settings.playerdir; 566 return (char *)settings.playerdir;
597 break; 567 break;
598 568
599 case 6: 569 case 6:
600 return settings.datadir; 570 return (char *)settings.datadir;
601 break; 571 break;
602 } 572 }
603 573
604 *type = CFAPI_NONE; 574 *type = CFAPI_NONE;
605 return NULL; 575 return NULL;
919 owner = va_arg (args, object *); 889 owner = va_arg (args, object *);
920 890
921 va_end (args); 891 va_end (args);
922 892
923 *type = CFAPI_STRING; 893 *type = CFAPI_STRING;
924 return describe_item (op, owner); 894 return (char *)describe_item (op, owner);
925} 895}
926 896
927void * 897void *
928cfapi_object_drain (int *type, ...) 898cfapi_object_drain (int *type, ...)
929{ 899{
1127 object *op; 1097 object *op;
1128 sval = va_arg (args, char *); 1098 sval = va_arg (args, char *);
1129 1099
1130 op = get_archetype_by_object_name (sval); 1100 op = get_archetype_by_object_name (sval);
1131 1101
1132 if (strncmp (query_name (op), ARCH_SINGULARITY, ARCH_SINGULARITY_LEN) == 0) 1102 if (strcmp (query_name (op), ARCH_SINGULARITY) == 0)
1133 { 1103 {
1134 op->destroy (); 1104 op->destroy ();
1135 /* Try with archetype names... */ 1105 /* Try with archetype names... */
1136 op = get_archetype (sval); 1106 op = get_archetype (sval);
1137 if (strncmp (query_name (op), ARCH_SINGULARITY, ARCH_SINGULARITY_LEN) == 0) 1107 if (strcmp (query_name (op), ARCH_SINGULARITY) == 0)
1138 { 1108 {
1139 op->destroy (); 1109 op->destroy ();
1140 *type = CFAPI_NONE; 1110 *type = CFAPI_NONE;
1141 va_end (args); 1111 va_end (args);
1142 return NULL; 1112 return NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines