--- deliantra/server/socket/lowlevel.C 2007/04/02 19:56:11 1.37 +++ deliantra/server/socket/lowlevel.C 2007/05/18 19:46:22 1.41 @@ -1,5 +1,5 @@ /* - * CrossFire, A Multiplayer game for X-windows + * CrossFire, A Multiplayer game * * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team * Copyright (C) 1992 Frank Tore Johansen @@ -192,17 +192,18 @@ {"command", PC(PlayerCmd) PF_PLAYING | PF_COMMAND0 }, {"examine", PC(ExamineCmd) PF_PLAYING }, + {"ex", PC(ExCmd) PF_PLAYING }, {"apply", PC(ApplyCmd) PF_PLAYING }, {"lookat", PC(LookAt) PF_PLAYING }, {"lock", PC(LockItem) PF_PLAYING }, {"mark", PC(MarkItem) PF_PLAYING }, {"move", PC(MoveCmd) PF_PLAYING }, - {"ext", PC(ExtCmd) 0 }, /* CF+ */ - {"mapredraw", PC(MapRedrawCmd) 0 }, /* Added: phil */ - {"mapinfo", PC(MapInfoCmd) 0 }, /* CF+ */ + {"ext", PC(ExtCmd) 0 }, // CF+ + {"mapredraw", PC(MapRedrawCmd) 0 }, + {"mapinfo", PC(MapInfoCmd) 0 }, // CF+ {"reply", SC(ReplyCmd) 0 }, - {"exti", SC(ExtiCmd) 0 }, /* CF+ */ + {"exti", SC(ExtiCmd) 0 }, // CF+ {"addme", SC(AddMeCmd) 0 }, {"askface", SC(AskFaceCmd) 0 }, {"requestinfo", SC(RequestInfo) 0 }, @@ -512,6 +513,22 @@ send_packet_printf ("drawinfo %d %s", flags, msg); } +void +client::send_msg (int color, const char *type, const char *msg) +{ + if (can_msg) + send_packet_printf ("msg %d %s %s", color, type, msg); + else if (color < 0) + return; // client cannot handle this + else if (strchr (msg, '<') || strchr (msg, '&')) + { + //TODO: should escape/modify to old syntax + send_packet_printf ("drawinfo %d %s", color, msg); + } + else + send_packet_printf ("drawinfo %d %s", color, msg); +} + /*********************************************************************** * * packet functions/utilities @@ -534,14 +551,14 @@ uint8 *p = buf + maxlen; uint32 val = v.val; + *--p = val & 0x7F; + while (val > 0x7F) { - *--p = (val & 0x7F) | 0x80; val >>= 7; + *--p = (val & 0x7F) | 0x80; } - *--p = val; - return *this << data (p, buf + maxlen - p); }