MapInfo.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. // MapInfo.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "Radiant.h"
  22. #include "MapInfo.h"
  23. #include "qe3.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CMapInfo dialog
  31. CMapInfo::CMapInfo(CWnd* pParent /*=NULL*/)
  32. : CDialog(CMapInfo::IDD, pParent)
  33. {
  34. //{{AFX_DATA_INIT(CMapInfo)
  35. m_nNet = 0;
  36. m_nTotalBrushes = 0;
  37. m_nTotalEntities = 0;
  38. //}}AFX_DATA_INIT
  39. }
  40. void CMapInfo::DoDataExchange(CDataExchange* pDX)
  41. {
  42. CDialog::DoDataExchange(pDX);
  43. //{{AFX_DATA_MAP(CMapInfo)
  44. DDX_Control(pDX, IDC_LIST_ENTITIES, m_lstEntity);
  45. DDX_Text(pDX, IDC_EDIT_NET, m_nNet);
  46. DDX_Text(pDX, IDC_EDIT_TOTALBRUSHES, m_nTotalBrushes);
  47. DDX_Text(pDX, IDC_EDIT_TOTALENTITIES, m_nTotalEntities);
  48. //}}AFX_DATA_MAP
  49. }
  50. BEGIN_MESSAGE_MAP(CMapInfo, CDialog)
  51. //{{AFX_MSG_MAP(CMapInfo)
  52. //}}AFX_MSG_MAP
  53. END_MESSAGE_MAP()
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CMapInfo message handlers
  56. BOOL CMapInfo::OnInitDialog()
  57. {
  58. CDialog::OnInitDialog();
  59. m_nTotalBrushes = 0;
  60. m_nTotalEntities = 0;
  61. m_nNet = 0;
  62. for (brush_t* pBrush=active_brushes.next ; pBrush != &active_brushes ; pBrush=pBrush->next)
  63. {
  64. m_nTotalBrushes++;
  65. if (pBrush->owner == world_entity)
  66. m_nNet++;
  67. }
  68. CMapStringToPtr mapEntity;
  69. int nValue = 0;
  70. for (entity_t* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next)
  71. {
  72. m_nTotalEntities++;
  73. nValue = 0;
  74. mapEntity.Lookup(pEntity->eclass->name, reinterpret_cast<void*&>(nValue));
  75. nValue++ ;
  76. mapEntity.SetAt(pEntity->eclass->name, reinterpret_cast<void*>(nValue));
  77. }
  78. m_lstEntity.ResetContent();
  79. m_lstEntity.SetTabStops(96);
  80. CString strKey;
  81. POSITION pos = mapEntity.GetStartPosition();
  82. while (pos)
  83. {
  84. mapEntity.GetNextAssoc(pos, strKey, reinterpret_cast<void*&>(nValue));
  85. CString strList;
  86. strList.Format("%s\t%i", strKey, nValue);
  87. m_lstEntity.AddString(strList);
  88. }
  89. UpdateData(FALSE);
  90. return TRUE; // return TRUE unless you set the focus to a control
  91. // EXCEPTION: OCX Property Pages should return FALSE
  92. }