Esempio n. 1
0
void PostDeposit::operator ()( const SPC & lhs )	const
{	// 입찰금 우편 반환 함수자
	u_long idReceiver	= lhs->GetIdPlayer();
	CTElection* pElection	= static_cast<CTElection*>( CTLord::Instance()->GetElection() );

	// 후보자 순위에 따른 반환금 구하기
	float fRate		= pElection->GetRetRate( idReceiver );
	if( fRate == 0.0F )
		return;
	// 2008/10/31 - 정밀도 오류가 발생하여 수정 - 康
//	__int64 iDeposit	= lhs->GetDeposit() * fRate;
	__int64 iDeposit	= (__int64)( lhs->GetDeposit() / 100 * ( fRate * 100 ) );

	// 후보자의 순위에 따라 편지 내용을 작성
	CMail* pMail	= new CMail;
	pMail->m_tmCreate	= ::time_null();
	pMail->m_idSender	= 0;	//

	int nOrder	= pElection->GetOrder( idReceiver );

	if( nOrder < IElection::nMaxCandidates )
	{
		lstrcpy( pMail->m_szTitle, prj.GetText( TID_GAME_ELECTION_RETURN_DEPOSIT_MAIL_TITLE_02 ) );	// title
		sprintf( pMail->m_szText, prj.GetText( TID_GAME_ELECTION_RETURN_DEPOSIT_MAIL_TEXT_02 ),
			static_cast<__int64>( lhs->GetDeposit() ),
			nOrder + 1,
			static_cast<float>( fRate * 100.0F ),
			static_cast<__int64>( iDeposit ) );
	}
	else
	{
		lstrcpy( pMail->m_szTitle, prj.GetText( TID_GAME_ELECTION_RETURN_DEPOSIT_MAIL_TITLE_01 ) );	// title
		sprintf( pMail->m_szText, prj.GetText( TID_GAME_ELECTION_RETURN_DEPOSIT_MAIL_TEXT_01 ),
			static_cast<__int64>( lhs->GetDeposit() ),
			static_cast<float>( fRate * 100.0F ),
			static_cast<__int64>( iDeposit ) );

		if( !m_pQuery->Execute( "uspElectionLeaveOut %d, %d, %d", g_appInfo.dwSys, pElection->GetId(), idReceiver ) )
			Error( "couldn't execute uspElectionLeaveOut" );
	}
	
	// 반환금을 페린과 페냐로 분리하여 첨부
	int nPerin	= static_cast<int>( iDeposit / static_cast<__int64>(PERIN_VALUE ) );
	int nPenya	= static_cast<int>( iDeposit - static_cast<__int64>( PERIN_VALUE ) * static_cast<__int64>( nPerin ) );

	pMail->m_nGold	= nPenya;
	if( nPerin > 0 )
	{
		pMail->m_pItemElem	= new CItemElem;
		pMail->m_pItemElem->m_dwItemId	= II_SYS_SYS_SCR_PERIN;
		pMail->m_pItemElem->m_nItemNum	= static_cast<short>( nPerin );
		pMail->m_pItemElem->SetSerialNumber( xRand() );
	}

	// 우편 발송
	post::Post( idReceiver, pMail, m_pQuery );
}
Esempio n. 2
0
void CCElection::State( void )
{	// 선거 상태 출력
#ifdef _DEBUG
	char lpString[100]	= { 0,};
	ELECTION_STATE eState	= GetState();
	sprintf( lpString, "state: %d", eState );
	g_WndMng.PutString( lpString, NULL, 0xff00ff00 );
	sprintf( lpString, "candidates list" );
	g_WndMng.PutString( lpString, NULL, 0xff00ff00 );
	for( int i = 0; i < (int)( m_vCandidates.size() ); i++ )
	{
		SPC ptr		= m_vCandidates[i];
		sprintf( lpString, "%02d: %07d: %I64d: %s: %d: %d", i, ptr->GetIdPlayer(), ptr->GetDeposit(), ptr->GetPledge(), ptr->GetVote(), ptr->GetCreate() );
		g_WndMng.PutString( lpString, NULL, 0xff00ff00 );
	}
#endif	// _DEBUG
}