コード例 #1
0
ファイル: Session.cpp プロジェクト: matyicsapo/Infiltrator
bool Session::LoadProfile (std::string profileName) {
	this->profileName = profileName;
	language = "ENG";
	allGold = 0;

	if (profileName == "")
		return false;

	GOOGLE_PROTOBUF_VERIFY_VERSION;

	std::fstream profileFile(("Saves/" + profileName + ".pro").c_str(), std::ios::in | std::ios::binary);
	if (!profileFile.is_open()) {
		return false;
	}

	Profile gameProfile;

	if (!gameProfile.ParseFromIstream(&profileFile)) {
		google::protobuf::ShutdownProtobufLibrary();
		return false;
	}

	// LOAD DATA ===
	allGold = gameProfile.allgold();

	TINI::TINIObject conf("Saves/" + profileName + ".ini");

	profileName = profileName;

	language = conf.GetValue("", "language");
	Game->Create(Convert->ToNum<int>(conf.GetValue("", "clientwidth")),
				Convert->ToNum<int>(conf.GetValue("", "clientheight")),
				conf.GetValue("", "fullscr") == "1" ? true : false);

	Sounds->SetVol_Master(Convert->ToNum<float>(conf.GetValue("", "vol_master")));
	Sounds->SetVol_Music(Convert->ToNum<float>(conf.GetValue("", "vol_music")));
	Sounds->SetVol_Effect(Convert->ToNum<float>(conf.GetValue("", "vol_effect")));
	// === LOAD DATA

	google::protobuf::ShutdownProtobufLibrary();

	return true;
}