Some examples of the holocode and associated functions


These five functions are all on the new features list of Medievia IV, thus proving that the code I reviewed is definitely not Medievia III. Note that these functions are listed as examples and are of little value other than proving a point. I am using them as small "quotes" of a much larger work in order to prove my point, as permitted by the fair use act (Section 107 of the Copyright Act of 1976).
int iMakeHoloRoom(int x,int y)
{
int iRoom=0;
unsigned short int usiMap;
struct char_data *vict=NULL, *next_v=NULL;
struct obj_data *obj=NULL, *next_o=NULL;
struct room_affect *ra=NULL,*ran=NULL;
struct FREIGHT *stpF=NULL,*stpFNext=NULL;

	if(Holo[x][y]>255){

/******************************************************************/
/******************************************************************/
/******************************************************************/
              /* TO BE REMOVED AFTER INITIAL TESTING*/
		if(world[Holo[x][y]]&&(world[Holo[x][y]]->holox!=x||world[Holo[x][y]]->holoy!=y)){
			log_hd("##Holocode seems confused, error 6130");
			SUICIDE;
		}		
/******************************************************************/
/******************************************************************/
/******************************************************************/
		if(world[Holo[x][y]]){
			return(Holo[x][y]);
		}else{
			log_hd("##Holocode seems confused, error 6150");
			SUICIDE;
		}
	}	
	if(!stpHoloRTemplates[Holo[x][y]]){
		sprintf(log_buf,"## need to make HoloRoom %d at %d by %d",Holo[x][y],x,y);
		log_hd(log_buf);
		return(0);		
	}
	if(Holo[x][y]==215)/*blocking link room*/
		return(0);
	if(iNextRoom)
		iRoom=iGetNextRoom();
	if(!iNextRoom){/*reuse mode*/
		igHoloReuse++; 
		iRoom=stpLastHoloRoom->number;
		stpLastHoloRoom=stpLastHoloRoom->holoprev;
		stpLastHoloRoom->holonext=NULL;
		Holo[world[iRoom]->holox][world[iRoom]->holoy]=world[iRoom]->holoroom;
		if(world[iRoom]->dir_option[NORTH])
			world[iRoom]->dir_option[NORTH]=my_free(world[iRoom]->dir_option[NORTH]);
		if(world[iRoom]->dir_option[SOUTH])
			world[iRoom]->dir_option[SOUTH]=my_free(world[iRoom]->dir_option[SOUTH]);
		if(world[iRoom]->dir_option[EAST])
			world[iRoom]->dir_option[EAST]=my_free(world[iRoom]->dir_option[EAST]);
		if(world[iRoom]->dir_option[WEST])
			world[iRoom]->dir_option[WEST]=my_free(world[iRoom]->dir_option[WEST]);
		if(world[iRoom]->dir_option[UP])
			world[iRoom]->dir_option[UP]=my_free(world[iRoom]->dir_option[UP]);
		if(world[iRoom]->dir_option[DOWN])
			world[iRoom]->dir_option[DOWN]=my_free(world[iRoom]->dir_option[DOWN]);
		/* stick freight in void cause room is being reused... when room is remade they will be put back */
		for(stpF=world[iRoom]->stpFreight;stpF;stpF=stpFNext){
			stpFNext=stpF->stpNextInRoom;
			FreightFromRoom(stpF);
			FreightToRoom(stpF,0);
			stpF->iLocationX=world[iRoom]->holox;
			stpF->iLocationX=world[iRoom]->holoy;
		}
		for(vict=world[iRoom]->people;vict;vict=next_v){
			next_v=vict->next_in_room;
			if(IS_NPC(vict)&&!IS_DEAD(vict)){
				extract_char(vict,TRUE);
			}else{
				sprintf(log_buf,"##HCode re-using a room with a player(%s)",GET_NAME(vict));
				log_hd(log_buf);				
			}
		}                                                                                                                                            
		for(obj=world[iRoom]->contents;obj;obj=next_o){
			next_o=obj->next_content;
			if(obj->item_number!=9811)
				extract_obj(obj);
		}                                                                                                     
		for(ra=world[iRoom]->room_afs;ra;ra=ran){
			ran=ra->next;
			remove_room_affect(ra,0);			
		}                                                                                                                                                
		usiMap=Holo[x][y];
		Holo[x][y]=iRoom;
	}else{	
		igHolomade++;
		usiMap=Holo[x][y];
		Holo[x][y]=iRoom;
		CREATE(world[iRoom],struct room_data, 1);
		number_of_rooms++;
	}
	world[iRoom]->number=iRoom;
	world[iRoom]->stpFreight=NULL;
	world[iRoom]->funct=NULL;
	world[iRoom]->name=stpHoloRTemplates[usiMap]->name;
	while((world[iRoom]->description=stpHoloRTemplates[usiMap]->description[number(0,9)])==NULL);
	world[iRoom]->zone=197;
	world[iRoom]->room_flags=stpHoloRTemplates[usiMap]->room_flags;
	world[iRoom]->sector_type=stpHoloRTemplates[usiMap]->sector_type;
	world[iRoom]->extra_flags=stpHoloRTemplates[usiMap]->extra_flags;
	world[iRoom]->class_restriction=stpHoloRTemplates[usiMap]->class_restriction;
	world[iRoom]->level_restriction=stpHoloRTemplates[usiMap]->level_restriction;
	world[iRoom]->mount_restriction=stpHoloRTemplates[usiMap]->mount_restriction;
	world[iRoom]->move_mod=stpHoloRTemplates[usiMap]->move_mod;
	world[iRoom]->pressure_mod=stpHoloRTemplates[usiMap]->pressure_mod;
	world[iRoom]->temperature_mod=stpHoloRTemplates[usiMap]->temperature_mod;
	world[iRoom]->holoroom=usiMap;
	world[iRoom]->holox=x;
	world[iRoom]->holoy=y;
	world[iRoom]->holoprev=NULL;
	world[iRoom]->holonext=stpFirstHoloRoom;
	if(usiMap==216)
		MakeTradeShop(iRoom);
	stpFirstHoloRoom=world[iRoom];
	if(!stpLastHoloRoom){
		stpLastHoloRoom=stpFirstHoloRoom;
	}
	/* see if any freight was in this room when it was remade */
	for(stpF=world[0]->stpFreight;stpF;stpF=stpFNext){
		stpFNext=stpF->stpNextInRoom;
		if(stpF->iLocationX==x&&stpF->iLocationY==y){
			FreightFromRoom(stpF);
			FreightToRoom(stpF,iRoom);
		}
	}
	if(Holo[x-1][y]>255||Holo[x-1][y]==215){
		if(Holo[x-1][y]==215){
			CREATE(world[iRoom]->dir_option[WEST], struct room_direction_data, 1);
			world[iRoom]->dir_option[WEST]->to_room=igLINKW;
			CREATE(world[igLINKW]->dir_option[EAST], struct room_direction_data, 1);
			world[igLINKW]->dir_option[EAST]->to_room=iRoom;
		}else{
			CREATE(world[iRoom]->dir_option[WEST], struct room_direction_data, 1);
			world[iRoom]->dir_option[WEST]->to_room=Holo[x-1][y];
			CREATE(world[Holo[x-1][y]]->dir_option[EAST], struct room_direction_data, 1);
			world[Holo[x-1][y]]->dir_option[EAST]->to_room=iRoom;
		}					
	}	
	if(Holo[x+1][y]>255||Holo[x+1][y]==215){
		if(Holo[x+1][y]==215){
			CREATE(world[iRoom]->dir_option[EAST], struct room_direction_data, 1);
			world[iRoom]->dir_option[EAST]->to_room=igLINKE;
			CREATE(world[igLINKE]->dir_option[WEST], struct room_direction_data, 1);
			world[igLINKE]->dir_option[WEST]->to_room=iRoom;
		}else{
			CREATE(world[iRoom]->dir_option[EAST], struct room_direction_data, 1);
			world[iRoom]->dir_option[EAST]->to_room=Holo[x+1][y];
			CREATE(world[Holo[x+1][y]]->dir_option[WEST], struct room_direction_data, 1);
			world[Holo[x+1][y]]->dir_option[WEST]->to_room=iRoom;
		}					
	}	
	if(Holo[x][y-1]>255||Holo[x][y-1]==215){
		if(Holo[x][y-1]==215){
			CREATE(world[iRoom]->dir_option[NORTH], struct room_direction_data, 1);
			world[iRoom]->dir_option[NORTH]->to_room=igLINKN;
			CREATE(world[igLINKN]->dir_option[SOUTH], struct room_direction_data, 1);
			world[igLINKN]->dir_option[SOUTH]->to_room=iRoom;
		}else{
			CREATE(world[iRoom]->dir_option[NORTH], struct room_direction_data, 1);
			world[iRoom]->dir_option[NORTH]->to_room=Holo[x][y-1];
			CREATE(world[Holo[x][y-1]]->dir_option[SOUTH], struct room_direction_data, 1);
			world[Holo[x][y-1]]->dir_option[SOUTH]->to_room=iRoom;
		}					
	}	
	if(Holo[x][y+1]>255||Holo[x][y+1]==215){
		if(Holo[x][y+1]==215){
			CREATE(world[iRoom]->dir_option[SOUTH], struct room_direction_data, 1);
			world[iRoom]->dir_option[SOUTH]->to_room=igLINKS;
			CREATE(world[igLINKS]->dir_option[NORTH], struct room_direction_data, 1);
			world[igLINKS]->dir_option[NORTH]->to_room=iRoom;
		}else{
			CREATE(world[iRoom]->dir_option[SOUTH], struct room_direction_data, 1);
			world[iRoom]->dir_option[SOUTH]->to_room=Holo[x][y+1];
			CREATE(world[Holo[x][y+1]]->dir_option[NORTH], struct room_direction_data, 1);
			world[Holo[x][y+1]]->dir_option[NORTH]->to_room=iRoom;
		}					
	}	
   	HoloMobilePlacement(x,y,iRoom);
	return(iRoom);
}

void MoveFlyingPeople(void)
{
struct char_data *stpV,*stpVN;
int x,y,tox,toy;
int ex,ey,exx,eyy,lx,ly,lxx,lyy;
char szEBuf[200],szLBuf[200];

	for(stpV=world[iFlyStoreRoom]->people;stpV;stpV=stpVN){
		stpVN=stpV->next_in_room;
		if(IS_NPC(stpV)||!IS_FLYING(stpV))
			continue;
		if(GET_MOVE(stpV->specials.stpMount)<6){
			ForceLanding(stpV);
			return;
		}
		if(stpV->p->stpFlying->iDir==-1){
			global_color=32;
			send_to_char("Your mount works hard flying in small circles.\n\r",stpV);			
			global_color=0;
			GET_MOVE(stpV->specials.stpMount)-=10;
			if(GET_MOVE(stpV->specials.stpMount)<0)
				GET_MOVE(stpV->specials.stpMount)=0;
		}else{
			x=stpV->p->stpFlying->iX;					
			y=stpV->p->stpFlying->iY;					
			switch(stpV->p->stpFlying->iDir){
				case NORTH:
					tox=x;
					toy=y-10;
					if(y<10){
						y=10;
						stpV->p->stpFlying->iDir=-1;
						global_color=33;
						send_to_char("You hit the northern edge of Vryce protected land. You circle in place and decide which way to fly.\n\r",stpV);
						global_color=0;
					}
					ex=x-SIGHTDIST;
					ey=y-SIGHTDIST;
					exx=x+SIGHTDIST;
					eyy=y-SIGHTDIST+10;
					strcpy(szEBuf,"$N carrying $n come into view flying Northbound.");
					lx=x-SIGHTDIST;
					ly=y+SIGHTDIST;
					lxx=x+SIGHTDIST;
					lyy=y+SIGHTDIST+10;
					strcpy(szLBuf,"$N carrying $n go over the horizon flying Northbound.");
					break;
				case SOUTH:
					tox=x;
					toy=y+10;
					if(y>(MAXHOLO-10)){
						y=MAXHOLO-10;
						stpV->p->stpFlying->iDir=-1;
						global_color=33;
						send_to_char("You hit the southern edge of Vryce protected land. You circle in place and decide which way to fly.\n\r",stpV);
						global_color=0;
					}
					ex=x-SIGHTDIST;
					ey=y+SIGHTDIST-10;
					exx=x+SIGHTDIST;
					eyy=y+SIGHTDIST;
					strcpy(szEBuf,"$N carrying $n come into view flying Southbound.");
					lx=x-SIGHTDIST;
					ly=y-SIGHTDIST-10;
					lxx=x+SIGHTDIST;
					lyy=y-SIGHTDIST;
					strcpy(szLBuf,"$N carrying $n go over the horizon flying Southbound.");
					break;
				case EAST:
					tox=x+10;
					toy=y;
					if(x>(MAXHOLO-10)){
						x=MAXHOLO-10;
						stpV->p->stpFlying->iDir=-1;
						global_color=33;
						send_to_char("You hit the eastern edge of Vryce protected land. You circle in place and decide which way to fly.\n\r",stpV);
						global_color=0;
					}
					ex=x+SIGHTDIST-10;
					ey=y-SIGHTDIST;
					exx=x+SIGHTDIST;
					eyy=y+SIGHTDIST;
					strcpy(szEBuf,"$N carrying $n come into view flying Eastbound.");
					lx=x-SIGHTDIST-10;
					ly=y-SIGHTDIST;
					lxx=x-SIGHTDIST;
					lyy=y+SIGHTDIST;
					strcpy(szLBuf,"$N carrying $n go over the horizon flying Eastbound.");
					break;
				case WEST:
					tox=x-10;
					toy=y;
					if(x<10){
						x=10;
						stpV->p->stpFlying->iDir=-1;
						global_color=33;
						send_to_char("You hit the western edge of Vryce protected land. You circle in place and decide which way to fly.\n\r",stpV);
						global_color=0;
					}
					ex=x-SIGHTDIST;
					ey=y-SIGHTDIST;
					exx=x-SIGHTDIST+10;
					eyy=y+SIGHTDIST;
					strcpy(szEBuf,"$N carrying $n come into view flying Westbound.");
					lx=x+SIGHTDIST;
					ly=y-SIGHTDIST;
					lxx=x+SIGHTDIST+10;
					lyy=y+SIGHTDIST;
					strcpy(szLBuf,"$N carrying $n go over the horizon flying Westbound.");
					break;
				default:
					SUICIDE;
					return;
			
			}
			GET_MOVE(stpV->specials.stpMount)-=10;
			if(GET_MOVE(stpV->specials.stpMount)<0)
				GET_MOVE(stpV->specials.stpMount)=0;
			stpV->p->stpFlying->iX=tox;						
			stpV->p->stpFlying->iY=toy;
			stpV->p->stpFlying->stpSurvey->iX=tox;
			stpV->p->stpFlying->stpSurvey->iY=toy;
			do_areamap(stpV,"",9);
			HoloAct(ex,ey,tox,toy,exx,eyy,szEBuf,TRUE,stpV,NULL,stpV->specials.stpMount,32,"see");			
			HoloAct(lx,ly,tox,toy,lxx,lyy,szLBuf,TRUE,stpV,NULL,stpV->specials.stpMount,32,"see");			
		}
	}

}

void do_mount(struct char_data *stpCh, char *szpArg, int iCmd)
{
struct char_data *stpMob;
char szBuf[MAX_INPUT_LENGTH];

	if(IS_UNDEAD(stpCh)){
		send_to_char("You don't even try as it is scared of you.\n\r",stpCh);
		return;
	}
	if(IS_NPC(stpCh))
		return;
	if(stpCh->specials.stpMount){
		sprintf(szBuf,"You realize you are already mounted on %s\n\r",stpCh->specials.stpMount->player.short_descr);
		global_color=33;
		send_to_char(szBuf,stpCh);
		global_color=0;
		return;
	}
	one_argument(szpArg,szBuf);
	if(!szBuf[0]){
		send_to_char("Mount what?\n\r",stpCh);
		return;
	}
	for(stpMob=world[stpCh->in_room]->people;stpMob;stpMob=stpMob->next_in_room){
		if(!IS_SET(stpMob->player.siMoreFlags,MOUNT))
			continue;
		if(!IS_NPC(stpMob))
			continue;
		if(stpMob->specials.stpMount)
			continue;
		if(!isname(szBuf,stpMob->player.name))
			continue;
		break;
	}
	if(!stpMob){
		global_color=33;
		send_to_char("You realize nothing like that is here that is mountable right now.\n\r",stpCh);
		global_color=0;
		return;
	}
 	if(IS_GOOD(stpMob)&&!IS_GOOD(stpCh)){
	  act("$n tries to mount $N, but is thrown off.",TRUE,stpCh,0,stpMob,TO_ROOM);
	  act("You try to mount $N, but $E throws you off.",TRUE,stpCh,0,stpMob,TO_CHAR);
	  return;
	}
 	if(IS_EVIL(stpMob)&&!IS_EVIL(stpCh)){
	  act("$n tries to mount $N, but is thrown off.",TRUE,stpCh,0,stpMob,TO_ROOM);
	  act("You try to mount $N, but $E throws you off.",TRUE,stpCh,0,stpMob,TO_CHAR);
	  return;
	}
	if(is_formed(stpMob))
		die_formation(stpMob);
	stpMob->specials.stpMount=stpCh;
	stpCh->specials.stpMount=stpMob;
	global_color=32;
	act("$n jumps up and mounts $N.",TRUE,stpCh,0,stpMob,TO_ROOM);
	act("You jump up and mount $N.",TRUE,stpCh,0,stpMob,TO_CHAR);
	global_color=0;
    if(IS_AFFECTED(stpCh, AFF_SNEAK))
        affect_from_char(stpCh, SKILL_SNEAK);
}

int do_simple_move(struct char_data *ch, int cmd, int following)
/* Assumes, 
    1. That there is no master and no followers.
    2. That the direction exists. 

   Returns :
   1 : If succes.
   0 : If fail
  -1 : If dead.
*/
{
    char tmp[80];
    int was_in;
    int need_movement=0,iMovement,x;
    struct obj_data *obj=NULL;
    struct char_data *k=NULL;
    struct char_data *k_next=NULL;	
    bool has_boat;
    bool has_wing;
    int to_room;
    int iWear;
    int is_tunnel_full(struct char_data *ch, int room);
	struct char_data *stpMoveCh;    

	if(IS_UNDEAD(ch)&&number(1,100)<8){
		send_to_char("You fall down.\n\r",ch);
		act("$n falls down.",TRUE,ch,0,0,TO_ROOM);
		GET_POS(ch) = POSITION_RESTING;
	}

    if (special(ch, cmd+1, ""))  /* Check for special routines (North is 1) */
		return(FALSE);
	if(ch->specials.stpMount&&!IS_NPC(ch))
		stpMoveCh=ch->specials.stpMount;
	else
		stpMoveCh=ch;
	if(ch->desc && ch->desc->connected != CON_SOCIAL_ZONE)
	if(GET_BREATH(stpMoveCh)<=0){
		global_color=32;
		send_to_char("You COLLAPSE, totally out of breath!\n\r",stpMoveCh);
		act("$n makes strange strangling sounds and COLLAPSES out of breath.",TRUE,stpMoveCh,0,0,TO_ROOM);
		if(stpMoveCh==ch){
			GET_HIT(ch)/=2;
			GET_POS(ch) = POSITION_RESTING;
		}
		global_color=0;
		GET_BREATH(stpMoveCh)=0;
		return(FALSE);
	}else if(GET_BREATH(stpMoveCh)<15){
		global_color=32;
		send_to_char("You STOP and PANT loud, sucking in air!\n\r",stpMoveCh);
		act("$n STOPS, Panting and heaving, loudly sucking in air.",TRUE,stpMoveCh,0,0,TO_ROOM);
		global_color=0;		
		return(FALSE);
	}else if(GET_BREATH(stpMoveCh)<30){
		global_color=32;
		send_to_char("You pant loudly, almost out of breath.\n\r",stpMoveCh);
		act("$n pants loudly, almost out of breath.",TRUE,stpMoveCh,0,0,TO_ROOM);
		global_color=0;		
	}
    if(world[ch->in_room]->zone==198){
		if(number(0,38)==25){
		    if(world[ch->in_room]->sector_type==SECT_INSIDE){
				if(IS_AFFECTED(ch,AFF_FLYING)){
			    	act("$n hits $s head on a stalactite.",TRUE,ch,0,0,TO_ROOM);
				    send_to_char("You hit your head on a stalactite.\n\r",ch);
			    	return(FALSE);
				}else{
				    act("$n trips over a small stalagmite and stumbles.",TRUE,ch,0,0,TO_ROOM);
				    send_to_char("You trip over a small stalagmite and stumble.\n\r",ch);
				    return(FALSE);
				}
		    }
		}
    }
    need_movement = (movement_loss[world[ch->in_room]->sector_type]
     +world[ch->in_room]->move_mod
     +world[EXIT(ch, cmd)->to_room]->move_mod
     +movement_loss[world[EXIT(ch, cmd)->to_room]->sector_type]);

    if(!is_allowed_here(ch, EXIT(ch, cmd)->to_room))
		return(FALSE);
   
   	/* Tunnel Full Checking  - Raster */
   	if(IS_SET(world[EXIT(ch, cmd)->to_room]->room_flags, TUNNEL))
   		if(is_tunnel_full(ch, EXIT(ch, cmd)->to_room)) {
   			send_to_char("You try to enter the room, but it is too cramped to proceed.\r\n",ch);
   			return(FALSE);
 		}
 		   
    if ((world[ch->in_room]->sector_type == SECT_WATER_NOSWIM) ||
     (world[EXIT(ch, cmd)->to_room]->sector_type == SECT_WATER_NOSWIM)) {
		has_boat = FALSE;

		/* See if char is carrying a boat */
		for (obj=ch->carrying; obj; obj=obj->next_content)
	    	if (obj->obj_flags.type_flag == ITEM_BOAT)
			has_boat = TRUE;

		if(IS_AFFECTED(ch,AFF_FLYING) || GET_LEVEL(ch) >34) 
			has_boat=TRUE;
	    for ( iWear = 0; iWear < MAX_WEAR; iWear++ )
    		if ( ch->equipment[iWear] )
        	  	if(ch->equipment[iWear]->obj_flags.type_flag==ITEM_BOAT ||
            	 ch->equipment[iWear]->obj_flags.type_flag==ITEM_FLY)
	          		has_boat = TRUE;
		if (!has_boat) {
		    send_to_char("You need a boat to go there.\n\r", ch);
	    	return(FALSE);
		}
    }
    if ((world[ch->in_room]->sector_type == SECT_AIR) || 
     (world[EXIT(ch, cmd)->to_room]->sector_type == SECT_AIR)) {
		has_wing = FALSE;

/* See if char is flying 
		for (obj=ch->carrying; obj; obj=obj->next_content)
	    	if (obj->obj_flags.type_flag == ITEM_FLY)
				has_wing = TRUE;

		if(IS_AFFECTED(ch,AFF_FLYING))
			has_wing=TRUE;
*/
        for ( iWear = 0; iWear < MAX_WEAR; iWear++ )
    	    if ( ch->equipment[iWear] )
                if(ch->equipment[iWear]->obj_flags.type_flag==ITEM_FLY)
		    has_wing = TRUE;

		if (!has_wing) {
		    send_to_char("You aren't flying.\n\r", ch);
	    	return(FALSE);
		}
    }
    if(world[ch->in_room]->zone != 180){ /*Social Zone*/
		if(ch->specials.stpMount&&!IS_NPC(ch)){
			iMovement=GET_MOVE(ch->specials.stpMount);
		}else{
			iMovement=GET_MOVE(ch);
		}
    	if((iMovementspecials.stpMount)
					send_to_char("Your mount is too exhausted.\n\r",ch);
				else
			 	   	send_to_char("You are too exhausted.\n\r",ch);
			}else{
				if(!IS_NPC(ch)&&ch->specials.stpMount)
					send_to_char("Your mount is too exhausted to follow.\n\r",ch);
				else
			    	send_to_char("You are too exhausted to follow.\n\r",ch);
			}
			return(FALSE);
		}
	}

    was_in = ch->in_room;
    to_room=world[was_in]->dir_option[cmd]->to_room;
    if(!IS_NPC(ch)){
    	if(ch->specials.direction!=666){
		    if(IS_SET(world[to_room]->room_flags,NEUTRAL)&& /*law to neut*/
			 !IS_SET(world[was_in]->room_flags,NEUTRAL)&&
		  	 !IS_SET(world[was_in]->room_flags,CHAOTIC)){
    	 	   ch->p->queryfunc=verify_move;
	    	    strcpy(ch->p->queryprompt, "ENTER Neutral PlayerKill Area? (y/n)>");
    	    	ch->p->querycommand=1111;
				ch->specials.direction=cmd;
				return(FALSE);
	    	}
		    if(IS_SET(world[to_room]->room_flags,CHAOTIC)&& /*law to cha*/
			 !IS_SET(world[was_in]->room_flags,NEUTRAL)&&
			 !IS_SET(world[was_in]->room_flags,CHAOTIC)){
		        ch->p->queryfunc=verify_move;
        		strcpy(ch->p->queryprompt, "ENTER CHAOTIC PlayerKill Area? (y/n)>");
		        ch->p->querycommand=1111;
				ch->specials.direction=cmd;
				return(FALSE);
		    }
		    if(IS_SET(world[to_room]->room_flags,CHAOTIC)&& /*neut to cha*/
			 !IS_SET(world[was_in]->room_flags,CHAOTIC)){
		        ch->p->queryfunc=verify_move;
		        strcpy(ch->p->queryprompt, "ENTER CHAOTIC PlayerKill Area? (y/n)>");
		        ch->p->querycommand=1111;
				ch->specials.direction=cmd;
				return(FALSE);
			}
			if(IS_SET(world[to_room]->room_flags,NEUTRAL)	/*cha to neut*/
			 &&!IS_SET(world[was_in]->room_flags,NEUTRAL)){
				ch->p->queryfunc=verify_move;
				strcpy(ch->p->queryprompt, "ENTER NEUTRAL PlayerKill Area? (y/n)>");
				ch->p->querycommand=111;
				ch->specials.direction=cmd;
				return(FALSE);
		    }
	    }
    }
    if(ch->specials.direction)/*used for verification of pk move */
		ch->specials.direction=0;    

    if( (GET_LEVEL(ch)<32) &&  (IS_UNDEAD(ch) || !IS_NPC(ch)) )
     	if(ch->desc)
			if(ch->desc->connected != CON_SOCIAL_ZONE){
				GET_MOVE(stpMoveCh) -= need_movement;
			}
    if (!IS_AFFECTED(ch, AFF_SNEAK)) {
		global_color=1;
 	if(!world[ch->in_room]->dir_option[cmd]->exit||(world[ch->in_room]->dir_option[cmd]->exit&&!strstr(world[ch->in_room]->dir_option[cmd]->exit,"$n"))){
	    if(IS_AFFECTED(ch,AFF_FLYING)){
	        sprintf(tmp, "$n flies %s.", dirs[cmd]);
	    }else{
			if(!ch->specials.stpMount){
		    	sprintf(tmp, "$n leaves %s.", dirs[cmd]);
			}else{
		    	sprintf(tmp, "$n riding %s leaves %s.",ch->specials.stpMount->player.short_descr, dirs[cmd]);
		    }
		    act(tmp, TRUE, ch, 0,0,TO_ROOM);
		}
	}else{
	    act(world[ch->in_room]->dir_option[cmd]->exit, TRUE, ch, 0,0,TO_ROOM);
	}
		global_color=0;
    }	
	/* So breath stuff dosn't run in social */
	if(ch->desc && ch->desc->connected != CON_SOCIAL_ZONE)
		if(GET_LEVEL(ch)<32&&!IS_UNDEAD(ch)){
			x=pulse-ch->specials.iLastMovePulse;
			if(x<0)x=0;
			x=6-x;
			if(x<0)x=0;	
			GET_BREATH(stpMoveCh)-=10*x;
			if(GET_BREATH(stpMoveCh)<0)
				GET_BREATH(stpMoveCh)=0;
		}
	ch->specials.iLastMovePulse=pulse;
    char_from_room(ch);
    char_to_room(ch, world[was_in]->dir_option[cmd]->to_room);
    global_color=1;
    if (!IS_AFFECTED(ch, AFF_SNEAK)){
		if(!world[was_in]->dir_option[cmd]->entrance||(world[was_in]->dir_option[cmd]->entrance&&!strstr(world[was_in]->dir_option[cmd]->entrance,"$n"))){
			if(!ch->specials.stpMount){
			   act("$n has arrived.", TRUE, ch, 0,0, TO_ROOM); 
			}else{
		    	sprintf(tmp, "$n riding %s arrived.",ch->specials.stpMount->player.short_descr);
				act(tmp,TRUE,ch,0,0,TO_ROOM);			
			}
		}else{
		   act(world[was_in]->dir_option[cmd]->entrance, TRUE, ch, 0,0, TO_ROOM); 
		}
    }
    global_color=0;
	if(ch->specials.was_in_room_pk!=ch->in_room &&
	 (world[ch->in_room]->holox || world[ch->in_room]->holoy) &&
	 world[ch->in_room]->funct!=iTradeShop &&
	 !IS_SET(ORIGINAL(ch)->specials.act, PLR_BRIEF) ) {
		do_areamap(ch,"\0",15);
		if(ch->specials.hunting)
			ShowTrackMessage(ch);
		ListRoomFreightToChar(ch);
		list_obj_to_char(world[ch->in_room]->contents, ch, 0,FALSE);
		list_char_to_char(world[ch->in_room]->people, ch, 0);		
	} else if(ch->specials.was_in_room_pk!=ch->in_room) {
		/* Run as Cmd 16 so track messages will run only when
		   the player walks into the room
		*/
	       do_look(ch, "\0",16);
             if( ch->desc  && !ORIGINAL(ch)->specials.autoexit )
	     	do_exits(ch,"",9);
	}

	if(IS_SET(world[ch->in_room]->room_flags, FIRE)) 
	{
		if(GET_LEVEL(ch) < 32 && !IS_NPC(ch) ) {
			GET_HIT(ch) -= dice(5,7);
			global_color=31;
			send_to_char("Your body starts BURNING as you enter the FIRE filled room.\r\n",ch);
			act("$n's body starts BURNING brightly as $e enters the room.", FALSE, ch, 0, 0, TO_ROOM);
			global_color=0;
			if(GET_HIT(ch) < 0) {
					global_color=31;
					send_to_char("Your body BURNS brightly and turns to ASH. You are dead!\r\n",ch);
					act("$n's body turns to ash.", FALSE, ch, 0, 0, TO_ROOM);
					global_color=0;
					raw_kill(ch,NULL);
					return(1);
			}
		}	
	}
	
		
    if(IS_UNDEAD(ch))
    	for (k = world[ch->in_room]->people; k; k = k_next){
			k_next=k->next_in_room;
			undead_gross_out(ch,k);
		}

	if(!IS_NPC(ch) && !IS_UNDEAD(ch) &&
	 (world[ch->in_room]->sector_type <= 5 || world[ch->in_room]->sector_type == 8) )
		make_scent(ch, ch->in_room);
		
    if(!IS_NPC(ch) || IS_UNDEAD(ch))
    	for (k = world[ch->in_room]->people; k; k = k_next){
			k_next=k->next_in_room;
	    if ( IS_MOB(k) ){
			if(!strcmp(&k->specials.last_attack[0],GET_NAME(ch))){
		    	if(IS_AFFECTED(ch, AFF_SNEAK)){
					send_to_char("You sneak into the room\n\r",ch);
					return(1);
	     	    }
		     	if((GET_LEVEL(k)specials.act, ACT_AGGRESSIVE))){
				    do_emote(k,"screams from fright!",0);
				    do_flee(k,"",0);
				    return(1);
		     	} else {
				    if(!IS_UNDEAD(k))
				    if((number(0,100)-GET_LEVEL(ch))<50) { 
						sprintf(log_buf,"AH HA! I have been looking for you %s!",GET_NAME(ch));
						do_say(k,log_buf,0);
						hit(k,ch,0);
						return(1);
				    }
				}
		    }
		}
    }
    return(1);
}

bool TradeGet(struct char_data *stpCh, char *szpName)
{
struct FREIGHT *stpF;
char szBuf[MAX_INPUT_LENGTH*2];
int x;

    if(IS_NPC(stpCh))
        return(FALSE);
    for(stpF=world[stpCh->in_room]->stpFreight;stpF;stpF=stpF->stpNextInRoom){
        if(!stpF->stpCh){
            if(isname(szpName,gstaFreightTypes[stpF->iType].szpName)){
                if(!stpCh->p->stpFreight||stpCh->p->stpFreight->iLocationRoom!=stpCh->in_room){
                    if(stpCh->p->stpFreight)
                        bFreightFromChar(stpCh->p->stpFreight);
                    bFreightToChar(stpF,stpCh);
                    global_color=33;
                    sprintf(szBuf,"You grab control of %s which has been abandoned.\n\r",gstaFreightTypes[stpF->iType].szpShortDescription);
                    send_to_char(szBuf,stpCh);
                    sprintf(szBuf,"$n takes control of %s which has been abandoned.",gstaFreightTypes[stpF->iType].szpShortDescription);
                    act(szBuf,TRUE,stpCh,0,0,TO_ROOM);
                    global_color=0;
                    return(TRUE);
                }else{
                    send_to_char("You realize your cargo is right here with you.\n\r",stpCh);
                    return(TRUE);
                }
            }            
            for(x=0;x<100;x++){
                if(stpF->iaCargo[x]>0){
                    if(!str_cmp(szpName,gstaTradables[x].szpName)){
                        if(!stpCh->p->stpFreight||stpCh->p->stpFreight->iLocationRoom!=stpCh->in_room){
                            send_to_char("You realize you have nothing to carry tradables in here.\n\r",stpCh);
                            return(TRUE);
                        }
                        if(bNewTradableToFreight(stpCh,x,1)){
                            stpF->iaCargo[x]--;
                            gstaTradables[x].iNumInGame--;/* take back (NEW ONE NOT REALLY MADE HERE)*/
                            global_color=33;
                            sprintf(szBuf,"You take a %s of %s from %s and pack it in your cargo.\n\r",gstaTradables[x].szpUnitName,gstaTradables[x].szpName,gstaFreightTypes[stpF->iType].szpShortDescription);
                            send_to_char(szBuf,stpCh);
                            sprintf(szBuf,"$n takes a %s of %s from %s and packs it in $s cargo.\n\r",gstaTradables[x].szpUnitName,gstaTradables[x].szpName,gstaFreightTypes[stpF->iType].szpShortDescription);
                            act(szBuf,TRUE,stpCh,0,0,TO_ROOM);
                            global_color=0;
                            return(TRUE);                            
                        }else{
                            return(TRUE);
                        }
                    }
                }
            }
        }
    }
    return(FALSE);
}