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.31 by root, Thu Dec 21 23:37:06 2006 UTC vs.
Revision 1.34 by root, Sat Dec 23 13:56:25 2006 UTC

130 */ 130 */
131static void 131static void
132send_changed_object (object *op) 132send_changed_object (object *op)
133{ 133{
134 object *tmp; 134 object *tmp;
135 player *pl;
136 135
137 if (op->env) 136 if (op->env)
138 { 137 {
139 tmp = op->in_player (); 138 tmp = op->in_player ();
140 139
141 if (!tmp) 140 if (!tmp)
142 { 141 {
143 for (pl = first_player; pl; pl = pl->next) 142 for_all_players (pl)
144 if (pl->ob->container == op->env) 143 if (pl->ob->container == op->env)
144 {
145 tmp = pl->ob;
145 break; 146 break;
146 147 }
147 if (pl)
148 tmp = pl->ob;
149 else
150 tmp = NULL;
151 } 148 }
152 149
153 if (tmp) 150 if (tmp)
154 esrv_send_item (tmp, op); 151 esrv_send_item (tmp, op);
155 } 152 }
169 */ 166 */
170static void 167static void
171send_removed_object (object *op) 168send_removed_object (object *op)
172{ 169{
173 object *tmp; 170 object *tmp;
174 player *pl;
175 171
176 if (op->env == NULL) 172 if (op->env == NULL)
177 { 173 {
178 /* no action necessary: remove_ob() notifies the client */ 174 /* no action necessary: remove_ob() notifies the client */
179 return; 175 return;
180 } 176 }
181 177
182 tmp = op->in_player (); 178 tmp = op->in_player ();
183 if (!tmp) 179 if (!tmp)
184 { 180 {
185 for (pl = first_player; pl; pl = pl->next) 181 for_all_players (pl)
186 if (pl->ob->container == op->env) 182 if (pl->ob->container == op->env)
183 {
184 tmp = pl->ob;
187 break; 185 break;
188 if (pl) 186 }
189 tmp = pl->ob;
190 else
191 tmp = NULL;
192 } 187 }
188
193 if (tmp) 189 if (tmp)
194 esrv_del_item (tmp->contr, op->count); 190 esrv_del_item (tmp->contr, op->count);
195} 191}
196 192
197extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr); 193extern "C" int cfperl_initPlugin (const char *iversion, f_plug_api gethooksptr);
1970 if (op->nrof > (uint32) iarg) 1966 if (op->nrof > (uint32) iarg)
1971 decrease_ob_nr (op, op->nrof - iarg); 1967 decrease_ob_nr (op, op->nrof - iarg);
1972 else if (op->nrof < (uint32) iarg) 1968 else if (op->nrof < (uint32) iarg)
1973 { 1969 {
1974 object *tmp; 1970 object *tmp;
1975 player *pl;
1976 1971
1977 op->nrof = iarg; 1972 op->nrof = iarg;
1978 if (op->env != NULL) 1973 if (op->env != NULL)
1979 { 1974 {
1980 tmp = op->in_player (); 1975 tmp = op->in_player ();
1981 if (!tmp) 1976 if (!tmp)
1982 { 1977 {
1983 for (pl = first_player; pl; pl = pl->next) 1978 for_all_players (pl)
1984 if (pl->ob->container == op->env) 1979 if (pl->ob->container == op->env)
1980 {
1981 tmp = pl->ob;
1985 break; 1982 break;
1986 if (pl)
1987 tmp = pl->ob;
1988 else 1983 }
1989 tmp = NULL;
1990 } 1984 }
1991 else 1985 else
1992 { 1986 {
1993 sum_weight (tmp); 1987 sum_weight (tmp);
1994 fix_player (tmp); 1988 tmp->update_stats ();
1995 } 1989 }
1996 if (tmp) 1990 if (tmp)
1997 esrv_send_item (tmp, op); 1991 esrv_send_item (tmp, op);
1998 } 1992 }
1999 else 1993 else
2131 iarg = va_arg (args, int); 2125 iarg = va_arg (args, int);
2132 2126
2133 if (op->weight != iarg) 2127 if (op->weight != iarg)
2134 { 2128 {
2135 object *tmp; 2129 object *tmp;
2136 player *pl;
2137 2130
2138 op->weight = iarg; 2131 op->weight = iarg;
2139 if (op->env != NULL) 2132 if (op->env != NULL)
2140 { 2133 {
2141 tmp = op->in_player (); 2134 tmp = op->in_player ();
2142 if (!tmp) 2135 if (!tmp)
2143 { 2136 {
2144 for (pl = first_player; pl; pl = pl->next) 2137 for_all_players (pl)
2145 if (pl->ob->container == op->env) 2138 if (pl->ob->container == op->env)
2139 {
2140 tmp = pl->ob;
2146 break; 2141 break;
2147 if (pl)
2148 tmp = pl->ob;
2149 else 2142 }
2150 tmp = NULL;
2151 } 2143 }
2152 else 2144 else
2153 { 2145 {
2154 sum_weight (tmp); 2146 sum_weight (tmp);
2155 fix_player (tmp); 2147 tmp->update_stats ();
2156 } 2148 }
2157 if (tmp) 2149 if (tmp)
2158 esrv_send_item (tmp, op); 2150 esrv_send_item (tmp, op);
2159 } 2151 }
2160 else 2152 else
2520} 2512}
2521 2513
2522void * 2514void *
2523cfapi_object_drain (int *type, ...) 2515cfapi_object_drain (int *type, ...)
2524{ 2516{
2525 va_list args; 2517 abort ();
2518}
2526 2519
2520void *
2521cfapi_object_fix (int *type, ...)
2522{
2523 va_list args;
2527 object *op; 2524 object *op;
2528 int ds;
2529 2525
2530 va_start (args, type); 2526 va_start (args, type);
2531 2527
2532 op = va_arg (args, object *); 2528 op = va_arg (args, object *);
2533 ds = va_arg (args, int);
2534 2529
2535 va_end (args); 2530 va_end (args);
2536 2531
2537 drain_specific_stat (op, ds); 2532 op->update_stats ();
2538
2539 *type = CFAPI_NONE;
2540 return NULL;
2541}
2542
2543void *
2544cfapi_object_fix (int *type, ...)
2545{
2546 va_list args;
2547 object *op;
2548
2549 va_start (args, type);
2550
2551 op = va_arg (args, object *);
2552
2553 va_end (args);
2554
2555 fix_player (op);
2556 2533
2557 *type = CFAPI_NONE; 2534 *type = CFAPI_NONE;
2558 return NULL; 2535 return NULL;
2559} 2536}
2560 2537
3557 3534
3558 case CFAPI_PARTY_PROP_PLAYER: 3535 case CFAPI_PARTY_PROP_PLAYER:
3559 *type = CFAPI_PPLAYER; 3536 *type = CFAPI_PPLAYER;
3560 obarg = va_arg (args, object *); 3537 obarg = va_arg (args, object *);
3561 3538
3562 pl = (obarg ? obarg->contr : first_player); 3539 pl = (obarg ? (player *)obarg->contr : first_player);
3563 rv = NULL; 3540 rv = NULL;
3564 for (; pl != NULL; pl = pl->next) 3541 for (; pl != NULL; pl = pl->next)
3565 if (pl->ob->contr->party == party) 3542 if (pl->ob->contr->party == party)
3566 { 3543 {
3567 rv = (void *) pl; 3544 rv = (void *) pl;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines