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