Jump to content
  • 0

Is this a bug or "feature"?


Gamer_Z

Question

Posted

look at the commented lines "bAlreadyInited = true;//":

  
/** 
 * This adds the local player to the ped pool, nothing else 
 * @return BOOL TRUE if success, FALSE otherwise 
 */ 
BOOL CGameSA::InitLocalPlayer(  ) 
{ 
    DEBUG_TRACE("BOOL CGameSA::InitLocalPlayer(  )"); 
  
    // Added by ChrML - Looks like it isn't safe to call this more than once but mod code might do 
    static bool bAlreadyInited = false; 
    if ( bAlreadyInited ) 
    { 
        return TRUE; 
    } 
    //bAlreadyInited = true;//Current MTA Code, wtf is this doing here? 
    CPoolsSA * pools = (CPoolsSA *)this->GetPools (); 
    if ( pools ) 
    { 
        //* HACKED IN HERE FOR NOW *// 
        CPedSAInterface* pInterface = pools->GetPedInterface ( (DWORD)1 ); 
  
        if ( pInterface ) 
        { 
            pools->AddPed ( (DWORD*)pInterface ); 
            bAlreadyInited = true;//only set to true when local player was succesfully added, right? 
            return TRUE; 
        } 
  
        return FALSE; 
    } 
    return FALSE; 
} 

2 answers to this question

Recommended Posts

  • 0
Posted

Though the comments are confusing, the logic looks correct here. We only mark it being successfully initiated when the local player is created. Then, when you try and initiate the local player again, it will simply return true.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...