Re: [NEWBIE][CODE] Godset

From: Jimmie Tryon (zereth@EARTHLINK.NET)
Date: 11/29/02


We did fix the problem with your suggestion.  Is there a more efficient
way to write the 'NEW CODE'?

- OLD CODE -

 /* cmd_num starts at 1, not 0, to remove 'RESERVED' */
  for (no = 1, cmd_num = 1; cmd_info[cmd_sort_info[cmd_num]].command[0] !
= '\n'; cmd_num++) {
    i = cmd_sort_info[cmd_num];

    if (cmd_info[i].minimum_level < 0 || GET_LEVEL(vict) < cmd_info
[i].minimum_level)
      continue;

    if ((cmd_info[i].minimum_level >= LVL_IMMORT) != wizhelp)
      continue;

    if (!wizhelp && socials != (cmd_info[i].command_pointer == do_action
|| cmd_info[i].command_$
      continue;

    send_to_char(ch, "%-11s%s", cmd_info[i].command, no++ % 7 ==
0 ? "\r\n" : "");
  }

  if (no % 7 != 1)
    send_to_char(ch, "\r\n");
}


- NEW CODE -



 /* cmd_num starts at 1, not 0, to remove 'RESERVED' */
  for (no = 1, cmd_num = 1; cmd_info[cmd_sort_info[cmd_num]].command[0] !
= '\n'; cmd_num++) {
    i = cmd_sort_info[cmd_num];


if (GET_LEVEL(vict) == LVL_IMPL)    {

    if ((cmd_info[i].minimum_level >= LVL_IMMORT) != wizhelp)
      continue;

    if (!wizhelp && socials != (cmd_info[i].command_pointer == do_action
|| cmd_info[i].command_$
      continue;

   if (cmd_info[i].minimum_level < 0 || GET_LEVEL(ch) < cmd_info
[i].minimum_level)
      continue;

     send_to_char(ch, "%-11s%s", cmd_info[i].command, no++ % 7 ==
0 ? "\r\n" : "");
} else {
    if (cmd_info[i].cmd_bits < 0 || CMD_FLAGGED(vict, cmd_info
[i].cmd_bits) < cmd_info[i].cmd_bi$
      continue;

    if ((cmd_info[i].minimum_level >= LVL_IMMORT) != wizhelp)
      continue;

    if (!wizhelp && socials != (cmd_info[i].command_pointer == do_action
|| cmd_info[i].command_$
      continue;

   if (cmd_info[i].minimum_level < 0 || GET_LEVEL(ch) < cmd_info
[i].minimum_level)
      continue;

  send_to_char(ch, "%-11s%s", cmd_info[i].command, no++ % 7 ==
0 ? "\r\n" : "");
    }
 }

  if (no % 7 != 1)
    send_to_char(ch, "\r\n");
}

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT