I'm not sure short circuiting flag_value is the best solution.
We put in a "<direction> flag <flags>" command.

   if(!strcasecmp(command,"flag"))
   {
     if (!arg[0])
       send_to_char("Syntax:  [direction] flag [flags]\n\r", ch);
     else if (!pRoom->exit[door] || !pRoom->exit[door]->u1.to_room)
       send_to_char("Exit does not exist.\n\r",ch);
     else if ((value = flag_value(exit_flags, argument)) == NO_FLAG)
       send_to_char("No such exit flag.\n\r", ch);
     else
     {
       ROOM_INDEX_DATA *pToRoom;
       sh_int rev;
       TOGGLE_BIT(pRoom->exit[door]->rs_flags,  value);
       pRoom->exit[door]->exit_info = pRoom->exit[door]->rs_flags;
       pToRoom = pRoom->exit[door]->u1.to_room;
       rev = rev_dir[door];
       if (pToRoom->exit[rev] && pToRoom->exit[rev]->u1.to_room == pRoom)
       {
         pToRoom->exit[rev]->rs_flags = pRoom->exit[door]->rs_flags;
         pToRoom->exit[rev]->exit_info = pRoom->exit[door]->exit_info;
       }
       send_to_char("Exit flag toggled.\n\r", ch);
       return TRUE;
     }
     return FALSE;
   }

Then again my game just crashed, so maybe you shouldn't listen to me.

--Palrich.


/* SNIPPET */
/* This will fix redit's 'north name door' *
 * in quickmud and Ivan's olc. Line #'s    *
 * are based on quickmud-bits.tar.gz       *
 * Mod'd by Snafu Life. No credit needed   */

-----------------------
bit.c flag_value() begining line 131:
        if ((bit = flag_lookup (word, flag_table)) != NO_FLAG)
        {
            SET_BIT (marked, bit);
            found = true;
-        }
+ /* This will only fire if it's the first time through and NO_FLAG */
+        }else if(!found) break;
    }
-----------------------
olc_act.c change_exit() begining line 1512:
    }

+    /* Reached the end, inform user */
+    send_to_char("Flag not found. See help exit.\r\n",ch);
    return false;
}
-----------------------

Reply via email to