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

Comparing deliantra/server/socket/lowlevel.C (file contents):
Revision 1.99 by root, Thu Jan 19 21:18:34 2017 UTC vs.
Revision 1.100 by root, Wed Nov 14 23:24:27 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * 6 *
6 * Deliantra is free software: you can redistribute it and/or modify it under 7 * Deliantra is free software: you can redistribute it and/or modify it under
7 * the terms of the Affero GNU General Public License as published by the 8 * the terms of the Affero GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your 9 * Free Software Foundation, either version 3 of the License, or (at your
646void 647void
647client::send_packet (const char *buf, int len) 648client::send_packet (const char *buf, int len)
648{ 649{
649 packet sl; 650 packet sl;
650 651
651 sl << data (buf, len); 652 sl << data_n (buf, len);
652 send_packet (sl); 653 send_packet (sl);
653} 654}
654 655
655void 656void
656client::send_packet (const char *buf) 657client::send_packet (const char *buf)
718 { 719 {
719 val >>= 7; 720 val >>= 7;
720 *--p = (val & 0x7F) | 0x80; 721 *--p = (val & 0x7F) | 0x80;
721 } 722 }
722 723
723 return *this << data (p, buf + maxlen - p); 724 return *this << data_n (p, buf + maxlen - p);
724} 725}
725 726
726packet &packet::operator <<(const data &v) 727packet &packet::operator <<(const data_n &v)
727{ 728{
728 if (room () < v.len) 729 if (room () < v.len)
729 reset (); 730 reset ();
730 else 731 else
731 { 732 {
740} 741}
741 742
742packet &packet::operator <<(const data8 &v) 743packet &packet::operator <<(const data8 &v)
743{ 744{
744 unsigned int len = min (v.len, 0x00FF); 745 unsigned int len = min (v.len, 0x00FF);
745 return *this << uint8 (len) << data (v.ptr, len); 746 return *this << uint8 (len) << data_n (v.ptr, len);
746} 747}
747 748
748packet &packet::operator <<(const data16 &v) 749packet &packet::operator <<(const data16 &v)
749{ 750{
750 unsigned int len = min (v.len, 0xFFFF); 751 unsigned int len = min (v.len, 0xFFFF);
751 return *this << uint16 (len) << data (v.ptr, len); 752 return *this << uint16 (len) << data_n (v.ptr, len);
752} 753}
753 754
754packet &packet::operator <<(const char *v) 755packet &packet::operator <<(const char *v)
755{ 756{
756 return *this << data (v, strlen (v ? v : 0)); 757 return *this << data_n (v, v ? strlen (v) : 0);
757} 758}
758 759
759void 760void
760packet::vprintf (const char *format, va_list ap) 761packet::vprintf (const char *format, va_list ap)
761{ 762{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines