//--------------------------------------------------------------------------- void uv_group::mouse_move_rel(int rel_x, int rel_y) { uv_widget *child; set_start_child(); while((child=get_next_child()) != NULL) { child->mouse_move_rel(rel_x,rel_y); }; };
void update_children( Custom_couple* Cc_ptr ) { Couple* cptr ; Custom_person* Cp_ptr ; char* ch_ptr ; int* child_ptr ; int child ; int next_child ; BOOLEAN found ; short dummy ; short rightmost_position ; short left_update_limit ; cptr = get_cdata_ptr( Cc_ptr->reference, &dummy ) ; if( ( ch_ptr = cptr->children ) != NULL ) { /* if any children already drawn find rightmost edge */ /* else start from centre of couple */ rightmost_position = Cc_ptr->x ; /* left_update_limit is used to ensure hline fully drawn */ left_update_limit = Cc_ptr->x ; if( ( child_ptr = Cc_ptr->child_numbers ) != NULL ) { while( *child_ptr != 0 ) { Cp_ptr = get_Cp_ptr( *child_ptr++ ) ; left_update_limit = max( left_update_limit, Cp_ptr->x ) ; rightmost_position = max( rightmost_position, Cp_ptr->box.g_x + Cp_ptr->box.g_w ) ; } } ch_ptr = cptr->children ; next_child = form_ref( &ch_ptr ) ; while( child = next_child ) { next_child = get_next_child( child, Cc_ptr->reference ) ; found = FALSE ; if( ( child_ptr = Cc_ptr->child_numbers ) != NULL ) { while( *child_ptr != 0 ) { Cp_ptr = get_Cp_ptr( *child_ptr++ ) ; if( Cp_ptr->reference == child ) found = TRUE ; } } if( !found ) add_child( Cc_ptr, child, &rightmost_position, left_update_limit ) ; } } }
static void display_nodes(device_node_cookie *node, uint8 level) { status_t err; device_node_cookie child = *node; level = display_device(node, level); if (get_child(&child) != B_OK) return; do { display_nodes(&child, level); } while ((err = get_next_child(&child)) == B_OK); }
void descendant_select( int reference, int excluded_child, int excluded_couple ) { Person *pptr ; Couple *cptr ; char *ch_ptr ; /* ptrs to array of child refs */ char *coupls_ptr ; /* ptr to array of couplings */ short block ; int coup ; int ch ; int next_child ; int next_coup ; exp_selected[match_refs[reference]] = TRUE ; pptr = get_pdata_ptr( reference, &block ) ; if( coupls_ptr = pptr->couplings, coupls_ptr ) { next_coup = form_ref( &coupls_ptr ) ; while( coup = next_coup ) { next_coup = get_next_couple( coup, reference ) ; if( coup != excluded_couple ) { cptr = get_cdata_ptr( coup, &block ) ; if( cptr->male_reference == reference ) { if( cptr->female_reference ) exp_selected[match_refs[cptr->female_reference]] = TRUE ; } else { if( cptr->male_reference ) exp_selected[match_refs[cptr->male_reference]] = TRUE ; } if( ch_ptr = cptr->children ) { next_child = form_ref( &ch_ptr ) ; while( ch = next_child ) { next_child = get_next_child( ch, coup ) ; if( ch != excluded_child ) descendant_select( ch, 0, 0 ) ; } } } } } }
//--------------------------------------------------------------------------- bool uv_group::draw_childs(vector<GLuint> * clist) { //Speicher für einen uv_widget Zeiger anlegen uv_widget *child; //Den Iterator auf den Startwert von Unten setzen, da die unteren Objekte //zuerst gezeichnet werden set_start_child(); //Die zeichenfunktion jedes childs aufrufen while((child=get_next_child()) != NULL) { //Farbe auf weiss zurücksetzen //glColor3f(1, 1, 1); //Draw Funktion des Childs aufrufen child->draw(clist); }; return true; };
void DevicesView::AddDeviceAndChildren(device_node_cookie *node, Device* parent) { Attributes attributes; Device* newDevice = NULL; // Copy all its attributes, // necessary because we can only request them once from the device manager char data[256]; struct device_attr_info attr; attr.cookie = 0; attr.node_cookie = *node; attr.value.raw.data = data; attr.value.raw.length = sizeof(data); while (dm_get_next_attr(&attr) == B_OK) { BString attrString; switch (attr.type) { case B_STRING_TYPE: attrString << attr.value.string; break; case B_UINT8_TYPE: attrString << attr.value.ui8; break; case B_UINT16_TYPE: attrString << attr.value.ui16; break; case B_UINT32_TYPE: attrString << attr.value.ui32; break; case B_UINT64_TYPE: attrString << attr.value.ui64; break; default: attrString << "Raw data"; } attributes.push_back(Attribute(attr.name, attrString)); } // Determine what type of device it is and create it for (unsigned int i = 0; i < attributes.size(); i++) { // Devices Root if (attributes[i].fName == B_DEVICE_PRETTY_NAME && attributes[i].fValue == "Devices Root") { newDevice = new Device(parent, BUS_NONE, CAT_COMPUTER, B_TRANSLATE("Computer")); break; } // ACPI Controller if (attributes[i].fName == B_DEVICE_PRETTY_NAME && attributes[i].fValue == "ACPI") { newDevice = new Device(parent, BUS_ACPI, CAT_BUS, B_TRANSLATE("ACPI bus")); break; } // PCI bus if (attributes[i].fName == B_DEVICE_PRETTY_NAME && attributes[i].fValue == "PCI") { newDevice = new Device(parent, BUS_PCI, CAT_BUS, B_TRANSLATE("PCI bus")); break; } // ISA bus if (attributes[i].fName == B_DEVICE_BUS && attributes[i].fValue == "isa") { newDevice = new Device(parent, BUS_ISA, CAT_BUS, B_TRANSLATE("ISA bus")); break; } // PCI device if (attributes[i].fName == B_DEVICE_BUS && attributes[i].fValue == "pci") { newDevice = new DevicePCI(parent); break; } // ACPI device if (attributes[i].fName == B_DEVICE_BUS && attributes[i].fValue == "acpi") { newDevice = new DeviceACPI(parent); break; } // ATA / SCSI / IDE controller if (attributes[i].fName == "controller_name") { newDevice = new Device(parent, BUS_PCI, CAT_MASS, attributes[i].fValue); } // SCSI device node if (attributes[i].fName == B_DEVICE_BUS && attributes[i].fValue == "scsi") { newDevice = new DeviceSCSI(parent); break; } // Last resort, lets look for a pretty name if (attributes[i].fName == B_DEVICE_PRETTY_NAME) { newDevice = new Device(parent, BUS_NONE, CAT_NONE, attributes[i].fValue); break; } } // A completely unknown device if (newDevice == NULL) { newDevice = new Device(parent, BUS_NONE, CAT_NONE, B_TRANSLATE("Unknown device")); } // Add its attributes to the device, initialize it and add to the list. for (unsigned int i = 0; i < attributes.size(); i++) { newDevice->SetAttribute(attributes[i].fName, attributes[i].fValue); } newDevice->InitFromAttributes(); fDevices.push_back(newDevice); // Process children status_t err; device_node_cookie child = *node; if (get_child(&child) != B_OK) return; do { AddDeviceAndChildren(&child, newDevice); } while ((err = get_next_child(&child)) == B_OK); }
float* tree_walk_algorithm(TimelineEvent *event_queue, PlayerData *player_stats){ //should return damage breakown //breakdown = {} //empty dict int *breakdown = malloc(sizeof(int) * NUM_CLASS_ACTIONS); float *final_breakdown = malloc(sizeof(float) * NUM_CLASS_ACTIONS); int total_d = 0; //dummy/test generated data, to be replaced by player_stats input Stats base_stats = {.agi = 2900, .crit = 800, .haste = 1200, .mast = 1200, .vers = 400, .multi = 800, .agi_mult = 1.0, .crit_mult = 1.0, .haste_mult = 1.0, .mast_mult = 1.0, .vers_mult = 1.0, .multi_mult = 1.0}; Weapon *mh_wep = make_new_weapon(1076, 2000, 2.6, WEAPON_MACE_1H);//124371 - Hammer of Wicked Infusion Weapon *oh_wep = mh_wep; //reuse, why not PlayerData root_player_data = {.player_stats = base_stats, .mh = mh_wep, .oh = oh_wep, .min_power=0, .min_power_secondary=0, .max_power=100, .max_power_secondary=5, .current_power=100, .current_power_secondary=0, .stance=1, .damage_mult=1.0, .haste_value=1.0, .attack_speed=1.0, .player_level=100, .target_level=103, .last_event=0, .regen_power=10, .regen_power_secondary=0}; //TODO: This pile of crap //get first event from event_queue //make root Event struct from it Event *current_node = make_new_event(event_queue->action_id, event_queue->time, total_d, breakdown, root_player_data, NULL, NULL, event_queue->next); //recycle_timeline_event(event_queue); insert_timeline_event(make_new_timeline_event(2.6, MH_AUTOATTACK, ""), current_node); int l = 0; //iteration number while(true) { l++; printf("\nCurrent node - id:%d time:%f iteration:%d\n", current_node->action_id, current_node->time, l); if(l % 1000 == 0){ printf("iteration %d\n", l); } //try to populate the children nodes try_to_populate(current_node); //if the current node has a next child if(if_node_has_next_child(current_node)){ current_node = get_next_child(current_node); } else { //if the parent is null/none/empty, we must be done if(current_node->parent == NULL){ return final_breakdown; } //send the data to the parent's final breakdown send_data_to_parent(current_node); //set the parent as the current node current_node = current_node->parent; //send the child we just left to the recycling bin recycle_last_child(current_node); } } return final_breakdown; } TimelineEvent* initialize_engine(){ engine_settings = malloc(sizeof(struct Settings)); //creates the settings struct in global space // read file from args string, file contains settings for runtime //basic init engine_settings->recycling_bin = NULL; //to point to a linked list of reusable events engine_settings->recycling_bin_timeline = NULL; setup_class_data(); engine_settings->end_condition_type = TIME_BASED; engine_settings->end_condition_value = 10; engine_settings->apl_cd = .1; engine_settings->latency = .05; //50ms engine_settings->spec = SPEC_COMBAT; //talents char *tal = "3000021"; //seal fate, mfd, lemonzest in this temp list engine_settings->talents = malloc(sizeof(int) * (NUM_CLASS_TALENTS/3)); for(int i = 0; tal[i] != '\0'; i++) { //for each character in the string //set the appropriate index in the enum array to that talent's number //talent number is equal to: (char_index*3) + char_number //(int)(tal[i]-'0') generates integer value for the char, type cast to avoid warnings //0 is an empty talent if(tal[i] != '0'){ engine_settings->talents[i] = i*3 + (int)(tal[i]-'0'); } else { engine_settings->talents[i] = 0; } printf("Talent: %d\n", engine_settings->talents[i]); } printf("Loading spec...\n\n"); //build event queue //TODO: APL should go first TimelineEvent *root_queue_node = make_new_timeline_event(0, MH_AUTOATTACK, ""); //root_queue_node->next = make_new_timeline_event(0.01, OH_AUTOATTACK, ""); //run tree walking algorithm return root_queue_node; }