View Single Post
Re: YaPB 1.0.0.0 modification problem
Old
  (#3)
Serious Sam
Member
 
Serious Sam's Avatar
 
Status: Offline
Posts: 33
Join Date: Sep 2009
Location: Bulgaria
Default Re: YaPB 1.0.0.0 modification problem - 18-09-2009

Ok, but, even if this is possible, I cant quite get it right.
In function "void CBaseBot::BuyStuff()" that is in bot_ai.cpp after the line
Code:
int* ptrWeaponTab = ptrWeaponPrefs[m_ucPersonality] + NUM_WEAPONS;
I added
Code:
int i;
   char *pszStart;
   char *pszEnd;
   switch (m_ucPersonality)
   {
        case PERSONALITY_NORMAL:
            pszStart = (char *)CVAR_GET_STRING("sb_norwepprefs");
            for (i = 0; i < NUM_WEAPONS; i++)
            {
                 pszEnd = strchr(pszStart, ',');
                 *ptrWeaponTab++ = atoi(pszStart);
                 pszStart = pszEnd + 1;
            }
            break;

        case PERSONALITY_AGRESSIVE:
            pszStart = (char *)CVAR_GET_STRING("sb_agrwepprefs");
            for (i = 0; i < NUM_WEAPONS; i++)
            {
                 pszEnd = strchr(pszStart, ',');
                 *ptrWeaponTab++ = atoi(pszStart);
                 pszStart = pszEnd + 1;
            }
            break;

        case PERSONALITY_DEFENSIVE:
            pszStart = (char *)CVAR_GET_STRING("sb_defwepprefs");
            for (i = 0; i < NUM_WEAPONS; i++)
            {
                 pszEnd = strchr(pszStart, ',');
                 *ptrWeaponTab++ = atoi(pszStart);
                 pszStart = pszEnd + 1;
            }
            break;

   }
and the result is that when a bot tries to buy a weapon the game crashes with runtime error
  
Reply With Quote