void DoOut()
{
    system("cls");
    cout << setiosflags(ios::fixed | ios::showpoint | ios::right);
    cout << setprecision(2) << endl;
    out_file << setiosflags(ios::fixed | ios::showpoint | ios::right);
    out_file << setprecision(2) << endl;
    // Name for Screen I/O
    cout << "Name:"<< setw(24) << patient_name << endl;
    // Name for File I/O
    out_file << "Name:" << setw(24) << patient_name << endl;
    // Room for Screen I/O
    cout << "Type Of Room:" << setw(16) << GetRoomType() << endl;
    // Room for File I/O
    out_file << "Type Of Room:" << setw(16) << GetRoomType() << endl;
    // Days for Screen I/O
    cout << "Number Of Days:" << setw(14) << patient_days << endl;
    // Days for File I/O
    out_file << "Number Of Days:" << setw(14) << patient_days << endl;
    // Insurance for Screen I/O
    cout << "Type Of Insurance:" << setw(11) << GetInsuranceType() << endl;
    // Insurance for File I/O
    out_file << "Type Of Insurance:" << setw(11) << GetInsuranceType() << endl;
    // Blank Line
    cout << endl;
    out_file << endl;
    // Charges for Screen I/O
    cout << "Charges:" << endl;
    cout << setw(13) << "Room" << setw(16) << GetRoomCharge()*patient_days << endl;
    cout << setw(14) << "Phone" << setw(15) << GetPhoneCharge()*patient_days << endl;
    cout << setw(11) << "TV" << setw(18) << GetTVCharge()*patient_days << endl;
    cout << setw(16) << "Dr. Fee" << setw(13) << patient_drfee << endl;
    // Charges for file I/O
    out_file << "Charges:" << endl;
    out_file << setw(13) << "Room" << setw(16) << GetRoomCharge() << endl;
    out_file << setw(14) << "Phone" << setw(15) << GetPhoneCharge() << endl;
    out_file << setw(11) << "TV" << setw(18) << GetTVCharge() << endl;
    out_file << setw(16) << "Dr. Fee" << setw(13) << patient_drfee << endl;
    // SubTotal for Screen I/O
    cout << "Subtotal" << setw(21) << GetSubtotal() << endl;
    // SubTotal for file I/O
    out_file << "Subtotal" << setw(21) << GetSubtotal() << endl;
    // Insurance Pays for Screen I/O
    cout << "Insurance Pays" << setw(15) << GetInsCovers() << endl;
    // Insurance Pays for file I/O
    out_file << "Insurance Pays" << setw(15) << GetInsCovers() << endl;
    // Total Due for Screen I/O
    cout << "Total Due" << setw(20) << (GetSubtotal() - GetInsCovers()) << endl;
    // Total Due for file I/O
    out_file << "Total Due" << setw(20) << (GetSubtotal() - GetInsCovers()) << endl;
    // Finish for Screen I/O
    cout << "\n\nPress any Key to Continue" << endl;
    // Finsih for file I/O
    getch();
    DoOver();
}
示例#2
0
bool CRoomBase::OnPeerMsg(CRoomPeer* pPeer, stMsg* pmsg )
{
	// process common msg that don't assocaite with specail card game ;
	// for example : speak work , look other player info ,and make firend , and so on ;
	// when processed , return true , other case return false ;
	switch ( pmsg->usMsgType )
	{
	case MSG_ROOM_SPEAK:
		{
			stMsgRoomPlayerSpeakRet msgBackRet ;
			msgBackRet.nRet = 0 ;
			stMsgRoomPlayerSpeak* pMsgRet = (stMsgRoomPlayerSpeak*)pmsg ;
			if ( 3 == pMsgRet->nContentType ) // interactive speak ;
			{
				CPlayerItemComponent* pItemMgr = (CPlayerItemComponent*)pPeer->GetPlayer()->GetComponent(ePlayerComponent_PlayerItemMgr);	
				if ( !pItemMgr->OnUserItem(ITEM_ID_INTERACTIVE) )
				{
					msgBackRet.nRet = 1 ;
					pPeer->SendMsgToClient((char*)&msgBackRet,sizeof(msgBackRet)) ;
					break;
				}

				if ( pMsgRet->nInteraciveWithPeerRoomIdx < 0 || pMsgRet->nInteraciveWithPeerRoomIdx >= GetMaxSeat() || m_vRoomPeer[pMsgRet->nInteraciveWithPeerRoomIdx] == NULL )
				{
					msgBackRet.nRet = 2 ;
					pPeer->SendMsgToClient((char*)&msgBackRet,sizeof(msgBackRet)) ;
					break;
				}
			}

			stMsgRoomOtherPlayerSpeak msg ;
			msg.nContentLen = pMsgRet->nContentLen ;
			msg.nContentType = pMsgRet->nContentType ;
			msg.nSpeakerRoomIdx = pPeer->GetPeerIdxInRoom() ;
			msg.nSpeakSex = pPeer->GetPlayerBaseData()->GetSex() ;
			msg.nSystemChatID = pMsgRet->nSystemChatID ;
			msg.nInteraciveWithPeerRoomIdx = pMsgRet->nInteraciveWithPeerRoomIdx;
			memcpy(msg.pSpeakName,pPeer->GetPlayerBaseData()->GetPlayerName(),sizeof(msg.pSpeakName));
			char* pBuffer = new char[sizeof(msg) + msg.nContentLen] ;
			unsigned short nOffset = 0 ;
			memcpy(pBuffer,&msg,sizeof(msg));
			nOffset += sizeof(msg);
			memcpy(pBuffer + nOffset,((char*)pMsgRet) + sizeof(stMsgRoomPlayerSpeak),msg.nContentLen );
			nOffset += msg.nContentLen ;
			SendMsgRoomPeers((stMsg*)pBuffer,nOffset) ;
			delete[] pBuffer ;
		}
		break;
	case MSG_ROOM_KICK_PEER:
		{
			stMsgKickPeerRet msgBack ;
			stMsgKickPeer* pRealMsg = (stMsgKickPeer*)pmsg ;
			msgBack.nRet = 0 ;
			if ( pRealMsg->nIdxToBeKick == pPeer->GetPeerIdxInRoom() )
			{
				msgBack.nRet = 4 ;
				pPeer->SendMsgToClient((char*)&msgBack,sizeof(msgBack) ) ;
				break;
			}
			
			if (pRealMsg->nIdxToBeKick >= GetMaxSeat() || m_vRoomPeer[pRealMsg->nIdxToBeKick] == NULL )
			{
				msgBack.nRet = 1 ;
				pPeer->SendMsgToClient((char*)&msgBack,sizeof(msgBack) ) ;
				break;				
			}

			if ( m_vRoomPeer[pRealMsg->nIdxToBeKick]->GetPlayerBaseData()->GetVipLevel() > pPeer->GetPlayerBaseData()->GetVipLevel() )
			{
				msgBack.nRet = 3 ;
				pPeer->SendMsgToClient((char*)&msgBack,sizeof(msgBack) ) ;
				break;
			}

			CPlayerItemComponent* pItemMgr = (CPlayerItemComponent*)pPeer->GetPlayer()->GetComponent(ePlayerComponent_PlayerItemMgr);	
			if ( pItemMgr->OnUserItem(ITEM_ID_KICK_CARD) )
			{
				// tell all other peer ;
				stMsgKickOtherPeerKickPeer msg ;
				msg.nIdxWhoBeKicked = pRealMsg->nIdxToBeKick ;
				msg.nIdxWhoKick = pPeer->GetPeerIdxInRoom();
				SendMsgRoomPeers(&msg,sizeof(msg));
				// can kick ;
				stKicPlayer stKickInfo;
				stKickInfo.nIdxInRoom = pRealMsg->nIdxToBeKick ;
				stKickInfo.bDoKicked = false ;
				stKickInfo.nUserUIDLimit = m_vRoomPeer[stKickInfo.nIdxInRoom]->GetPlayer()->GetUserUID();
				//memcpy(stKickInfo.cNameBeKicked,m_vRoomPeer[pRealMsg->nIdxToBeKick]->GetPlayerBaseData()->GetPlayerName(),sizeof(stKickInfo.cNameBeKicked));
				memcpy(stKickInfo.cNameKicker,pPeer->GetPlayerBaseData()->GetPlayerName(),sizeof(stKickInfo.cNameKicker));
				m_vAllKickedPeers.push_back(stKickInfo) ;
				ProcessKickedPeers();
			}
			else
			{
				msgBack.nRet = 2 ;
			}
			pPeer->SendMsgToClient((char*)&msgBack,sizeof(msgBack) ) ;
		}
		break;
	case MSG_ROOM_REQUEST_PEER_DETAIL:
		{
// 			stMsgRoomRequestPeerDetailRet msgBack ;
// 			stMsgRoomRequestPeerDetail* pMsgRet = (stMsgRoomRequestPeerDetail*)pmsg ;
// 			msgBack.nPeerIdxInRoom = pMsgRet->nPeerIdxInRoom ;
// 			CRoomPeer* pFindPeer = NULL ;
// 			if ( pMsgRet->nPeerIdxInRoom >= GetMaxSeat() || m_vRoomPeer[pMsgRet->nPeerIdxInRoom] == NULL )
// 			{
// 				msgBack.nRet = 1 ;
// 			}
// 			else
// 			{
// 				pFindPeer = m_vRoomPeer[pMsgRet->nPeerIdxInRoom];
// 				msgBack.nRet = 0 ;
// 				CPlayerBaseData* pBaseData = pFindPeer->GetPlayerBaseData() ;
// 				pBaseData->GetPlayerDetailData(&msgBack.stDetailInfo) ;
// 			}
// 			pPeer->SendMsgToClient((char*)&msgBack,sizeof(msgBack)) ;
		}
		break;
	case MSG_PlAYER_INVITED_FRIEND_TO_JOIN_ROOM:
		{
			stMsgPlayerInviteFriendToJoinRoomRet msgBack ;
			msgBack.nRet = 0 ;
			stMsgPlayerInviteFriendToJoinRoom* pMsgRet = (stMsgPlayerInviteFriendToJoinRoom*)pmsg ;
			if ( pMsgRet->nRoomIdx >= GetMaxSeat() || m_vRoomPeer[pMsgRet->nRoomIdx] != NULL )
			{
				msgBack.nRet = 1 ;
				pPeer->SendMsgToClient((char*)&msgBack,sizeof(msgBack)) ;
				break; ;
			}

			CPlayer* pPlayer = CGameServerApp::SharedGameServerApp()->GetPlayerMgr()->GetPlayerByUserUID(pMsgRet->nPlayerUID) ;
			if ( !pPlayer )
			{
				msgBack.nRet = 2 ;
				pPeer->SendMsgToClient((char*)&msgBack,sizeof(msgBack)) ;
				break; ;
			}

			//if ( pPlayer->GetState() != CPlayer::ePlayerState_Free )
			//{
			//	msgBack.nRet = 4 ;
			//	pPeer->SendMsgToClient((char*)&msgBack,sizeof(msgBack)) ;
			//	break; ;
			//}

			if ( CanJoin(pPlayer) != 0 )
			{
				msgBack.nRet = 3 ;
				pPeer->SendMsgToClient((char*)&msgBack,sizeof(msgBack)) ;
				break; ;
			}
			pPeer->SendMsgToClient((char*)&msgBack,sizeof(msgBack)) ;

			// tell the player you invite ;
			stMsgPlayerBeInvitedToJoinRoom msgInfom ;
			memcpy(msgInfom.pNameWhoInviteMe,pPeer->GetPlayerBaseData()->GetPlayerName(),sizeof(msgInfom.pNameWhoInviteMe));
			msgInfom.nRoomID = GetRoomID();
			msgInfom.nRoomLevel = GetRoomLevel();
			msgInfom.nRoomType = GetRoomType() ;
			msgInfom.nSitIdx = pMsgRet->nRoomIdx ;
			msgInfom.nUserUIDWhoInviteMe = pPeer->GetPlayer()->GetUserUID() ;
			pPlayer->SendMsgToClient((char*)&msgInfom,sizeof(msgInfom)) ;
		}
		break;
	default:
		return false ;
	}
	return true ;
}