void cGameStateCredits::render(CGraphics &con, Camera &cam, CGameData &data){

::ShowCursor(false);
  CLog *pLog = CLog::Instance();
  static bLostDevice = false;

  HRESULT hr;

  if(FAILED(hr = con.m_d3ddev->TestCooperativeLevel())){

    pLog->Log("Failed test");
    if(hr == D3DERR_DEVICELOST)
      return;
    pLog->Log("No lost");
    if( hr == D3DERR_DEVICENOTRESET ){
      pLog->Log("Time to reset");
      con.DeleteLost();
      pLog->Log("Deleted everything");
      hr = con.m_d3ddev->Reset(&con.GetDPP());
      pLog->Log("Dev reset");
      con.ReloadLost();
      pLog->Log("ReloadLost");
      bLostDevice = false;
      return;
    }
  }

  D3DXMATRIX V;
  cam.getViewMatrix(&V, 0);
  con.m_d3ddev->SetTransform(D3DTS_VIEW, &V);

  // clear the window to a deep blue
  con.m_d3ddev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 200, 200), 1.0f, 0);
  con.m_d3ddev->BeginScene();    // begins the 3D scene

  //render credits
  GRAPHIC_IMAGE gi;
  gi = con.GetSprite(2);
  //con.RenderGraphicModulate(gi, data.m_screenWidth - 240, 40, 255, 255, 255);

  //scrolls message
  int posY = 0;
  
  for(int i = 0; i < m_msg.size(); i++){
    posY = m_scrollValue + ((int)m_msg.size() - i * 20);
    if(m_msg[i].type == 0)  //font
      con.Print(m_msg[i].msg, m_msg[i].font , m_msg[i].x, con.GetScreenHeight() - posY, m_msg[i].red, m_msg[i].green, m_msg[i].blue,255);
    else{//graphic
      con.RenderGraphicModulate(m_msg[i].gi, m_msg[i].x, con.GetScreenHeight() -posY, 255, 255, 255);
    }
  }

  con.Print("Press ESCAPE to Continue!", F_V20B, data.m_screenWidth/2 - 130, data.m_screenHeight - 60, 255, 255, 0, 255);

  if(data.m_displayDebugInfo == true){
    con.Print("Version", data.m_version, F_V16, 40, 730,  255, 255, 255, 255);
    con.Print("FPS", data.m_FPS , F_V16, 930, 730,  255, 255, 255, 255);    
  }  

  con.m_d3ddev->EndScene();    // ends the 3D scene
  hr = con.m_d3ddev->Present(NULL, NULL, NULL, NULL);   // displays the created frame on the screen

  if(FAILED(hr = con.m_d3ddev->TestCooperativeLevel())){
    if(hr == D3DERR_DEVICELOST)
      bLostDevice = true;
  }

  return;
}
示例#2
0
void AbstractThread::run()
{
	// is the very first since there is a possibility of something being altered there
	onStart();

	int exceptions = 0;
	bool lastWasException = false;
	m_terminateRequested = false;

	for (;;)
	{
		bool gotException = false;

		//	report me being alive if I am being checked for status
		if( m_hangCheck != 0 )
		{
			m_hangCheck = 0;
		}

		try
		{
			tick();

			// ensure this is recorded as 'idle' time (ideally this should
			// be in tick() but we cannot guarantee it to be called there
			CurrentProfileData.Start(PROFILE_IDLE);
		}
		catch( const CSError& e )
		{
			gotException = true;
			g_Log.CatchEvent(&e, "%s::tick", getName());
			CurrentProfileData.Count(PROFILE_STAT_FAULTS, 1);
		}
		catch( ... )
		{
			gotException = true;
			g_Log.CatchEvent(NULL, "%s::tick", getName());
			CurrentProfileData.Count(PROFILE_STAT_FAULTS, 1);
		}

		if( gotException )
		{
			if( lastWasException )
			{
				exceptions++;
			}
			else
			{
				lastWasException = true;
				exceptions = 0;
			}
			if( exceptions >= EXCEPTIONS_ALLOWED )
			{
				// a bad thing really happened. ALL previous EXCEPTIONS_ALLOWED ticks resulted in exception
				// almost for sure we have looped somewhere and have no way to get out from this situation
				// probably a thread restart can fix the problems
				// but there is no real need to restart a thread, we will just simulate a thread restart,
				// notifying a subclass like we have been just restarted, so it will restart it's operations
				g_Log.Event(LOGL_CRIT, "'%s' thread raised too many exceptions, restarting...\n", getName());
				onStart();
				lastWasException = false;
			}
		}
		else
		{
			lastWasException = false;
		}

		if( shouldExit() )
			break;

		m_sleepEvent.wait(m_tickPeriod);
	}
}
示例#3
0
文件: coam.cpp 项目: isub/coam
int InitCoAManager ()
{
	int iRetVal = 0;

	do {
		std::vector<std::string> vectConfParam;
		std::string strConfParam;

		iRetVal = g_coConf.GetParamValue ("log_file_mask", strConfParam);
		if (iRetVal) {
			UTL_LOG_F(g_coLog, "Log file mask not defined");
			break;
		}
		/* инициализация логгера */
		iRetVal = g_coLog.Init (strConfParam.c_str());
		if (iRetVal) {
			UTL_LOG_F(g_coLog, "can not initialize log writer: code: '%d'", iRetVal);
			break;
		}
		/* изменение пользователя и группы владельца демона */
		ChangeOSUser ();

		std::string strDBPoolSize;
		int iDBPoolSize;
		int iFnRes;

		const char *pcszConfParam = "db_pool_size";
		iFnRes = g_coConf.GetParamValue( pcszConfParam, strDBPoolSize );
		if( iFnRes || 0 == strDBPoolSize.length() ) {
			UTL_LOG_F( g_coLog, "dbpool: configuration parameter '%s' not defined", pcszConfParam );
		} else {
			iDBPoolSize = atoi( strDBPoolSize.c_str() );
		}

		std::string strDBUser, strDBPswd, strDBDescr;

		pcszConfParam = "db_user";
		iFnRes = g_coConf.GetParamValue( pcszConfParam, strDBUser );
		if( iFnRes || 0 == strDBUser.length() ) {
			UTL_LOG_F( g_coLog, "dbpool: configuration parameter '%s' not defined", pcszConfParam );
		}

		/* запрашиваем пароль пользователя БД из конфигурации */
		pcszConfParam = "db_pswd";
		iFnRes = g_coConf.GetParamValue( pcszConfParam, strDBPswd );
		if( iFnRes || 0 == strDBPswd.length() ) {
			UTL_LOG_F( g_coLog, "dbpool: configuration parameter '%s' not defined", pcszConfParam );
		}

		/* запрашиваем дескриптор БД из конфигурации */
		pcszConfParam = "db_descr";
		iFnRes = g_coConf.GetParamValue( pcszConfParam, strDBDescr );
		if( iFnRes || 0 == strDBDescr.length() ) {
			UTL_LOG_F( g_coLog, "dbpool: configuration parameter '%s' not defined", pcszConfParam );
		}

		/* инициализация пула подклчений к БД */
		iRetVal = db_pool_init(&g_coLog, strDBUser, strDBPswd, strDBDescr, iDBPoolSize );
		if (iRetVal) {
			UTL_LOG_F(g_coLog, "can not initialize DB pool");
		}
		/* создание списка NASов */
		iRetVal = CreateNASList (&g_mapNASList);
		if (iRetVal) {
			break;
		}
		/* инициализация пула потоков */
		iRetVal = InitThreadPool ();
		if (iRetVal) {
			break;
		}
	} while (0);

	return iRetVal;
}
// `J` Job Farm - Laborers - Combat_Job
bool cJobManager::WorkBeastCapture(sGirl* girl, sBrothel* brothel, bool Day0Night1, string& summary)
{
#pragma region //	Job setup				//
	int actiontype = ACTION_COMBAT;
	stringstream ss; string girlName = girl->m_Realname; ss << girlName;
	int roll_a = g_Dice.d100(), roll_b = g_Dice.d100(), roll_c = g_Dice.d100();
	if (g_Girls.DisobeyCheck(girl, actiontype, brothel))			// they refuse to work
	{
		ss << " refused to capture beasts during the " << (Day0Night1 ? "night" : "day") << " shift.";
		girl->m_Events.AddMessage(ss.str(), IMGTYPE_PROFILE, EVENT_NOWORK);
		return true;
	}
	ss << " equipped herself and went out to hunt for exotic beasts and animals.\n\n";

	g_Girls.EquipCombat(girl);	// ready armor and weapons!

	int wages = 40, tips = 0;
	int enjoy = 0;
	int imagetype = IMGTYPE_COMBAT;
	int msgtype = Day0Night1;

#pragma endregion
#pragma region //	The Fight to get the Beasts		//

	int tired = 0;
	int gainmax = (int)(JP_BeastCapture(girl, false) / 30) + 1;
	int gain = g_Dice % gainmax + 1;
	sGirl* tempgirl = g_Girls.CreateRandomGirl(18, false, false, false, true, false);
	Uint8 fight_outcome = 0;
	if (tempgirl)		// `J` reworked incase there are no Non-Human Random Girls
	{
		fight_outcome = g_Girls.girl_fights_girl(girl, tempgirl);
	}
	else
	{
		g_LogFile.write("Error: You have no Non-Human Random Girls for your girls to fight\n");
		g_LogFile.write("Error: You need a Non-Human Random Girl to allow WorkBeastCapture randomness");
		fight_outcome = 7;
	}
	if (tempgirl) delete tempgirl; tempgirl = 0;	// Cleanup
	if (fight_outcome == 7)
	{
		ss << "She came back with just one animal today.\n\n";
		ss << "(Error: You need a Non-Human Random Girl to allow WorkBeastCapture randomness)";
		gain = 1;
		msgtype = EVENT_WARNING;
		tired = 15;
	}
	else if (fight_outcome == 1)	// she won
	{
		if (gain <= 2)	gain = 2;
		if (gain >= gainmax)	gain = gainmax;
		ss << "She had fun hunting today and came back with " << gain << " new beasts.";;
		imagetype = IMGTYPE_COMBAT;
		tired = g_Dice % (3 * gain);
		enjoy += g_Dice % 4 + 2;
	}
	else		// she lost or it was a draw
	{
		gain = g_Dice.bell(-gainmax / 3, gainmax / 2);
		ss << " The animals were difficult to track today. " << girlName << " eventually returned worn out and frustrated, ";
		if (gain <= 0)
		{
			gain = 0;
			ss << "empty handed.";
		}
		else
		{
			ss << "dragging ";
			if (gain == 1)	ss << "one";
			if (gain > 1)	ss << gain;
			ss << " captured beast" << (gain > 1 ? "s" : "") << " behind her.";
		}
		imagetype = IMGTYPE_COMBAT;
		enjoy -= g_Dice % 3 + 1;
		tired = g_Dice % (10 * gain) + 20;
	}
	ss << "\n\n";

#pragma endregion
#pragma region	//	A Little Randomness			//

	//SIN: A little randomness
	if (((g_Girls.GetSkill(girl, SKILL_ANIMALHANDLING) + g_Girls.GetStat(girl, STAT_CHARISMA)) > 125) && g_Dice.percent(30))
	{
		ss << girlName << " has a way with animals, a" << (gain > 1 ? "nother" : "") << " beast freely follows her back.\n";
		gain++;
	}
	//SIN: most the rest rely on more than one cap so might as well skip the lot if less than this...
	if (gain > 1)
	{
		// `J` added a switch with a use next if check fails and changed percents to (gain * 5)
		switch (g_Dice % 10)
		{
		case 0:
			if (girl->has_trait( "Twisted") && girl->has_trait( "Nymphomaniac") && (g_Girls.GetStat(girl, STAT_LIBIDO) >= 80))
			{
				ss << "Being a horny, twisted nymphomaniac, " << girlName << " had some fun with the beasts before she handed them over.\n";
				g_Girls.UpdateSkill(girl, SKILL_BEASTIALITY, g_Dice % gain);
				g_Girls.UpdateStat(girl, STAT_LIBIDO, -(g_Dice % gain));
				tired += gain;
				break;
			}
		case 1:
			if (girl->has_trait( "Psychic") && (g_Girls.GetStat(girl, STAT_LIBIDO) >= 90) && g_Dice.percent(gain * 5))
			{
				ss << girlName << "'s Psychic sensitivity caused her mind be overwhelmed by the creatures' lusts";
				if (g_Girls.CheckVirginity(girl))
				{
					ss << " but, things were moving too fast and she regained control before they could take her virginity.\n";
					g_Girls.UpdateSkill(girl, SKILL_BEASTIALITY, 1);
					g_Girls.UpdateStat(girl, STAT_LIBIDO, 2); // no satisfaction!
				}
				else
				{
					ss << ". Many hours later she staggered in to present the creatures to you.\n";
					g_Girls.UpdateSkill(girl, SKILL_BEASTIALITY, g_Dice % gain);
					g_Girls.UpdateStat(girl, STAT_LIBIDO, -2 * (g_Dice % gain));
					g_Girls.UpdateStat(girl, STAT_TIREDNESS, gain);
					girl->calc_insemination(g_Girls.GetBeast(), 1);
				}
				tired += gain;
				break;
			}
		case 2:
			if (girl->has_trait( "Assassin") && g_Dice.percent(gain * 5))
			{
				ss << " One of the captured creatures tried to escape on the way back. Trained assassin, " << girlName << ", instantly killed it as an example to the others.\n";
				g_Girls.UpdateSkill(girl, SKILL_COMBAT, 1);
				gain--;
				break;
			}
		case 3:
			if (g_Girls.GetStat(girl, STAT_TIREDNESS) > 50 && g_Dice.percent(gain * 5))
			{
				ss << girlName << " was so exhausted she couldn't concentrate. One of the creatures escaped.\n";
				gain--;
				break;
			}
		default: break;

		}
	}

#pragma endregion
#pragma region	//	Collect Pets				//

	// `J` Farm Bookmark - adding in items that can be gathered in the farm
	if (g_Dice.percent(5))
	{
		string itemfound = ""; string itemfoundtext = "";
		int chooseitem = g_Dice.d100();

		if (chooseitem < 25)
		{
			itemfound = (g_Dice % 2) ? "Black Cat" : "Cat";
			itemfoundtext = "a stray cat and brought it back with her.";
		}
		else if (chooseitem < 50)
		{
			itemfound = "Guard Dog";
			itemfoundtext = "a tough looking stray dog and brought it back with her.";
		}
		else if (chooseitem < 60)
		{
			itemfound = "A Bunch of Baby Ducks";
			itemfoundtext = "a bunch of baby ducks without a mother, so she gathered them up in her shirt and brought them home.";
		}
		else if (chooseitem < 65)
		{
			itemfound = "Death Bear";
			itemfoundtext = "a large bear that seems to have had some training, so she brought it home.";
		}
		else if (chooseitem < 80)
		{
			itemfound = "Pet Spider";
			itemfoundtext = "a strange looking spider so she collected it in a bottle and brought it back with her.";
		}
		else if (chooseitem < 95)
		{
			itemfound = (g_Dice % 4 == 1) ? "Fox Stole" : "Fur Stole";
			itemfoundtext = "a dead animal that was not too badly damaged. She brought it home, skinned it, cleaned it up and made a lovely stole from it.";
		}
		else if (chooseitem < 96)
		{
			itemfound = "Echidna's Snake";
			itemfoundtext = "a rather obedient and psychic snake. It wrapped itself around her crotch and let her take it home.";
		}
		else
		{
			itemfound = "Tiger Shark Tooth";
			itemfoundtext = "a rather large shark tooth and brought it home.";
		}

		sInventoryItem* item = g_InvManager.GetItem(itemfound);
		if (item)
		{
			ss << girlName << " found " << itemfoundtext;
			g_Brothels.AddItemToInventory(item);
		}
	}

#pragma endregion
#pragma region	//	Money					//

	// slave girls not being paid for a job that normally you would pay directly for do less work
	if ((girl->is_slave() && !cfg.initial.slave_pay_outofpocket()))
	{
		wages = 0;
	}
	else
	{
		wages += gain * 10; // `J` Pay her based on how much she brings back
	}

#pragma endregion
#pragma region	//	Finish the shift			//

	g_Brothels.add_to_beasts(gain);

	// Money
	girl->m_Tips = max(0, tips);
	girl->m_Pay = max(0, wages);

	// Improve girl
	// Base Improvement and trait modifiers
	int xp = 10, libido = 1, skill = 3;
	/* */if (girl->has_trait("Quick Learner"))	{ skill += 1; xp += 3; }
	else if (girl->has_trait("Slow Learner"))	{ skill -= 1; xp -= 3; }
	/* */if (girl->has_trait("Nymphomaniac"))	{ libido += 2; }
	// EXP and Libido
	int I_xp = (g_Dice % xp) + 1;							g_Girls.UpdateStat(girl, STAT_EXP, I_xp);
	int I_libido = (g_Dice % libido) + 1;					g_Girls.UpdateStatTemp(girl, STAT_LIBIDO, I_libido);
	if (tired > 0) girl->tiredness(tired);

	// primary improvement (+2 for single or +1 for multiple)
	int I_combat		= (g_Dice % skill) + 1;				g_Girls.UpdateSkill(girl, SKILL_COMBAT, I_combat);
	int I_animalh		= (g_Dice % skill) + 1;				g_Girls.UpdateSkill(girl, SKILL_ANIMALHANDLING, I_animalh);
	int I_strength		= (g_Dice % skill) + 1;				g_Girls.UpdateStat(girl, STAT_STRENGTH, I_strength);
	// secondary improvement (-1 for one then -2 for others)
	int I_constitution	= max(0, (g_Dice % skill) - 1);		g_Girls.UpdateStat(girl, STAT_CONSTITUTION, I_constitution);
	int I_beastiality	= max(0, (g_Dice % skill) - 2);		g_Girls.UpdateSkill(girl, SKILL_BEASTIALITY, I_beastiality);
	int I_agility		= max(0, (g_Dice % skill) - 2);		g_Girls.UpdateStat(girl, STAT_AGILITY, I_agility);
	int I_magic			= max(0, (g_Dice % skill) - 2);		g_Girls.UpdateSkill(girl, SKILL_MAGIC, I_magic);

	// Update Enjoyment
	g_Girls.UpdateEnjoyment(girl, actiontype, enjoy);

	// Gain Traits
	g_Girls.PossiblyGainNewTrait(girl, "Tough", 30, actiontype, "She has become pretty Tough from all of the fights she's been in.", Day0Night1);
	g_Girls.PossiblyGainNewTrait(girl, "Adventurer", 40, actiontype, "She has been in enough tough spots to consider herself Adventurer.", Day0Night1);
	g_Girls.PossiblyGainNewTrait(girl, "Aggressive", 60, actiontype, "She is getting rather Aggressive from her enjoyment of combat.", Day0Night1);
	if (g_Dice.percent(25) && g_Girls.GetStat(girl, STAT_STRENGTH) >= 60 && g_Girls.GetSkill(girl, SKILL_COMBAT) > g_Girls.GetSkill(girl, SKILL_MAGIC))
	{
		g_Girls.PossiblyGainNewTrait(girl, "Strong", 60, ACTION_COMBAT, girlName + " has become pretty Strong from all of the fights she's been in.", Day0Night1);
	}

	//lose traits
	g_Girls.PossiblyLoseExistingTrait(girl, "Fragile", 15, actiontype, girl->m_Realname + " has had to heal from so many injuries you can't say she is fragile anymore.", Day0Night1);

	if (cfg.debug.log_show_numbers())
	{
		ss << "\n\nNumbers:"
			<< "\n Wages = " << (int)wages
			<< "\n Tips = " << (int)tips
			<< "\n Xp = " << I_xp
			<< "\n Libido = " << I_libido
			<< "\n combat = " << I_combat
			<< "\n animalh = " << I_animalh
			<< "\n strength = " << I_strength
			<< "\n constitution = " << I_constitution
			<< "\n beastiality = " << I_beastiality
			<< "\n agility = " << I_agility
			<< "\n magic = " << I_magic
			<< "\n Tiredness = " << tired
			<< "\n Enjoy " << girl->enjoy_jobs[actiontype] << " = " << enjoy
			;

	}

	girl->m_Events.AddMessage(ss.str(), imagetype, msgtype);

#pragma endregion
	return false;
}
示例#5
0
const Bool CWAVFile::LoadFromFile( const Char* a_FilePath )
{
	m_FilePath += a_FilePath;
	CFlatFile file; CFileHandler fileHandler;
	//Open the file
	file.Open( a_FilePath, CFile::FILEMODE_READ, CFile::FILETYPE_BINARY );
	//Link the file to the filehandler
	fileHandler.LinkFile( &file );	
	//Read out the header ( yay for templates )
	fileHandler.Read<CWAVFile::SWaveHeader>( &m_Header );

	CLog* log = CLog::GetInstance();

	//Check chunkID
	Char* chunkID = (Char*)&m_Header.m_ChunkID;	
	if ( strncmp( chunkID, "RIFF", 4 ) != 0 )
	{
		log->OutMessage( "ChunkID does not correspond to RIFF", CLog::MESSAGETYPE_WARNING );
		return false;
	}
	//Check chunkSize
	if ( m_Header.m_ChunkSize != file.GetSize() - 8 )
	{
		log->OutMessage( "Filesize does not match size defined in the header", CLog::MESSAGETYPE_WARNING );
		return false;
	}
	Char* formatString = (Char*)&m_Header.m_Format;	
	//Check format
	if ( strncmp( "WAVE", formatString, 4 ) != 0 )
	{
		log->OutMessage( "Format does not correspond to WAVE", CLog::MESSAGETYPE_WARNING );
		return false;
	}
	const Char* subChunkOneID = (Char*)&m_Header.m_SubChunkOneID;
	//Check subchunk ID
	if ( strncmp( "fmt", subChunkOneID, 3 ) != 0 )
	{
		log->OutMessage( "ChunkOne ID does not match fmt", CLog::MESSAGETYPE_WARNING );
		return false;
	}
	//Check subchunk size
	if ( m_Header.m_SubChunkOneSize != 16 )
	{
		log->OutMessage( "ChunkOne size does not match the PCM value ( 16 ), others are not supported", CLog::MESSAGETYPE_WARNING );
		return false;
	}
	//Check audio format
	if ( m_Header.m_AudioFormat != 1 )
	{
		log->OutMessage( "Audio format not match the PCM value ( 1 ), others are not supported", CLog::MESSAGETYPE_WARNING );
		return false;
	}
	//Check Channel count
	if ( m_Header.m_ChannelCount == 0 )
	{
		log->OutMessage( "No audio channels found in the header", CLog::MESSAGETYPE_WARNING );
		return false;
	}
	Int bytesPerSample = m_Header.m_BitsPerSample / 8;
	//Check if byterate matches other values
	if ( m_Header.m_ByteRate != ( m_Header.m_SampleRate * m_Header.m_ChannelCount * bytesPerSample ) )
	{
		log->OutMessage( "Byterate does not match other values in header", CLog::MESSAGETYPE_WARNING );
		return false;
	}
	//Block allignment
	if ( m_Header.m_BlockAllignment != ( m_Header.m_ChannelCount * bytesPerSample ) )
	{
		log->OutMessage( "Block allignment does not match other values in header", CLog::MESSAGETYPE_WARNING );
		return false;
	}
	//Check for valid bbp
	if ( bytesPerSample != 1 && bytesPerSample != 2 )
	{
		log->OutMessage( "BBp value is not support only 8;16 are supported", CLog::MESSAGETYPE_WARNING );
		return false;
	}

	//Reading of chunks 
	const Char* subChunkID = (Char*)&m_Header.m_SubChunkTwoID;
	while ( strncmp( subChunkID, "data", 4 ) != 0 )
	{
		int currentPosition = file.GetPosition();
		file.Skip( m_Header.m_SubChunkTwoSize );

		fileHandler.Read<Int>( m_Header.m_SubChunkTwoID, 1 );
		fileHandler.Read<Int>( m_Header.m_SubChunkTwoSize, 1 );
	}

	////Check subchunk ID
	//if ( m_Header.m_SubChunkTwoID != _byteswap_ulong( 0x64617461 ) )
	//{
	//	//log->OutMessage( "ChunkTwo ID does not match data", CLog::MESSAGETYPE_WARNING );
	//	//return false;
	//}
	////Check subchunk size
	//if ( m_Header.m_SubChunkTwoSize != ( file.GetSize() - sizeof( SWaveHeader ) ) )
	//{
	//	log->OutMessage( "ChunkTwo size does not match the filesize", CLog::MESSAGETYPE_WARNING );		
	//}

	//Everything is correct so now read out the data
	m_Data = new Char[m_Header.m_SubChunkTwoSize];
	fileHandler.Read<Char>( m_Data, m_Header.m_SubChunkTwoSize );
	//Check if we reached the end of the file
	if ( file.GetPosition() == file.GetSize() )
	{
		file.Close();
	}
	else
	{
		log->OutMessage( "End of file not reached", CLog::MESSAGETYPE_WARNING );	
		file.Close();
	}
	
	//Calculate samplecount
	m_SampleCount = m_Header.m_SubChunkTwoSize / ( m_Header.m_ChannelCount * bytesPerSample );
	m_DataSize = m_Header.m_SubChunkTwoSize;
	return true;
}