MantisBT - Zandronum
View Issue Details
0001484Zandronum[All Projects] Suggestionpublic2013-09-04 16:342015-09-05 02:06
Monsterovich 
 
highminoralways
closeddenied 
1.1.1 
 
0001484: loadini feature
This feature is most useful on sectorcraft servers, loadini has been created since zandro 1.0. It works successfuly on ZDoom, but zan code is not completed fully, because zan is based on old ZDoom revision, so it works nicely in zan too.

It uses full pathes. If you have to add it, please do not remove them.

To test:
loadini map-something.ini
**configfile.cpp** line 603

//====================================================================
//
// FConfigFile :: LoadNewConfigFile
//
//====================================================================

/* Created special for loadini */
bool FConfigFile::LoadNewConfigFile (void (*nosechandler)(const char *pathname, FConfigFile *config, void *userdata), void *userdata)
{
    FILE *file = fopen (PathName, "r");
    bool succ;

    if (file == NULL)
    {
        return false;
    }

    succ = ReadConfig (file);
    fclose (file);

    if (!succ)
    { // First valid line did not define a section
        if (nosechandler != NULL)
        {
            nosechandler (PathName, this, userdata);
        }
        return false;
    } else return true;
}

**configfile.h** line 73

bool LoadNewConfigFile (void (*nosechandler)(const char *pathname, FConfigFile *config, void *userdata), void *userdata);

**gameconfigfile.cpp** line 771

bool FGameConfigFile::LoadConfig(FString pathname)
{
    bool result;

    ChangePathName (pathname);
    bMigrating = false;
    result = LoadNewConfigFile (MigrateStub, NULL);
    return result;
}

CCMD (loadini)
{
    const char *pathname = (argv.argc() == 1) ? NULL : argv[1];

    if(GameConfig->LoadConfig(pathname))
    {
    GameConfig->DoGlobalSetup ();
    GameConfig->DoGameSetup ("Doom"); // WARNING! I didn't find how to get gamename in zan. Change it!
    Printf("Config loaded.\n");
    } else
    {
    Printf("Config loading failed.\n");
    }
}

**gameconfigfile.h** line 56

bool LoadConfig(FString pathname);
No tags attached.
Issue History
2013-09-04 16:34MonsterovichNew Issue
2013-09-07 16:35MonsterovichNote Added: 0007132
2013-09-07 17:18DuskNote Deleted: 0007132
2013-09-07 18:07DuskNote Added: 0007133
2013-09-07 18:13MonsterovichNote Added: 0007134
2013-09-08 04:41ZzZomboNote Added: 0007138
2015-09-05 02:06DuskStatusnew => closed
2015-09-05 02:06DuskResolutionopen => denied

Notes
(0007133)
Dusk   
2013-09-07 18:07   
And what exactly is the point of this?
(0007134)
Monsterovich   
2013-09-07 18:13   
'http://submarine.strangled.net/scmaps [^]'

Good example.
(0007138)
ZzZombo   
2013-09-08 04:41   
Just another way of messing w/ user preferences for malicious mods.