.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Releases, Installers, Docs & Coding (http://forums.bots-united.com/forumdisplay.php?f=48)
-   -   bug in bot naming (http://forums.bots-united.com/showthread.php?t=2210)

Krush 06-07-2004 02:51

bug in bot naming
 
Don't know if anyone else has brought this up but the current way names are being handled does not work if a bot remains on server during and after a map change.

inside
Code:

void BotCreate (int bot_skill, int bot_team, int bot_class, const char *bot_name)
the else part where they are supplying the name
Code:

  // a name has been given
  else
  {
      // If Detailnames are on, attach Clan Tag
      if (g_bDetailNames)
      {
        if (iPersonality == 0)
            sprintf (c_name, "[POD]%s (%d)", bot_name, skill);
        else if (iPersonality == 1)
            sprintf (c_name, "[P*D]%s (%d)", bot_name, skill);
        else
            sprintf (c_name, "[P0D]%s (%d)", bot_name, skill);
      }
      else
        strncpy (c_name, bot_name, 32);
  }

has a bug cause in the case i describe the name already has the tag and skill on it

so for example say the name that we start with is "Bot"
first time through it makes it "[POD]Bot (54)"
but when the map change occurs you end up with "[POD][POD]Bot (54) (54)"
and the next map change "[POD][POD][POD]Bot (54) (54) (54)"

you get my point. this goes on until the name is so big the game crashes on server change.

a quick fix is to remove bots before the change. but a easier thing is to change that code up there to this:
Code:

  else
  {
      // If Detailnames are on, attach Clan Tag
      if (g_bDetailNames)
      {
        if (iPersonality == 0)
            sprintf (c_name, "%s", bot_name);
        else if (iPersonality == 1)
            sprintf (c_name, "%s", bot_name);
        else
            sprintf (c_name, "%s", bot_name);
      }
      else
        strncpy (c_name, bot_name, 32);
  }

if anyone has a better idea let me know

sPlOrYgOn 06-07-2004 04:14

Re: bug in bot naming
 
thats an old bug.
what version do you have?
here's how it was fixed.
Code:

  // a name has been given
  else
  {
      // If Detailnames are on, see if we NEED to attach Clan Tag
      if (g_bDetailNames)
      {
        if ((strstr (bot_name, "[POD]") != NULL)
            || (strstr (bot_name, "[P*D]") != NULL)
            || (strstr (bot_name, "[P0D]") != NULL))
        {
            strncpy (c_name, bot_name, 32);

            if (bot_personality == 0)
              c_name[2] = 'O';
            else if (bot_personality == 1)
              c_name[2] = '*';
            else
              c_name[2] = '0';
        }
        else
        {
            if (bot_personality == 0)
              snprintf (c_name, 32, "[POD]%s (%d)", bot_name, skill);
            else if (bot_personality == 1)
              snprintf (c_name, 32, "[P*D]%s (%d)", bot_name, skill);
            else
              snprintf (c_name, 32, "[P0D]%s (%d)", bot_name, skill);
        }
      }
      else
        strncpy (c_name, bot_name, 32);


Krush 06-07-2004 05:06

Re: bug in bot naming
 
Not sure what version of the code i got I got it off the http://www.tnib.de/podbot/


All times are GMT +2. The time now is 12:21.

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