Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, Bing

Members: 0
Guests: 14
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » mp_open_passage and mp_close_...
Forum Rules | Mark all | Recent Posts

mp_open_passage and mp_close_passage
< Newer Topic :: Older Topic > these are also annoying

Pages:<< prev 1 next >>
Post is unread #1 Feb 6, 2003, 9:25 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

lol I also found these annoying using a number instead of the direction so this is how i set these two up on my mud :) since some might be use to the numbers let it handle that as well as the direction names
open mud_comm.c and find mp_open_passage

void do_mp_open_passage(CHAR_DATA *ch, char *argument)
{
  char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], arg3[MAX_INPUT_LENGTH];
  ROOM_INDEX_DATA *targetRoom, *fromRoom;
  int targetRoomVnum, fromRoomVnum, exit_num = 0;
  EXIT_DATA *pexit;

  if(!IS_NPC(ch) || IS_AFFECTED(ch, AFF_CHARM))
  {
    send_to_char("Huh?\n\r", ch);
  return;
  }
  argument = one_argument(argument, arg1);  
  argument = one_argument(argument, arg2);  
  argument = one_argument(argument, arg3);  
  if(arg1[0] == '\0')
  {
    progbug("MpOpenPassage - Missing arg1. %s", ch->name);
  return;
  }
  if(arg2[0] == '\0')
  {
    progbug("MpOpenPassage - Missing arg2. %s", ch->name);
  return;
  }
  if(arg3[0] == '\0')
  {
    progbug("MpOpenPassage - Missing arg3. %s", ch->name);
  return;
  }
  if(!is_number(arg1))
  {
    progbug("MpOpenPassage - arg1 isn't a number. %s", ch->name);
  return;
  }
  fromRoomVnum = atoi(arg1);
  if((fromRoom = get_room_index(fromRoomVnum)) == NULL)
  {
    progbug("MpOpenPassage - arg1 isn't an existing room. %s", ch->name);
  return;
  }
  if(!is_number(arg2))
  {
    progbug("MpOpenPassage - arg2 isn't a number. %s", ch->name);
  return;
  }
  targetRoomVnum = atoi(arg2);
  if((targetRoom = get_room_index(targetRoomVnum)) == NULL)
  {
    progbug("MpOpenPassage - arg2 isn't an existing room. %s", ch->name);
  return;
  }
  if(!is_number(arg3))
  {
    if(!str_cmp(arg3, "n";) || !str_cmp(arg3, "north";)) exit_num = 0;
    else if(!str_cmp(arg3, "e";) || !str_cmp(arg3, "east";)) exit_num = 1;
    else if(!str_cmp(arg3, "s";) || !str_cmp(arg3, "south";)) exit_num = 2;
    else if(!str_cmp(arg3, "w";) || !str_cmp(arg3, "west";)) exit_num = 3;
    else if(!str_cmp(arg3, "u";) || !str_cmp(arg3, "up";)) exit_num = 4;
    else if(!str_cmp(arg3, "d";) || !str_cmp(arg3, "down";)) exit_num = 5;
    else if(!str_cmp(arg3, "ne";) || !str_cmp(arg3, "northeast";)) exit_num = 6;
    else if(!str_cmp(arg3, "nw";) || !str_cmp(arg3, "northwest";)) exit_num = 7;
    else if(!str_cmp(arg3, "se";) || !str_cmp(arg3, "southeast";)) exit_num = 8;
    else if(!str_cmp(arg3, "sw";) || !str_cmp(arg3, "southwest";)) exit_num = 9;
    else
      progbug("MpOpenPassage - arg3 isn't a valid direction name. %s", ch->name);
  }
  else if(is_number(arg3))
    exit_num = atoi(arg3);

  if((exit_num < 0) || (exit_num > MAX_DIR))
  {
    progbug("MpOpenPassage - arg3 isn't a valid direction use a number from 0 - %d. %s", MAX_DIR, ch->name);
  return;
  }
  if((pexit = get_exit(fromRoom, exit_num)) != NULL)
  {
    if(!IS_EXIT_FLAG(pexit, EX_PASSAGE))
      return;
    progbug("MpOpenPassage - Exit %d already exists. %s", exit_num, ch->name);
  return;
  }
  pexit = make_exit(fromRoom, targetRoom, exit_num);
  pexit->keyword = STRALLOC("";);
  pexit->description = STRALLOC("";);
  pexit->key = -1;
  pexit->exit_info = EX_PASSAGE;
return;
}


open mud_comm.c and find mp_close_passage

void do_mp_close_passage(CHAR_DATA *ch, char *argument)
{
  char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
  ROOM_INDEX_DATA *fromRoom;
  int fromRoomVnum, exit_num = 0;
  EXIT_DATA *pexit;

  if(!IS_NPC(ch) || IS_AFFECTED(ch, AFF_CHARM))
  {
    send_to_char("Huh?\n\r", ch);
  return;
  }
  argument = one_argument(argument, arg1);  
  argument = one_argument(argument, arg2);  
  if(arg1[0] == '\0')
  {
    progbug("MpClosePassage - Missing arg1. %s", ch->name);
  return;
  }
  if(arg2[0] == '\0')
  {
    progbug("MpClosePassage - Missing arg2. %s", ch->name);
  return;
  }
  if(!is_number(arg1))
  {
    progbug("MpClosePassage - arg1 isn't a number. %s", ch->name);
  return;
  }
  fromRoomVnum = atoi(arg1);
  if((fromRoom = get_room_index(fromRoomVnum)) == NULL)
  {
    progbug("MpClosePassage - arg1 isn't an existing room. %s", ch->name);
  return;
  }
  if(!is_number(arg2))
  {
    if(!str_cmp(arg2, "n";) || !str_cmp(arg2, "north";)) exit_num = 0;
    else if(!str_cmp(arg2, "e";) || !str_cmp(arg2, "east";)) exit_num = 1;
    else if(!str_cmp(arg2, "s";) || !str_cmp(arg2, "south";)) exit_num = 2;
    else if(!str_cmp(arg2, "w";) || !str_cmp(arg2, "west";)) exit_num = 3;
    else if(!str_cmp(arg2, "u";) || !str_cmp(arg2, "up";)) exit_num = 4;
    else if(!str_cmp(arg2, "d";) || !str_cmp(arg2, "down";)) exit_num = 5;
    else if(!str_cmp(arg2, "ne";) || !str_cmp(arg2, "northeast";)) exit_num = 6;
    else if(!str_cmp(arg2, "nw";) || !str_cmp(arg2, "northwest";)) exit_num = 7;
    else if(!str_cmp(arg2, "se";) || !str_cmp(arg2, "southeast";)) exit_num = 8;
    else if(!str_cmp(arg2, "sw";) || !str_cmp(arg2, "southwest";)) exit_num = 9;
    else
      progbug("MpOpenPassage - arg3 isn't a valid direction name. %s", ch->name);
  }
  else if(is_number(arg2))
    exit_num = atoi(arg2);
  if((exit_num < 0) || (exit_num > MAX_DIR))
  {
    progbug("MpClosePassage - arg2 isn't a valid direction use a number from 0 - %d. %s", MAX_DIR, ch->name);
  return;
  }
  if((pexit = get_exit(fromRoom, exit_num)) == NULL)
    return;    /* already closed, ignore...  so rand_progs close without spam */
  if(!IS_EXIT_FLAG(pexit, EX_PASSAGE))
  {
    progbug("MpClosePassage - Exit not a passage. %s", ch->name);
  return;
  }
  extract_exit(fromRoom, pexit);
return;
}


Hope this helps someone out :)

Edit: Board code likes to mess up code samples. Word of advice - don't use the preview function when posting code samples, just post it :)



<!--EDIT|Samson|Feb 6 2003, 11:24 AM-->
       
Pages:<< prev 1 next >>