Beispiel #1
0
void CON_CvarSetValue(char *var_name, float value)
{
    char val[32];
    
    sprintf(val, "%f",value);
    CON_CvarSet(var_name, val);
}
Beispiel #2
0
static CMD(Seta) {
    if(!param[0] || !param[1]) {
        return;
    }

    CON_CvarSet(param[0], param[1]);

    if(netgame) {
        if(playeringame[0] && consoleplayer == 0) {
            NET_SV_UpdateCvars(CON_CvarGet(param[0]));
        }
    }
}
Beispiel #3
0
alist_t *DoRunActions(alist_t *al, dboolean free)
{
    alist_t     *next = NULL;
    action_t    *action;
    cvar_t      *cvar;
    
    while(al)
    {
        next = al->next;
        if(dstrcmp(al->cmd, "wait") == 0)
            break;
        
        action = FindAction(al->cmd);
        if(action)
        {
            action->proc(action->data, al->param);
        }
        else if(cvar = CON_CvarGet(al->cmd))
        {
            if(netgame)
            {
                if(cvar->nonclient)
                {
                    // I'll just have to assume for now that
                    // player# 0 is the server..
                    if(consoleplayer != 0)
                    {
                        CON_Warnf("Cannot change cvar that's locked by server\n");
                        goto next;
                    }
                }
            }

            if(!al->param[0])
            {
                char str[256];
                sprintf(str, "%s: %s (%s)", cvar->name, cvar->string, cvar->defvalue);
                CON_AddLine(str, dstrlen(str));
            }
            else
            {
                CON_CvarSet(cvar->name, al->param[0]);
                if(netgame)
                {
                    if(playeringame[0] && consoleplayer == 0)
                        NET_SV_UpdateCvars(cvar);
                }
            }
        }
        else
            CON_Warnf("Unknown command \"%s\"\n", al->cmd);
        
next:
        if(free)
            DerefSingleAction(al);
        
        al = next;
    }
    
    if(al) // reached wait command
    {
        if(free)
            DerefSingleAction(al);
        
        if(next != NULL)
            return next;
    }

    return al;
}