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


C++ CsvReader类代码示例

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


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

示例1: load

    //--------------------------------------------------------------------------------------------
	// MG_CN_MODIFY
    MG::Bool BigMapResCsv::load( Str16 fileName, IMGExternalPackManager* packManager/* = NULL */)
    {
        CsvReader csvreader;
		// MG_CN_MODIFY
        if(!csvreader.create(fileName, packManager))
        {
            return false;
        }

        CsvData* csvdata = NULL;
        Int RowCount = csvreader.count();

        for(int i = 0; i < RowCount; ++i)
        {
            csvdata = csvreader.findValue(i);
            if(!csvdata)
            {
                continue;
            }

            UInt nCol = 3;

            std::string widgetName;
            MGStrOp::toString(csvdata->mData[nCol++].c_str(), widgetName);
            UInt placeid = 0;
            MGStrOp::toU32(csvdata->mData[nCol++].c_str(), placeid );


            mMapWidgetNamePlaceId[widgetName] = placeid;
        }

        return true;
    }
开发者ID:dnjsflagh1,项目名称:code,代码行数:35,代码来源:BigMapResCsv.cpp

示例2: load

    //-----------------------------------------------------------------------------------
	// MG_CN_MODIFY
	MG::Bool CharacterResourceConfig::load( Str16 fileName, IMGExternalPackManager* packManager/* = NULL*/ )
	{
		CsvReader csvreader;
		// MG_CN_MODIFY
		if(!csvreader.create(fileName, packManager))
		{
			return false;
		}

		CsvData* csvdata = NULL;
		Int RowCount = csvreader.count();

		for(int i = 0; i < RowCount; ++i)
		{
			csvdata = csvreader.findValue(i);
			if(!csvdata)
			{
				continue;
			}

			CharacterResInfo* res_info = new CharacterResInfo();
			MGStrOp::toU32(csvdata->mData[CHARACTER_ID].c_str(),res_info->id);
			MGStrOp::toU32(csvdata->mData[CHARACTER_TEMPLATEID].c_str(),res_info->templateid);
			res_info->name = csvdata->mData[CHARACTER_NAME].c_str();
			MGStrOp::toU32(csvdata->mData[CHARACTER_MAPLISTID].c_str(),res_info->maplistid);
            MGStrOp::toU32(csvdata->mData[CHARACTER_POINTRESId].c_str(),res_info->pointresid);
			MGStrOp::toI32(csvdata->mData[CHARACTER_MAPLISTTYPE].c_str(),(I32&)res_info->maplisttype);
			mCharacterResourceList[res_info->id] = res_info;
            
		}
		return true;

	}
开发者ID:dnjsflagh1,项目名称:code,代码行数:35,代码来源:CharacterResourceConfig.cpp

示例3: fromOutlookCsvData

Schedule Schedule::fromOutlookCsvData(const QString& dataString,
                                      const QTimeZone& timeZone,
                                      const QString& dateFormat,
                                      const QString& timeFormat)
{
    CsvReader reader;
    reader.setData(dataString);
    QList<QStringList> parsedCsv = reader.parse();

    return Schedule::fromOutlookCsvParsed(parsedCsv, timeZone, dateFormat, timeFormat);
}
开发者ID:kenrobbins,项目名称:caltrain_runner,代码行数:11,代码来源:schedule.cpp

示例4: loadFile

	//-------------------------------------------------------------------------------------------------------
	// MG_CN_MODIFY
	MG::Bool CharacterNpcList::loadFile( Str16 filename, IMGExternalPackManager* packManager/* = NULL*/ )
	{
		CsvReader csvreader;
		// MG_CN_MODIFY
		if(!csvreader.create(filename, packManager))
		{
			return false;
		}

		CsvData* csvdata = NULL;
		Int RowCount = csvreader.count();

		for(int i = 0; i < RowCount; ++i)
		{
			csvdata = csvreader.findValue(i);
			if(!csvdata)
			{
				continue;
			}

			CharacterNpcInfo* tempCharInfo = new CharacterNpcInfo;
			UInt nCol = 0;

			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->CharacterNpcId);
			nCol++;
			tempCharInfo->ListName		    = csvdata->mData[nCol++].c_str();
			tempCharInfo->SurName		    = csvdata->mData[nCol++].c_str();
			tempCharInfo->Name				= csvdata->mData[nCol++].c_str();
			tempCharInfo->Title				= csvdata->mData[nCol++].c_str();
			tempCharInfo->Tips				= csvdata->mData[nCol++].c_str();

			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), (U32&)tempCharInfo->GenderType   );
			DYNAMIC_ASSERT(tempCharInfo->GenderType < GENDER_TYPE_MAX  &&  tempCharInfo->GenderType > GENDER_TYPE_NULL);

			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->Level						);
			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->CharacterAppellationId		);
			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->CharacterDialogId			);
			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->AIId						);
			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->InfluenceId				); 
			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->ArtIconId					);
			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->ArtMashId					);
			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->ArtEffectId				);
			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->CharacterVisionEventListId	); 
			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->AIBaseGroupId				); 
			MGStrOp::toU32(csvdata->mData[nCol++].c_str(), tempCharInfo->AIFightGroupId				);

			mMapCharacterNpcInfo[tempCharInfo->CharacterNpcId] = tempCharInfo;
		}

		return true;
	}
开发者ID:dnjsflagh1,项目名称:code,代码行数:53,代码来源:CharacterNpcList.cpp

示例5: loadCsv

	//--------------------------------------------------------------------------
	// MG_CN_MODIFY
	Bool DistrictListCsv::loadCsv(const Char16* FileName, IMGExternalPackManager* packManager/* = NULL*/)
	{
		CsvReader csvreader;
		// MG_CN_MODIFY
		if(!csvreader.create(FileName, packManager))
		{
			return false;
		}

		CsvData* csvdata = NULL;
		Int RowCount = csvreader.count();

		for(Int i = 0; i < RowCount; ++i)
		{
			csvdata = csvreader.findValue(i);
			if(!csvdata)
			{
				continue;
			}

			DistrictIdType id;
			MGStrOp::toI32(csvdata->mData[DistrictListRow::districtId].c_str(), id);
			if (true == isInDistrictList(id))
			{
				DYNAMIC_ASSERT(0);
				continue;
			}

			I32 openType = -1;
			MGStrOp::toI32(csvdata->mData[DistrictListRow::openType].c_str(), openType);
			if (DOT_OPEN != (DistrictOpenType)openType)
			{
				continue;
			}

			DistrictListCsvInfo* newDistrictInfo = mDistrictList.createOrRetrieve(id, false);
			
			newDistrictInfo->setDistrictId(id);
			newDistrictInfo->setName(csvdata->mData[DistrictListRow::name]);
			newDistrictInfo->setText(csvdata->mData[DistrictListRow::text]);
			newDistrictInfo->setTitle(csvdata->mData[DistrictListRow::title]);
			newDistrictInfo->setOpenType((DistrictOpenType)openType);

			I32 rank = -1;
			MGStrOp::toI32(csvdata->mData[DistrictListRow::districtRank].c_str(), rank);
			newDistrictInfo->setRank((DistrictRankType)rank);
			int kk = 0;
		}

		return true;
	}
开发者ID:dnjsflagh1,项目名称:code,代码行数:53,代码来源:DistrictList.cpp

示例6: LoadDataFromCsv

bool Data_EnemyDraw::LoadDataFromCsv(){
	// リストの解放
	drawList.Release();
	// Csvを読み込むクラス
	CsvReader				reader;
	// ファイル名を保持する
	TCHAR					fileName[MAX_PATH];
	// グループの内容を一時的に保持する変数
	Data_EnemyDraw_Data		tmpDraw;

	strcpy_s(fileName, MAX_PATH-1, CSVFILE_ENEMYDRAW);
	if(reader.Open(fileName)){
		// ダミー行
		reader.NextLine();
		// csvファイルを読み込んでグループに格納する
		for(int n=0; n<MAX_ENEMYDRAWFILE; n++){
			tmpDraw = DATA_ENEMYDRAW_DATA();
			// レファレンス用IDを取得する
			if(reader.Read() == CSV_READ_NOERROR){
				if(reader.GetIntValue(1, 0) == 0){
					continue;
				}
				tmpDraw.refID = (WORD)reader.GetIntValue(1, 0);
				// 画像サイズを取得
				tmpDraw.iWidth = reader.GetIntValue(2, 1);
				tmpDraw.iHeight = reader.GetIntValue(3, 1);
				// 描画基準位置を取得
				tmpDraw.cx = reader.GetFloatValue(4, 0);
				tmpDraw.cy = reader.GetFloatValue(5, 0);
				// 拡大倍率を取得
				tmpDraw.baseExRate = reader.GetFloatValue(6, 1.0);

				// 取得したグループをデータベースにセットする
				drawList.AddData(tmpDraw);
			}
		}
	}else{
		return false;
	}

	// 画像ハンドルの結びつけは毎回手動で行う必要がある
	DATA_ENEMYDRAW_DATA*		pData;
	for(int n=0; n<drawList.GetSize(); n++){
		pData = drawList.GetPointerByIndex(n);
		for(int i=0; i<DOLL_ATTR_NUM; i++){
			pData->hImg[i] = GetImgHandleByRefID(pData->refID, i);
		}
	}

	return true;
}
开发者ID:Takanashi1443,项目名称:AliceGame,代码行数:51,代码来源:Data_EnemyDraw.cpp

示例7: evaluateTestData

void evaluateTestData(const Network& net) {
	CsvReader reader;
	CsvWriter writer;
	cout << "Leyendo test data" << endl;
	MatrixXd testData = reader.csvReadToMatrix(TEST_DATA_FILE);
	if (testData.rows() == 0 && testData.cols() == 0) {
		printf("Error leyendo test data.\n");
		return;
	}
	cout << "cantidad de features: " << (testData.cols() - 1) << endl << endl;
	cout << "Evaluando test data" << endl;
	MatrixXd results = net.evaluate(testData);
	writer.makeSubmitWithMatrix(SUBMIT_FILE, results);
}
开发者ID:gsnaider,项目名称:san-francisco-crime-classification,代码行数:14,代码来源:NeuralNetwork.cpp

示例8: load

    //-----------------------------------------------------------------------------------
	// MG_CN_MODIFY
    MG::Bool ColorResConfig::load( Str16 fileName, IMGExternalPackManager* packManager/* = NULL*/)
    {
        CsvReader csvreader;
		// MG_CN_MODIFY
        if(!csvreader.create(fileName, packManager))
        {
            return false;
        }

        CsvData* csvdata = NULL;
        Int RowCount = csvreader.count();

        for(int i = 0; i < RowCount; ++i)
        {
            csvdata = csvreader.findValue(i);
            if(!csvdata)
            {
                continue;
            }

            ColorResCsvInfo* tempInfo = new ColorResCsvInfo;
            UInt nCol = 0;

            MGStrOp::toU32(csvdata->mData[nCol++].c_str(),      tempInfo->ColorRes_Id     );
			nCol++;
			MGStrOp::toString(csvdata->mData[nCol++].c_str(),   tempInfo->ColorName	  );
            MGStrOp::toU32(csvdata->mData[nCol++].c_str(),      (U32&)tempInfo->UseType   );

			Str16 tempStr = csvdata->mData[nCol++];
			MGStrOp::toFlt(tempStr.substr(0,3).c_str(),(tempInfo->ColorValue).r);
			MGStrOp::toFlt(tempStr.substr(3,3).c_str(),(tempInfo->ColorValue).g);
			MGStrOp::toFlt(tempStr.substr(6,3).c_str(),(tempInfo->ColorValue).b);
			MGStrOp::toFlt(tempStr.substr(9,3).c_str(),(tempInfo->ColorValue).a);

			tempInfo->ColorValue.r = tempInfo->ColorValue.r/255.0f;
			tempInfo->ColorValue.g = tempInfo->ColorValue.g/255.0f;
			tempInfo->ColorValue.b = tempInfo->ColorValue.b/255.0f;
			tempInfo->ColorValue.a = tempInfo->ColorValue.a/255.0f;

			MGStrOp::toString(csvdata->mData[nCol++].c_str(),   tempInfo->EscapeChar);

            mColorResCsvMap[tempInfo->ColorRes_Id] = tempInfo;
        }

        return true;
    }
开发者ID:dnjsflagh1,项目名称:code,代码行数:48,代码来源:ColorResConfig.cpp

示例9: load

	//--------------------------------------------------------------------------
	// MG_CN_MODIFY
	Bool RelationCsvBase::load(const Char16* FileName, IMGExternalPackManager* packManager/* = NULL*/)
	{
		CsvReader csvreader;
		// MG_CN_MODIFY
		if(!csvreader.create(FileName, packManager))
		{
			return false;
		}

		CsvData* csvdata = NULL;
		Int RowCount = csvreader.count();

		for(Int i = 0; i < RowCount; ++i)
		{
			csvdata = csvreader.findValue(i);
			if(!csvdata)
			{
				continue;
			}

			RelationIdType relationId;
			MGStrOp::toI32(csvdata->mData[RCB_RelationId].c_str(), relationId);
			if (true == mRelationList.hasData(relationId))
			{
				DYNAMIC_ASSERT(0);
				continue;
			}

			MapIdType mapId;
			MGStrOp::toU32(csvdata->mData[RCB_MapId].c_str(), mapId);

			GameObjectIdType gameDataId;
			MGStrOp::toU64(csvdata->mData[RCB_GameDataId].c_str(), gameDataId);

			RelationInfo* newRelationInfo = mRelationList.createOrRetrieve(relationId, false);
			newRelationInfo->relationId	= relationId;
			newRelationInfo->mapId		= mapId;
			newRelationInfo->artName	= csvdata->mData[RCB_ArtName];
			newRelationInfo->gameDataId	= gameDataId;

			//mArtMapResList[id] = newArtMapRes;
		}

		return true;
	}
开发者ID:dnjsflagh1,项目名称:code,代码行数:47,代码来源:RelationCsvBase.cpp

示例10: load

	// MG_CN_MODIFY
	MG::Bool QuestValueChangeInfos::load(Str16 fileName, IMGExternalPackManager* packManager/* = NULL*/)
	{
		CsvReader csvreader;
		// MG_CN_MODIFY
		if(!csvreader.create(fileName, packManager))
		{
			return false;
		}

		CsvData* csvdata = NULL;
		Int rowCount = csvreader.count();
		for(Int i = 0; i < rowCount; ++i)
		{
			csvdata = csvreader.findValue(i);
			if(!csvdata)
			{
				continue;
			}
			QuestValueChangeInfo* tempInfo = MG_NEW QuestValueChangeInfo;

			MGStrOp::toU32(csvdata->mData[questvaluechangeinfoid].c_str(),					tempInfo->id);
			MGStrOp::toU32(csvdata->mData[questvaluechangeinfogroupid].c_str(),				tempInfo->groupId);
			I32 tempType;
			MGStrOp::toI32(csvdata->mData[questvaluechangeinfotype].c_str(),				tempType);
			tempInfo->type = (CHANGE_TYPE)tempType; 
			MGStrOp::toU32(csvdata->mData[questvaluechangeinfoparam1].c_str(),				tempInfo->param1);
			MGStrOp::toU32(csvdata->mData[questvaluechangeinfoparam2].c_str(),				tempInfo->param2);
			MGStrOp::toU32(csvdata->mData[questvaluechangeinfoparam3].c_str(),				tempInfo->param3);
			MGStrOp::toU32(csvdata->mData[questvaluechangeinfoparam4].c_str(),				tempInfo->param4);

			MGStrOp::toI32(csvdata->mData[questvaluechangeinfovaluechangetype].c_str(),		tempType);       
			tempInfo->valueChangeType = (VALUECHANGE_TYPE)(tempType-1);                   //Мо±нґУ1їЄКј
			MGStrOp::toI32(csvdata->mData[questvaluechangeinfovaluechangenum].c_str(),		tempInfo->valueChangeNum);
			if (getQuestValueChangeInfo(tempInfo->id))
			{
				DYNAMIC_ASSERT(false);
				MG_SAFE_DELETE(tempInfo);
				continue;
			}
			mQuestValueChangeInfoMap[tempInfo->id] = tempInfo;
		}
		return true;
	}
开发者ID:dnjsflagh1,项目名称:code,代码行数:44,代码来源:QuestValueChange.cpp

示例11: trainNetWithParsedTrainData

Network trainNetWithParsedTrainData(vector<int> hiddenLayers, int epochs,
		int miniBatchSize, double learningRate, double regularizationFactor) {

	inputData_t data = generateInputData();

	int input_dim = data.x_train.cols();
	int output_dim = OUTPUT_SIZE;

	vector<int> layers;
	layers.push_back(input_dim);
	layers.insert(layers.end(), hiddenLayers.begin(), hiddenLayers.end()); //inserta todos los elementos de hiddenLayers
	layers.push_back(output_dim);

	Network net(layers);
	if (LOAD_NET){
		CsvReader reader;
		vector<MatrixXd> weights = reader.readWheights(WEIGHTS_BASE_LOAD_PATH,2);
		vector<VectorXd> biases = reader.readBiases(BIASES_LOAD_PATH);
		net = Network(layers,biases,weights);
	}
	if (TRAIN_NET){
		cout << "Arranca train" << endl;
		net.SGD(data.x_train, data.y_train, data.x_test, data.y_test, epochs, miniBatchSize,
				learningRate, regularizationFactor);
	}

	int validationResult = net.accuracy(data.x_validation, data.y_validation);
	double cost = net.totalCost(data.x_validation, data.y_validation);
	cout << "---------------------------" << endl;
	cout << "Validation results: " << validationResult << " / "
			<< data.y_validation.rows() << endl;
	cout << "---------------------------" << endl;
	cout << "Validation cost: " << cost << endl;
	cout << "---------------------------" << endl;
	return net;
}
开发者ID:gsnaider,项目名称:san-francisco-crime-classification,代码行数:36,代码来源:NeuralNetwork.cpp

示例12: load

	//--------------------------------------------------------------------------
	// MG_CN_MODIFY
	Bool ArtMapResCsv::load(const Char16* FileName, IMGExternalPackManager* packManager/* = NULL*/)
	{
		CsvReader csvreader;
		// MG_CN_MODIFY
		if(!csvreader.create(FileName, packManager))
		{
			return false;
		}

		DYNAMIC_ASSERT(csvreader.getColumnSize() == AMR_RPGRadarID + 1 || csvreader.getColumnSize() == AMR_Max);
		
		CsvData* csvdata = NULL;
		Int RowCount = csvreader.count();

		for(Int i = 0; i < RowCount; ++i)
		{
			csvdata = csvreader.findValue(i);
			if(!csvdata)
			{
				continue;
			}

			ArtMapResIdType artMapResId;
			MGStrOp::toI32(csvdata->mData[AMR_ArtMapResId].c_str(), artMapResId);
			if (true == mArtMapResList.hasData(artMapResId))
			{
				DYNAMIC_ASSERT(0);
				continue;
			}

			ArtMapResCsvInfo* newArtMapRes = mArtMapResList.createOrRetrieve(artMapResId, false);
			newArtMapRes->artMapResId	= artMapResId;
			newArtMapRes->name			= csvdata->mData[AMR_Name];
			newArtMapRes->BaseFilePath	= csvdata->mData[AMR_BaseFilePath];
			//newArtMapRes->cameraId		= csvdata->mData[AMR_CameraSetID];

			MGStrOp::toI32(csvdata->mData[AMR_UseType].c_str(), (I32&)newArtMapRes->mapType);
			MGStrOp::toU32(csvdata->mData[AMR_RPGCamSetID].c_str(), newArtMapRes->rpgCameraId);
			MGStrOp::toU32(csvdata->mData[AMR_RPGRadarID].c_str(), newArtMapRes->rpgRadarId);

			if ( csvdata->mData.size() > AMR_RPGRadarID + 1 )
			{
				MGStrOp::toU32(csvdata->mData[AMR_SLGCamSetID].c_str(), newArtMapRes->slgCameraId);
				MGStrOp::toU32(csvdata->mData[AMR_SLGRadarID].c_str(), newArtMapRes->slgRadarId);
			}
			else
			{
				newArtMapRes->slgCameraId = newArtMapRes->rpgCameraId;
				newArtMapRes->slgRadarId = newArtMapRes->rpgRadarId;
			}
		}

		return true;
	}
开发者ID:dnjsflagh1,项目名称:code,代码行数:56,代码来源:ArtMapResCsv.cpp

示例13: load

	//-------------------------------------------------------------------------------------------
	// MG_CN_MODIFY
	Bool LongRangeGeneralAttackSkillTemplate::load(Str16 fileName, IMGExternalPackManager* packManager/* = NULL*/)
	{
		CsvReader csvreader;
		// MG_CN_MODIFY
		if(!csvreader.create(fileName, packManager))
		{
			return false;
		}

		CsvData* csvdata = NULL;
		Int rowCount = csvreader.count();
		for(Int i = 0; i < rowCount; ++i)
		{
			csvdata = csvreader.findValue(i);
			if(!csvdata)
			{
				continue;
			}
			LongRangeGeneralAttackSkillInfo* tempInfo = MG_NEW LongRangeGeneralAttackSkillInfo;

			MGStrOp::toU32(csvdata->mData[SKILLTYPEID].c_str(),	tempInfo->skillTypeId);
			MGStrOp::toU32(csvdata->mData[SKILLTYPEGROUPID].c_str(), tempInfo->skillTypeGroupId);
			tempInfo->name = csvdata->mData[NAME];
			tempInfo->text = csvdata->mData[TEXT];
			tempInfo->kindName = csvdata->mData[KINDNAME];
			MGStrOp::toU32(csvdata->mData[ARTICONID].c_str(), tempInfo->artIconId);

			for(UInt i = 0; i < 4; ++i)
			{
				tempInfo->skillExpression[i].action = csvdata->mData[ACTION1 + 3 * i];
				MGStrOp::toU32(csvdata->mData[ACTION1 + 3 * i + 1].c_str(), tempInfo->skillExpression[i].artEffectId);
				MGStrOp::toU32(csvdata->mData[ACTION1 + 3 * i + 2].c_str(), tempInfo->skillExpression[i].audioResId);
			}

			UInt tempArtEffectFlyType; 
			MGStrOp::toU32(csvdata->mData[ARTEFFECTFLYTYPE].c_str(), tempArtEffectFlyType);
			tempInfo->artEffectFlyType = (SkillFlyType)tempArtEffectFlyType;
			MGStrOp::toU32(csvdata->mData[ARTEFFECTFLYID].c_str(), tempInfo->artEffectFlyId);
			MGStrOp::toU32(csvdata->mData[ARTEFFECTFLYSPEED].c_str(), tempInfo->artEffectFlySpeed);
			tempInfo->artEffectFlySpeed /= 10;
			MGStrOp::toFlt(csvdata->mData[ATTACKFRONTTIME].c_str(), tempInfo->attackFrontTime);
			tempInfo->attackFrontTime /= 10;
			MGStrOp::toFlt(csvdata->mData[ATTACKBEHINDTIME].c_str(), tempInfo->attackBehindTime);
			tempInfo->attackBehindTime /= 10;
			MGStrOp::toU32(csvdata->mData[PUBLICTIMEPIECEID].c_str(), tempInfo->publicTimepieceId);
			MGStrOp::toU32(csvdata->mData[PUBLICTIMEPIECEDELAY].c_str(), tempInfo->publicTimepieceDelay);
			tempInfo->publicTimepieceDelay *= 100;
			MGStrOp::toU32(csvdata->mData[CHARACTERJUDGEID1].c_str(), tempInfo->characterJudgeId1);
			MGStrOp::toU32(csvdata->mData[CHARACTERJUDGEID2].c_str(), tempInfo->characterJudgeId2);
			MGStrOp::toFlt(csvdata->mData[RANGE].c_str(), tempInfo->range);
			tempInfo->range /= 10;
			MGStrOp::toFlt(csvdata->mData[MAXRANGE].c_str(), tempInfo->maxRange);
			tempInfo->maxRange /= 10;
			UInt tempAttackType; 
			MGStrOp::toU32(csvdata->mData[ATTACKTYPE].c_str(), tempAttackType);
			tempInfo->attackType = (AttackType)tempAttackType;
			MGStrOp::toU32(csvdata->mData[FORMULAPARAMETERID].c_str(), tempInfo->formulaParameterId);
			MGStrOp::toU32(csvdata->mData[HATE].c_str(), tempInfo->hate);
			
			if (getLongRangeGeneralAttackSkillInfo(tempInfo->skillTypeId))
			{
				DYNAMIC_ASSERT(false);
				MG_SAFE_DELETE(tempInfo);
				continue;
			}

			mLongRangeGeneralAttackSkillInfoList[tempInfo->skillTypeId] = tempInfo;
		}

		return true;
	}
开发者ID:dnjsflagh1,项目名称:code,代码行数:73,代码来源:LongRangeGeneralAttackSkillTemplate.cpp

示例14: LoadDataFromCsv

bool Data_EnemyParam::LoadDataFromCsv(){
	// リストの解放
	enemyList.Release();
	// Csvを読み込むクラス
	CsvReader				reader;
	// ファイル名を保持する
	TCHAR					fileName[MAX_PATH];
	// グループの内容を一時的に保持する変数
	Data_EnemyParam_Each	tmpEnemy;
	// ファイルが存在しない場合が何度か続いたらループを抜ける
	int						nEmptyFile = 0;
	// 何番目の敵インデックスまで埋まっているか
	int						index = 0;
	int						actionIndex = 0;

	for(int n=1; n<=MAX_ENEMYPARAMFILE; n++){
		sprintf_s(fileName, MAX_PATH-1, CSVFILE_ENEMYPARAM, n);
		// csvファイルを読み込んでグループに格納する
		if(reader.Open(fileName)){
			tmpEnemy = Data_EnemyParam_Each();
			nEmptyFile = 0; // 空ファイル数のリセット
			index = 0;
			// ダミー行
			reader.NextLine();
			// レファレンス用IDを取得する
			if(reader.Read() == CSV_READ_NOERROR){
				if(reader.GetIntValue(0, 0) == 0){
					continue;
				}
				tmpEnemy.data.refID = (WORD)reader.GetIntValue(0, 0);
			}
			// ダミー行
			reader.NextLine();
			// 敵の名前と属性と経験値を取得する
			if(reader.Read() == CSV_READ_NOERROR){
				// バッファに直接値を入れる
				reader.GetValue(0, tmpEnemy.data.name, BATTLEUNIT_NAME_BYTES-1);
				// 属性を読み取る
				tmpEnemy.data.attr = (BYTE)reader.GetIntValue(1, DOLL_ATTR_NONE);
				// 経験値を読み取る
				tmpEnemy.data.exp = (DWORD)reader.GetIntValue(2, 0);
				// レベルを読み取る
				tmpEnemy.data.level = (WORD)reader.GetIntValue(3, 1);
			}
			// ダミー行
			reader.NextLine();
			// 敵の各パラメータを取得する
			reader.Read();
			for(int i=0; i<NUM_ENEMYPARAM_DATA; i++){
				tmpEnemy.data.param[i] = reader.GetIntValue(i, 0);
			}
			reader.NextLine();
			// ステートの配列を取得する
			for(int i=0; i<MAX_INITIALSTATE; i++){
				reader.Read();
				tmpEnemy.SetInitialState(
					i,
					reader.GetIntValue(0, 0),
					reader.GetIntValue(1, 0),
					reader.GetIntValue(2, 0));
			}
			reader.NextLine();
			// 敵の攻撃パターンを取得する
			for(int i=0; i<MAX_ACTIONPATTERN; i++){
				// 各行動は三行に分けて記述する。
				// 一行目:攻撃パターン名、スキルID、ターゲットのタイプ、優先度
				// 二行目、三行目:条件、条件に関するパラメータ(3つ)
				reader.Read();
				// 一行目
				tmpEnemy.SetActionPattern(i, 0,
					(DWORD)reader.GetIntValue(0, 0));
				tmpEnemy.SetActionPattern(i, 1,
					(BYTE)reader.GetIntValue(1, 0));
				tmpEnemy.SetActionPattern(i, 2,
					(WORD)reader.GetIntValue(2, 0));
				// 二行目、三行目
				for(int j=0; j<MAX_CONDITION; j++){
					reader.Read();
					tmpEnemy.SetActConditionPattern(
						i, j, reader.GetIntValue(0, 0));
					for(int k=0; k<MAX_CONDITIONPARAM; k++){
						tmpEnemy.SetActConditionParam(
							i, j, k, reader.GetIntValue(1+k, 0));
					}
				}
				// ダミー行
				reader.NextLine();
			}
			// 取得したグループをデータベースにセットする
			enemyList.AddData(tmpEnemy);
		}else{
			nEmptyFile++;
			if(nEmptyFile > 100){
				// 空ファイルが続いた場合、ループを抜ける
				break;
			}
		}
	}
	return true;
}
开发者ID:Takanashi1443,项目名称:AliceGame,代码行数:100,代码来源:Data_EnemyParam.cpp

示例15: load

	//--------------------------------------------------------------------------
	Bool InstanceAtkStrengthListCsv::load(const Char16* FileName, IMGExternalPackManager* packManager/* = NULL*/)
	{
		CsvReader csvreader;

		if(!csvreader.create(FileName, packManager))
		{
			return false;
		}

		DYNAMIC_ASSERT(csvreader.getColumnSize() == InstanceAtkStrengthListCsvRow_Max);

		CsvData* csvdata = NULL;
		Int RowCount = csvreader.count();

		for(Int i = 0; i < RowCount; ++i)
		{
			csvdata = csvreader.findValue(i);
			if(!csvdata)
			{
				continue;
			}

			CampIdType campId;
			MGStrOp::toU64(csvdata->mData[InstanceAtkStrengthListCsvRow_CampId].c_str(), campId);
			if (true == mInstanceAtkStrengthList.hasData(campId))
			{
				DYNAMIC_ASSERT(0);
				continue;
			}

			U32 buildTemplateId;
			MGStrOp::toU32(csvdata->mData[InstanceAtkStrengthListCsvRow_CharacterBuildId].c_str(), buildTemplateId);

			U32 campPoint;
			MGStrOp::toU32(csvdata->mData[InstanceAtkStrengthListCsvRow_CampPointId].c_str(), campPoint);

			U32 generalRefreshPoint;
			MGStrOp::toU32(csvdata->mData[InstanceAtkStrengthListCsvRow_GeneraRefreshpoint].c_str(), generalRefreshPoint);

			U32 generalAlivePoint;
			MGStrOp::toU32(csvdata->mData[InstanceAtkStrengthListCsvRow_GeneraSpawnPoint].c_str(), generalAlivePoint);

			U32 armyPoint01;
			MGStrOp::toU32(csvdata->mData[InstanceAtkStrengthListCsvRow_ArmyPlayedPoint01].c_str(), armyPoint01);

			U32 armyPoint02;
			MGStrOp::toU32(csvdata->mData[InstanceAtkStrengthListCsvRow_ArmyPlayedPoint02].c_str(), armyPoint02);

			U32 armyPoint03;
			MGStrOp::toU32(csvdata->mData[InstanceAtkStrengthListCsvRow_ArmyPlayedPoint03].c_str(), armyPoint03);

			U32 armyPoint04;
			MGStrOp::toU32(csvdata->mData[InstanceAtkStrengthListCsvRow_ArmyPlayedPoint04].c_str(), armyPoint04);

			U32 armyPoint05;
			MGStrOp::toU32(csvdata->mData[InstanceAtkStrengthListCsvRow_ArmyPlayedPoint05].c_str(), armyPoint05);

			InstanceAtkStrengthListCsvInfo* newInfo	= mInstanceAtkStrengthList.createOrRetrieve(campId, false);
			newInfo->campId					= campId;
			newInfo->buildTemplateId		= buildTemplateId;
			newInfo->campPoint				= campPoint;
			newInfo->generalRefreshPoint	= generalRefreshPoint;
			newInfo->generalAlivePoint		= generalAlivePoint;
			newInfo->armyPoint[0]			= armyPoint01;
			newInfo->armyPoint[1]			= armyPoint02;
			newInfo->armyPoint[2]			= armyPoint03;
			newInfo->armyPoint[3]			= armyPoint04;
			newInfo->armyPoint[4]			= armyPoint05;
		}

		return true;
	}
开发者ID:dnjsflagh1,项目名称:code,代码行数:73,代码来源:InstanceAtkStrengthListCsv.cpp


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