Bad pointer in vcmd_insert_repeated

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sirridan
    Knight
    • May 2009
    • 560

    Bad pointer in vcmd_insert_repeated

    I'm having a bit of trouble with the vcmd_insert_repeated command. I added targeting to CMD_EAT so I could add a potion of dragon's breath effect to food, and I can target, but the effect doesn't fire off because the direction is always 0.

    if I hit right on the keyboard, it gets direction 6 which is correct, but when it gets to this code segment, the va_arg is a bad pointer (according to visual studio), and the direction returned to the fire_beam function is always 0.

    Any clue to what's mucking up the pointer?

    Code:
    static errr vcmd_insert_repeated(cmd_code c, int nrepeats, va_list vp)
    {
    	/* code removed for post */
    
    	for (j = 0; (game_cmds[idx].arg_type[j] != arg_END && 
    				 j < N_ELEMENTS(game_cmds[idx].arg_type)); j++)
    	{
    		switch (game_cmds[idx].arg_type[j])
    		{
    			/* code removed for post */
    			case arg_DIRECTION:
    			case arg_TARGET:
    			{
    				cmd.args[j].direction = va_arg(vp, int); <--- bad ptr
    				break;
    			}
  • Sirridan
    Knight
    • May 2009
    • 560

    #2
    I'm dumb, sorry for the bad thread. I didn't edit the command list properly so the game knew to look for a target command when eating, fixed that though. All is well

    Comment

    Working...
    😀
    😂
    🥰
    😘
    🤢
    😎
    😞
    😡
    👍
    👎