fixed menu var leak

This commit is contained in:
ineed bots
2024-05-09 20:42:19 -06:00
parent 1477323917
commit 6c935c2bbd

View File

@@ -60,7 +60,6 @@ init_menu()
self.menuinit = true;
self.menuopen = false;
self.menu_player = undefined;
self.submenu = "Main";
self.curs[ "Main" ][ "X" ] = 0;
self AddOptions();
@@ -75,6 +74,12 @@ init_menu()
self thread doGreetings();
}
destroyElemFixed()
{
self.parent removechild( self );
self destroyelem();
}
kill_menu()
{
self notify( "bots_kill_menu" );
@@ -93,7 +98,7 @@ watchDisconnect()
{
if ( isdefined( self.menutexty[ i ] ) )
{
self.menutexty[ i ] destroy();
self.menutexty[ i ] destroyElemFixed();
}
}
}
@@ -104,7 +109,7 @@ watchDisconnect()
{
if ( isdefined( self.menutext[ i ] ) )
{
self.menutext[ i ] destroy();
self.menutext[ i ] destroyElemFixed();
}
}
}
@@ -113,12 +118,12 @@ watchDisconnect()
{
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
{
self.menu[ "X" ][ "Shader" ] destroy();
self.menu[ "X" ][ "Shader" ] destroyElemFixed();
}
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
{
self.menu[ "X" ][ "Scroller" ] destroy();
self.menu[ "X" ][ "Scroller" ] destroyElemFixed();
}
}
@@ -332,7 +337,7 @@ OpenSub( menu, menu2 )
{
if ( isdefined( self.menutext[ i ] ) )
{
self.menutext[ i ] destroy();
self.menutext[ i ] destroyElemFixed();
}
}
}
@@ -341,12 +346,12 @@ OpenSub( menu, menu2 )
{
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
{
self.menu[ "X" ][ "Shader" ] destroy();
self.menu[ "X" ][ "Shader" ] destroyElemFixed();
}
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
{
self.menu[ "X" ][ "Scroller" ] destroy();
self.menu[ "X" ][ "Scroller" ] destroyElemFixed();
}
}
@@ -402,7 +407,7 @@ OpenSub( menu, menu2 )
{
if ( isdefined( self.menutexty[ i ] ) )
{
self.menutexty[ i ] destroy();
self.menutexty[ i ] destroyElemFixed();
}
}
}
@@ -426,18 +431,21 @@ CursMove( direction )
if ( self.submenu == "Main" )
{
self.menu[ "X" ][ "Scroller" ].x = self.menutext[ self.curs[ "Main" ][ "X" ] ].x;
self.menu[ "X" ][ "Scroller" ].y = self.menutext[ self.curs[ "Main" ][ "X" ] ].y;
if ( isdefined( self.menutext ) )
{
for ( i = 0; i < self.menutext.size; i++ )
self.menu[ "X" ][ "Scroller" ].x = self.menutext[ self.curs[ "Main" ][ "X" ] ].x;
self.menu[ "X" ][ "Scroller" ].y = self.menutext[ self.curs[ "Main" ][ "X" ] ].y;
if ( isdefined( self.menutext ) )
{
if ( isdefined( self.menutext[ i ] ) )
for ( i = 0; i < self.menutext.size; i++ )
{
self.menutext[ i ].fontscale = 1.5;
self.menutext[ i ].color = ( 1, 1, 1 );
self.menutext[ i ].glowalpha = 0;
if ( isdefined( self.menutext[ i ] ) )
{
self.menutext[ i ].fontscale = 1.5;
self.menutext[ i ].color = ( 1, 1, 1 );
self.menutext[ i ].glowalpha = 0;
}
}
}
}
@@ -578,7 +586,7 @@ ExitSub()
{
if ( isdefined( self.menutexty[ i ] ) )
{
self.menutexty[ i ] destroy();
self.menutexty[ i ] destroyElemFixed();
}
}
}
@@ -603,7 +611,7 @@ ExitMenu()
{
if ( isdefined( self.menutext[ i ] ) )
{
self.menutext[ i ] destroy();
self.menutext[ i ] destroyElemFixed();
}
}
}
@@ -612,12 +620,12 @@ ExitMenu()
{
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
{
self.menu[ "X" ][ "Shader" ] destroy();
self.menu[ "X" ][ "Shader" ] destroyElemFixed();
}
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
{
self.menu[ "X" ][ "Scroller" ] destroy();
self.menu[ "X" ][ "Scroller" ] destroyElemFixed();
}
}