Big net::msg conversion

This commit is contained in:
iikorni
2026-08-30 12:38:12 -05:00
parent 216dd1aecd
commit df2b863d72
36 changed files with 2860 additions and 2764 deletions
+21 -21
View File
@@ -78,7 +78,7 @@ void CL_ClearState(void) {
// wipe the entire cl structure
memset(&cl, 0, sizeof(cl));
SZ_Clear(&cls.message);
cls.message = net::msg{};
// clear other arrays
memset(cl_dlights, 0, sizeof(cl_dlights));
@@ -117,10 +117,10 @@ void CL_Disconnect(void) {
CL_Stop_f();
console::debug("Sending clc_disconnect\n");
SZ_Clear(&cls.message);
MSG_WriteByte(&cls.message, clc_disconnect);
NET_SendUnreliableMessage(cls.netcon, &cls.message);
SZ_Clear(&cls.message);
cls.message.clear();
cls.message.write_byte(clc_disconnect);
NET_SendUnreliableMessage(cls.netcon, cls.message);
cls.message.clear();
NET_Close(cls.netcon);
cls.state = ca_disconnected;
@@ -165,7 +165,7 @@ void CL_EstablishConnection(const char *host) {
cls.demonum = -1; // not in the demo loop now
cls.state = ca_connected;
CL_ClearSignons(); // need all the signon messages before playing
MSG_WriteByte(&cls.message, clc_nop); // NAT Fix from ProQuake
cls.message.write_byte(clc_nop); // NAT Fix from ProQuake
}
/*
@@ -182,26 +182,26 @@ void CL_SignonReply(void) {
switch (cls.signon) {
case 1:
MSG_WriteByte(&cls.message, clc_stringcmd);
MSG_WriteString(&cls.message, "prespawn");
cls.message.write_byte(clc_stringcmd);
cls.message.write_string("prespawn");
break;
case 2:
MSG_WriteByte(&cls.message, clc_stringcmd);
MSG_WriteString(&cls.message, va("name \"%s\"\n", cl_name.string));
cls.message.write_byte(clc_stringcmd);
cls.message.write_string(va("name \"%s\"\n", cl_name.string));
MSG_WriteByte(&cls.message, clc_stringcmd);
MSG_WriteString(&cls.message,
cls.message.write_byte(clc_stringcmd);
cls.message.write_string(
va("color %i %i\n", ((int) cl_color.value) >> 4, ((int) cl_color.value) & 15));
MSG_WriteByte(&cls.message, clc_stringcmd);
cls.message.write_byte(clc_stringcmd);
sprintf(str, "spawn %s", cls.spawnparms);
MSG_WriteString(&cls.message, str);
cls.message.write_string(str);
break;
case 3:
MSG_WriteByte(&cls.message, clc_stringcmd);
MSG_WriteString(&cls.message, "begin");
cls.message.write_byte(clc_stringcmd);
cls.message.write_string("begin");
Cache_Report(); // print remaining memory
break;
@@ -666,12 +666,12 @@ void CL_SendCmd(void) {
}
if (cls.demoplayback) {
SZ_Clear(&cls.message);
cls.message.clear();
return;
}
// send the reliable message
if (!cls.message.cursize)
if (cls.message.empty())
return; // no message at all
if (!NET_CanSendMessage(cls.netcon)) {
@@ -679,10 +679,10 @@ void CL_SendCmd(void) {
return;
}
if (NET_SendMessage(cls.netcon, &cls.message) == -1)
if (NET_SendMessage(cls.netcon, cls.message) == -1)
Host_Error("CL_SendCmd: lost server connection");
SZ_Clear(&cls.message);
cls.message.clear();
}
/*
@@ -744,7 +744,7 @@ CL_Init
=================
*/
void CL_Init(void) {
SZ_Alloc(&cls.message, 1024);
cls.message = net::msg{};
CL_InitInput();
CL_InitTEnts();