Re: Vehicle Code

From: Scott Warren (dswarren@MAIL.CLT.BELLSOUTH.NET)
Date: 08/16/97


Sorry, forgot one attachment.

--8<--

Hi to all that responed to my not on the circle mail list. Below are
excerpts from diff files. I've made a lot of changes to the code I'm
working on so there may be some incompatabilities between these and
stock circles. I think the only other things needed are some defines:
ROOM_HELM, ITEM_SAILBOAT, ITEM_ENTERABLE, ITEM_CAR, and (if you want)
SECT_PIER - I used pier for an area that could handle both water vessels
and walking peoples. Let me know what doesn't fit and I'll help you get
it working (and update this file which will be posted on the ftp site).

Scott Warren - the code tinkerer formerly known as Calain ;)



*** act.informative.c   Sun Apr 14 03:08:31 1996
--- othersrc/act.informative.c  Fri Jul 11 11:06:07 1997
***************
*** 46,52 ****
--- 49,125 ----
  extern char *room_bits[];
  extern char *spells[];

+ /* global */
+ int boot_high = 0;
+
  long find_class_bitvector(char arg);
+ struct char_data *find_mount(struct char_data *ch);
+ int visibility(void);
+ void do_look_out(struct char_data *ch);
+
+
+ int search_keywords(char *word, struct char_data *tch)
+ { char *tmp;
+   if((tmp = strstr(tch->player.keywords, word)))
+      return 1;
+   return 0;
+  }
+ void look_in_direction(struct char_data *ch, int dir)
+ {void list_char_to_char(struct char_data *list, struct char_data *ch);
+  int roomnum;
+  int distance;
+
+  if(EXIT(ch, dir))
+  {
+  if(EXIT(ch, dir)->general_description)
+   send_to_char(EXIT(ch, dir)->general_description, ch);
+  else
+   send_to_char("You see nothing special.\r\n", ch);
+  if(IS_SET(EXIT(ch, dir)->exit_info, EX_CLOSED) &&
+                EXIT(ch, dir)->keyword)
+  { sprintf(buf, "The %s is closed.\r\n", fname(EXIT(ch, dir)->keyword));
+    send_to_char(buf, ch);
+  }
+  else
+  { if(IS_SET(EXIT(ch, dir)->exit_info, EX_ISDOOR) && EXIT(ch, dir)->keyword)
+    { sprintf(buf, "The %s is open.\r\n", fname(EXIT(ch, dir)->keyword));
+      send_to_char(buf, ch);
+      send_to_char(CCYEL(ch, C_NRM), ch);
+    }
+    distance = visibility();
+    send_to_char("[near]\r\n", ch);
+    if(IS_DARK(EXIT(ch, dir)->to_room) || distance < 1 ||
+            IS_SET(EXIT(ch, dir)->to_room, ROOM_NOSEE))
+      {send_to_char("Can't see that far.\r\n", ch);
+       return;
+      }
+    list_char_to_char(world[EXIT(ch, dir)->to_room].people, ch);
+    roomnum = EXIT(ch, dir)->to_room;
+    if(CAN_GO2(roomnum, dir))
+     { send_to_char("[far]\r\n", ch);
+       if(IS_DARK(EXIT2(roomnum, dir)->to_room) || distance < 2 ||
+             IS_SET(EXIT2(roomnum, dir)->to_room, ROOM_NOSEE))
+       { send_to_char("Can't see that far.\r\n", ch);
+         return;
+       }
+       list_char_to_char(world[EXIT2(roomnum,dir)->to_room].people, ch);
+      roomnum = EXIT2(roomnum, dir)->to_room;
+      if(CAN_GO2(roomnum, dir))
+      { send_to_char("[very far]\r\n", ch);
+        if (IS_DARK(EXIT2(roomnum, dir)->to_room) || distance < 3 ||
+              IS_SET(EXIT2(roomnum, dir)->to_room, ROOM_NOSEE))
+          { send_to_char("Can't see that far.\r\n", ch);
+            return;
+          }
+        list_char_to_char(world[EXIT2(roomnum,dir)->to_room].people, ch);
+        return;
+      }
+     }
+    }
+   }
+ return;
+ }
+

  void show_obj_to_char(struct obj_data * object, struct char_data * ch,
                        int mode)



2nd patch:
*** act.movement.c      Sat Apr 13 20:02:07 1996
--- othersrc/act.movement.c     Mon Jul  7 10:29:52 1997
***************
*** 34,41 ****
  int special(struct char_data *ch, int cmd, char *arg);
  void death_cry(struct char_data *ch);
  int find_eq_pos(struct char_data * ch, struct obj_data * obj, char *arg);

!

  /* simple function to determine if char can walk on water */
  int has_boat(struct char_data *ch)
--- 33,77 ----
  int special(struct char_data *ch, int cmd, char *arg);
  void death_cry(struct char_data *ch);
  int find_eq_pos(struct char_data * ch, struct obj_data * obj, char *arg);
+ void mprog_greet_trigger(struct char_data * ch);
+ void mprog_entry_trigger(struct char_data * mob);
+ struct char_data *find_mount(struct char_data *ch);
+ void enter_an_object(struct char_data *ch, struct obj_data *obj);
+ void leave_an_object(struct char_data *ch);
+ char *find_exdesc(char *temp, struct extra_descr_data *temp2);
+ int checkmovetrap(struct char_data *ch, int door);
+ int checkopen(struct char_data *ch, struct obj_data *obj);
+ int search_keywords(char *arg, struct char_data *ch);
+
***************
***************
*** 195,200 ****
--- 284,292 ----
     * It cannot be done in perform_move because perform_move is called
     * by other functions which do not require the remapping.
     */
+ /* if PLR_DRIVING go ahead and unset the flag. safest thing to do I guess */
+   if(IS_SET(PLR_FLAGS(ch), PLR_PILOT))
+     TOGGLE_BIT(PLR_FLAGS(ch), PLR_PILOT);
    perform_move(ch, cmd - 1, 0);
  }

***************
*** 432,443 ****

  ACMD(do_enter)
  {
!   int door;

    one_argument(argument, buf);

    if (*buf) {                 /* an argument was supplied, search for door
                                 * keyword */
      for (door = 0; door < NUM_OF_DIRS; door++)
        if (EXIT(ch, door))
        if (EXIT(ch, door)->keyword)
--- 533,559 ----

  ACMD(do_enter)
  {
!   int door, bits;
!   struct char_data *dummy = NULL;
!   struct obj_data *found_obj = NULL;

    one_argument(argument, buf);

+   if (GET_POS(ch) == POS_RIDING)
+      { send_to_char("Not while mounted.\r\n", ch);
+        return; }
    if (*buf) {                 /* an argument was supplied, search for door
                                 * keyword */
+ /* first do checks for entering an ITEM_SAILBOAT or ITEM_CAR (ITEM_TENT
+    later) want to put as little new code here as possible. */
+     bits = generic_find(buf, FIND_OBJ_ROOM, ch, &dummy, &found_obj);
+     if(found_obj != NULL && (GET_OBJ_TYPE(found_obj) == ITEM_CAR ||
+              GET_OBJ_TYPE(found_obj) == ITEM_SAILBOAT ||
+              GET_OBJ_TYPE(found_obj) == ITEM_ENTERABLE))
+     {
+     enter_an_object(ch, found_obj);
+     return;
+     }
      for (door = 0; door < NUM_OF_DIRS; door++)
        if (EXIT(ch, door))
        if (EXIT(ch, door)->keyword)
***************
*** 467,473 ****
  ACMD(do_leave)
  {
    int door;
!
    if (!IS_SET(ROOM_FLAGS(ch->in_room), ROOM_INDOORS))
      send_to_char("You are outside.. where do you want to go?\r\n", ch);
    else {
--- 583,593 ----
  ACMD(do_leave)
  {
    int door;
!   if(IS_SET(ROOM_FLAGS(ch->in_room), ROOM_LEAVE))
!    {
!    leave_an_object(ch);
!    return;
!    }
    if (!IS_SET(ROOM_FLAGS(ch->in_room), ROOM_INDOORS))
      send_to_char("You are outside.. where do you want to go?\r\n", ch);
    else {
***************


AND
of course add do_sail and do_drive to interpreter.c


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST