.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Bug Reports (http://forums.bots-united.com/forumdisplay.php?f=49)
-   -   PB crashes after typing "meta unload podbot" (http://forums.bots-united.com/showthread.php?t=9020)

Immortal_BLG 13-03-2012 01:56

Re: PB crashes after typing "meta unload podbot"
 
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]


All times are GMT +2. The time now is 06:26.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.