当前位置: 首页>>代码示例>>C++>>正文


C++ dbc函数代码示例

本文整理汇总了C++中dbc函数的典型用法代码示例。如果您正苦于以下问题:C++ dbc函数的具体用法?C++ dbc怎么用?C++ dbc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dbc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

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;
	}
}
开发者ID:FTCTeam4977,项目名称:Robot2013-2014,代码行数:28,代码来源:Teleop.c

示例2: dbc

 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;
 }
开发者ID:BohuTANG,项目名称:ft-index,代码行数:14,代码来源:cursor.cpp

示例3: ReadMapDBC

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;
}
开发者ID:Erotix8210,项目名称:StrawberryCore,代码行数:34,代码来源:System.cpp

示例4: ReadAreaTableDBC

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);
}
开发者ID:AwkwardDev,项目名称:StrawberryCore,代码行数:25,代码来源:dbc.cpp

示例5: ReadLiquidTypeTableDBC

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);
}
开发者ID:Erotix8210,项目名称:StrawberryCore,代码行数:34,代码来源:System.cpp

示例6: ReadMapDBC

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;
}
开发者ID:martial69320,项目名称:cerberus,代码行数:31,代码来源:System.cpp

示例7: ReadMapDBC

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;
}
开发者ID:FirstCore,项目名称:PandaCore,代码行数:30,代码来源:System.cpp

示例8: ReadAreaTableDBC

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);
}
开发者ID:FirstCore,项目名称:PandaCore,代码行数:27,代码来源:System.cpp

示例9: dbc

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");
    }
开发者ID:madtreat,项目名称:dbcon,代码行数:25,代码来源:dbconfwindow.cpp

示例10: ReadLiquidTypeTableDBC

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);
}
开发者ID:FirstCore,项目名称:PandaCore,代码行数:28,代码来源:System.cpp

示例11: nodo_analizar

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);
}
开发者ID:JuliaLangEs,项目名称:latino,代码行数:7,代码来源:ast.c

示例12: dbc

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();
        }));
    }
}
开发者ID:tgreener,项目名称:MOG1-GameServer,代码行数:34,代码来源:ThreadPool.cpp

示例13: malloc

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);
}
开发者ID:AngelFishy,项目名称:Solid,代码行数:8,代码来源:ast.c

示例14: dbc

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);
}
开发者ID:FlavioFalcao,项目名称:Wayfinder-Server,代码行数:58,代码来源:MapModuleNotice.cpp

示例15: ExtractGameobjectModels

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");
}
开发者ID:Allowed,项目名称:SkyFire_5xx,代码行数:55,代码来源:gameobject_extract.cpp


注:本文中的dbc函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。