… | |
… | |
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 | */ |
571 | void |
571 | void |
572 | AddMeCmd (char *buf, int len, client * ns) |
572 | AddMeCmd (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. */ |
820 | void |
822 | void |
821 | ReplyCmd (char *buf, int len, player *pl) |
823 | ReplyCmd (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]); |