void Diffusion::integrate(const double dt) { const int n = get_species().size(); for (int i = 0; i < n; ++i) { Species &s = *(get_species()[i]); const Vect3d step_length = calc_step_length(s, dt); const int n = s.mols.size(); for (int j = 0; j < n; ++j) { s.mols.r0[j] = s.mols.r[j]; s.mols.r[j] += step_length.cwiseProduct(Vect3d(norm(),norm(),norm())); } } }
void find_buddy( char_data* ch, obj_data* obj, int level, int species_list, int obj_list ) { char_data* buddy; player_data* pc; species_data* species; int i; if( obj == NULL ) { bug( "Find_Buddy: Null Object as reagent!?" ); return; } if( ( pc = player( ch ) ) == NULL ) return; for( i = 0; i < 10; i++ ) if( obj->pIndexData->vnum == list_value[ obj_list ][ 10*(ch->shdata->alignment%3)+i ] ) break; if( i == 10 ) { send( ch, "Nothing happens.\n\r" ); return; } send( *ch->array, "%s disintegrates in a burst of blue flame.\n\r", obj ); obj->Extract( 1 ); if( number_range( 0,100 ) < 50-7*level+10*i ) { send( ch, "You feel the summoning fail.\n\r" ); return; } i = list_value[ species_list ][ 10*(ch->shdata->alignment%3)+i ]; if( ( species = get_species( i ) ) == NULL ) { bug( "Find_buddy: unknown species." ); return; } buddy = create_mobile( species ); set_bit( &buddy->status, STAT_PET ); remove_bit( &buddy->status, STAT_AGGR_ALL ); remove_bit( &buddy->status, STAT_AGGR_GOOD ); remove_bit( &buddy->status, STAT_AGGR_EVIL ); buddy->To( ch->array ); send( ch, "%s comes to your summons, stepping from the shadows.\n\r", buddy ); add_follower( buddy, ch ); return; }
info_s *new_info (info_s *parent, char *name, unint mode) { info_s *info; u64 ino; FN; ino = alloc_ino(parent->in_tree.t_dev); info = alloc_info(strlen(name) + 1, get_species(mode), parent->in_tree.t_dev); init_inode( &info->in_inode, ino, mode, name); add_info(ino, info); return info; }
static rc_t vdb_info_db( vdb_info_data * data, VSchema * schema, const VDBManager *mgr ) { const VDatabase * db; rc_t rc = VDBManagerOpenDBRead( mgr, &db, schema, "%s", data->acc ); if ( rc == 0 ) { const VTable * tab; const KMetadata * meta = NULL; rc_t rc1 = VDatabaseOpenTableRead( db, &tab, "SEQUENCE" ); if ( rc1 == 0 ) { data->s_platform = get_platform( tab ); data->seq_rows = get_rowcount( tab ); VTableRelease( tab ); } data->ref_rows = get_tab_row_count( db, "REFERENCE" ); data->prim_rows = get_tab_row_count( db, "PRIMARY_ALIGNMENT" ); data->sec_rows = get_tab_row_count( db, "SECONDARY_ALIGNMENT" ); data->ev_rows = get_tab_row_count( db, "EVIDENCE_ALIGNMENT" ); data->ev_int_rows = get_tab_row_count( db, "EVIDENCE_INTERVAL" ); data->consensus_rows = get_tab_row_count( db, "CONSENSUS" ); data->passes_rows = get_tab_row_count( db, "PASSES" ); data->metrics_rows = get_tab_row_count( db, "ZMW_METRICS" ); if ( data->ref_rows > 0 ) get_species( data->species, sizeof data->species, db, mgr ); rc = VDatabaseOpenMetadataRead ( db, &meta ); if ( rc == 0 ) { get_meta_info( data, meta ); KMetadataRelease ( meta ); } VDatabaseRelease( db ); } return rc; }
static int find_search ( void *data, u64 rec_key, void *rec, unint len) { find_search_s *s = data; inode_s *inode = rec; info_s *info; FN; if (s->ino != rec_key) { return qERR_NOT_FOUND; } /* * Found the inode, allocate a structure and fill it in */ info = alloc_info(len - sizeof(inode_s), get_species(inode->i_mode), Inode_tree.t_dev); memcpy( &info->in_inode, inode, len); s->info = info; return 0; }
void do_mlog( char_data* ch, char* argument ) { char tmp [ ONE_LINE ]; pfile_data* pfile; char_data* victim = NULL; species_data* species; if( is_number( argument ) ) { if( ( species = get_species( atoi( argument ) ) ) == NULL ) { send( ch, "There is no mob with that vnum.\r\n" ); return; } } else { if( ( pfile = find_pfile_exact( argument ) ) == NULL ) { if( ( victim = one_character( ch, argument, "mlog", (thing_array*) &player_list, (thing_array*) &mob_list ) ) == NULL ) return; if( victim->pcdata != NULL ) pfile = victim->pcdata->pfile; } if( pfile != NULL ) { sprintf( tmp, "%s%s", PLAYER_LOG_DIR, pfile->name ); if( !view_file( ch, tmp ) ) send( ch, "%s has no log.\r\n", pfile->name ); return; } species = victim->species; } sprintf( tmp, "%smob.%d", MOB_LOG_DIR, species->vnum ); if( !view_file( ch, tmp ) ) send( ch, "%s has no log.\r\n", species->Name( ) ); return; }
void do_shedit( char_data* ch, char* argument ) { char buf [MAX_STRING_LENGTH ]; mob_data* keeper; shop_data* shop; char_data* victim; species_data* species; int number; for( shop = shop_list; shop != NULL; shop = shop->next ) if( ch->in_room == shop->room ) break; if( *argument != '\0' && !can_edit( ch, ch->in_room ) ) return; if( exact_match( argument, "new" ) ) { if( shop != NULL ) { send( ch, "There is already a shop here.\r\n" ); return; } shop = new shop_data; shop->room = ch->in_room; shop->custom = NULL; shop->keeper = -1; shop->repair = 0; shop->materials = 0; shop->buy_type[0] = 0; shop->buy_type[1] = 0; shop->next = shop_list; shop_list = shop; send( ch, "New shop created here.\r\n" ); return; } if( shop == NULL ) { send( ch, "There is no shop associated with this room.\r\n" ); return; } if( *argument == '\0' ) { species = get_species( shop->keeper ); sprintf( buf, "Shop Keeper: %s [ Vnum: %d ]\r\n\r\n", ( species == NULL ? "none" : species->descr->name ), shop->keeper ); sprintf( buf+strlen( buf ), "Repair: %d\r\n\r\n", shop->repair ); send( buf, ch ); return; } if( exact_match( argument, "delete" ) ) { remove( shop_list, shop ); for( int i = 0; i < mob_list; i++ ) if( mob_list[i]->pShop == shop ) mob_list[i]->pShop = NULL; send( ch, "Shop deleted.\r\n" ); return; } if( matches( argument, "keeper" ) ) { if( ( victim = one_character( ch, argument, "set keepr", ch->array ) ) == NULL ) return; if( ( keeper = mob( victim ) ) == NULL ) { send( ch, "Players can not be shop keepers.\r\n" ); return; } shop->keeper = keeper->species->vnum; keeper->pShop = shop; send( ch, "Shop keeper set to %s.\r\n", keeper->descr->name ); return; } if( matches( argument, "repair" ) ) { if( ( number = atoi( argument ) ) < 0 || number > 10 ) { send( ch, "A shop's repair level must be between 0 and 10.\r\n" ); return; } shop->repair = number; send( ch, "The shop's repair level is set to %d.\r\n", number ); } }
void find_familiar( char_data* ch, obj_data* obj, int level, int species_list, int obj_list ) { char_data* familiar; player_data* pc; species_data* species; int i; if( obj == NULL ) { bug( "Find_Familiar: Null Object as reagent!?" ); return; } if( ( pc = player( ch ) ) == NULL ) return; if( ch->shdata->level < LEVEL_APPRENTICE && is_set( ch->pcdata->pfile->flags, PLR_FAMILIAR ) ) { send( ch, "Nothing happens.\n\r" ); send( ch, "You can only summon one familiar per level.\n\r" ); return; } if( pc->familiar != NULL ) { send( ch, "Nothing happens.\n\r" ); send( ch, "You can only have one familiar at a time.\n\r" ); return; } for( i = 0; i < 10; i++ ) if( obj->pIndexData->vnum == list_value[ obj_list ][ 10*(ch->shdata->alignment%3)+i ] ) break; if( i == 10 ) { send( ch, "Nothing happens.\n\r" ); return; } send( *ch->array, "%s disintegrates in a burst of blue flame.\n\r", obj ); obj->Extract( 1 ); if( number_range( 0,100 ) < 50-7*level+10*i ) { send( ch, "You feel the summoning fail.\n\r" ); return; } i = list_value[ species_list ][ 10*(ch->shdata->alignment%3)+i ]; if( ( species = get_species( i ) ) == NULL ) { bug( "Find_familiar: unknown species." ); return; } familiar = create_mobile( species ); familiar->reset = NULL; pc->familiar = familiar; set_bit( &familiar->status, STAT_PET ); set_bit( &familiar->status, STAT_FAMILIAR ); set_bit( ch->pcdata->pfile->flags, PLR_FAMILIAR ); remove_bit( &familiar->status, STAT_AGGR_ALL ); remove_bit( &familiar->status, STAT_AGGR_GOOD ); remove_bit( &familiar->status, STAT_AGGR_EVIL ); familiar->To( ch->array ); send( ch, "%s comes to your summons, stepping from the shadows.\n\r", familiar ); add_follower( familiar, ch ); return; }
void do_skin( char_data* ch, char* argument ) { mprog_data* mprog; obj_data* corpse; thing_data* thing; thing_array* list; species_data* species; char_data* rch; int i; if( is_confused_pet( ch ) ) return; if( ( thing = one_thing( ch, argument, "skin", ch->array ) ) == NULL ) return; if( ( corpse = object( thing ) ) == NULL ) { fsend( ch, "Skinning %s alive would be cruel and unusual.\r\n", thing ); return; } if( corpse->pIndexData->item_type != ITEM_CORPSE ) { send( ch, "You can only skin corpses.\r\n" ); return; } if( corpse->pIndexData->vnum == OBJ_CORPSE_PC ) { send( ch, "You can't [yet] skin player corpses!\r\n" ); return; } if( ( species = get_species( corpse->value[1] ) ) == NULL ) { send( ch, "Corpses without a species cannot be skinned.\r\n" ); return; } for( mprog = species->mprog; mprog != NULL; mprog = mprog->next ) if( mprog->trigger == MPROG_TRIGGER_SKIN ) { var_obj = corpse; var_ch = ch; var_room = ch->in_room; execute( mprog ); return; } list = get_skin_list( species ); if( list == (thing_array*) -1 ) { send( ch, "You cannot skin %s.\r\n", corpse ); return; } if( list == NULL ) { fsend( ch, "You skin %s, but it is too mangled to be of any use.", corpse ); fsend( *ch->array, "%s skins %s but is unable to extract anything of value.", ch, corpse ); } else { fsend( ch, "You skin %s producing %s.\r\n", corpse, list ); for( i = 0; i < *ch->array; i++ ) if( ( rch = character( ch->array->list[i] ) ) != NULL && rch != ch && ch->Seen( rch ) ) fsend( rch, "%s skins %s producing %s.\r\n", ch, corpse, list ); for( i = 0; i < *list; i++ ) { list->list[i]->To( ch ); consolidate( (obj_data*) list->list[i] ); } delete list; } drop_contents( corpse ); corpse->Extract( 1 ); }