OverLoaded Member Function Not Found

This is a discussion on OverLoaded Member Function Not Found within the C++ Programming forums, part of the General Programming Boards category; Im trying to give Npc AI to a half life mod and i ran into this error 1>.\hl2mp\hl2mp_player.cpp(626) : error ...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    6

    OverLoaded Member Function Not Found

    Im trying to give Npc AI to a half life mod and i ran into this error

    1>.\hl2mp\hl2mp_player.cpp(626) : error C2511: 'bool CHL2MP_Player::WantsLagCompensationOnEntity(const CBasePlayer *,const CUserCmd *,const CBitVec<NUM_BITS> *) const' : overloaded member function not found in 'CHL2MP_Player'
    1> with
    1> [
    1> NUM_BITS=2048
    1> ]


    Code:
    bool CHL2MP_Player::WantsLagCompensationOnEntity (const CBasePlayer *pPlayer, const CUserCmd *pCmd, const CBitVec<MAX_EDICTS> *pEntityTransmitBits)  const
    {
    	// No need to lag compensate at all if we're not attacking in this command and
    	// we haven't attacked recently.
    	if ( !( pCmd->buttons & IN_ATTACK ) && (pCmd->command_number - m_iLastWeaponFireUsercmd > 5) )
    		return false;
    
    	// If this entity hasn't been transmitted to us and acked, then don't bother lag compensating it.
    	if ( pEntityTransmitBits && !pEntityTransmitBits->Get( pPlayer->entindex() ) )
    		return false;
    
    	const Vector &vMyOrigin = GetAbsOrigin();
    	const Vector &vHisOrigin = pPlayer->GetAbsOrigin();
    
    	// get max distance player could have moved within max lag compensation time, 
    	// multiply by 1.5 to to avoid "dead zones"  (sqrt(2) would be the exact value)
    	float maxDistance = 1.5 * pPlayer->MaxSpeed() * sv_maxunlag.GetFloat();
    
    	// If the player is within this distance, lag compensate them in case they're running past us.
    	if ( vHisOrigin.DistTo( vMyOrigin ) < maxDistance )
    		return true;
    
    	// If their origin is not within a 45 degree cone in front of us, no need to lag compensate.
    	Vector vForward;
    	AngleVectors( pCmd->viewangles, &vForward );
    	
    	Vector vDiff = vHisOrigin - vMyOrigin;
    	VectorNormalize( vDiff );
    
    	float flCosAngle = 0.707107f;	// 45 degree angle
    	if ( vForward.Dot( vDiff ) < flCosAngle )
    		return false;
    
    	return true;
    }
    and thats the culprit. any ideas any help is greatly appreciated

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I notice that the error says NUM_BITS whereas the code says MAX_EDICTS. Perhaps that's a hint.

    Also, what's on and around line 626? If it's the function header you posted, then you have a mismatch between the parameters on this line and the declaration in the class.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    6
    bool CHL2MP_Player::WantsLagCompensationOnEntity (const CBasePlayer *pPlayer, const CUserCmd *pCmd, const CBitVec<MAX_EDICTS> *pEntityTransmitBits) const

    thats line 626.


    thank you for pointing me in the right direction. it was a simple typo between the header file and the cpp file. i appreciate ur help.
    Last edited by lifeafterdeath; 06-05-2008 at 11:57 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 12:14 PM
  5. I need help with passing pointers in function calls
    By vien_mti in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 11:00 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21