… | |
… | |
33 | */ |
33 | */ |
34 | |
34 | |
35 | |
35 | |
36 | #include <global.h> |
36 | #include <global.h> |
37 | #include <object.h> /* LOOK_OBJ */ |
37 | #include <object.h> /* LOOK_OBJ */ |
38 | #include <newclient.h> |
|
|
39 | #include <newserver.h> |
|
|
40 | #include <sproto.h> |
38 | #include <sproto.h> |
41 | |
39 | |
42 | /** This is the maximum number of bytes we expect any one item to take up */ |
40 | /** This is the maximum number of bytes we expect any one item to take up */ |
43 | #define MAXITEMLEN 300 |
41 | #define MAXITEMLEN 300 |
44 | |
42 | |
… | |
… | |
114 | /* Used in the send_look to put object head into packet |
112 | /* Used in the send_look to put object head into packet |
115 | * sl for socket ns. Need socket to know if we need to send |
113 | * sl for socket ns. Need socket to know if we need to send |
116 | * animation of face to the client. |
114 | * animation of face to the client. |
117 | */ |
115 | */ |
118 | static void |
116 | static void |
119 | add_object_to_socklist (client_socket &ns, packet &sl, object *head) |
117 | add_object_to_socklist (client &ns, packet &sl, object *head) |
120 | { |
118 | { |
121 | int flags, len, anim_speed; |
119 | int flags, len, anim_speed; |
122 | char item_n[MAX_BUF]; |
120 | char item_n[MAX_BUF]; |
123 | const char *item_p; |
121 | const char *item_p; |
124 | |
122 | |
… | |
… | |
640 | player_apply (pl->ob, op, 0, 0); |
638 | player_apply (pl->ob, op, 0, 0); |
641 | } |
639 | } |
642 | |
640 | |
643 | /** Client wants to apply some object. Lets do so. */ |
641 | /** Client wants to apply some object. Lets do so. */ |
644 | void |
642 | void |
645 | LockItem (uint8 *data, int len, player *pl) |
643 | LockItem (char *data, int len, player *pl) |
646 | { |
644 | { |
647 | int flag = data[0]; |
645 | int flag = data[0]; |
648 | tag_t tag = net_uint32 (data + 1); |
646 | tag_t tag = net_uint32 ((uint8 *)data + 1); |
649 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
647 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
650 | |
648 | |
651 | if (!op) |
649 | if (!op) |
652 | { |
650 | { |
653 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to lock/unlock"); |
651 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to lock/unlock"); |
… | |
… | |
662 | esrv_update_item (UPD_FLAGS, pl->ob, op); |
660 | esrv_update_item (UPD_FLAGS, pl->ob, op); |
663 | } |
661 | } |
664 | |
662 | |
665 | /** Client wants to apply some object. Lets do so. */ |
663 | /** Client wants to apply some object. Lets do so. */ |
666 | void |
664 | void |
667 | MarkItem (uint8 * data, int len, player *pl) |
665 | MarkItem (char *data, int len, player *pl) |
668 | { |
666 | { |
669 | tag_t tag = net_uint32 (data); |
667 | tag_t tag = net_uint32 ((uint8 *)data); |
670 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
668 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
671 | |
669 | |
672 | if (!op) |
670 | if (!op) |
673 | { |
671 | { |
674 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to mark"); |
672 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to mark"); |