Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

659 lines
16 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // RunMapExpertDlg.cpp : implementation file
  9. //
  10. #include "stdafx.h"
  11. #include "hammer.h"
  12. #include "RunMapExpertDlg.h"
  13. #include "RunMapCfgDlg.h"
  14. #include "mapdoc.h"
  15. #include "gridnav.h"
  16. // memdbgon must be the last include file in a .cpp file!!!
  17. #include <tier0/memdbgon.h>
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CRunMapExpertDlg dialog
  20. CRunMapExpertDlg::CRunMapExpertDlg(CWnd* pParent /*=NULL*/)
  21. : CDialog(CRunMapExpertDlg::IDD, pParent)
  22. {
  23. //{{AFX_DATA_INIT(CRunMapExpertDlg)
  24. //}}AFX_DATA_INIT
  25. m_pActiveSequence = NULL;
  26. m_bNoUpdateCmd = FALSE;
  27. m_bSwitchMode = FALSE;
  28. m_bWaitForKeypress = FALSE;
  29. }
  30. void CRunMapExpertDlg::DoDataExchange(CDataExchange* pDX)
  31. {
  32. CDialog::DoDataExchange(pDX);
  33. //{{AFX_DATA_MAP(CRunMapExpertDlg)
  34. DDX_Control(pDX, IDC_CONFIGURATIONS, m_cCmdSequences);
  35. DDX_Control(pDX, IDC_MOVEUP, m_cMoveUp);
  36. DDX_Control(pDX, IDC_MOVEDOWN, m_cMoveDown);
  37. DDX_Control(pDX, IDC_ENSUREFN, m_cEnsureFn);
  38. DDX_Control(pDX, IDC_ENSURECHECK, m_cEnsureCheck);
  39. DDX_Control(pDX, IDC_PARAMETERS, m_cParameters);
  40. DDX_Control(pDX, IDC_COMMAND, m_cCommand);
  41. DDX_Check(pDX, IDC_WAITFORKEYPRESS, m_bWaitForKeypress);
  42. //}}AFX_DATA_MAP
  43. DDX_Control(pDX, IDC_COMMANDLIST, m_cCommandList);
  44. }
  45. // dvs: this is duplicated in OPTBuild.cpp!!
  46. enum
  47. {
  48. id_InsertParmMapFileNoExt = 0x100,
  49. id_InsertParmMapFile,
  50. id_InsertParmMapPath,
  51. id_InsertParmBspDir,
  52. id_InsertParmExeDir,
  53. id_InsertParmGameDir,
  54. id_InsertParmEnd
  55. };
  56. enum
  57. {
  58. id_BrExecutable = 0x150,
  59. id_BrChangeDir,
  60. id_BrCopyFile,
  61. id_BrDelFile,
  62. id_BrRenameFile,
  63. id_BrGameProgram,
  64. id_BrVISProgram,
  65. id_BrBSPProgram,
  66. id_BrLIGHTProgram,
  67. id_BrGenerateGridNav,
  68. id_BrEnd
  69. };
  70. BEGIN_MESSAGE_MAP(CRunMapExpertDlg, CDialog)
  71. //{{AFX_MSG_MAP(CRunMapExpertDlg)
  72. ON_BN_CLICKED(IDC_BROWSECOMMAND, OnBrowsecommand)
  73. ON_LBN_SELCHANGE(IDC_COMMANDLIST, OnSelchangeCommandlist)
  74. ON_BN_CLICKED(IDC_INSERTPARM, OnInsertparm)
  75. ON_BN_CLICKED(IDC_MOVEDOWN, OnMovedown)
  76. ON_BN_CLICKED(IDC_MOVEUP, OnMoveup)
  77. ON_BN_CLICKED(IDC_NEW, OnNew)
  78. ON_BN_CLICKED(IDC_NORMAL, OnNormal)
  79. ON_BN_CLICKED(IDC_REMOVE, OnRemove)
  80. ON_EN_UPDATE(IDC_COMMAND, OnUpdateCommand)
  81. ON_EN_UPDATE(IDC_PARAMETERS, OnUpdateParameters)
  82. ON_BN_CLICKED(IDC_ENSURECHECK, OnEnsurecheck)
  83. ON_EN_UPDATE(IDC_ENSUREFN, OnUpdateEnsurefn)
  84. ON_CBN_SELCHANGE(IDC_CONFIGURATIONS, OnSelchangeConfigurations)
  85. ON_BN_CLICKED(IDC_EDITCONFIGS, OnEditconfigs)
  86. ON_COMMAND_EX_RANGE(id_InsertParmMapFileNoExt, id_InsertParmEnd, HandleInsertParm)
  87. ON_COMMAND_EX_RANGE(id_BrExecutable, id_BrEnd, HandleInsertCommand)
  88. //}}AFX_MSG_MAP
  89. END_MESSAGE_MAP()
  90. /////////////////////////////////////////////////////////////////////////////
  91. // CRunMapExpertDlg message handlers
  92. BOOL CRunMapExpertDlg::HandleInsertCommand(UINT nID)
  93. // insert a parm at the current cursor location into the parameters
  94. // edit control
  95. {
  96. PCCOMMAND pCommand = GetCommandAtIndex(NULL);
  97. if(!pCommand)
  98. return TRUE; // no command
  99. if(nID == id_BrExecutable)
  100. {
  101. CFileDialog dlg(TRUE, "exe", NULL, OFN_HIDEREADONLY |
  102. OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
  103. "Executable Files|*.exe||", this);
  104. if(dlg.DoModal() == IDCANCEL)
  105. return TRUE;
  106. m_cCommand.SetWindowText(dlg.m_ofn.lpstrFile);
  107. pCommand->iSpecialCmd = 0;
  108. }
  109. else
  110. {
  111. pCommand->iSpecialCmd = 0;
  112. switch(nID)
  113. {
  114. case id_BrCopyFile:
  115. pCommand->iSpecialCmd = CCCopyFile;
  116. break;
  117. case id_BrDelFile:
  118. pCommand->iSpecialCmd = CCDelFile;
  119. break;
  120. case id_BrRenameFile:
  121. pCommand->iSpecialCmd = CCRenameFile;
  122. break;
  123. case id_BrChangeDir:
  124. pCommand->iSpecialCmd = CCChangeDir;
  125. break;
  126. case id_BrGameProgram:
  127. m_cCommand.SetWindowText("$game_exe");
  128. break;
  129. case id_BrVISProgram:
  130. m_cCommand.SetWindowText("$vis_exe");
  131. break;
  132. case id_BrLIGHTProgram:
  133. m_cCommand.SetWindowText("$light_exe");
  134. break;
  135. case id_BrBSPProgram:
  136. m_cCommand.SetWindowText("$bsp_exe");
  137. break;
  138. case id_BrGenerateGridNav:
  139. pCommand->iSpecialCmd = CCGenerateGridNav;
  140. break;
  141. }
  142. if(pCommand->iSpecialCmd)
  143. pCommand->bLongFilenames = TRUE;
  144. OnSelchangeCommandlist();
  145. UpdateCommandWithEditFields(-1);
  146. }
  147. return TRUE;
  148. }
  149. void CRunMapExpertDlg::OnBrowsecommand(void)
  150. {
  151. CMenu menu;
  152. menu.CreatePopupMenu();
  153. menu.AppendMenu(MF_STRING, id_BrExecutable, "Executable");
  154. menu.AppendMenu(MF_STRING, id_BrChangeDir, "Change Directory");
  155. menu.AppendMenu(MF_STRING, id_BrCopyFile, "Copy File");
  156. menu.AppendMenu(MF_STRING, id_BrDelFile, "Delete File");
  157. menu.AppendMenu(MF_STRING, id_BrRenameFile, "Rename File");
  158. menu.AppendMenu(MF_SEPARATOR);
  159. menu.AppendMenu(MF_STRING, id_BrBSPProgram, "BSP program");
  160. menu.AppendMenu(MF_STRING, id_BrVISProgram, "VIS program");
  161. menu.AppendMenu(MF_STRING, id_BrLIGHTProgram, "LIGHT program");
  162. menu.AppendMenu(MF_STRING, id_BrGameProgram, "Game program");
  163. // the generate grid nav command only appears if grid nav is enabled
  164. CMapDoc* pMapDoc = CMapDoc::GetActiveMapDoc();
  165. if ( pMapDoc && pMapDoc->GetGridNav() && pMapDoc->GetGridNav()->IsEnabled() )
  166. {
  167. menu.AppendMenu(MF_SEPARATOR);
  168. menu.AppendMenu(MF_STRING, id_BrGenerateGridNav, "Generate Grid Nav");
  169. }
  170. // track menu
  171. CWnd *pButton = GetDlgItem(IDC_BROWSECOMMAND);
  172. CRect r;
  173. pButton->GetWindowRect(r);
  174. menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, r.left, r.bottom, this, NULL);
  175. }
  176. LPCTSTR CRunMapExpertDlg::GetCmdString(PCCOMMAND pCommand)
  177. {
  178. switch(pCommand->iSpecialCmd)
  179. {
  180. case 0:
  181. return pCommand->szRun;
  182. case CCCopyFile:
  183. return "Copy File";
  184. case CCDelFile:
  185. return "Delete File";
  186. case CCRenameFile:
  187. return "Rename File";
  188. case CCChangeDir:
  189. return "Change Directory";
  190. case CCGenerateGridNav:
  191. return "Generate Grid Nav";
  192. }
  193. return "";
  194. }
  195. void CRunMapExpertDlg::OnSelchangeCommandlist()
  196. {
  197. int iIndex = -1;
  198. // change the selection in the command list - update the command
  199. // and parameters edit boxes
  200. PCCOMMAND pCommand = GetCommandAtIndex(&iIndex);
  201. // enable/disable controls
  202. BOOL bEnable = pCommand ? TRUE : FALSE;
  203. int iEnableCmds[] =
  204. {
  205. // edit fields:
  206. IDC_COMMAND,
  207. IDC_PARAMETERS,
  208. IDC_ENSUREFN,
  209. // checkboxes/buttons:
  210. IDC_ENSURECHECK,
  211. IDC_INSERTPARM,
  212. IDC_BROWSECOMMAND,
  213. -1
  214. };
  215. m_bNoUpdateCmd = TRUE;
  216. for(int i = 0; iEnableCmds[i] != -1; i++)
  217. {
  218. CWnd *pWnd = GetDlgItem(iEnableCmds[i]);
  219. pWnd->EnableWindow(bEnable);
  220. if(bEnable == FALSE)
  221. {
  222. // ensure fields are cleared if we're disabling them
  223. if(i < 3)
  224. pWnd->SetWindowText("");
  225. else
  226. ((CButton*)pWnd)->SetCheck(0);
  227. }
  228. }
  229. m_bNoUpdateCmd = FALSE;
  230. if(!pCommand)
  231. return;
  232. // set moveup/movedown buttons
  233. m_cMoveUp.EnableWindow(iIndex != 0);
  234. m_cMoveDown.EnableWindow(iIndex != m_cCommandList.GetCount() - 1);
  235. m_bNoUpdateCmd = TRUE;
  236. m_cCommand.SetWindowText(GetCmdString(pCommand));
  237. m_cParameters.SetWindowText(pCommand->szParms);
  238. m_cEnsureCheck.SetCheck(pCommand->bEnsureCheck);
  239. m_cEnsureFn.SetWindowText(pCommand->szEnsureFn);
  240. // don't forget to call this:
  241. OnEnsurecheck();
  242. m_bNoUpdateCmd = FALSE;
  243. }
  244. BOOL CRunMapExpertDlg::HandleInsertParm(UINT nID)
  245. // insert a parm at the current cursor location into the parameters
  246. // edit control
  247. {
  248. LPCTSTR pszInsert;
  249. switch (nID)
  250. {
  251. case id_InsertParmMapFileNoExt:
  252. pszInsert = "$file";
  253. break;
  254. case id_InsertParmMapFile:
  255. pszInsert = "$file.$ext";
  256. break;
  257. case id_InsertParmMapPath:
  258. pszInsert = "$path";
  259. break;
  260. case id_InsertParmExeDir:
  261. pszInsert = "$exedir";
  262. break;
  263. case id_InsertParmBspDir:
  264. pszInsert = "$bspdir";
  265. break;
  266. case id_InsertParmGameDir:
  267. default:
  268. pszInsert = "$gamedir";
  269. break;
  270. }
  271. Assert(pszInsert);
  272. if(!pszInsert)
  273. return TRUE;
  274. m_cParameters.ReplaceSel(pszInsert);
  275. return TRUE;
  276. }
  277. void CRunMapExpertDlg::OnInsertparm(void)
  278. {
  279. // two stages - name/description OR data itself
  280. CMenu menu;
  281. menu.CreatePopupMenu();
  282. menu.AppendMenu(MF_STRING, id_InsertParmMapFileNoExt, "Map Filename (no extension)");
  283. menu.AppendMenu(MF_STRING, id_InsertParmMapFile, "Map Filename (with extension)");
  284. menu.AppendMenu(MF_STRING, id_InsertParmMapPath, "Map Path (no filename)");
  285. menu.AppendMenu(MF_SEPARATOR);
  286. menu.AppendMenu(MF_STRING, id_InsertParmExeDir, "Game Executable Directory");
  287. menu.AppendMenu(MF_STRING, id_InsertParmBspDir, "BSP Directory");
  288. menu.AppendMenu(MF_STRING, id_InsertParmGameDir, "Game Directory");
  289. // track menu
  290. CWnd *pButton = GetDlgItem(IDC_INSERTPARM);
  291. CRect r;
  292. pButton->GetWindowRect(r);
  293. menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, r.left, r.bottom, this, NULL);
  294. }
  295. void CRunMapExpertDlg::DeleteCommand(int iIndex)
  296. {
  297. // kill the command at that index (deletes the dataptr memory too)
  298. PCCOMMAND pCommand = GetCommandAtIndex(&iIndex);
  299. m_cCommandList.DeleteString(iIndex);
  300. if(iIndex >= m_cCommandList.GetCount()-1)
  301. iIndex = m_cCommandList.GetCount()-1;
  302. m_cCommandList.SetCurSel(iIndex);
  303. // selection has "changed"
  304. OnSelchangeCommandlist();
  305. delete pCommand;
  306. }
  307. void CRunMapExpertDlg::AddCommand(int iIndex, PCCOMMAND pCommand)
  308. {
  309. // add a command to the list at the index specified in iIndex (-1 to add
  310. // at end of list.)
  311. CString str;
  312. str.Format("%s %s", GetCmdString(pCommand), pCommand->szParms);
  313. iIndex = m_cCommandList.InsertString(iIndex, str);
  314. m_cCommandList.SetItemDataPtr(iIndex, PVOID(pCommand));
  315. }
  316. void CRunMapExpertDlg::MoveCommand(int iIndex, BOOL bUp)
  317. {
  318. PCCOMMAND pCommand = GetCommandAtIndex(&iIndex);
  319. if(!pCommand)
  320. return;
  321. // keep check state of item in listbox
  322. BOOL bChecked = m_cCommandList.GetCheck(iIndex);
  323. // don't bother with the string - that's made from the command/parms
  324. // struct that the item's dataptr points to
  325. m_cCommandList.DeleteString(iIndex);
  326. int iNewIndex = iIndex + (bUp ? -1 : +1);
  327. AddCommand(iNewIndex, pCommand);
  328. // restore check state saved above
  329. m_cCommandList.SetCheck(iNewIndex, bChecked);
  330. // selection has changed
  331. m_cCommandList.SetCurSel(iNewIndex);
  332. OnSelchangeCommandlist();
  333. }
  334. void CRunMapExpertDlg::OnMovedown()
  335. {
  336. MoveCommand(-1, FALSE);
  337. }
  338. void CRunMapExpertDlg::OnMoveup()
  339. {
  340. MoveCommand(-1, TRUE);
  341. }
  342. void CRunMapExpertDlg::OnNew()
  343. {
  344. // add a command
  345. PCCOMMAND pCommand = new CCOMMAND;
  346. memset(pCommand, 0, sizeof(CCOMMAND));
  347. AddCommand(-1, pCommand);
  348. m_cCommandList.SetCurSel(m_cCommandList.GetCount()-1);
  349. // sleection has changed
  350. OnSelchangeCommandlist();
  351. }
  352. void CRunMapExpertDlg::OnNormal()
  353. {
  354. m_bSwitchMode = TRUE;
  355. SaveCommandsToSequence();
  356. CHammer *pApp = (CHammer*) AfxGetApp();
  357. pApp->SaveSequences();
  358. UpdateData();
  359. EndDialog(IDOK);
  360. }
  361. void CRunMapExpertDlg::UpdateCommandWithEditFields(int iIndex)
  362. {
  363. PCCOMMAND pCommand = GetCommandAtIndex(&iIndex);
  364. // update command struct with edit fields:
  365. m_cCommand.GetWindowText(pCommand->szRun, MAX_PATH);
  366. m_cParameters.GetWindowText(pCommand->szParms, MAX_PATH);
  367. m_cEnsureFn.GetWindowText(pCommand->szEnsureFn, MAX_PATH);
  368. pCommand->bEnsureCheck = m_cEnsureCheck.GetCheck();
  369. // save checked state..
  370. BOOL bCmdChecked = m_cCommandList.GetCheck(iIndex);
  371. // update list by deleting/adding command
  372. m_cCommandList.SetRedraw(FALSE);
  373. m_cCommandList.DeleteString(iIndex);
  374. AddCommand(iIndex, pCommand);
  375. m_cCommandList.SetCurSel(iIndex);
  376. m_cCommandList.SetRedraw(TRUE);
  377. m_cCommandList.Invalidate();
  378. m_cCommandList.SetCheck(iIndex, bCmdChecked);
  379. // DON'T call OnCommandlistSelchange() here
  380. }
  381. PCCOMMAND CRunMapExpertDlg::GetCommandAtIndex(int *piIndex)
  382. {
  383. // make sure we're pointing at something:
  384. int iIndex = -1;
  385. if(piIndex == NULL)
  386. piIndex = &iIndex;
  387. // return the current command structure
  388. if(piIndex[0] == -1)
  389. piIndex[0] = m_cCommandList.GetCurSel();
  390. if(piIndex[0] == LB_ERR)
  391. return NULL;
  392. PCCOMMAND pCommand = PCCOMMAND(m_cCommandList.GetItemDataPtr(piIndex[0]));
  393. return pCommand;
  394. }
  395. void CRunMapExpertDlg::OnRemove()
  396. {
  397. // kill the current command
  398. int iIndex = m_cCommandList.GetCurSel();
  399. if(iIndex == LB_ERR)
  400. return;
  401. DeleteCommand(iIndex);
  402. }
  403. void CRunMapExpertDlg::OnUpdateCommand()
  404. {
  405. if(!m_bNoUpdateCmd)
  406. {
  407. // make sure no special command is contained here ..
  408. // (this is only ever called when the user types
  409. // in the command edit field.)
  410. PCCOMMAND pCommand = GetCommandAtIndex(NULL);
  411. if(pCommand->iSpecialCmd)
  412. {
  413. // clear out command .. set the noupdatecmd
  414. // flag so we don't get into a stack overflow
  415. m_bNoUpdateCmd = TRUE;
  416. m_cCommand.SetWindowText("");
  417. m_bNoUpdateCmd = FALSE;
  418. pCommand->iSpecialCmd = 0;
  419. }
  420. UpdateCommandWithEditFields(-1);
  421. }
  422. }
  423. void CRunMapExpertDlg::OnUpdateParameters()
  424. {
  425. if(!m_bNoUpdateCmd)
  426. UpdateCommandWithEditFields(-1);
  427. }
  428. void CRunMapExpertDlg::OnEnsurecheck()
  429. {
  430. if(!m_bNoUpdateCmd)
  431. UpdateCommandWithEditFields(-1);
  432. // enable/disable edit field
  433. m_cEnsureFn.EnableWindow(m_cEnsureCheck.GetCheck());
  434. }
  435. void CRunMapExpertDlg::OnUpdateEnsurefn()
  436. {
  437. if(!m_bNoUpdateCmd)
  438. UpdateCommandWithEditFields(-1);
  439. }
  440. void CRunMapExpertDlg::InitSequenceList()
  441. {
  442. // add all the information from the CHammer object into
  443. // the dialog box ..
  444. CHammer *pApp = (CHammer*) AfxGetApp();
  445. m_cCmdSequences.ResetContent();
  446. // add the configurations into the list ..
  447. int iSize = pApp->m_CmdSequences.GetSize();
  448. if(iSize == 0)
  449. {
  450. // add a default configuration
  451. CCommandSequence *pSeq = new CCommandSequence;
  452. strcpy(pSeq->m_szName, "Default");
  453. ((CHammer*)AfxGetApp())->m_CmdSequences.Add(pSeq);
  454. iSize = 1;
  455. }
  456. for(int i = 0; i < iSize; i++)
  457. {
  458. CCommandSequence *pSeq = pApp->m_CmdSequences[i];
  459. int iIndex = m_cCmdSequences.AddString(pSeq->m_szName);
  460. m_cCmdSequences.SetItemDataPtr(iIndex, PVOID(pSeq));
  461. }
  462. m_pActiveSequence = NULL;
  463. m_cCmdSequences.SetCurSel(0);
  464. OnSelchangeConfigurations();
  465. }
  466. BOOL CRunMapExpertDlg::OnInitDialog()
  467. {
  468. CDialog::OnInitDialog();
  469. int iSequence = AfxGetApp()->GetProfileInt("RunMapExpert",
  470. "LastSequence", 0);
  471. InitSequenceList();
  472. m_cCmdSequences.SetCurSel(iSequence);
  473. OnSelchangeConfigurations();
  474. return TRUE;
  475. }
  476. void CRunMapExpertDlg::OnOK()
  477. {
  478. SaveCommandsToSequence();
  479. CHammer *pApp = (CHammer*) AfxGetApp();
  480. pApp->SaveSequences();
  481. CDialog::OnOK();
  482. }
  483. void CRunMapExpertDlg::SaveCommandsToSequence()
  484. {
  485. if(!m_pActiveSequence)
  486. return; // nothing set yet
  487. int nCommands = m_cCommandList.GetCount();
  488. m_pActiveSequence->m_Commands.RemoveAll();
  489. for(int i = 0; i < nCommands; i++)
  490. {
  491. PCCOMMAND pCommand = PCCOMMAND(m_cCommandList.GetItemDataPtr(i));
  492. pCommand->bEnable = m_cCommandList.GetCheck(i);
  493. if (!strcmp(pCommand->szRun, "$game_exe"))
  494. pCommand->bNoWait = TRUE;
  495. m_pActiveSequence->m_Commands.Add(*pCommand);
  496. // free the memory:
  497. delete pCommand;
  498. }
  499. }
  500. void CRunMapExpertDlg::OnSelchangeConfigurations()
  501. {
  502. // save the current command list back into the previously active
  503. // command sequence
  504. SaveCommandsToSequence();
  505. int iSel = m_cCmdSequences.GetCurSel();
  506. if(iSel == LB_ERR) // nothing there
  507. {
  508. m_pActiveSequence = NULL;
  509. return;
  510. }
  511. AfxGetApp()->WriteProfileInt("RunMapExpert", "LastSequence", iSel);
  512. CCommandSequence *pSeq = (CCommandSequence*)
  513. m_cCmdSequences.GetItemDataPtr(iSel);
  514. // delete strings from listbox (dataptrs already deleted
  515. // in SaveCommandsToSequence())
  516. m_cCommandList.ResetContent();
  517. m_pActiveSequence = pSeq;
  518. // add the commands from this sequence into the command listbox ..
  519. CCommandArray &Commands = pSeq->m_Commands;
  520. for(int i = 0; i < Commands.GetSize(); i++)
  521. {
  522. PCCOMMAND pCommand = new CCOMMAND(Commands[i]);
  523. AddCommand(i, pCommand);
  524. m_cCommandList.SetCheck(i, pCommand->bEnable);
  525. }
  526. // set to 0th element in list ..
  527. m_cCommandList.SetCurSel(0);
  528. OnSelchangeCommandlist();
  529. }
  530. void CRunMapExpertDlg::OnEditconfigs()
  531. {
  532. CRunMapCfgDlg dlg;
  533. SaveCommandsToSequence();
  534. if(dlg.DoModal() == IDOK)
  535. InitSequenceList();
  536. }
  537. void CRunMapExpertDlg::OnCancel()
  538. {
  539. SaveCommandsToSequence();
  540. CHammer *pApp = (CHammer*) AfxGetApp();
  541. pApp->SaveSequences();
  542. CDialog::OnCancel();
  543. }