Quote:
Originally Posted by KWo
Why exactly in ServerActivate - there is no need to allocate the memory for the string?
|
because the function "ServerActivate" is called each time at changelevel that lead to multiple memory allocation for strings, but the function "GameInit" is called only ONCE - and this is what you need.
[EDIT]
Excuse silly me....
I have forgotten that really it is impossible to call function "ALLOC_STRING" before the server wasn't loaded...
So fix is:
Remove code:
Code:
for (unsigned char stringIndex (0u); stringIndex < String_Total; ++stringIndex)
strings[stringIndex] = const_cast <char *> (STRING (ALLOC_STRING (strings[stringIndex])));
from GameDLLInit and put in to:
Code:
int Spawn (edict_t *pent)
{
{
static bool isFirstCall (true);
if (isFirstCall)
{
isFirstCall = false;
for (unsigned char stringIndex (0u); stringIndex < String_Total; ++stringIndex)
strings[stringIndex] = const_cast <char *> (STRING (ALLOC_STRING (strings[stringIndex])));
}
}
// ...
}
[/EDIT]