Thread: reload bug
View Single Post
Re: reload bug
Old
  (#2)
Josh_Borke
Member
 
Status: Offline
Posts: 152
Join Date: Jun 2004
Default Re: reload bug - 25-06-2004

ok, not to be bothersome, but i'd like to see if i can help squash this bug, as such i've been trying to get my head around the code and do some further debugging.

Further debugging has shown that

bot_client.cpp ~ line 300 - BotClient_Valve_AmmoX function

it seems to be broken

index != (weapon_defs[ammo_index].iAmmo1 || weapon_defs[ammo_index].iId)

i see function pointers and my brain stops processing so I don't know where to go from here. I can see where it is called in engine.cpp. It looks like it hooks into meta above this so I am lost, HTH

PS. Here is the code for easy reference.

Code:
  // This message is sent whenever ammo ammounts are adjusted (up or down).
  void
  BotClient_Valve_AmmoX (void *p, int bot_index)
  {
    //DebugOut("bot_client: BotClient_Valve_AmmoX()\n");
    static int state = 0;		// current state machine state
    static int index;
    static int ammount;
    int ammo_index;
  
    if (state == 0)
  	{
  	  state++;
  	  index = *(int *) p;	// ammo index (for type of ammo)
  	}
    else if (state == 1)
  	{
  	  state = 0;
  
  	  ammount = *(int *) p;	// the ammount of ammo currently available
  
  	  bots[bot_index].m_rgAmmo[index] = ammount;	// store it away
  
  	  ammo_index = bots[bot_index].current_weapon.iId;
  
  	  // update the ammo counts for this weapon...
  	  bots[bot_index].current_weapon.iAmmo1 =
  	bots[bot_index].m_rgAmmo[weapon_defs[ammo_index].iAmmo1];
  
  	  bots[bot_index].current_weapon.iAmmo2 =
  	bots[bot_index].m_rgAmmo[weapon_defs[ammo_index].iAmmo2];
  
  	}
  }

Last edited by Josh_Borke; 25-06-2004 at 05:17..
  
Reply With Quote