Exemplo n.º 1
0
void iScenPropsDlg::iCMDH_ControlCommand(iView* pView, CTRL_CMD_ID cmd, sint32 param)
{
	uint32 uid = pView->GetUID();
	if ( (uid == DRC_OK || uid == DRC_CANCEL) && cmd == CCI_BTNCLICK) {
		// Setup difficulty
		m_scProps.m_Difficulty = (DIFFICULTY_LEVEL)m_difLevel->GetCurrentTab();
		// Setup players
		for (uint32 xx=0; xx<m_scProps.m_Players.GetSize(); ++xx) {
			m_scProps.m_Players[xx].m_Type = m_btnPlayers[xx]->PlayerType();
			m_scProps.m_Players[xx].m_Nation = m_btnNations[xx]->PlayerNation();
		}
		// End dialog
		EndDialog(uid); 
	} else if (uid == 301) {
		m_pDfcLabel->SetText(GetDfcString((DIFFICULTY_LEVEL)m_difLevel->GetCurrentTab()));
	} else if (uid == 401) {
		iStringT title = m_scProps.m_Name;
		//if (!m_scProps.m_Version.Empty()) title.Addf(_T(" v.%s"), m_scProps.m_Version.CStr());
		iStringT desc = m_scProps.m_Description;
		if (!m_scProps.m_Author.Empty()) desc.Addf(_T("\n\n%s: %s"), gTextMgr[TRID_MAP_AUTHOR], m_scProps.m_Author.CStr());
		iTextDlg tdlg(m_pMgr, title, desc, PID_NEUTRAL, dlgfc_topic, dlgfc_splain);
		tdlg.DoModal();
	} else if (uid >= 200 && uid < (200+m_scProps.m_Players.GetSize()) && cmd == CCI_BTNCLICK) {
		uint32 val = uid - 200;
		m_btnPlayers[val]->TogglePlayerType();
		UpdateControls();
	}
}
Exemplo n.º 2
0
void iDlg_BattleLog::iCMDH_ControlCommand(iView* pView, CTRL_CMD_ID cmd, sint32 param)
{
	uint32 uid = pView->GetUID();
	if (uid == DRC_OK && cmd == CCI_BTNCLICK) {
		EndDialog(pView->GetUID());
	} else if (uid == 101) {
		// Listbox
		if (cmd == CCI_LBSELDBLCLICK) {
			if (param != -1) {
				iTextDlg tdlg(m_pMgr, gTextMgr[TRID_COMBAT_LOG], m_log[param], m_pid);
				tdlg.DoModal();
			}
		} 
	} 
}
Exemplo n.º 3
0
bool SaveGameFile( const iStringT& fname, iGameWorld& gmap )
{
	// Check and create save directory (if not exists)
	iStringT saveDir = gSavePath.Left(gSavePath.Length()-1);
	bool dirIsOk = iFile::DirExists(saveDir);
	if ( !dirIsOk ) {
		dirIsOk = iFile::DirCreate(saveDir);
	}
	if (!dirIsOk) {
		DWORD dwErr = GetLastError();
		iTextDlg tdlg(&gApp.ViewMgr(), _T(""), iFormat(_T("Unable to create '%s' folder: ErrorCode: 0x%08X"), saveDir.CStr(), dwErr), PID_NEUTRAL);
		tdlg.DoModal();
	}

	// normally we should create it in the save directory
	iStringT tempSaveName( gSavePath + _T("tempsave.tmp") );
	iFilePtr pFile( CreateWin32File( tempSaveName ) );

	if ( !pFile ) {
		DWORD dwErr = GetLastError();
		iTextDlg dlg( &gApp.ViewMgr(), _T("Failure"), iFormat(_T("Unable to save [%s], ErrorCode: 0x%08X"), fname.CStr(), dwErr), PID_NEUTRAL);
		dlg.DoModal();
		return false;
	}

	if ( !gGame.Map().SaveToFile( pFile.get() ) ) {
		iTextDlg dlg( &gApp.ViewMgr(), _T("Failure"), _T("Unable to save game!"), PID_NEUTRAL );
		dlg.DoModal();
		return false;
	}
	// close file
	pFile.reset();
	// rename file to the destination
	iFile::Delete( fname );
	iFile::Rename( tempSaveName, fname );
	iFile::Delete( tempSaveName );
	return true;
}
Exemplo n.º 4
0
void CMainFrame::OnThickness(wxCommandEvent& event)
{
	EpaisseurDialog tdlg(m_toolbar, -1, wxT("Epaisseur"));
	tdlg.ShowModal();
}