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

Comparing deliantra/server/socket/request.C (file contents):
Revision 1.47 by root, Wed Dec 20 01:19:11 2006 UTC vs.
Revision 1.49 by root, Thu Dec 21 06:12:37 2006 UTC

569 * it either has to be here or init_sockets needs to be exported. 569 * it either has to be here or init_sockets needs to be exported.
570 */ 570 */
571void 571void
572AddMeCmd (char *buf, int len, client * ns) 572AddMeCmd (char *buf, int len, client * ns)
573{ 573{
574 if (INVOKE_CLIENT (ADDME, ns))
575 return;
576
574 if (ns->status != Ns_Add || add_player (ns)) 577 if (ns->pl || add_player (ns))
575 ns->send_packet ("addme_failed"); 578 ns->send_packet ("addme_failed");
576 else 579 else
577 ns->send_packet ("addme_success"); 580 ns->send_packet ("addme_success");
578} 581}
579 582
813 packet sl ("comc"); 816 packet sl ("comc");
814 sl << uint16 (cmdid) << uint32 (time); 817 sl << uint16 (cmdid) << uint32 (time);
815 pl->socket->send_packet (sl); 818 pl->socket->send_packet (sl);
816} 819}
817 820
818
819/** This is a reply to a previous query. */ 821/** This is a reply to a previous query. */
820void 822void
821ReplyCmd (char *buf, int len, player *pl) 823ReplyCmd (char *buf, int len, client *ns)
822{ 824{
825 if (!ns->pl)
826 return; //TODO: depends on the exact reply we are after
827 //TODO: but right now, we always have a ns->pl
828
829 player *pl = ns->pl;
830
823 /* This is to synthesize how the data would be stored if it 831 /* This is to synthesize how the data would be stored if it
824 * was normally entered. A bit of a hack, and should be cleaned up 832 * was normally entered. A bit of a hack, and should be cleaned up
825 * once all the X11 code is removed from the server. 833 * once all the X11 code is removed from the server.
826 * 834 *
827 * We pass 13 to many of the functions because this way they 835 * We pass 13 to many of the functions because this way they
848 case ST_ROLL_STAT: 856 case ST_ROLL_STAT:
849 key_roll_stat (pl->ob, buf[0]); 857 key_roll_stat (pl->ob, buf[0]);
850 break; 858 break;
851 859
852 case ST_CHANGE_CLASS: 860 case ST_CHANGE_CLASS:
853
854 key_change_class (pl->ob, buf[0]); 861 key_change_class (pl->ob, buf[0]);
855 break; 862 break;
856 863
857 case ST_CONFIRM_QUIT: 864 case ST_CONFIRM_QUIT:
858 key_confirm_quit (pl->ob, buf[0]); 865 key_confirm_quit (pl->ob, buf[0]);
1670 for (y = pl->y - socket.mapy / 2; y < max_y; y++, ay++) 1677 for (y = pl->y - socket.mapy / 2; y < max_y; y++, ay++)
1671 { 1678 {
1672 ax = 0; 1679 ax = 0;
1673 for (x = pl->x - socket.mapx / 2; x < max_x; x++, ax++) 1680 for (x = pl->x - socket.mapx / 2; x < max_x; x++, ax++)
1674 { 1681 {
1675
1676 emask = mask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4; 1682 emask = mask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4;
1677 1683
1678 /* If this space is out of the normal viewable area, we only check 1684 /* If this space is out of the normal viewable area, we only check
1679 * the heads value ax or ay will only be greater than what 1685 * the heads value ax or ay will only be greater than what
1680 * the client wants if using the map1a command - this is because 1686 * the client wants if using the map1a command - this is because
2011 return; 2017 return;
2012 2018
2013 memset (&newmap, 0, sizeof (struct Map)); 2019 memset (&newmap, 0, sizeof (struct Map));
2014 2020
2015 for (j = (pl->y - pl->contr->socket->mapy / 2); j < (pl->y + (pl->contr->socket->mapy + 1) / 2); j++) 2021 for (j = (pl->y - pl->contr->socket->mapy / 2); j < (pl->y + (pl->contr->socket->mapy + 1) / 2); j++)
2016 {
2017 for (i = (pl->x - pl->contr->socket->mapx / 2); i < (pl->x + (pl->contr->socket->mapx + 1) / 2); i++) 2022 for (i = (pl->x - pl->contr->socket->mapx / 2); i < (pl->x + (pl->contr->socket->mapx + 1) / 2); i++)
2018 { 2023 {
2019 ax = i; 2024 ax = i;
2020 ay = j; 2025 ay = j;
2021 m = pm; 2026 m = pm;
2022 mflags = get_map_flags (m, &m, ax, ay, &ax, &ay); 2027 mflags = get_map_flags (m, &m, ax, ay, &ax, &ay);
2023 2028
2024 if (mflags & P_OUT_OF_MAP) 2029 if (mflags & P_OUT_OF_MAP)
2025 continue; 2030 continue;
2026 2031
2027 if (mflags & P_NEED_UPDATE)
2028 update_position (m, ax, ay);
2029
2030 /* If a map is visible to the player, we don't want to swap it out 2032 /* If a map is visible to the player, we don't want to swap it out
2031 * just to reload it. This should really call something like 2033 * just to reload it. This should really call something like
2032 * swap_map, but this is much more efficient and 'good enough' 2034 * swap_map, but this is much more efficient and 'good enough'
2033 */ 2035 */
2034 if (mflags & P_NEW_MAP) 2036 if (mflags & P_NEW_MAP)
2035 m->timeout = 50; 2037 m->timeout = 50;
2036 } 2038 }
2037 } 2039
2038 /* do LOS after calls to update_position */ 2040 /* do LOS after calls to update_position */
2039 if (pl->contr->do_los) 2041 if (pl->contr->do_los)
2040 { 2042 {
2041 update_los (pl); 2043 update_los (pl);
2042 pl->contr->do_los = 0; 2044 pl->contr->do_los = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines