- fixed memory leak in DEM_NETEVENT.

- added handling for DEM_NETEVENT to SkipCommand.
- keep the data of DEM_NETEVENT at a fixed length to simplify handling.
This commit is contained in:
Christoph Oelckers 2017-02-27 02:31:19 +01:00
parent 3a5124e10e
commit 720e05d131
2 changed files with 8 additions and 3 deletions

View file

@ -2666,12 +2666,13 @@ void Net_DoCommand (int type, BYTE **stream, int player)
case DEM_NETEVENT: case DEM_NETEVENT:
{ {
FString ename = ReadString(stream); const char *ename = ReadString(stream);
int argn = ReadByte(stream); int argn = ReadByte(stream);
int arg[3] = { 0, 0, 0 }; int arg[3] = { 0, 0, 0 };
for (int i = 0; i < argn; i++) for (int i = 0; i < 3; i++)
arg[i] = ReadLong(stream); arg[i] = ReadLong(stream);
E_Console(player, ename, arg[0], arg[1], arg[2]); E_Console(player, ename, arg[0], arg[1], arg[2]);
delete[] ename;
} }
break; break;
@ -2721,6 +2722,10 @@ void Net_SkipCommand (int type, BYTE **stream)
skip = strlen ((char *)(*stream)) + 5; skip = strlen ((char *)(*stream)) + 5;
break; break;
case DEM_NETEVENT:
skip = strlen((char *)(*stream)) + 13;
break;
case DEM_SUMMON2: case DEM_SUMMON2:
case DEM_SUMMONFRIEND2: case DEM_SUMMONFRIEND2:
case DEM_SUMMONFOE2: case DEM_SUMMONFOE2:

View file

@ -1139,7 +1139,7 @@ CCMD(netevent)
Net_WriteByte(DEM_NETEVENT); Net_WriteByte(DEM_NETEVENT);
Net_WriteString(argv[1]); Net_WriteString(argv[1]);
Net_WriteByte(argn); Net_WriteByte(argn);
for (int i = 0; i < argn; i++) for (int i = 0; i < 3; i++)
Net_WriteLong(arg[i]); Net_WriteLong(arg[i]);
} }
} }