예제 #1
0
void do_dedit( char_data* ch, char* argument )
{
  wizard_data*    imm  = (wizard_data*) ch;
  exit_data*     exit;
  int           flags;
  int             dir;

  if( !get_flags( ch, argument, &flags, "1", "dedit" ) )
    return;

  if( matches( argument, "delete" ) ) {
    if( ( exit = (exit_data*) one_thing( ch, argument, "dedit delete", 
      (thing_array*) &ch->in_room->exits ) ) != NULL )
      delete_exit( imm, exit, is_set( &flags, 0 ) );
    return;
    }

  if( matches( argument, "new" ) ) {
    if( ( dir = direction_arg( argument ) ) != -1 ) 
      create_exit( imm, dir, argument, is_set( &flags, 0 ) );
    return;
    }

  if( ( exit = (exit_data*) one_thing( ch, argument, "dedit", 
    (thing_array*) &ch->in_room->exits ) ) == NULL )
    return;

  imm->exit_edit = exit;

  send( ch, "Dflag and dset now act on the exit %s.\n\r",
    dir_table[ exit->direction ].where );
}
예제 #2
0
// this figures out where the exits are using shitty
// step by step derivatives
void gen_exits(struct CaveRoom* cr)
{
	float ang = 0;
	float last = 0;
	// iterate through angles slowly
	while(ang < M_PI*2.0f)
	{
		// get the value of the derivative at this angle
		float curr = cave_get_dir(cr, ang);
		if (curr < 0 && last > 0)
		{
			struct Exit* exit = malloc(sizeof(*exit));
			create_exit(&(cr->exits), exit);
			exit->angle = ang;
		}
		last = curr;
		ang += 0.1f;
	}
}