task main() { waitForStart(); while (true) { getJoystickSettings(joystick); // Flag OI if ( joy2Btn(6) ) motor[flag] = 20; else if ( joy2Btn(5) ) motor[flag] = -20; else setFlagRaiserMotor(joy2Btn(2)); // Winch+Collector OI setWinchMotor(dbc(joystick.joy2_y1, 10)); setCollectorRoller(joy2Btn(7)||joy2Btn(8), joy2Btn(8)); // Drivetrain OI motor[leftDrive] = dbc(-joystick.joy1_y1, 8); motor[rightDrive] = dbc(joystick.joy1_y2, 8); // Auto arm OI motor[autoArm] = dbc(joystick.joy2_y2, 8)/2; } }
bool DBC::advance(const IterationStrategy &strategy, YDB_CALLBACK_FUNCTION callback, void *extra) const { int r; if (strategy.forward) { r = dbc()->c_getf_next(dbc(), strategy.getf_flags(), callback, extra); } else { r = dbc()->c_getf_prev(dbc(), strategy.getf_flags(), callback, extra); } if (r == DB_NOTFOUND) { return false; } else if (r != 0 && r != -1) { handle_ft_retval(r); } return true; }
uint32 ReadMapDBC(int const locale) { HANDLE localeFile; char localMPQ[512]; sprintf(localMPQ, "%s/Data/%s/locale-%s.MPQ", input_path, langs[locale], langs[locale]); if (!SFileOpenArchive(localMPQ, 0, MPQ_OPEN_READ_ONLY, &localeFile)) exit(1); printf("Read Map.dbc file... "); HANDLE dbcFile; if (!SFileOpenFileEx(localeFile, "DBFilesClient\\Map.dbc", SFILE_OPEN_PATCHED_FILE, &dbcFile)) { printf("Fatal error: Cannot find Map.dbc in archive!\n"); exit(1); } DBCFile dbc(dbcFile); if(!dbc.open()) { printf("Fatal error: Invalid Map.dbc file format!\n"); exit(1); } size_t map_count = dbc.getRecordCount(); map_ids = new map_id[map_count]; for(uint32 x = 0; x < map_count; ++x) { map_ids[x].id = dbc.getRecord(x).getUInt(0); strcpy(map_ids[x].name, dbc.getRecord(x).getString(1)); } printf("Done! (%u maps loaded)\n", map_count); return map_count; }
void ReadAreaTableDBC() { Log sLog; sLog.Write("Read AreaTable.dbc file..."); DBCFile dbc("DBFilesClient\\AreaTable.dbc"); if(!dbc.open()) { sLog.Write("Fatal error: Invalid AreaTable.dbc file format!"); assert(false); } size_t area_count = dbc.getRecordCount(); size_t maxid = dbc.getMaxId(); areas = new uint16[maxid + 1]; memset(areas, 0xff, (maxid + 1) * sizeof(uint16)); for(uint32 x = 0; x < area_count; ++x) areas[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); maxAreaId = dbc.getMaxId(); sLog.Write("Done! (%u areas loaded)", area_count); }
void ReadLiquidTypeTableDBC(int const locale) { HANDLE localeFile; char localMPQ[512]; sprintf(localMPQ, "%s/Data/%s/locale-%s.MPQ", input_path, langs[locale], langs[locale]); if (!SFileOpenArchive(localMPQ, 0, MPQ_OPEN_READ_ONLY, &localeFile)) exit(1); printf("Read LiquidType.dbc file..."); HANDLE dbcFile; if (!SFileOpenFileEx(localeFile, "DBFilesClient\\LiquidType.dbc", SFILE_OPEN_PATCHED_FILE, &dbcFile)) { printf("Fatal error: Cannot find LiquidType.dbc in archive!\n"); exit(1); } DBCFile dbc(dbcFile); if(!dbc.open()) { printf("Fatal error: Invalid LiquidType.dbc file format!\n"); exit(1); } size_t LiqType_count = dbc.getRecordCount(); size_t LiqType_maxid = dbc.getMaxId(); LiqType = new uint16[LiqType_maxid + 1]; memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); for(uint32 x = 0; x < LiqType_count; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); printf("Done! (%u LiqTypes loaded)\n", LiqType_count); }
uint32 ReadMapDBC() { printf("Read Map.dbc file... "); DBCFile dbc("DBFilesClient\\Map.dbc"); if(!dbc.open()) { printf("Fatal error: Invalid Map.dbc file format!\n"); exit(1); } size_t map_count = dbc.getRecordCount(); map_ids = new map_id[map_count]; for(uint32 x = 0; x < map_count; ++x) { map_ids[x].id = dbc.getRecord(x).getUInt(0); const char* map_name = dbc.getRecord(x).getString(1); size_t max_map_name_length = sizeof(map_ids[x].name); if (strlen(map_name) >= max_map_name_length) { printf("Fatal error: Map name too long!\n"); exit(1); } strncpy(map_ids[x].name, map_name, max_map_name_length); map_ids[x].name[max_map_name_length - 1] = '\0'; } printf("Done! (" SZFMTD "maps loaded)\n", map_count); return map_count; }
uint32 ReadMapDBC() { printf("Read Map.dbc file... "); HANDLE dbcFile; if (!SFileOpenFileEx(LocaleMpq, "DBFilesClient\\Map.dbc", SFILE_OPEN_PATCHED_FILE, &dbcFile)) { printf("Fatal error: Cannot find Map.dbc in archive!\n"); exit(1); } DBCFile dbc(dbcFile); if (!dbc.open()) { printf("Fatal error: Invalid Map.dbc file format!\n"); exit(1); } size_t map_count = dbc.getRecordCount(); map_ids = new map_id[map_count]; for(uint32 x = 0; x < map_count; ++x) { map_ids[x].id = dbc.getRecord(x).getUInt(0); strcpy(map_ids[x].name, dbc.getRecord(x).getString(1)); } SFileCloseFile(dbcFile); printf("Done! (%u maps loaded)\n", map_count); return map_count; }
void ReadAreaTableDBC() { printf("Read AreaTable.dbc file..."); HANDLE dbcFile; if (!SFileOpenFileEx(LocaleMpq, "DBFilesClient\\AreaTable.dbc", SFILE_OPEN_PATCHED_FILE, &dbcFile)) { printf("Fatal error: Cannot find AreaTable.dbc in archive!\n"); exit(1); } DBCFile dbc(dbcFile); if(!dbc.open()) { printf("Fatal error: Invalid AreaTable.dbc file format!\n"); exit(1); } size_t area_count = dbc.getRecordCount(); maxAreaId = dbc.getMaxId(); areas = new uint16[maxAreaId + 1]; for (uint32 x = 0; x < area_count; ++x) areas[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); SFileCloseFile(dbcFile); printf("Done! (%u areas loaded)\n", area_count); }
void DBConfWindow::verifyTables() { DBCon dbc(dbSettings, "check-tables"); if (dbc.isOpen()) { QString tableCheck = "SHOW TABLES;"; statusBox->insertPlainText(tr("\nVerifying db tables exist...\n")); QSqlQuery results = dbc.execQuery(tableCheck); QStringList dbTableList; while (results.next()) { QString dbt = results.value(0).toString(); dbTableList.append(dbt); } DBTableList expected = dbSettings->getTables(); foreach (DBTable* table, expected) { statusBox->insertPlainText("-> " + table->name() + ": "); if (dbTableList.contains(table->name())) { statusBox->setTextColor(Qt::green); statusBox->insertPlainText(tr("exists")); } else { statusBox->setTextColor(Qt::red); statusBox->insertPlainText(tr("missing")); } statusBox->setTextColor(Qt::black); scrollToEnd(); statusBox->insertPlainText("\n"); }
void DBConfWindow::testConnection() { statusBox->setVisible(true); QString dbTypeStr = dbSettings->dbTypeStr(); statusBox->insertPlainText(tr("\nVerifying %1 driver is installed...").arg(dbTypeStr)); bool isValidDBDriver = DBCon::isValidDatabaseDriver("Q" + dbTypeStr); if (isValidDBDriver) { statusBox->insertPlainText(tr("yes\n")); } else { statusBox->setTextColor(Qt::red); statusBox->insertPlainText(tr("no")); statusBox->setTextColor(Qt::black); statusBox->insertPlainText("\n"); } statusBox->insertPlainText(tr("Attempting to connect to database...\n")); DBCon dbc(dbSettings, "test-database"); if (dbc.isValid()) { statusBox->insertPlainText(tr("Database connection driver is valid\n")); } if (dbc.isOpenError()) { statusBox->setTextColor(Qt::red); statusBox->insertPlainText(tr("Error opening database connection:\n")); statusBox->insertPlainText(dbc.lastError()); statusBox->setTextColor(Qt::black); statusBox->insertPlainText("\n"); } else if (dbc.isOpen()) { statusBox->insertPlainText(tr("Connection to database has been opened successfully!\n")); statusBox->setTextColor(Qt::blue); statusBox->insertPlainText(tr("You should save the database settings now.")); statusBox->setTextColor(Qt::black); } scrollToEnd(); }
void ReadLiquidTypeTableDBC() { printf("Read LiquidType.dbc file..."); HANDLE dbcFile; if (!SFileOpenFileEx(LocaleMpq, "DBFilesClient\\LiquidType.dbc", SFILE_OPEN_PATCHED_FILE, &dbcFile)) { printf("Fatal error: Cannot find LiquidType.dbc in archive!\n"); exit(1); } DBCFile dbc(dbcFile); if(!dbc.open()) { printf("Fatal error: Invalid LiquidType.dbc file format!\n"); exit(1); } size_t liqTypeCount = dbc.getRecordCount(); size_t liqTypeMaxId = dbc.getMaxId(); LiqType = new uint16[liqTypeMaxId + 1]; memset(LiqType, 0xff, (liqTypeMaxId + 1) * sizeof(uint16)); for(uint32 x = 0; x < liqTypeCount; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); SFileCloseFile(dbcFile); printf("Done! (%u LiqTypes loaded)\n", liqTypeCount); }
lat_objeto *nodo_analizar_arbol(lat_vm *vm, ast *tree) { lat_bytecode *bcode = (lat_bytecode *)lat_asignar_memoria(sizeof(lat_bytecode) * MAX_BYTECODE_FUNCTION); int i = nodo_analizar(vm, tree, bcode, 0); dbc(OP_END, 0, 0, NULL); nodo_liberar(tree); return lat_definir_funcion(vm, bcode); }
void ThreadPool::run() { if(isRunning) return; //Threads are already running. isRunning = true; for(int i = 0; i < count; i++) { threads.push_back(std::thread([&] (void) -> void { DBConnection dbc(dbWriteLock); dbc.open(DB_FILE); ServiceLocator sl; sl.setAsServiceLocator(); sl.setDBConnection(&dbc); initFunction(); while(true) { poolLock.wait(); if(!isRunning) break; int handle = this->popHandle(); sl.setClientSocketHandle(handle); runFunction(handle); } deinitFunction(); dbc.close(); })); } }
solid_object *parse_tree(ast_node *tree) { solid_bytecode *bcode = (solid_bytecode *) malloc( sizeof(solid_bytecode) * 1024); int i = parse_node(tree, bcode, 0); dbc(OP_END, 0, 0, NULL); return define_function(bcode, NULL); }
bool MapModuleNotice::save(DataBuffer* dataBuffer, int version) { DataBufferChecker dbc(*dataBuffer, "MapModuleNotice::save"); dbc.assertRoom(getSizeInDataBuffer(version)); mc2dbg << "Saves MapModuleNotice" << endl; if ( version > 0 ) { // Version of MapModuleNotice on disk. // Differs from the version of index.db, but does // not exist in index.db version 0 dataBuffer->writeNextLong( 1 ); } dataBuffer->writeNextLong(m_mapID); dataBuffer->writeNextLong(m_countryCode); dataBuffer->writeNextLong(m_creationTime); dataBuffer->writeNextShort(0); // Number of strings dataBuffer->writeNextByte(0); // Current status. Not used. dataBuffer->writeNextByte(m_neighbourMaps.size()); mc2dbg4 << "[MMN]: Saving mapnotice with mapID " << m_mapID << endl; mc2dbg4 << ", nbrStrings = 0, nbrNeighbours = " << m_neighbourMaps.size() << endl; mc2dbg4 << " m_neighbourMaps: ["; // Save neighbour maps for( set<uint32>::const_iterator it = m_neighbourMaps.begin(); it != m_neighbourMaps.end(); ++it ) { dataBuffer->writeNextLong(*it); mc2dbg4 << *it << " "; } mc2dbg4 << "]" << endl; // Save the strings. // Removed // Save the GfxData m_gfxData->save( *dataBuffer ); MC2BoundingBox bbox; m_gfxData->getMC2BoundingBox(bbox); mc2dbg << "Saved gfx with bbox:" << endl; bbox.dump(); if ( version > 0 ) { mc2dbg4 << "[MMN]: Saving map name \"" << m_mapName << "\" for map id " << m_mapID << endl; dataBuffer->writeNextString(m_mapName); } return (true); }
void ExtractGameobjectModels() { printf("Extracting GameObject models..."); DBCFile dbc(LocaleMpq, "DBFilesClient\\GameObjectDisplayInfo.dbc"); if(!dbc.open()) { printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n"); exit(1); } std::string basepath = szWorkDirWmo; basepath += "/"; std::string path; FILE * model_list = fopen((basepath + "temp_gameobject_models").c_str(), "wb"); for (DBCFile::Iterator it = dbc.begin(); it != dbc.end(); ++it) { path = it->getString(1); if (path.length() < 4) continue; FixNameCase((char*)path.c_str(), path.size()); char * name = GetPlainName((char*)path.c_str()); FixNameSpaces(name, strlen(name)); char * ch_ext = GetExtension(name); if (!ch_ext) continue; strToLower(ch_ext); bool result = false; if (!strcmp(ch_ext, ".wmo")) result = ExtractSingleWmo(path); else if (!strcmp(ch_ext, ".mdl")) // TODO: extract .mdl files, if needed continue; else //if (!strcmp(ch_ext, ".mdx") || !strcmp(ch_ext, ".m2")) result = ExtractSingleModel(path); if (result) { uint32 displayId = it->getUInt(0); uint32 path_length = strlen(name); fwrite(&displayId, sizeof(uint32), 1, model_list); fwrite(&path_length, sizeof(uint32), 1, model_list); fwrite(name, sizeof(char), path_length, model_list); } } fclose(model_list); printf("Done!\n"); }
task gyroTask() { float lastTime = nPgmTime; while(1) { gyroData.degsec = HTGYROreadRot(GYRO); gyroData.deg += dbc(gyroData.degsec,1)*((nPgmTime-lastTime)/1000); lastTime = nPgmTime; wait1Msec(1); } }
void IDTranslationTable::load(DataBuffer& dbuf) { DataBufferChecker dbc(dbuf, "IDTranslationTable::load"); if ( m_version != 0) { loadOld( dbuf, 0 ); // ok to use 0 here? when is load() used? } else { loadNew( dbuf, 0 ); } dbc.assertPosition(getSizeInDataBuffer()); }
// copied from contrib/extractor/System.cpp void ReadLiquidTypeTableDBC() { switch(expansion) { case 0: { printf("Setting liquid types..."); LiqType = new uint16[21]; memset(LiqType, 0xff, (21)*sizeof(uint16)); LiqType[1] = 0; LiqType[2] = 1; LiqType[3] = 2; LiqType[4] = 3; LiqType[21] = 3; printf("Done! (5 LiqTypes set)\n"); }break; case 1: { printf("Setting liquid types..."); LiqType = new uint16[62]; memset(LiqType, 0xff, (62)*sizeof(uint16)); LiqType[1] = 0; LiqType[2] = 1; LiqType[3] = 2; LiqType[4] = 3; LiqType[21] = 3; LiqType[41] = 0; LiqType[61] = 0; printf("Done! (7 LiqTypes set)\n"); }break; default: { printf("Read LiquidType.dbc file..."); DBCFile dbc("DBFilesClient\\LiquidType.dbc"); if(!dbc.open()) { printf("Fatal error: Invalid LiquidType.dbc file format!\n"); exit(1); } size_t LiqType_count = dbc.getRecordCount(); size_t LiqType_maxid = dbc.getRecord(LiqType_count - 1).getUInt(0); LiqType = new uint16[LiqType_maxid + 1]; memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); for(uint32 x = 0; x < LiqType_count; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); printf("Done! (%u LiqTypes loaded)\n", (unsigned int)LiqType_count); }break; } }
void ReadAreaTableDBC() { printf("Read AreaTable.dbc file... "); DBCFile dbc("DBFilesClient\\AreaTable.dbc"); dbc.open(); unsigned int area_count=dbc.getRecordCount(); uint32 maxid = dbc.getMaxId(); areas=new uint16[maxid + 1]; memset(areas, 0xff, sizeof(areas)); for(unsigned int x=0; x<area_count;++x) areas[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); printf("Done! (%u areas loaded)\n", area_count); }
void ReadLiquidTypeTableDBC() { printf("Read LiquidType.dbc file..."); DBCFile dbc("DBFilesClient\\LiquidType.dbc"); dbc.open(); size_t LiqType_count = dbc.getRecordCount(); size_t LiqType_maxid = dbc.getMaxId(); LiqType = new uint16[LiqType_maxid + 1]; memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); for(uint32 x = 0; x < LiqType_count; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); printf("Done! (%u LiqTypes loaded)\n", LiqType_count); }
bool DBC::set_range(const IterationStrategy &strategy, const Bounds &bounds, YDB_CALLBACK_FUNCTION callback, void *extra) const { int r = dbc()->c_set_bounds(dbc(), bounds.left_dbt(), bounds.right_dbt(), strategy.prelock, 0); handle_ft_retval(r); if (strategy.forward) { if (bounds.left_infinite()) { r = dbc()->c_getf_first(dbc(), strategy.getf_flags(), callback, extra); } else { r = dbc()->c_getf_set_range(dbc(), strategy.getf_flags(), const_cast<DBT *>(bounds.left_dbt()), callback, extra); } } else { if (bounds.right_infinite()) { r = dbc()->c_getf_last(dbc(), strategy.getf_flags(), callback, extra); } else { r = dbc()->c_getf_set_range_reverse(dbc(), strategy.getf_flags(), const_cast<DBT *>(bounds.right_dbt()), callback, extra); } } if (r == DB_NOTFOUND) { return false; } else if (r != 0 && r != -1) { handle_ft_retval(r); } return true; }
uint32 ReadMapDBC() { printf("Read Map.dbc file... "); DBCFile dbc("DBFilesClient\\Map.dbc"); dbc.open(); uint32 map_count=dbc.getRecordCount(); map_ids=new map_id[map_count]; for(unsigned int x=0;x<map_count;x++) { map_ids[x].id=dbc.getRecord(x).getUInt(0); strcpy(map_ids[x].name,dbc.getRecord(x).getString(1)); } printf("Done! (%u maps loaded)\n", map_count); return map_count; }
int SearchUnit::save(DataBuffer& buf) const { DataBufferChecker dbc(buf, "SearchUnit::save"); dbc.assertRoom(getSizeInDataBuffer()); // Write the version buf.writeNextLong(0); m_searchMap->save(buf); m_ownedMultiStringSearch->save(buf); // Done dbc.assertPosition(getSizeInDataBuffer()); return getSizeInDataBuffer(); }
void role_perms_edit_dialog::set_checkboxes() { db_ctxt dbc(true); try { if (m_role_oid > 0) { db_role role(m_role_oid); QList<db_obj_privilege> privs_for_read = db_obj_privilege::ability_privileges("read", &dbc); m_initial_privs[priv_read] = role.has_multiple_privileges(privs_for_read, &dbc); QList<db_obj_privilege> privs_for_update = db_obj_privilege::ability_privileges("update", &dbc); m_initial_privs[priv_update] = role.has_multiple_privileges(privs_for_update, &dbc); QList<db_obj_privilege> privs_for_trash = db_obj_privilege::ability_privileges("trash", &dbc); m_initial_privs[priv_trash] = role.has_multiple_privileges(privs_for_trash, &dbc); QList<db_obj_privilege> privs_for_delete = db_obj_privilege::ability_privileges("delete", &dbc); m_initial_privs[priv_delete] = role.has_multiple_privileges(privs_for_delete, &dbc); QList<db_obj_privilege> privs_for_compose = db_obj_privilege::ability_privileges("compose", &dbc); m_initial_privs[priv_compose] = role.has_multiple_privileges(privs_for_compose, &dbc); QList<db_obj_privilege> privs_for_basic_management = db_obj_privilege::ability_privileges("admin-level1", &dbc); m_initial_privs[priv_basic_management] = role.has_multiple_privileges(privs_for_basic_management, &dbc); } else { memset((void*)m_initial_privs, 0, sizeof(m_initial_privs)); } m_perm_read->setChecked(m_initial_privs[priv_read]); m_perm_update->setChecked(m_initial_privs[priv_update]); m_perm_trash->setChecked(m_initial_privs[priv_trash]); m_perm_delete->setChecked(m_initial_privs[priv_delete]); m_perm_compose->setChecked(m_initial_privs[priv_compose]); m_perm_basic_management->setChecked(m_initial_privs[priv_basic_management]); } catch(db_excpt& p) { DBEXCPT (p); } }
// copied from contrib/extractor/System.cpp void ReadLiquidTypeTableDBC() { HANDLE localeFile; char localMPQ[1024]; snprintf(localMPQ, sizeof(localMPQ), "%smisc.MPQ", input_path); if (FileExists(localMPQ)==false) { // Use misc.mpq printf(localMPQ, "%s/Data/%s/locale-%s.MPQ", input_path); } if (!SFileOpenArchive(localMPQ, 0, MPQ_OPEN_READ_ONLY, &localeFile)) { exit(1); } printf("Read LiquidType.dbc file..."); HANDLE dbcFile; if (!SFileOpenFileEx(localeFile, "DBFilesClient\\LiquidType.dbc", SFILE_OPEN_PATCHED_FILE, &dbcFile)) { if (!SFileOpenFileEx(localeFile, "DBFilesClient\\LiquidType.dbc", SFILE_OPEN_PATCHED_FILE, &dbcFile)) { printf("Fatal error: Cannot find LiquidType.dbc in archive!\n"); exit(1); } } DBCFile dbc(localeFile, "DBFilesClient\\LiquidType.dbc"); if (!dbc.open()) { printf("Fatal error: Invalid LiquidType.dbc file format!\n"); exit(1); } size_t LiqType_count = dbc.getRecordCount(); size_t LiqType_maxid = dbc.getMaxId(); LiqType = new uint16[LiqType_maxid + 1]; memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); for (size_t x = 0; x < LiqType_count; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); printf("Done! (%zu LiqTypes loaded)\n", LiqType_count); }
void armBaseUpdate() { int potInput = HTSPBreadADC(S3, 0, 10)+BASE_OFFSET; static int loopsStable = 0; if ( abs(base.error) <= 60 ) // was 75 { if ( loopsStable < 1000 ) loopsStable++; } else loopsStable = 0; if ( potInput < 500 && potInput > 270 ) { // Arm is in top range - very little force needed to maintain position base.Kp = 0.7; base.Ki = 0.01; base.errorSum = 0; } else { base.Kp = 1.5; base.Ki = 0.07; } if ( abs(base.error) > 70 && base.target == BASE_PICKUP ) // Arm is headed forward and we are far away base.Kd = 2.5; // increase D to prevent slaming against the floor //else if ( potInput > 450 && base.target > 450 ) // TODO: check if this D modification is still needed // base.Kd = 2.5; else base.Kd = 0.4; if ( loopsStable <= 9 ) // was 20 motor[armBase] = dbc(limitVar(calcPID(base, potInput), 80), 23); else { calcPID(base, potInput); // keep PID updated for error calculation // even though we are not using it's output base.errorSum = 0; // prevent I from building up motor[armBase] = 0; } }
void ReadLiquidTypeTableDBC() { printf("Read LiquidType.dbc file..."); DBCFile dbc("DBFilesClient\\LiquidType.dbc"); if(!dbc.open()) { printf("Fatal error: Invalid LiquidType.dbc file format!\n"); exit(1); } size_t liqTypeCount = dbc.getRecordCount(); size_t liqTypeMaxId = dbc.getMaxId(); LiqType = new uint16[liqTypeMaxId + 1]; memset(LiqType, 0xff, (liqTypeMaxId + 1) * sizeof(uint16)); for(uint32 x = 0; x < liqTypeCount; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); printf("Done! (" SZFMTD " LiqTypes loaded)\n", liqTypeCount); }
// copied from contrib/extractor/System.cpp void ReadLiquidTypeTableDBC() { printf("Read LiquidType.dbc file..."); DBCFile dbc("DBFilesClient\\LiquidType.dbc"); if(!dbc.open()) { printf("Fatal error: Invalid LiquidType.dbc file format!\n"); exit(1); } size_t LiqType_count = dbc.getRecordCount(); size_t LiqType_maxid = dbc.getRecord(LiqType_count - 1).getUInt(0); LiqType = new uint16[LiqType_maxid + 1]; memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); for(uint32 x = 0; x < LiqType_count; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); printf("Done! (%u LiqTypes loaded)\n", (unsigned int)LiqType_count); }
/** * @brief * */ void ReadLiquidTypeTableDBC() { printf("Reading liquid types from LiquidType.dbc..."); DBCFile dbc("DBFilesClient\\LiquidType.dbc"); if (!dbc.open()) { printf("Fatal error: Could not read LiquidType.dbc!\n"); exit(1); } size_t LiqType_count = dbc.getRecordCount(); size_t LiqType_maxid = dbc.getMaxId(); LiqType = new uint16[LiqType_maxid + 1]; memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); for (uint32 x = 0; x < LiqType_count; ++x) { LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); } printf("Success! %lu liquid types loaded.\n", LiqType_count); }