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.36 by root, Mon Dec 25 14:54:44 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);
913 va_end (args); 909 va_end (args);
914 return &rv; 910 return &rv;
915 break; 911 break;
916 912
917 case CFAPI_MAP_PROP_WPARTX: 913 case CFAPI_MAP_PROP_WPARTX:
918 map = va_arg (args, maptile *); 914 abort ();
919
920 rv = map->wpartx;
921 *type = CFAPI_INT;
922 va_end (args);
923 return &rv;
924 break;
925
926 case CFAPI_MAP_PROP_WPARTY: 915 case CFAPI_MAP_PROP_WPARTY:
927 map = va_arg (args, maptile *); 916 abort ();
928
929 rv = map->wparty;
930 *type = CFAPI_INT;
931 va_end (args);
932 return &rv;
933 break;
934 917
935 case CFAPI_MAP_PROP_MESSAGE: 918 case CFAPI_MAP_PROP_MESSAGE:
936 map = va_arg (args, maptile *); 919 map = va_arg (args, maptile *);
937 920
938 buf = map->msg; 921 buf = map->msg;
1970 if (op->nrof > (uint32) iarg) 1953 if (op->nrof > (uint32) iarg)
1971 decrease_ob_nr (op, op->nrof - iarg); 1954 decrease_ob_nr (op, op->nrof - iarg);
1972 else if (op->nrof < (uint32) iarg) 1955 else if (op->nrof < (uint32) iarg)
1973 { 1956 {
1974 object *tmp; 1957 object *tmp;
1975 player *pl;
1976 1958
1977 op->nrof = iarg; 1959 op->nrof = iarg;
1978 if (op->env != NULL) 1960 if (op->env != NULL)
1979 { 1961 {
1980 tmp = op->in_player (); 1962 tmp = op->in_player ();
1981 if (!tmp) 1963 if (!tmp)
1982 { 1964 {
1983 for (pl = first_player; pl; pl = pl->next) 1965 for_all_players (pl)
1984 if (pl->ob->container == op->env) 1966 if (pl->ob->container == op->env)
1967 {
1968 tmp = pl->ob;
1985 break; 1969 break;
1986 if (pl)
1987 tmp = pl->ob;
1988 else 1970 }
1989 tmp = NULL;
1990 } 1971 }
1991 else 1972 else
1992 { 1973 {
1993 sum_weight (tmp); 1974 sum_weight (tmp);
1994 fix_player (tmp); 1975 tmp->update_stats ();
1995 } 1976 }
1996 if (tmp) 1977 if (tmp)
1997 esrv_send_item (tmp, op); 1978 esrv_send_item (tmp, op);
1998 } 1979 }
1999 else 1980 else
2131 iarg = va_arg (args, int); 2112 iarg = va_arg (args, int);
2132 2113
2133 if (op->weight != iarg) 2114 if (op->weight != iarg)
2134 { 2115 {
2135 object *tmp; 2116 object *tmp;
2136 player *pl;
2137 2117
2138 op->weight = iarg; 2118 op->weight = iarg;
2139 if (op->env != NULL) 2119 if (op->env != NULL)
2140 { 2120 {
2141 tmp = op->in_player (); 2121 tmp = op->in_player ();
2142 if (!tmp) 2122 if (!tmp)
2143 { 2123 {
2144 for (pl = first_player; pl; pl = pl->next) 2124 for_all_players (pl)
2145 if (pl->ob->container == op->env) 2125 if (pl->ob->container == op->env)
2126 {
2127 tmp = pl->ob;
2146 break; 2128 break;
2147 if (pl)
2148 tmp = pl->ob;
2149 else 2129 }
2150 tmp = NULL;
2151 } 2130 }
2152 else 2131 else
2153 { 2132 {
2154 sum_weight (tmp); 2133 sum_weight (tmp);
2155 fix_player (tmp); 2134 tmp->update_stats ();
2156 } 2135 }
2157 if (tmp) 2136 if (tmp)
2158 esrv_send_item (tmp, op); 2137 esrv_send_item (tmp, op);
2159 } 2138 }
2160 else 2139 else
2520} 2499}
2521 2500
2522void * 2501void *
2523cfapi_object_drain (int *type, ...) 2502cfapi_object_drain (int *type, ...)
2524{ 2503{
2525 va_list args; 2504 abort ();
2505}
2526 2506
2507void *
2508cfapi_object_fix (int *type, ...)
2509{
2510 va_list args;
2527 object *op; 2511 object *op;
2528 int ds;
2529 2512
2530 va_start (args, type); 2513 va_start (args, type);
2531 2514
2532 op = va_arg (args, object *); 2515 op = va_arg (args, object *);
2533 ds = va_arg (args, int);
2534 2516
2535 va_end (args); 2517 va_end (args);
2536 2518
2537 drain_specific_stat (op, ds); 2519 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 2520
2557 *type = CFAPI_NONE; 2521 *type = CFAPI_NONE;
2558 return NULL; 2522 return NULL;
2559} 2523}
2560 2524
2904} 2868}
2905 2869
2906void * 2870void *
2907cfapi_object_clear (int *type, ...) 2871cfapi_object_clear (int *type, ...)
2908{ 2872{
2909 va_list args; 2873 abort ();
2910 object *op;
2911
2912 va_start (args, type);
2913
2914 op = va_arg (args, object *);
2915
2916 va_end (args);
2917
2918 op->clear ();
2919 *type = CFAPI_NONE;
2920 return NULL;
2921} 2874}
2922 2875
2923void * 2876void *
2924cfapi_object_reset (int *type, ...) 2877cfapi_object_reset (int *type, ...)
2925{ 2878{
2958} 2911}
2959 2912
2960void * 2913void *
2961cfapi_object_clean_object (int *type, ...) 2914cfapi_object_clean_object (int *type, ...)
2962{ 2915{
2963 va_list args; 2916 abort ();
2964 object *op;
2965
2966 va_start (args, type);
2967 op = va_arg (args, object *);
2968
2969 clean_object (op);
2970 va_end (args);
2971 *type = CFAPI_NONE;
2972 return NULL;
2973} 2917}
2974 2918
2975void * 2919void *
2976cfapi_object_on_same_map (int *type, ...) 2920cfapi_object_on_same_map (int *type, ...)
2977{ 2921{
3557 3501
3558 case CFAPI_PARTY_PROP_PLAYER: 3502 case CFAPI_PARTY_PROP_PLAYER:
3559 *type = CFAPI_PPLAYER; 3503 *type = CFAPI_PPLAYER;
3560 obarg = va_arg (args, object *); 3504 obarg = va_arg (args, object *);
3561 3505
3562 pl = (obarg ? obarg->contr : first_player); 3506 pl = (obarg ? (player *)obarg->contr : first_player);
3563 rv = NULL; 3507 rv = NULL;
3564 for (; pl != NULL; pl = pl->next) 3508 for (; pl != NULL; pl = pl->next)
3565 if (pl->ob->contr->party == party) 3509 if (pl->ob->contr->party == party)
3566 { 3510 {
3567 rv = (void *) pl; 3511 rv = (void *) pl;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines