示例#1
0
bool cmpStructName(const codeview_type* cvtype, const BYTE* name, bool cstr)
{
	bool cstr2;
	const BYTE* name2 = getStructName(cvtype, cstr2);
	if(!name || !name2)
		return name == name2;
	return dstrcmp(name, cstr, name2, cstr2);
}
示例#2
0
static void AddAction(action_t *action)
{
    action_t    *tree;
    int         cmp;
    int         child;
    
    action->parent = NULL;
    action->children[0] = action->children[1] = NULL;

    if(Actions)
    {
        tree = Actions;
        while(tree)
        {
            cmp = dstrcmp(action->name, tree->name);
            if(cmp == 0)
            {
                ReplaceActionWith(tree, action);
                
                for(child = 0;child < 2;child++)
                {
                    action->children[child] = tree->children[child];
                    if(tree->children[child])
                        tree->children[child]->parent = action;
                    tree->children[child] = NULL;
                }

                G_FreeAction(tree);
                tree = NULL;
            }
            else
            {
                if(cmp>0)
                    child = 1;
                else
                    child = 0;
                if (tree->children[child])
                    tree = tree->children[child];
                else
                {
                    action->parent = tree;
                    tree->children[child] = action;
                    tree = NULL;
                    G_OptimizeActionTree();
                }
            }
        }
    }
    else
    {
        Actions = action;
    }
}
示例#3
0
cvar_t *CON_CvarGet(char *name)
{
    cvar_t *var;
    
    for(var = cvarcap; var; var = var->next)
    {
        if(!dstrcmp(name, var->name))
            return var;
    }
        
        return NULL;
}
示例#4
0
static dboolean IsSameAction(char *cmd, alist_t *al)
{
    if(!al)
        return false;
    
    if(!dstrcmp(al->cmd, "weapon"))
    {
        {
            char buff[256];
            sprintf(buff, "%s %s", al->cmd, al->param[0]);
            if(!dstrcmp(cmd, buff))
                return true;
            else
                return false;
        }
    }
    else
    {
        if(dstricmp(cmd, al->cmd)!=0)
            return false;
    }
    return true;
}
示例#5
0
t_propertie	*rtml_propertie(t_object	*obj,
				const char	*str)
{
  t_lst		*lst;

  if (obj == NULL || obj->inside == NULL || obj->inside->first == NULL)
    return (NULL);
  lst = obj->inside->first;
  do
    {
      if (dstrcmp(str, ((t_propertie*)lst->data)->name) == 0)
	return (lst->data);
      NEXT(lst);
    }
  while (lst != obj->inside->first);
  return (NULL);
}
示例#6
0
void CON_CvarSet(char *var_name, char *value)
{
    cvar_t	*var;
    dboolean changed;
    
    var = CON_CvarGet(var_name);
    if(!var)
    {	// there is an error in C code if this happens
        CON_Printf(WHITE, "CON_CvarSet: variable %s not found\n", var_name);
        return;
    }
    
    changed = dstrcmp(var->string, value);
    
    Z_Free(var->string);	// free the old value string
    
    var->string = Z_Malloc(dstrlen(value)+1, PU_STATIC, 0);
    dstrcpy(var->string, value);
    var->value = datof(var->string);

    if(var->callback)
        var->callback(var);
}
示例#7
0
static action_t *FindAction(char *name)
{
    action_t    *tree;
    int         cmp;
    
    if(!name)
        return NULL;

    tree = Actions;
    while(tree)
    {
        cmp = dstrcmp(name, tree->name);
        if(cmp == 0)
            break;

        if(cmp > 0)
            tree = tree->children[1];
        else
            tree = tree->children[0];
    }

    return tree;
}
示例#8
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;
}