Virtual random maze creator

zhaozj2021-02-12  148

/ ************************************************** ***** * Maze is something that is often used in a game. The previous maze requires * * Wizard a room to manually draw, time-furnished, and once * * is found by players, labyrinth The pattern is leaked, the labyrinth is not called its * * is a maze, so the wizards have twisted brains to put the maze design as complicated as possible, * *, but more complex maze will be found in the right route, and too much * * * Visually walking maze also makes players feel too cumbersome, reducing fun. So production * * Life Ideas. * * Random labyrinth generating algorithm is simple as possible, the labyrinth storage is ascended as much as possible to memory * * body, the labyrinth room uses a virtual object, handling flexible, labyrinth room only in the * * player, will be installed into memory, and labyrinth room is also like Ordinary Room * * When it is not referred to a period of time for a while, it can be destroyed, and it is not a reference to it. It can be completely destroyed for a while. The next time you need * * will be re-established. Will produce a new maze. Regional Wizard * * Writing Random Maze only requires some preset parameters such as the single-sided long, * * room description, entrance and exit description, dozens of or thousands of rooms, route * * Different random maze Ok, greatly improve the regional writing efficiency * * and the playability of the game. * * This item is currently suitable for random maze, namely: the description of the room in the labyrinth * * is the same, such as a wood, a grave, etc., if you want this object to create * * complete random area, there is a certain plot, In the area of ​​a certain pattern, it is required to specify some of the rules described in the maze in the maze according to their own situation, and the description of the neighboring room is reasonable, and the items in the room are coordinated. If * * * Members can only make the connection part of the maze, and use several maze portfolios * * into a completely random area, ha, then make a wizard to be more relaxed. * * At present, the labyrinth used in this game is generally 10 to 40 single-sided lengths. I don't know how to do more * big maze, and there is a description of this, to be based on the server performance of my * *, However, I think the most common machine makes an area * * The labyrinth for 100x100 should be a relaxed thing. * * Due to the use of Virtual Object, it is necessary to adjust the root * * according to its own system. * ********************************************************** ***** / #pragma Optimize #define N 8 #define s 4 #define W 2 #define E 1 #define all 15 / **************************** ************************* * The biggest value of the maze of the maze is currently tentative for 100, due to random maze * Create and operate the labyrinth 'area "of the resource single-edge length 100 is the * 100x100 equal to 10,000 rooms, which is generally not available. A general real-time maze (real-time maze refers to the labyrinth of the game running in the game running process * as needed to be created with a single side of the labyrinth that needs to be created with 10 to 50. If you need to create a giant maze, if there are a few * Wan and more than 10,000 rooms, the creation work should be placed in the game. When the game is turned to do, the game starts for a while (such as 20 seconds) prohibits players from login. * The game updates this maze by regular restarting. * I don't know who will use such a big maze. . . . . .

*********************************************************** ** / #define max_long 100 // As long as you can have an entrance to the room connected to other rooms. // The possible exports have three. // Define This rule can only have two exits. // It is to close one if there are three exports of rooms. // will not make players who have an export of exports because they see four directions.

#define two_valid_leaves inherit f_clean_up; class coordinate {int x; int y;} Class Coordinate * newpath = (}), / * Treat Queue * / Enter, / * Entrance coordinate * / leave; / * Exit coordinate * / private String * Valid_dirs = ({"South", "North", "West", "EAST"}); private mapping reverse_dir = ([NORTH ":" South "," South ":" North "," West ": "EAST", "EAST": "West",]); // full labyrinth export array. Private mixed * all; / ******************************** Features: **************** / Private int L; // Single long private string * inherit_rooms = ({}); // Maze allows inherited file Name Private String entry_dir; // Maze Port_Entry_Dir; // Maze Port and Region Connection Direction PRIVATE STRING LINK_ENTRY_ROOM; // Laboked Link_Exit_Dir; // Laboratory Outlet and Region Connection Direction PRIVATE String link_exit_room; // Laboratory export connection area file name Private String entry_short; // Malaze entry short description private string entry_desc; // Malaze EXIT_SHORT; // Maze Export Short description Private string exit_Desc ; // 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描 描/ Maze room is outdoor private string * maze_npcs = ({}); // Monster in the labyrinth / ******************* ---- END --- ********************* / / / set up tags. Private int maze_built = 0; // Reset the whole area variable. Private void refresh_vars (); // Establishment Maze private void create_maze (); // Select the random exit. Private int random_out (int x, int y, int N); // Processing connection. Private void link_to_north (int x, int y); private void link_to_south (int X, INT Y); Private Void Link_TO_WEST (int X, int y); Private void link_to_east (int x, int y); // Draw a map of the built labyrinth. Private void Paint_vrm_map (); private string mroom_fname (int X, int y) ) {RETURN SPRINTF ("% S /% D /% D", base_name (this_Object ()), x, y)

} Private void refresh_vars () // Reset the whole domain variable. {NewPath = (}); all = 0;} // Check private int check_vars () {INT i, N; IF on some of the necessary parameters (l <5) || L> Max_long) Return 0; inherit_rooms - = ({0}); if (! n = sizeof (inherit_rooms)) Return 0; for (i = 0; Iif (! Stringp (inherit_rooms [i ]) || (inherit_rooms [i] == ""))

Return 0;

IF (! Stringp (entry_dir) || (Member_Array (entry_dir, valid_dirs) == -1)

)

Return 0;

/ *

IF (! stringp (link_entry_dir) || (MEMBER_ARRAY (LINK_ENTRY_DIR, VALID_DIR

s) == -1)))))

Return 0;

IF (! stringp (link_exit_dir) || (MEMBER_ARRAY (Link_exit_Dir, Valid_DIRS)

== -1)))))

Return 0;

* /

IF (! stringp (limited_entry_room) || (link_entry_room == "))

Return 0;

IF (! stringp (link_exit_room) || (link_exit_room == "))

Return 0;

IF (! Stringp (entry_short) || (entry_short == ")))

Return 0;

IF (! Stringp (exit_short) || (exit_short == ")))

Return 0;

IF (! stringp (entry_desc) || ​​(entry_desc == ")))

Return 0;

IF (! Stringp (exit_desc) || ​​(exit_desc == ")))

Return 0;

MAZE_ROOM_DESC - = ({0});

IF (! n = sizeof (maze_room_desc))

Return 0;

For (i = 0; i

IF (! Stringp (Maze_room_Desc [i]) || (Maze_room_Desc [i] == ""))

Return 0;

IF (! Stringp (Maze_room_short) || (Maze_room_short == "))

Return 0;

Return 1;

}

Private int random_out (int x, int y, int N) // Select the random exit function.

{

INT * OUTS = ({}), RETN = 0;

Class Coordinate Temp;

// the West Room IS (X-1, Y)

IF (N & W

&& ((x-1)> = 0)

&&! all [x-1] [y])

{

Temp = new (class coordinate);

TEMP-> x = X-1;

TEMP-> Y = Y;

// The western room is not in the list of NewPath to be handled.

// if (Member_Array (Temp, NewPath) == -1) OUTS = ({W});

}

// the East Room IS (x 1, y)

IF (N & E

&& ((x 1)

&&! all [x 1] [y])

{

Temp = new (class coordinate);

TEMP-> x = x 1;

TEMP-> Y = Y;

// The room in the east is not in the list of NewPath to be processed.

// if (Member_Array (Temp, NewPath) == -1)

OUTS = ({E});

}

// The South Room IS (X, Y-1)

IF (N & S

&& ((Y-1)> = 0)

&&! all [x] [Y-1])

{

Temp = new (class coordinate);

Temp-> x = x;

TEMP-> Y = Y-1;

// The room in the south is not in the list of NewPath to be handled.

// if (Member_Array (Temp, NewPath) == -1)

Outs = ({s});

}

// the North Room IS (x, y 1)

IF (N & N

&& (Y 1)

&&! all [x] [y 1])

{

Temp = new (class coordinate);

Temp-> x = x;

TEMP-> y = y 1;

// The northern room is not in the list of NewPath to be processed.

// if (Member_Array (Temp, NewPath) == -1)

OUTS = ({n});

}

#ifdef two_valid_leaves

// If there are three exits, random closes one.

IF (Sizeof (Outs)> = 3)

OUTS - = ({OUTS [Random (Sizeof (Outs))]});

#ENDIF

For (int i = 0; i

RETN | = OUTS [I];

Return Retn;

}

Private void create_maze ()

{

INT I;

Class Coordinate * Valid_leaves = (}), TEMP;

Refresh_vars (); // Reset a variable.

if (! Check_vars ()) // checks some preset variables.

Return;

// 1. Determine the maze single edge.

All = Allocate (L);

For (i = 0; i

Allocate (1); // Establish an array.

Enter = New (class coordinate);

Switch (entry_dir)

{

Case "South":

// ENTER entry coordinates.

Enter-> x = to_int (l / 2); // Take the labyrinth relatively balanced.

ENTER-> Y = 0;

All [Enter-> x] [ENTER-> Y] | = S;

Break;

Case "north":

ENTER-> x = TO_INT (L / 2);

ENTER-> Y = L-1;

All [Enter-> X] [ENTER-> Y] | = N;

Break;

Case "West":

ENTER-> Y = TO_INT (L / 2);

ENTER-> X = 0;

All [Enter-> X] [ENTER-> Y] | = W;

Break;

Case "EAST":

ENTER-> Y = TO_INT (L / 2);

ENTER-> X = L-1;

All [Enter-> X] [ENTER-> Y] | = E;

Break;

}

// Store to be processed queue.

NewPath = ({ENTER});

// Enter the main loop.

DO

{

INT X, Y, OUT, NUMB;

// Make some monitoring and initialization.

IF (! (NUMB = SIZEOF (NewPath)))))))

CONTINUE;

Numb = random (NUMB);

RESET_EVAL_COST ();

x = newpath [NUMB] -> X;

Y = newpath [NUMB] -> Y;

// If there are three possible exports to close an exit:

OUT = all ^ (all [x] [y]);

OUT = random_out (x, y, out);

if (! out) // There is no possible export.

{

Newpath - = ({newpath [numb]});

CONTINUE;

}

// Process the connection.

IF (OUT & W) LINK_TO_WEST (X, Y);

IF (OUT & E) LINK_TO_EAST (X, Y);

IF (OUT & N) LINK_TO_NORTH (X, Y);

IF (OUT & S) LINK_TO_SOUTH (X, Y);

// The current room is processed.

Newpath - = ({newpath [numb]});

}

While (sizeof (newpa));

Switch (entry_dir)

{

Case "West":

For (i = 0; i

IF (all [l-1] [i])

{

Temp = new (class coordinate);

TEMP-> x = L-1;

TEMP-> Y = I;

Valid_leaves = ({TEMP});

}

Break;

Case "EAST":

For (i = 0; i

IF (all [0] [i])

{

Temp = new (class coordinate);

TEMP-> x = 0;

TEMP-> Y = I;

Valid_leaves = ({TEMP});

}

Break;

Case "South":

For (i = 0; i

IF (all [i] [l-1])

{

Temp = new (class coordinate);

TEMP-> x = I;

Temp-> y = l-1;

Valid_leaves = ({TEMP});

}

Break;

Case "north":

For (i = 0; i

IF (all [i] [0])

{

Temp = new (class coordinate);

TEMP-> x = I;

TEMP-> y = 0;

Valid_leaves = ({TEMP});

}

Break;

}

IF (! (i = sizeof (valid_leaves))) // No export must be re-established

{

Call_oTher (this_Object (), "create_maze");

Return;}

IF (i == 1)

Leave = Valid_leaves [0];

Else

Leave = Valid_leaves [Random (i)]; // Randomly select one.

Switch (entry_dir)

{

Case "South":

All [Leave-> x] [Leave-> Y] | = N;

Break;

Case "north":

All [Leave-> x] [Leave-> Y] | = S;

Break;

Case "West":

All [Leave-> x] [Leave-> Y] | = E;

Break;

Case "EAST":

All [Leave-> x] [Leave-> Y] | = W;

Break;

}

// The maze is created.

MAZE_BUILT = 1;

// Draw a completed maze map.

// The map file is the '.map' file with the same name in the same directory.

// Draw a map may benefit the work of the regional wizard.

// If you need to open objects to 'write' in this directory.

// paint_vrm_map ();

}

Private void link_to_west (int x, int y) // the West Room IS (X-1, Y)

{

Class Coordinate Temp;

// can't link. The current room is already the most western room.

IF ((x-1) <0)

Return;

Temp = new (class coordinate);

TEMP-> x = X-1;

TEMP-> Y = Y;

// The west of the room has been in PATH or has been in the list of NEWPATH.

IF (all [Temp-> x] [TEMP-> Y] / * || MEMBER_ARRAY (TEMP, NewPath) * /)

Return;

All [x] [y] | = W;

All [Temp-> x] [TEMP-> Y] | = E;

NewPath = ({TEMP});

}

PRIVATE VOID LINK_TO_EAST (INT X, INT Y) // The East Room IS (X 1, Y)

{

Class Coordinate Temp;

// can't link. The current room is already the most east room.

IF ((x 1)> = L)

Return;

Temp = new (class coordinate);

TEMP-> x = x 1;

TEMP-> Y = Y;

// The room in the east has been in PATH or has been in the list of NewPath to be processed.

IF (all [Temp-> x] [TEMP-> Y] / * || MEMBER_ARRAY (TEMP, NewPath) * /)

Return;

All [x] [y] | = e;

All [Temp-> x] [TEMP-> Y] | = W;

NewPath = ({TEMP});

}

Private void link_to_south (int x, int y) // the South Room IS (x, y-1)

{

Class Coordinate Temp;

// can't Link. The current room is already the southernmost room.

IF ((Y-1) <0)

Return;

Temp = new (class coordinate);

Temp-> x = x;

TEMP-> Y = Y-1;

/ / The room in the southern end has been in PATH, or it has been in the list newpath .IF (all [Temp-> x] [Temp-> Y] / * || MEMBER_ARRAY (TEMP, NewPath) * /)

Return;

All [x] [y] | = s;

All [Temp-> x] [TEMP-> Y] | = N;

NewPath = ({TEMP});

}

PRIVATE VOID LINK_TO_NORTH (INT X, INT Y) // The North Room IS (X, Y 1)

{

Class Coordinate Temp;

// can't link. The current room is already the northernmost room.

IF ((y 1)> = L)

Return;

Temp = new (class coordinate);

Temp-> x = x;

TEMP-> y = y 1;

// The northern end room has been in PATH or in the list of NEWPATH to be processed.

IF (all [Temp-> x] [TEMP-> Y] / * || MEMBER_ARRAY (TEMP, NewPath) * /)

Return;

All [x] [y] | = n;

All [Temp-> x] [TEMP-> Y] | = S;

NewPath = ({TEMP});

}

// Draw a map of the labyrinth has been built.

PRIVATE VOID PAINT_VRM_MAP ()

{

String Hor = "─", ver = "│", Room = "◎", SROOM = "●";

INT X, Y;

String Output = "", map_file;

For (y = (l-1); y> = 0; y -

{

RESET_EVAL_COST ();

Output = Sprintf ("Y =% - 3D:", Y);

For (x = 0; x

{

Output = Sprintf ("% s",

(((x == Enter-> x) && (y == Enter-> Y)))

|| ((x == Leave-> x) && (y == leave-> y))))))))))

SROOM: ROOM);

IF ((all [x] [y]) & e) // Have EAST

Output = HOR;

Else

OUTPUT = ""

}

Output = "/ n";

OUTPUT = ""

For (x = 0; x

{

IF ((All [x] [y]) & s) // Have South

Output = VER;

Else

OUTPUT = ""

}

Output = "/ n";

}

Map_file = sprintf ("% s.map", base_name (this_Object ()));

Write_file (Map_File, Output, 1);

}

Nomask Int Clean_up ()

{

String fname;

INT X, Y;

Object * maze_objs = ({}), link_room;

IF (! maze_built)

{

DEStruct (this_Object ()); Return 0;

}

FNAME = base_name (this_Object ());

IF (Objectp (Link_Room = Find_Object (Sprintf ("% s / Entry", FNAME)))))))

{

LINK_ROOM-> Clean_up ();

IF (ObjectP (Link_Room))

Return 1;

}

IF (Objectp (Link_Room = Find_Object (Sprintf ("% s / exit", fname))))))))))

{

LINK_ROOM-> Clean_up ();

IF (ObjectP (Link_Room))

Return 1;

}

For (x = 0; x

FOR (y = 0; y

IF (file_object (sprintf ("% s /% D /% D", FNAME, X, Y)))))

MAZE_OBJS = ({FIND_OBJECT (Sprintf ("% s /% D /% D", FNAME, X, Y)});

Maze_objs-> clean_up ();

Maze_Objs - = ({0});

IF (SizeOf (Maze_Objs))

Return 1;

Else

{

DESTRUCT (this_Object ());

Return 0;

}

}

// The wizard can enforce the maze,

/ / But the player in the maze is going to void.

Void Remove (String EUID)

{

String fname = base_name (this_Object ());

Object m_room;

INT X, Y;

For (x = 0; x

FOR (y = 0; y

IF (objectp (m_room = find_object (sprintf ("% s /% D /% D", FNAME, X, Y)))))

DESTRUCT (M_ROOM);

IF (Find_Object (Sprintf ("% s / Entry", FNAME))))

DESTRUCT (Sprintf ("% s / entry", fname);

IF (Find_Object (Sprintf ("% s / exit", fname)))

DEStruct (Sprintf ("% s / exit", fname));

}

/ **** The following is an interface function for preset maze parameters **** /

// Single side of the maze

Void set_maze_long (int mlong)

{

IF (! INTP (MLONG))

Return;

// The smallest is 5, and there is no significance.

IF ((Mlong <5) || Mlong> Max_long)

Return;

l = mlong;

}

// The name of the object inherited by the labyrinth room.

Void set_inherit_room (mixed rooms)

{

IF (StringP (Rooms))

{

// Whether this archive exists

IF (file_size (sprintf ("% s.c", rooms)> 0)

Inherit_rooms = ({Rooms});

Return;

}

ELSE IF (ArrayP (Rooms))

{

FOREACH (String f in rooms)

{

IF (! Stringp (f) || f == "")

Return;

IF (file_size (sprintf ("% s.c", f)) <= 0)

Return;

}

Inherit_rooms = rooms; return;

}

Return;

}

// Inlet direction (export is opposite)

Void set_entry_dir (String Dir)

{

IF (! Stringp (DIR))

Return;

The legality check in the inlet direction.

IF (MEMBER_ARRAY (Dir, Valid_Dirs) == -1)

Return;

Entry_dir = DIR;

}

// Inlet connection direction and region

Void set_link_entry_dir (String Dir)

{

IF (! Stringp (Dir) || DIR == "")

Return;

LINK_ENTRY_DIR = DIR;

}

// File name of the area file connected to the labyrinth entrance

Void set_link_entry_room (String Lroom)

{

IF (! Stringp (lroom) || lroom == "")

Return;

IF (file_size (sprintf ("% s.c", lroom) <= 0)

Return;

LINK_ENTRY_ROOM = LROOM

}

// Export and regional connection direction

Void set_link_exit_dir (String Dir)

{

IF (! Stringp (Dir) || DIR == "")

Return;

LINK_EXIT_DIR = DIR;

}

// File name of the area file connected to the labyrinth export

Void set_link_exit_room (string lroom)

{

IF (! Stringp (lroom) || lroom == "")

Return;

IF (file_size (sprintf ("% s.c", lroom) <= 0)

Return;

LINK_EXIT_ROOM = LROOM

}

// Short description of the labyrinth entrance

Void set_entry_short (String Desc)

{

IF (! Stringp (DESC) || DESC == "")

Return;

Entry_short = desc;

}

// Long description of the labyrinth entrance

Void set_entry_desc (string desc)

{

IF (! Stringp (DESC) || DESC == "")

Return;

Entry_Desc = desc;

}

// Short description of the labyrinth export

Void set_exit_short (String Desc)

{

IF (! Stringp (DESC) || DESC == "")

Return;

EXIT_SHORT = DESC;

}

// Long description of the maze export

Void set_exit_desc (String Desc)

{

IF (! Stringp (DESC) || DESC == "")

Return;

EXIT_DESC = DESC;

}

// Short description of the labyrinth room

Void set_maze_room_short (String Desc)

{

IF (! Stringp (DESC) || DESC == "")

Return;

MAZE_ROOM_SHORT = DESC;

}

// Description of the labyrinth room, if there are multiple descriptions, manufacture each room

// will be randomly selected from it.

Void set_maze_room_desc (mixed desces)

{

IF (StringP (Desces)) {

MAZE_ROOM_DESC = ({Desique);

Return;

}

IF (ArrayP (Desces))

{

FOREACH (String Desc in Desces)

IF (! Stringp (DESC))

Return;

MAZE_ROOM_DESC = Desces;

Return;

}

}

// Is the labyrinth room is an outdoor room

Void set_outdoors (int outd)

{

IF (! INTP (OUTD))

Return;

IF (OUTD)

IS_outdoors = 1;

}

// Monster in the maze

Void set_maze_npcs (Mixed NPC)

{

IF (StringP (NPC))

{

// Whether this archive exists

IF (file_size (sprintf ("% s.c", npc)> 0)

MAZE_NPCS = ({NPC});

Return;

}

ELSE IF (ArrayP (NPC))

{

FOREACH (String F in NPC)

{

IF (! Stringp (f) || f == "")

Return;

IF (file_size (sprintf ("% s.c", f)) <= 0)

Return;

}

MAZE_NPCS = NPC;

Return;

}

Return;

}

/ **** More interface functions for preset maze parameters **** /

// Create a labyrinth room, called by Virtual_D.

Nomask Object Query_maze_room (String STR)

{

INT random_rate = 20; // Possibility of NPC in the room

INT IDX, X, Y, EXITS;

Object ob;

String f;

IF (Previous_Object () && (getEuid (previous_Object ())! = root_uid))

Return 0;

IF (! Stringp (STR) || Str == "")

Return 0;

IF (! maze_built) // Maze does not establish

CREATE_MAZE ();

IF (! maze_built)

Return 0;

IF (str == "entry") // Maze entry room

{

f = inherit_rooms [random (Sizeof (inherit_rooms)];

OB = new (f);

IF (! ob)

Return 0;

OB-> set ("Virtual_Room", 1);

Ob-> set ("short", entry_short);

OB-> Set ("long", entry_desc);

IF (is_outdoors)

OB-> Set ("OutDoors", 1);

OB-> Set (Sprintf ("EXITS /% S", LINK_ENTRY_DIR, LINK_ENTRY_ROOM);

OB-> set (Sprintf ("EXITS /% S", Reverse_Dir [Entry_Dir]), MROOM_FNAME (Enter

-> x, enter-> y);

IF (SizeOf (Maze_npcs) && (Random (100) <= random_rate))

{

OB-> set ("Objects",

MAZE_NPCS [Random (sizeof (MAZE_NPCS))]: 1,]));

OB-> setup ();

}

Return OB;

}

IF (str == "exit") // Maze outlet room

{

f = inherit_rooms [random (Sizeof (inherit_rooms)];

OB = new (f);

IF (! ob)

Return 0;

OB-> set ("Virtual_Room", 1);

Ob-> set ("short", exit_short);

OB-> Set ("long", exit_desc);

IF (is_outdoors)

OB-> Set ("OutDoors", 1);

Ob-> set (Sprintf ("EXITS /% S", LINK_EXIT_DIR, LINK_EXIT_ROOM);

Ob-> set (Sprintf ("EXITS /% S", Entry_Dir),

MROOM_FNAME (Leave-> X, Leave-> Y));

IF (SizeOf (Maze_npcs) && (Random (100) <= random_rate))

{

OB-> set ("Objects",

MAZE_NPCS [Random (sizeof (marze_npcs)]: 1,

]));

OB-> setup ();

}

Return OB;

}

IDX = MEMBER_ARRAY ('/', STR);

IF (idx == -1)

Return 0;

IF (! SSCANF (STR [0..idx-1], "% D", X))

Return 0;

IF (! SSCANF (STR [IDX 1 ..], "% D", Y))

Return 0;

IF (! EXITS = all [x] [y])

Return 0;

f = inherit_rooms [random (Sizeof (inherit_rooms)];

OB = new (f);

IF (! ob)

Return 0;

OB-> set ("Virtual_Room", 1);

OB-> Set ("Short", Maze_room_short);

OB-> set ("long", maj_room_desc [random (sizeof (marze_room_desc))]);

IF (is_outdoors)

OB-> Set ("OutDoors", 1);

IF (EXITS & W)

OB-> Set ("exits / west", mroom_fname (x-1, y);

IF (EXITS & E)

OB-> set ("exits / east", mroom_fname (x 1, y));

IF (EXITS & N)

Ob-> set ("exits / north", mroom_fname (x, y 1));

IF (EXITS & S)

Ob-> set ("exits / South", MROOM_FNAME (X, Y-1));

IF ((x == Enter-> x) && (y == Enter-> Y))

Ob-> set (Sprintf ("EXITS /% S", Entry_Dir),

Sprintf ("% s / entry", base_name (this_Object ())))); if ((x == Leave-> x) && (y == leave-> y))

Ob-> set (Sprintf ("EXITS /% S", Reverse_Dir [Entry_Dir]),

Sprintf ("% s / exit", base_name (this_Object ())))))

IF (SizeOf (Maze_npcs) && (Random (100) <= random_rate))

{

OB-> set ("Objects",

MAZE_NPCS [Random (sizeof (marze_npcs)]: 1,

]));

OB-> setup ();

}

Return OB;

}

转载请注明原文地址:https://www.9cbs.com/read-7020.html

New Post(0)