Thread: Unamed Bots
View Single Post
Re: Unamed Bots
Old
  (#23)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Unamed Bots - 28-04-2004

Oh I see. It occurs only when detailnames are off. I bet I know where this bug is, then.

Line 330 of bot.cpp

change
Code:
		 strncpy (c_name, bot_name, 32);
to
Code:
		 strncpy (c_name, szBotNames[name_index], 32);
My bad.

*edit* didn't see how late I was... sPlOrYgOn already fixed the bug. Congrats mate

*EDIT 2*
While I'm here, I've just caught another one on the fly.
Would you mind changing:
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);
}
to
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 (iPersonality == 0)
			c_name[2] = 'O';
		 else if (iPersonality == 1)
			c_name[2] = '*';
		 else
			c_name[2] = '0';
	  }
	  else
	  {
		 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);
}
this is to avoid bots called [POD][P0D][P*D]bot_name (80) (96) (77)" after several map changes.

*EDIT 3* ....and yet another one to display the new personality tags correctly. yee-haw.

*EDIT 4* I should test my bugfixes too before submitting them. :o This one compile correctly now.

It would probably be cleaner to set the clan tags directly in the BotCreateTab, BEFORE calling BotCreate(), and to define the bot personality there. I'll let this up to you



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 28-04-2004 at 11:07..
  
Reply With Quote