From 3b31e10e9ce959a1ac9a0a4a41a178161c001419 Mon Sep 17 00:00:00 2001 From: skyjake Date: Mon, 23 Jun 2003 08:04:44 +0000 Subject: [PATCH] Added Msg_SetOffset() --- doomsday/Include/net_msg.h | 1 + doomsday/Src/net_msg.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doomsday/Include/net_msg.h b/doomsday/Include/net_msg.h index 7becc2429d..831b257b9f 100644 --- a/doomsday/Include/net_msg.h +++ b/doomsday/Include/net_msg.h @@ -13,6 +13,7 @@ short Msg_ReadPackedShort(); int Msg_ReadLong(); void Msg_Read(void *dest, int len); int Msg_Offset(); +void Msg_SetOffset(int offset); int Msg_MemoryLeft(); boolean Msg_End(); diff --git a/doomsday/Src/net_msg.c b/doomsday/Src/net_msg.c index 3aa0536dbc..9306799f8b 100644 --- a/doomsday/Src/net_msg.c +++ b/doomsday/Src/net_msg.c @@ -136,17 +136,22 @@ void Msg_Read(void *dest, int len) netbuffer.cursor += len; } -int Msg_Offset() +int Msg_Offset(void) { return netbuffer.cursor - netbuffer.msg.data; } -int Msg_MemoryLeft() +void Msg_SetOffset(int offset) +{ + netbuffer.cursor = netbuffer.msg.data + offset; +} + +int Msg_MemoryLeft(void) { return NETBUFFER_MAXDATA - (netbuffer.cursor - netbuffer.msg.data); } -boolean Msg_End() +boolean Msg_End(void) { return (netbuffer.cursor-netbuffer.msg.data >= netbuffer.length); } \ No newline at end of file