コード例 #1
0
ファイル: SetFanDlg.cpp プロジェクト: timesgarden/hupai
void SetFanDlg::OnOK()
{
	CString err;
	err.Empty();
	for(int i = 0; i < m_PP->m_NumPlayers; i++){
		if(m_Zi == 0 && !(i == m_HuPlayer || i == m_DianPlayer))
			continue;
		CString s;
		this->m_RichDianFinalFan[i].GetWindowTextW(s);
		if(_GetNum(s, m_DianFinalFan[i]) != 0)
			err = err + L"玩家" + m_PP->m_PlayersInfo[i].m_Name + L"的番数无法识别\n";
	}
	if(err.IsEmpty()){
		int sum = 0;
		for(int i = 0; i < m_PP->m_NumPlayers; i++){
			sum += m_DianFinalFan[i];
		}
		if(sum != 0){
			AfxMessageBox(L"番数和不等于0");
			return;
		}
		CDialog::OnOK();
	}
	else{
		AfxMessageBox(err);
	}
}
コード例 #2
0
ファイル: SetFanDlg.cpp プロジェクト: timesgarden/hupai
void SetFanDlg::OnEnChangeRicheditFinalfan()
{
	// TODO:  Add your control notification handler code here
	if(m_IgnoreRichChange)
		return;
	if(!m_HuTypeLock){
		m_HuType = USERDEFHU;
		this->SetWindowTextW(BIT2STRHU(m_HuType));
	}
	CString s;
	GetDlgItem(IDC_RICHEDIT_FINALFAN)->GetWindowTextW(s);
	int n;
	if(_GetNum(s, n) != 0)
		return;
	m_HuFinalFan = n;
	for(int i = 0; i < m_PP->m_NumPlayers; i++)
		m_DianFinalFan[i] = 0;

	m_IgnoreRichChange = 1;
	for(int i = 0; i < m_PP->m_NumPlayers; i++){
		if(i == m_HuPlayer || i != m_DianPlayer && m_Zi == 0)
			continue;
		m_DianFinalFan[i] = - m_HuFinalFan - m_DianAppendFan[i];
		m_DianFinalFan[m_HuPlayer] -= m_DianFinalFan[i];
	
		this->m_RichDianFinalFan[i].GetWindowTextW(s);
		if(_SetAppendNum(m_DianFinalFan[i], s, 1) == 0)
			this->m_RichDianFinalFan[i].SetWindowTextW(s);
	}
	this->m_RichDianFinalFan[m_HuPlayer].GetWindowTextW(s);
	if(_SetAppendNum(m_DianFinalFan[m_HuPlayer], s, 1) == 0)
		this->m_RichDianFinalFan[m_HuPlayer].SetWindowTextW(s);
	m_IgnoreRichChange = 0;
//	this->m_DianAppendFan
}
コード例 #3
0
ファイル: SetFanDlg.cpp プロジェクト: timesgarden/hupai
void SetFanDlg::OnEnChangeRicheditAppendfan()
{
	// TODO:  Add your control notification handler code here
	if(m_IgnoreRichChange)
		return;
	CString s;
	GetDlgItem(IDC_RICHEDIT_APPENDFAN)->GetWindowTextW(s);
	int n;
	if(_GetNum(s, n) != 0)
		return;
	m_HuAppendFan = n;
	m_HuTypeLock = 1;
	this->OnEnChangeRicheditBasefan();
	m_HuTypeLock = 0;
}
コード例 #4
0
ファイル: SetFanDlg.cpp プロジェクト: timesgarden/hupai
void SetFanDlg::OnEnChangeRicheditBasefan()
{
	// TODO:  Add your control notification handler code here
	if(m_IgnoreRichChange)
		return;
	if(!m_HuTypeLock){
		m_HuType = USERDEFHU;
		this->SetWindowTextW(BIT2STRHU(m_HuType));
	}

	CString s;
	GetDlgItem(IDC_RICHEDIT_BASEFAN)->GetWindowTextW(s);
	if(_GetNum(s, this->m_BaseFan) != 0)
		return;
	m_HuFinalFan = m_BaseFan + m_HuAppendFan;
	GetDlgItem(IDC_RICHEDIT_FINALFAN)->GetWindowTextW(s);
	if(_SetAppendNum(m_HuFinalFan, s, false) == 0)
		GetDlgItem(IDC_RICHEDIT_FINALFAN)->SetWindowTextW(s);
	
}
コード例 #5
0
ファイル: Font.cpp プロジェクト: NikolayBorcho/Arena
Font* Font_Load(const char *FontName)
{
	char cBuff[256];	
	char cLine[512];
	char *pLine;
	
	Font *pFont=(Font*)Mem_New(sizeof(Font));
	char *pFileBuff;
	char *pFileBuffPtr;
	i32 iNum;
	
	memset(pFont,0,sizeof(Font));
	FontElement *pCurrentChar;
	
	sprintf(cBuff,"%s.tga",FontName);
	
	// load tga
	
	Image *pImage[1];
	
	pImage[0]=LoadTGA(cBuff,true,true);
	pFont->iTexID=TgaLoad_genTexture(pImage);
	
	
	sprintf(cBuff,"%s.xml",FontName);
	
	// load xml
	
	FILE *pXML;
	pXML=fopen(cBuff,"rb");
	
	if(!pXML)		
	{
		return 0;	
	}
	else	
	{
		pFileBuff=(char*)Mem_New(sizeof(char)*36*1024);	
		pFileBuffPtr=pFileBuff;
		u32 uSize=fread(pFileBuff,sizeof(char),36*1024,pXML);
	
		while(uSize)		
		{
			pLine=cLine;	
			
			while(uSize)	
			{
				*pLine=*pFileBuffPtr;
				
				pFileBuffPtr++;
				
				if(*pLine==' ')		
				{
					*pLine=0;	
					break;
				}
				
				pLine++;
				
				uSize--;
			}
			
			if(strstr(cLine,"id="))
			{
				iNum=_GetNum(cLine);
				
				ASSERT(iNum<256,"illegal font number");
				pCurrentChar=&pFont->elements[(unsigned char)iNum];	
#ifdef _DEBUG
				pCurrentChar->bInitalised=true;
#endif
			}
			else if(strstr(cLine,"x="))	
			{
				iNum=_GetNum(cLine);
				
				ASSERT(pCurrentChar,"error parsing font");
				pCurrentChar->u1=iNum/(float)pImage[0]->iWidth;	
			}
			else if(strstr(cLine,"y="))	
			{
				iNum=_GetNum(cLine);
				
				ASSERT(pCurrentChar,"error parsing font");
				pCurrentChar->v1=iNum/(float)pImage[0]->iHeight;	
			}
			else if(strstr(cLine,"width="))	
			{
				iNum=_GetNum(cLine);
				
				ASSERT(pCurrentChar,"error parsing font");
				pCurrentChar->u2=pCurrentChar->u1 + iNum/(float)pImage[0]->iWidth;	
				pCurrentChar->width=(float)iNum;
			}
			else if(strstr(cLine,"height="))	
			{
				iNum=_GetNum(cLine);
				
				ASSERT(pCurrentChar,"error parsing font");
				pCurrentChar->v2=pCurrentChar->v1 + iNum/(float)pImage[0]->iHeight;
				pCurrentChar->height=(float)iNum;
			}
			else
			{
				pCurrentChar=NULL;
			}
		}
	}
	
	fclose(pXML);
	
	Mem_Free(pFileBuff);
	
	return pFont;
}