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.24 by root, Thu Dec 14 04:30:32 2006 UTC vs.
Revision 1.31 by root, Thu Dec 21 23:37:06 2006 UTC

43static const hook_entry plug_hooks[NR_OF_HOOKS] = { 43static const hook_entry plug_hooks[NR_OF_HOOKS] = {
44 {cfapi_system_register_global_event, 1, "cfapi_system_register_global_event"}, 44 {cfapi_system_register_global_event, 1, "cfapi_system_register_global_event"},
45 {cfapi_system_unregister_global_event, 3, "cfapi_system_unregister_global_event"}, 45 {cfapi_system_unregister_global_event, 3, "cfapi_system_unregister_global_event"},
46 {cfapi_system_check_path, 4, "cfapi_system_check_path"}, 46 {cfapi_system_check_path, 4, "cfapi_system_check_path"},
47 {NULL, 5, "cfapi_system_re_cmp"}, 47 {NULL, 5, "cfapi_system_re_cmp"},
48 {cfapi_system_strdup_local, 6, "cfapi_system_strdup_local"}, 48 {cfapi_system_strdup, 6, "cfapi_system_strdup"},
49 {cfapi_system_directory, 7, "cfapi_system_directory"}, 49 {cfapi_system_directory, 7, "cfapi_system_directory"},
50 {cfapi_system_find_animation, 8, "cfapi_system_find_animation"}, 50 {cfapi_system_find_animation, 8, "cfapi_system_find_animation"},
51 {cfapi_object_clean_object, 9, "cfapi_object_clean_object"}, 51 {cfapi_object_clean_object, 9, "cfapi_object_clean_object"},
52 {cfapi_object_on_same_map, 10, "cfapi_object_on_same_map"}, 52 {cfapi_object_on_same_map, 10, "cfapi_object_on_same_map"},
53 {cfapi_object_get_key, 11, "cfapi_object_get_key"}, 53 {cfapi_object_get_key, 11, "cfapi_object_get_key"},
132send_changed_object (object *op) 132send_changed_object (object *op)
133{ 133{
134 object *tmp; 134 object *tmp;
135 player *pl; 135 player *pl;
136 136
137 if (op->env != NULL) 137 if (op->env)
138 { 138 {
139 tmp = is_player_inv (op->env); 139 tmp = op->in_player ();
140
140 if (!tmp) 141 if (!tmp)
141 { 142 {
142 for (pl = first_player; pl; pl = pl->next) 143 for (pl = first_player; pl; pl = pl->next)
143 if (pl->ob->container == op->env) 144 if (pl->ob->container == op->env)
144 break; 145 break;
146
145 if (pl) 147 if (pl)
146 tmp = pl->ob; 148 tmp = pl->ob;
147 else 149 else
148 tmp = NULL; 150 tmp = NULL;
149 } 151 }
152
150 if (tmp) 153 if (tmp)
151 esrv_send_item (tmp, op); 154 esrv_send_item (tmp, op);
152 } 155 }
153 else 156 else
154 { 157 {
174 { 177 {
175 /* no action necessary: remove_ob() notifies the client */ 178 /* no action necessary: remove_ob() notifies the client */
176 return; 179 return;
177 } 180 }
178 181
179 tmp = is_player_inv (op->env); 182 tmp = op->in_player ();
180 if (!tmp) 183 if (!tmp)
181 { 184 {
182 for (pl = first_player; pl; pl = pl->next) 185 for (pl = first_player; pl; pl = pl->next)
183 if (pl->ob->container == op->env) 186 if (pl->ob->container == op->env)
184 break; 187 break;
482 *type = CFAPI_INT; 485 *type = CFAPI_INT;
483 return &rv; 486 return &rv;
484} 487}
485 488
486void * 489void *
487cfapi_system_strdup_local (int *type, ...) 490cfapi_system_strdup (int *type, ...)
488{ 491{
489 va_list args; 492 va_list args;
490 char *txt; 493 char *txt;
491 494
492 va_start (args, type); 495 va_start (args, type);
493 txt = va_arg (args, char *); 496 txt = va_arg (args, char *);
494 497
495 va_end (args); 498 va_end (args);
496 *type = CFAPI_STRING; 499 *type = CFAPI_STRING;
497 return strdup_local (txt); 500 return strdup (txt);
498} 501}
499 502
500void * 503void *
501cfapi_system_register_global_event (int *type, ...) 504cfapi_system_register_global_event (int *type, ...)
502{ 505{
1032 1035
1033 map = va_arg (args, maptile *); 1036 map = va_arg (args, maptile *);
1034 x = va_arg (args, int); 1037 x = va_arg (args, int);
1035 y = va_arg (args, int); 1038 y = va_arg (args, int);
1036 1039
1037 update_position (map, x, y); 1040 map->at (x, y).flags_ |= P_NEED_UPDATE;
1041
1038 va_end (args); 1042 va_end (args);
1039 *type = CFAPI_NONE; 1043 *type = CFAPI_NONE;
1040 return NULL; 1044 return NULL;
1041} 1045}
1042 1046
1090 x = va_arg (args, int); 1094 x = va_arg (args, int);
1091 y = va_arg (args, int); 1095 y = va_arg (args, int);
1092 1096
1093 va_end (args); 1097 va_end (args);
1094 1098
1095 rv = get_map_ob (map, x, y); 1099 rv = GET_MAP_OB (map, x, y);
1096 *type = CFAPI_POBJECT; 1100 *type = CFAPI_POBJECT;
1097 return rv; 1101 return rv;
1098} 1102}
1099 1103
1100void * 1104void *
1846 rv = &ri; 1850 rv = &ri;
1847 *type = CFAPI_INT; 1851 *type = CFAPI_INT;
1848 break; 1852 break;
1849 1853
1850 case CFAPI_PLAYER_PROP_IP: 1854 case CFAPI_PLAYER_PROP_IP:
1851 rv = op->contr->socket->host; 1855 rv = op->contr->ns->host;
1852 *type = CFAPI_STRING; 1856 *type = CFAPI_STRING;
1853 break; 1857 break;
1854 1858
1855 case CFAPI_PLAYER_PROP_MARKED_ITEM: 1859 case CFAPI_PLAYER_PROP_MARKED_ITEM:
1856 rv = find_marked_object (op); 1860 rv = find_marked_object (op);
1971 player *pl; 1975 player *pl;
1972 1976
1973 op->nrof = iarg; 1977 op->nrof = iarg;
1974 if (op->env != NULL) 1978 if (op->env != NULL)
1975 { 1979 {
1976 tmp = is_player_inv (op->env); 1980 tmp = op->in_player ();
1977 if (!tmp) 1981 if (!tmp)
1978 { 1982 {
1979 for (pl = first_player; pl; pl = pl->next) 1983 for (pl = first_player; pl; pl = pl->next)
1980 if (pl->ob->container == op->env) 1984 if (pl->ob->container == op->env)
1981 break; 1985 break;
2132 player *pl; 2136 player *pl;
2133 2137
2134 op->weight = iarg; 2138 op->weight = iarg;
2135 if (op->env != NULL) 2139 if (op->env != NULL)
2136 { 2140 {
2137 tmp = is_player_inv (op->env); 2141 tmp = op->in_player ();
2138 if (!tmp) 2142 if (!tmp)
2139 { 2143 {
2140 for (pl = first_player; pl; pl = pl->next) 2144 for (pl = first_player; pl; pl = pl->next)
2141 if (pl->ob->container == op->env) 2145 if (pl->ob->container == op->env)
2142 break; 2146 break;
2694 break; 2698 break;
2695 2699
2696 case 3: 2700 case 3:
2697 op = va_arg (args, object *); 2701 op = va_arg (args, object *);
2698 2702
2699 rv = is_player_inv (op); 2703 rv = op->in_player ();
2700 break; 2704 break;
2701 2705
2702 default: 2706 default:
2703 rv = NULL; 2707 rv = NULL;
2704 *type = CFAPI_NONE; 2708 *type = CFAPI_NONE;
3310 drop (author, op); 3314 drop (author, op);
3311 3315
3312 if (author->type == PLAYER) 3316 if (author->type == PLAYER)
3313 { 3317 {
3314 author->contr->count = 0; 3318 author->contr->count = 0;
3315 author->contr->socket->update_look = 1; 3319 author->contr->ns->floorbox_update ();
3316 } 3320 }
3317 3321
3318 *type = CFAPI_NONE; 3322 *type = CFAPI_NONE;
3319 return NULL; 3323 return NULL;
3320} 3324}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines