VadaVaka
It's fixed... - Printable Version

+- VadaVaka (https://vadavaka.com/forums)
+-- Forum: General Forums (https://vadavaka.com/forums/forumdisplay.php?fid=5)
+--- Forum: IT-Geeks Hang Out (https://vadavaka.com/forums/forumdisplay.php?fid=42)
+---- Forum: Programming (https://vadavaka.com/forums/forumdisplay.php?fid=27)
+---- Thread: It's fixed... (/showthread.php?tid=2732)



It's fixed... - kermit - 06-03-2003

i am pleased to anounce that i have taken care of the reconnecting problem in ricochet. the solution was very simple, so painfully obvious that i'm ashamed i didn't take care of it a helluva lot sooner.

you can replace the AddClientToArena function in your DiscArena.cpp file w/ this one below and recompile...or pm me and i will e-mail you my modified DiscArena.cpp file. remeber that this function is
a global and not part of the Arena class.

i didn't really write any new code...i just swaped some things around (man, i feel dumb...lol). now about that white-disc...hmm...

// MODIFIED FUNCTION //////////////////////////////////////////////////////////////////////////////
void AddClientToArena( CBasePlayer *pPlayer )
{

// This is the HAX!!!
// remember ...we don't have any arena objects yet...so when do we
// initialize?
// here's the plan...we need to tell the
// computer to try and place the client in a full arena first...that will make him/her spectate...
for (int i = 0; i < MAX_ARENAS; i++)
{
if ( g_pArenaList[i]->IsFull() == FALSE )
{
int iArenaNumber = i;

g_pArenaList[iArenaNumber]->AddClient( pPlayer, TRUE );

bool bFoundOne = TRUE;

/*
// Now, if this arena's not full, try to find one more player to join her
while ( (g_pArenaList[iArenaNumber]->IsFull() == FALSE) && bFoundOne )
{
bFoundOne = FALSE;

// Cycle through all the arenas and find a spare player
for (int j = 0; j < MAX_ARENAS; j++)
{
CBasePlayer *pSparePlayer = g_pArenaList[j]->GetFirstSparePlayer();
if (pSparePlayer && pSparePlayer != pPlayer)
{
g_pArenaList[j]->RemoveClient( pSparePlayer );
g_pArenaList[iArenaNumber]->AddClient( pSparePlayer, TRUE );
bFoundOne = TRUE;
break;
}
}
} */

// If we couldn't find another player for this arena, just add them to an existing arena
if ( g_pArenaList[iArenaNumber]->IsFull() == FALSE )
{
// Add to the first full arena
for (int j = 0; j < MAX_ARENAS; j++)
{
if ( g_pArenaList[j]->IsFull() )
{
// Remove from current
g_pArenaList[iArenaNumber]->RemoveClient( pPlayer );

// Add to full one
iArenaNumber = j;
g_pArenaList[iArenaNumber]->AddClient( pPlayer, TRUE );
break;
}
}
}

//while ( (g_pArenaList[iArenaNumber]->IsFull() == FALSE) && bFoundOne )
else
{
bFoundOne = FALSE;

// Cycle through all the arenas and find a spare player
for (int j = 0; j < MAX_ARENAS; j++)
{
CBasePlayer *pSparePlayer = g_pArenaList[j]->GetFirstSparePlayer();
if (pSparePlayer && pSparePlayer != pPlayer)
{
g_pArenaList[j]->RemoveClient( pSparePlayer );
g_pArenaList[iArenaNumber]->AddClient( pSparePlayer, TRUE );
bFoundOne = TRUE;
break;
}
}
} // */



//ALERT( at_console, "ADDED %s to Arena %d\n", STRING(pPlayer->pev->netname), iArenaNumber );
return;
}
}
}
// END ///////////////////////////////////////////////////////////////////////////////////////////


It's fixed... - RuNnInG_wIth_ScISsOrS - 06-03-2003

:thumb:.


It's fixed... - CloudFuel - 06-03-2003

Wow I actually understood all of that! Awesome!!!


It's fixed... - evil_admin - 06-03-2003

I have copied the source and will incorporate it into my
latest version. I am in the middle of changing servers
but once it starts showing up I will set it for rc_arena
so we can test it out.

Way to go .asm!!!!


It's fixed... - kermit - 06-09-2003

great...sounds like a man w/ some experience. yeah, i wouldn't technically call the reconnecting situation a bug because it was probably valve's intent to get a client playing as soon as possible, but it's damn annoying for everyone when someone exploits it.

Quote:It seems to me unorthodox to edit the function which does exactly what it is supposed to do, when it is called at the wrong occassions.

i'm unorthodox...^_^