1 // Property of Alientrap/AK
2 // custom/creategame/mods.qc
6 Item_DataLink_Nex_ModSwitch
10 // first line filename
11 // second line mod name
13 void() _IDLNMS_Build =
15 local float lSearchHandle;
16 local float lSearchSize;
17 local float lSearchCounter;
19 lSearchHandle = search_begin( "*.modinfo", true, true );
20 if( lSearchHandle < 0 ) {
21 String_EntitySet( self, valueList, "'progs.dat'" );
22 String_EntitySet( self, descList, "'Deathmatch'" );
26 for( lSearchSize = search_getsize( lSearchHandle ), lSearchCounter = 0;
27 lSearchCounter < lSearchSize; ++lSearchCounter ) {
29 local string lFilename;
31 local string lModName;
32 local string lModPath;
35 lFilename = search_getfilename( lSearchHandle, lSearchCounter );
36 lHandle = fopen( lFilename, FILE_READ );
38 print( "Menu: Couldn't open modinfo file '", lFilename, "'\n" );
42 lModPath = String_Create();
43 lModName = String_Create();
45 lLine = fgets( lHandle );
46 if( !validstring( lLine ) )
49 lModPath = String_Set( lModPath, lLine );
51 lLine = fgets( lHandle );
52 if( !validstring( lLine ) )
55 lModName = String_Set( lModName, lLine );
57 String_EntitySet( self, valueList, strcat( self.valueList, lModPath, " " ) );
58 String_EntitySet( self, descList, strcat( self.descList, lModName, " " ) );
60 String_Free( lModPath );
61 String_Free( lModName );
66 search_end( lSearchHandle );
69 void() Item_DataLink_Nex_ModSwitch_Spawn =
71 local string lTemp1, lTemp2;
73 String_EntityCreate( self, valueList );
74 String_EntityCreate( self, descList );
78 lTemp1 = self.descList;
79 lTemp2 = self.valueList;
80 Item_DataLink_TextSwitch_Spawn();
81 String_Free( lTemp1 );
82 String_Free( lTemp2 );