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


C++ Iterator::getInt方法代码示例

本文整理汇总了C++中dbcfile::Iterator::getInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Iterator::getInt方法的具体用法?C++ Iterator::getInt怎么用?C++ Iterator::getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dbcfile::Iterator的用法示例。


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

示例1: sc

Sky::Sky( DBCFile::Iterator data )
{
	pos = Vec3D( data->getFloat( LightDB::PositionX ) / skymul, data->getFloat( LightDB::PositionY ) / skymul, data->getFloat( LightDB::PositionZ ) / skymul );
	r1 = data->getFloat( LightDB::RadiusInner ) / skymul;
	r2 = data->getFloat( LightDB::RadiusOuter ) / skymul;
	//gLog( "New sky (%i) at (%f,%f,%f) with (%f > %f).\n", data->getInt( LightDB::ID ), pos.x, pos.y, pos.z, r1, r2 );

	for (int i=0; i<36; i++) 
		mmin[i] = -2;

	global = ( pos.x == 0.0f && pos.y == 0.0f && pos.z == 0.0f );

	int FirstId = data->getInt( LightDB::DataIDs ) * 18;

	for( int i = 0; i < 18; i++ ) 
	{
		try {
			DBCFile::Record rec = gLightIntBandDB.getByID( FirstId + i );
			int entries = rec.getInt( LightIntBandDB::Entries );

			if ( entries == 0 ) 
				mmin[i] = -1;
			else 
			{
				mmin[i] = rec.getInt( LightIntBandDB::Times );
				for( int l = 0; l < entries; l++ ) 
				{
					SkyColor sc( rec.getInt( LightIntBandDB::Times + l ), rec.getInt( LightIntBandDB::Values + l ) );
					colorRows[i].push_back( sc );
				}
			}
		} catch (LightIntBandDB::NotFound) {
		}
	}
}
开发者ID:ahpho,项目名称:wowmapviewer,代码行数:35,代码来源:sky.cpp

示例2: buildTypeList

void UIWaterTypeBrowser::buildTypeList()
{
  removeChild( WaterTypeList );
  WaterTypeList = new UIListView(4,24,width() - 8,height() - 28,20);
  WaterTypeList->clickable( true );
  addChild(WaterTypeList);
 
 
  
  
  //LiquidTypeDB::getLiquidName(gWorld->getWaterType(tileX, tileY));

  for( DBCFile::Iterator i = gLiquidTypeDB.begin(); i != gLiquidTypeDB.end(); ++i )
  {

          UIFrame *curFrame = new UIFrame(1,1,1,1);
          std::stringstream ss;
          ss << i->getInt(LiquidTypeDB::ID) << "-" << LiquidTypeDB::getLiquidName(i->getInt(LiquidTypeDB::ID));
          UIButton *tempButton = new UIButton(0.0f,
                                              0.0f,
                                              200.0f,
                                              28.0f,
                                              ss.str(),
                                              "Interface\\DialogFrame\\UI-DialogBox-Background-Dark.blp",
                                              "Interface\\DialogFrame\\UI-DialogBox-Background-Dark.blp",
                                              boost::bind(&UIWaterTypeBrowser::setWaterTypeID, this, _1, _2), //steff: kidding me? we talked about this some h before u did this
                                              i->getInt(LiquidTypeDB::ID)
                                              );
          tempButton->setLeft();
          curFrame->addChild(tempButton);
          WaterTypeList->addElement(curFrame);
       
  }

  WaterTypeList->recalcElements(1);
}
开发者ID:Hlkz,项目名称:noggit,代码行数:36,代码来源:UIWaterTypeBrowser.cpp

示例3: createMapList

void Menu::createMapList()
{
	for (DBCFile::Iterator i = gMapDB.begin(); i != gMapDB.end(); ++i)
	{
		MapEntry e;
		e.mapID = i->getInt(MapDB::MapID);
		e.name = i->getLocalizedString(MapDB::Name);
		e.areaType = i->getUInt(MapDB::AreaType);
		if (e.areaType == 3) e.name = i->getString(MapDB::InternalName);

		if (e.areaType < 0 || e.areaType > 3 || !World::IsEditableWorld(e.mapID))
			continue;

		mMaps.push_back(e);
	}
}
开发者ID:Deamon87,项目名称:Noggit3Fork,代码行数:16,代码来源:Menu.cpp

示例4: loadMap

void Menu::loadMap(int mapID)
{
	delete gWorld;
	gWorld = NULL;

	for (DBCFile::Iterator it = gMapDB.begin(); it != gMapDB.end(); ++it)
	{
		if (it->getInt(MapDB::MapID) == mapID)
		{
			gWorld = new World(it->getString(MapDB::InternalName));
			mGUIMinimapWindow->show();
			return;
		}
	}

	LogError << "Map with ID " << mapID << " not found. Failed loading." << std::endl;
}
开发者ID:Deamon87,项目名称:Noggit3Fork,代码行数:17,代码来源:Menu.cpp

示例5: sc

Sky::Sky(DBCFile::Iterator data)
{
    pos = Vec3D(data->getFloat(LightDB::PositionX) / skymul, data->getFloat(LightDB::PositionY) / skymul, data->getFloat(LightDB::PositionZ) / skymul);
    r1 = data->getFloat(LightDB::RadiusInner) / skymul;
    r2 = data->getFloat(LightDB::RadiusOuter) / skymul;

    for (int i = 0; i<36; ++i)
        mmin[i] = -2;

    global = (pos.x == 0.0f && pos.y == 0.0f && pos.z == 0.0f);

    int FirstId = data->getInt(LightDB::DataIDs) * 18 - 17; // cromons light fix ;) Thanks

    for (int i = 0; i < 18; ++i)
    {
        try
        {
            DBCFile::Record rec = gLightIntBandDB.getByID(FirstId + i);
            int entries = rec.getInt(LightIntBandDB::Entries);

            if (entries == 0)
                mmin[i] = -1;
            else
            {
                mmin[i] = rec.getInt(LightIntBandDB::Times);
                for (int l = 0; l < entries; l++)
                {
                    SkyColor sc(rec.getInt(LightIntBandDB::Times + l), rec.getInt(LightIntBandDB::Values + l));
                    colorRows[i].push_back(sc);
                }
            }
        }
        catch (...)
        {
            LogError << "When trying to intialize sky " << data->getInt(LightDB::ID) << ", there was an error with getting an entry in a DBC (" << i << "). Sorry." << std::endl;
            DBCFile::Record rec = gLightIntBandDB.getByID(i);
            int entries = rec.getInt(LightIntBandDB::Entries);

            if (entries == 0)
                mmin[i] = -1;
            else
            {
                mmin[i] = rec.getInt(LightIntBandDB::Times);
                for (int l = 0; l < entries; l++)
                {
                    SkyColor sc(rec.getInt(LightIntBandDB::Times + l), rec.getInt(LightIntBandDB::Values + l));
                    colorRows[i].push_back(sc);
                }
            }
        }
    }



    /*
    unsigned int SKYFOG = data->getInt( LightDB::DataIDs );
    unsigned int ID = data->getInt( LightDB::ID );
    DBCFile::Record rec = gLightParamsDB.getByID( SKYFOG );
    unsigned int skybox = rec.getInt( LightParamsDB::skybox);


    if ( skybox == 0 )
    alt_sky=NULL;
    else{
    DBCFile::Record rec = gLightSkyboxDB.getByID(skybox);
    std::string skyname= rec.getString(LightSkyboxDB::filename);
    alt_sky=new Model(skyname); // if this is ever uncommented, use ModelManager::
    Log << "Loaded sky " << skyname << std::endl;
    }

    */

}
开发者ID:vienis,项目名称:noggit,代码行数:73,代码来源:Sky.cpp

示例6: main

int main()
{
    InitMPQs();
    FILE* fo = fopen("display_bounding_boxes.sql", "w");
    DBCFile displayInfo("DBFilesClient\\CreatureDisplayInfo.dbc");
    DBCFile modelInfo("DBFilesClient\\CreatureModelData.dbc");
    displayInfo.open();
    modelInfo.open();

    std::map<uint32, DBCFile::Record> modelInfoEntries;
    std::map<std::string, ModelCache> modelCache;

    for (DBCFile::Iterator itr = modelInfo.begin(); itr != modelInfo.end(); ++itr)
    {
        unsigned int entry = itr->getInt(0);
        modelInfoEntries.insert(std::make_pair(entry, *itr));
    }

    for (DBCFile::Iterator itr = displayInfo.begin(); itr != displayInfo.end(); ++itr)
    {
        unsigned int displayid = itr->getInt(0);
        unsigned int modelentry = itr->getInt(1);
        float modelscale = itr->getFloat(4);

        std::map<uint32, DBCFile::Record>::iterator  modelitr = modelInfoEntries.find(modelentry);

        if (modelitr == modelInfoEntries.end())
        {
            printf("Cannot find model entry for display %u (entry %u)\n", displayid, modelentry);
            continue;
        }

        DBCFile::Record modelrec = modelitr->second;

        const char* modelname = modelrec.getString(2);

        std::string strmodelname(modelname);

        replace(strmodelname, ".mdx", ".m2", 0);
        replace(strmodelname, ".MDX", ".m2", 0);

        M2Header* header;
        M2Attachment* attachments;
        M2Bone* bones;
        uint16* bonelookups;

        std::map<std::string, ModelCache>::iterator cacheitr = modelCache.find(modelname);

        if (cacheitr == modelCache.end())
        {

            MPQFile modelf(strmodelname.c_str());

            if (modelf.isEof())
            {
                printf("Error: cannot open %s\n", strmodelname.c_str());
                continue;
            }

            printf("Processing %u", displayid);

            header = (M2Header*)malloc(sizeof(M2Header));
            modelf.read(header, sizeof(M2Header));

            printf(" %u attachments %u bone lookups %u bones\n", header->nAttachments, header->nBoneLookupTable, header->nBones);

            attachments = (M2Attachment*)malloc(header->nAttachments * sizeof(M2Attachment));
            modelf.seek(header->ofsAttachments);
            modelf.read(attachments, header->nAttachments * sizeof(M2Attachment));

            bonelookups = (uint16*)malloc(header->nBoneLookupTable * sizeof(uint16));
            modelf.seek(header->ofsBoneLookupTable);
            modelf.read(bonelookups, header->nBoneLookupTable * sizeof(uint16));

            bones = (M2Bone*)malloc(header->nBones * sizeof(M2Bone));
            modelf.seek(header->ofsBones);
            modelf.read(bones, header->nBones * sizeof(M2Bone));

            ModelCache cacheentry;
            cacheentry.attachments = attachments;
            cacheentry.bones = bones;
            cacheentry.bonelookups = bonelookups;
            cacheentry.header = header;
            modelCache.insert(std::make_pair(modelname, cacheentry));
        }
        else
        {
            header = cacheitr->second.header;
            bones = cacheitr->second.bones;
            bonelookups = cacheitr->second.bonelookups;
            attachments = cacheitr->second.attachments;
        }

        //try and get the bone
        for (uint32 i = 0; i < header->nAttachments; ++i)
        {
            if (attachments[i].bone > header->nBoneLookupTable)
            {
                printf("Attachment %u requests bonelookup %u (too large, bonelookup table is only %u entries)\n", i, attachments[i].bone, header->nBoneLookupTable);
                continue;
//.........这里部分代码省略.........
开发者ID:AriDEV,项目名称:AscEmu,代码行数:101,代码来源:CreatureDataExtractor.cpp


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