Dear all friend, please help
I don't desire to insert overland in my mud, and in internet I have found this snippet:
Recursive Mapper By Noah Skelton, February 26, 2002
First:
You might want to cedit map and make it a level 1 command..
In act_info.c:
in function do_config find:
else if ( IS_IMMORTAL( ch )
&& !str_prefix( arg+1, "map" ) ) bit = PLR_AUTOMAP; /* maps */
and change it to:
else if (!str_prefix( arg+1, "map" ) ) bit = PLR_AUTOMAP; /* maps */
in function do_look find:
if ( !IS_NPC(ch) && xIS_SET(ch->act, PLR_AUTOMAP) ) /* maps */
{
if(ch->in_room->map != NULL)
{
do_lookmap(ch, NULL);
}
}
And change it to look like this:
if ( !IS_NPC(ch) && xIS_SET(ch->act, PLR_AUTOMAP) ) /* maps */
{
do_lookmap(ch, "auto");
}
In mapout.c:
up at the top where the function declarations are:
find:
void draw_map (CD * ch, RID * rm, int flag, int mode);
change it to:
void draw_map(CHAR_DATA *ch, byte map[50][50]);
and below it paste this:
void CheckRoom(ROOM_INDEX_DATA *location, int PosX, int PosY, byte map[50][50]);
void CheckExitDir(ROOM_INDEX_DATA *location, int PosX, int PosY, int Exd, byte map[50][50]);
int center, MapDiameter;
find the function do_lookmap and delete it and paste this in its place:
void do_lookmap( CHAR_DATA *ch, char *argument )
{
ROOM_INDEX_DATA *location;
int x, y;
byte map[50][50];
if (!str_cmp( argument, "auto" ))
MapDiameter = 5;
else
MapDiameter = atoi(argument);
if ( MapDiameter < 3)
MapDiameter = 3;
else if (MapDiameter>49)
MapDiameter = 49;
x = (MapDiameter/2) * 2;
if(MapDiameter==x)
MapDiameter--;
center = MapDiameter/2+1;
location = get_room_index(ch->in_room->vnum);
for (y=0;y<=MapDiameter;++y){for (x=0;x<=MapDiameter;++x){map[x][y]=(SECT_MAX+1);}}
CheckRoom(location, center, center, map);
map[center][center] = ch->in_room->sector_type;
draw_map(ch, map);
return;
}
After you do that paste this in below it:
void CheckRoom(ROOM_INDEX_DATA *location, int CX, int CY, byte map[50][50])
{
int PosX, PosY;
PosX=CX; PosY=CY-1;
if (PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0)
CheckExitDir(location, PosX, PosY, DIR_NORTH, map);
PosX=CX; PosY=CY+1;
if (PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0)
CheckExitDir(location, PosX, PosY, DIR_SOUTH, map);
PosX=CX+1; PosY=CY;
if (PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0)
CheckExitDir(location, PosX, PosY, DIR_EAST, map);
PosX=CX-1; PosY=CY;
if (PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0)
CheckExitDir(location, PosX, PosY, DIR_WEST, map);
PosX=CX+1; PosY=CY-1;
if (PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0)
CheckExitDir(location, PosX, PosY, DIR_NORTHEAST, map);
PosX=CX-1; PosY=CY-1;
if (PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0)
CheckExitDir(location, PosX, PosY, DIR_NORTHWEST, map);
PosX=CX+1; PosY=CY+1;
if (PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0)
CheckExitDir(location, PosX, PosY, DIR_SOUTHEAST, map);
PosX=CX-1; PosY=CY+1;
if (PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0)
CheckExitDir(location, PosX, PosY, DIR_SOUTHWEST, map);
return;
}
void CheckExitDir(ROOM_INDEX_DATA *location,int X, int Y, int ExD, byte map[50][50])
{
EXIT_DATA *xit;
if(get_exit(location, ExD))
{
xit = get_exit(location, ExD);
if(map[X][Y]==(SECT_MAX+1) && !IS_SET(xit->exit_info, EX_CLOSED))
{
location = get_room_index(xit->vnum);
map[X][Y] = location->sector_type;
CheckRoom(location, X, Y, map);
}
}
return;
}
Now find the function draw_map, delete it and put this in its place:
void draw_map(CHAR_DATA *ch, byte map[50][50])
{
int x,y;
char *sect;
for (y=1;y<= MapDiameter;++y)
{
for (x=1;x<=MapDiameter;++x)
{
switch(map[x][y])
{
default:
sect = "&R&r?";
break;
case SECT_INSIDE:
sect = "&z#";
break;
case SECT_CITY:
sect = "&P.";
break;
case SECT_FIELD:
sect = "&G.";
break;
case SECT_FOREST:
sect = "&G@";
break;
case SECT_HILLS:
sect = "&G^^";
break;
case SECT_MOUNTAIN:
sect = "&W^^";
break;
case SECT_WATER_SWIM:
sect = "&B~";
break;
case SECT_WATER_NOSWIM:
sect = "&B~";
break;
case SECT_UNDERWATER:
sect = "&R&b-";
break;
case SECT_AIR:
sect = "&W@";
break;
case SECT_DESERT:
sect = "&Y.";
break;
case SECT_OCEANFLOOR:
sect = "&B-";
break;
case SECT_UNDERGROUND:
sect = "&z.";
break;
case SECT_LAVA:
sect = "&R~";
break;
case SECT_SWAMP:
sect = "&G~";
break;
case (SECT_MAX+1):
sect = " ";
break;
}
if(x==center && y==center)
sect = "&R*";
send_to_char_color(sect, ch);
}
send_to_char("\n\r",ch);
}
return;
}
+++++++++++++++++++++++++++++++++++++++++
continue in other post |