timedFlagOnSpawn.cpp
// Parse an individual flag definition. This should respect the following syntax:
//     syntax:  <flag>=<time>
//     example: WG=15
Parse an individual flag definition. This should respect the following syntax:
syntax:  =
example: WG=15
Parse an individual flag definition . This should respect the following syntax : syntax : = example : WG = 15
timedFlagOnSpawn::FlagDefinition timedFlagOnSpawn::parseFlagDefinition (const char* definition)
{
    std::string workspace = definition;
    bz_APIStringList def;
    def.tokenize(definition, "=");
    if (workspace.find("=") == std::string::npos || def.size() != 2)
    {
        throw std::runtime_error("Invalid flag definition");
    }
    FlagDefinition flagDef;
    flagDef.flag = def[0];
    flagDef.delay = std::stoi(def[1]);
    bz_debugMessagef(VERBOSE_LVL, "DEBUG :: timedFlagOnSpawn :: Flag Definition parsed as %s flag will be given for %d seconds", flagDef.flag.c_str(), flagDef.delay);
    return flagDef;
}
timedFlagOnSpawn :: FlagDefinition timedFlagOnSpawn :: parseFlagDefinition ( const char * definition ) { std :: string workspace = definition ; bz_APIStringList def ; def . tokenize ( definition , " " ) ; if ( workspace . find ( " " ) == std :: string :: npos || def . size ( ) != 2 ) { throw std :: runtime_error ( " " ) ; } FlagDefinition flagDef ; flagDef . flag = def [ 0 ] ; flagDef . delay = std :: stoi ( def [ 1 ] ) ; bz_debugMessagef ( VERBOSE_LVL , " " , flagDef . flag . c_str ( ) , flagDef . delay ) ; return flagDef ; }
Parse an individual flag definition.
Parse an individual flag definition .