|
Junior Member
|
08-30-2018
, 12:23
Re: Polymorph: Mod Manager
|
#939
|
Quote:
Originally Posted by fysiks
So, here are the changes I think will implement what you want (untested):
Add this variable declaration near the top with the others:
Code:
new g_iThisMap = -1 // Index of 'ThisMap'
Update the while loop condition like this:
Code:
while (isInMenu(a) || g_iThisMap == a)
if (++a >= mapNum) a = 0
Then replace the entire loadMaps() function with this new version:
Code:
stock bool:loadMaps(szConfigDir[], szMapFile[], iModIndex)
{
new szFilepath[STRLEN_PATH], szData[STRLEN_MAP], szMapName[32], i = 0
get_mapname(szMapName, charsmax(szMapName))
g_iMapNums[iModIndex] = 0
formatex(szFilepath, charsmax(szFilepath), "%s/%s", szConfigDir, szMapFile)
new f = fopen(szFilepath, "rt")
if(!f)
return false
while(!feof(f))
{
fgets(f, szData, charsmax(szData))
trim(szData)
if(!szData[0] || szData[0] == ';' || (szData[0] == '/' && szData[1] == '/'))
continue
if(is_map_valid(szData))
{
ArrayPushString(g_aModMaps[iModIndex], szData)
if( g_iThisMod == iModIndex )
{
if( equal(szMapName, szData) )
{
g_iThisMap = i
}
}
i++
g_iMapNums[iModIndex]++
}
}
fclose(f)
return true
}
Let me know how it goes.
|
So far, everything is working fine. And how to prohibit the extension of the mod? When the mod is renewed and the map is changed, the mod can be extended again, I suspect that it is also necessary to record the index of the previous mod and make a check on the previous mod?
|
|
|
|