44
55#define ARRAY_STRING_LENGTH 32
66
7- enum GroupCommands
7+ enum struct GroupCommands
88{
9- ArrayList : groupListName ,
10- ArrayList : groupListCommand
11- };
9+ ArrayList groupListName ;
10+ ArrayList groupListCommand ;
11+ }
1212
13- int g_groupList [ GroupCommands ] ;
13+ GroupCommands g_groupList ;
1414int g_groupCount ;
1515
1616SMCParser g_configParser ;
1717
18- enum Places
18+ enum struct Places
1919{
20- Place_Category ,
21- Place_Item ,
22- Place_ReplaceNum
23- };
20+ int category ;
21+ int item ;
22+ int replaceNum ;
23+ }
2424
2525char g_command [MAXPLAYERS +1 ][CMD_LENGTH ];
26- int g_currentPlace [MAXPLAYERS +1 ][ Places ];
26+ Places g_currentPlace [MAXPLAYERS +1 ];
2727
2828/* *
2929 * What to put in the 'info' menu field (for PlayerList and Player_Team menus only)
@@ -331,11 +331,11 @@ void ParseConfigs()
331331 g_configParser .OnKeyValue = KeyValue ;
332332 g_configParser .OnLeaveSection = EndSection ;
333333
334- delete g_groupList [ groupListName ] ;
335- delete g_groupList [ groupListCommand ] ;
334+ delete g_groupList . groupListName ;
335+ delete g_groupList . groupListCommand ;
336336
337- g_groupList [ groupListName ] = new ArrayList (ARRAY_STRING_LENGTH );
338- g_groupList [ groupListCommand ] = new ArrayList (ARRAY_STRING_LENGTH );
337+ g_groupList . groupListName = new ArrayList (ARRAY_STRING_LENGTH );
338+ g_groupList . groupListCommand = new ArrayList (ARRAY_STRING_LENGTH );
339339
340340 char configPath [256 ];
341341 BuildPath (Path_SM , configPath , sizeof (configPath ), " configs/dynamicmenu/adminmenu_grouping.txt" );
@@ -376,13 +376,13 @@ public SMCResult NewSection(SMCParser smc, const char[] name, bool opt_quotes)
376376
377377public SMCResult KeyValue (SMCParser smc , const char [] key , const char [] value , bool key_quotes , bool value_quotes )
378378{
379- g_groupList [ groupListName ] .PushString (key );
380- g_groupList [ groupListCommand ] .PushString (value );
379+ g_groupList . groupListName .PushString (key );
380+ g_groupList . groupListCommand .PushString (value );
381381}
382382
383383public SMCResult EndSection (SMCParser smc )
384384{
385- g_groupCount = g_groupList [ groupListName ] .Length ;
385+ g_groupCount = g_groupList . groupListName .Length ;
386386}
387387
388388public void DynamicMenuCategoryHandler (TopMenu topmenu ,
@@ -421,8 +421,8 @@ public void DynamicMenuItemHandler(TopMenu topmenu,
421421
422422 strcopy (g_command [param ], sizeof (g_command []), output .cmd );
423423
424- g_currentPlace [param ][ Place_Item ] = location ;
425- g_currentPlace [param ][ Place_ReplaceNum ] = 1 ;
424+ g_currentPlace [param ]. item = location ;
425+ g_currentPlace [param ]. replaceNum = 1 ;
426426
427427 ParamCheck (param );
428428 }
@@ -436,19 +436,19 @@ public void ParamCheck(int client)
436436 Item outputItem ;
437437 Submenu outputSubmenu ;
438438
439- g_DataArray .GetArray (g_currentPlace [client ][ Place_Item ] , outputItem );
439+ g_DataArray .GetArray (g_currentPlace [client ]. item , outputItem );
440440
441- if (g_currentPlace [client ][ Place_ReplaceNum ] < 1 )
441+ if (g_currentPlace [client ]. replaceNum < 1 )
442442 {
443- g_currentPlace [client ][ Place_ReplaceNum ] = 1 ;
443+ g_currentPlace [client ]. replaceNum = 1 ;
444444 }
445445
446- Format (buffer , 5 , " #%i " , g_currentPlace [client ][ Place_ReplaceNum ] );
447- Format (buffer2 , 5 , " @%i " , g_currentPlace [client ][ Place_ReplaceNum ] );
446+ Format (buffer , 5 , " #%i " , g_currentPlace [client ]. replaceNum );
447+ Format (buffer2 , 5 , " @%i " , g_currentPlace [client ]. replaceNum );
448448
449449 if (StrContains (g_command [client ], buffer ) != - 1 || StrContains (g_command [client ], buffer2 ) != - 1 )
450450 {
451- outputItem .submenus .GetArray (g_currentPlace [client ][ Place_ReplaceNum ] - 1 , outputSubmenu );
451+ outputItem .submenus .GetArray (g_currentPlace [client ]. replaceNum - 1 , outputSubmenu );
452452
453453 Menu itemMenu = new Menu (Menu_Selection );
454454 itemMenu .ExitBackButton = true ;
@@ -460,8 +460,8 @@ public void ParamCheck(int client)
460460
461461 for (int i = 0 ; i < g_groupCount ; i ++ )
462462 {
463- g_groupList [ groupListName ] .GetString (i , nameBuffer , sizeof (nameBuffer ));
464- g_groupList [ groupListCommand ] .GetString (i , commandBuffer , sizeof (commandBuffer ));
463+ g_groupList . groupListName .GetString (i , nameBuffer , sizeof (nameBuffer ));
464+ g_groupList . groupListCommand .GetString (i , commandBuffer , sizeof (commandBuffer ));
465465 itemMenu .AddItem (commandBuffer , nameBuffer );
466466 }
467467 }
@@ -591,7 +591,7 @@ public void ParamCheck(int client)
591591 }
592592
593593 g_command [client ][0 ] = ' \0 ' ;
594- g_currentPlace [client ][ Place_ReplaceNum ] = 1 ;
594+ g_currentPlace [client ]. replaceNum = 1 ;
595595 }
596596}
597597
@@ -622,16 +622,16 @@ public int Menu_Selection(Menu menu, MenuAction action, int param1, int param2)
622622 char infobuffer [NAME_LENGTH +2 ];
623623 Format (infobuffer , sizeof (infobuffer ), " \" %s \" " , info );
624624
625- Format (buffer , 5 , " #%i " , g_currentPlace [param1 ][ Place_ReplaceNum ] );
625+ Format (buffer , 5 , " #%i " , g_currentPlace [param1 ]. replaceNum );
626626 ReplaceString (g_command [param1 ], sizeof (g_command []), buffer , infobuffer );
627627 //replace #num with the selected option (quoted)
628628
629- Format (buffer , 5 , " @%i " , g_currentPlace [param1 ][ Place_ReplaceNum ] );
629+ Format (buffer , 5 , " @%i " , g_currentPlace [param1 ]. replaceNum );
630630 ReplaceString (g_command [param1 ], sizeof (g_command []), buffer , info );
631631 //replace @num with the selected option (unquoted)
632632
633633 // Increment the parameter counter.
634- g_currentPlace [param1 ][ Place_ReplaceNum ] ++ ;
634+ g_currentPlace [param1 ]. replaceNum ++ ;
635635
636636 ParamCheck (param1 );
637637 }
0 commit comments