MapInfo.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #include "../../idlib/precompiled.h"
  21. #pragma hdrstop
  22. #include "qe3.h"
  23. #include "Radiant.h"
  24. #include "MapInfo.h"
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CMapInfo dialog
  32. CMapInfo::CMapInfo(CWnd* pParent /*=NULL*/)
  33. : CDialog(CMapInfo::IDD, pParent)
  34. {
  35. //{{AFX_DATA_INIT(CMapInfo)
  36. m_nNet = 0;
  37. m_nTotalBrushes = 0;
  38. m_nTotalEntities = 0;
  39. //}}AFX_DATA_INIT
  40. }
  41. void CMapInfo::DoDataExchange(CDataExchange* pDX)
  42. {
  43. CDialog::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(CMapInfo)
  45. DDX_Control(pDX, IDC_LIST_ENTITIES, m_lstEntity);
  46. DDX_Text(pDX, IDC_EDIT_NET, m_nNet);
  47. DDX_Text(pDX, IDC_EDIT_TOTALBRUSHES, m_nTotalBrushes);
  48. DDX_Text(pDX, IDC_EDIT_TOTALENTITIES, m_nTotalEntities);
  49. //}}AFX_DATA_MAP
  50. }
  51. BEGIN_MESSAGE_MAP(CMapInfo, CDialog)
  52. //{{AFX_MSG_MAP(CMapInfo)
  53. //}}AFX_MSG_MAP
  54. END_MESSAGE_MAP()
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CMapInfo message handlers
  57. BOOL CMapInfo::OnInitDialog()
  58. {
  59. CDialog::OnInitDialog();
  60. m_nTotalBrushes = 0;
  61. m_nTotalEntities = 0;
  62. m_nNet = 0;
  63. for (brush_t* pBrush=active_brushes.next ; pBrush != &active_brushes ; pBrush=pBrush->next)
  64. {
  65. m_nTotalBrushes++;
  66. if (pBrush->owner == world_entity)
  67. m_nNet++;
  68. }
  69. CMapStringToPtr mapEntity;
  70. int nValue = 0;
  71. for (entity_t* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next)
  72. {
  73. m_nTotalEntities++;
  74. nValue = 0;
  75. mapEntity.Lookup(pEntity->eclass->name, reinterpret_cast<void*&>(nValue));
  76. nValue++ ;
  77. mapEntity.SetAt(pEntity->eclass->name, reinterpret_cast<void*>(nValue));
  78. }
  79. m_lstEntity.ResetContent();
  80. m_lstEntity.SetTabStops(96);
  81. CString strKey;
  82. POSITION pos = mapEntity.GetStartPosition();
  83. while (pos)
  84. {
  85. mapEntity.GetNextAssoc(pos, strKey, reinterpret_cast<void*&>(nValue));
  86. CString strList;
  87. strList.Format("%s\t%i", strKey, nValue);
  88. m_lstEntity.AddString(strList);
  89. }
  90. UpdateData(FALSE);
  91. return TRUE; // return TRUE unless you set the focus to a control
  92. // EXCEPTION: OCX Property Pages should return FALSE
  93. }