TerrainDlg.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #define TERRAINDLG_CPP
  2. /*************************************************************************************************\
  3. TerrainDlg.cpp : Implementation of the TerrainDlg component.
  4. //---------------------------------------------------------------------------//
  5. // Copyright (C) Microsoft Corporation. All rights reserved. //
  6. //===========================================================================//
  7. \*************************************************************************************************/
  8. #include "mclib.h"
  9. #include "TerrainDlg.h"
  10. #include "resource.h"
  11. #include "mclibresource.h"
  12. #include "utilities.h"
  13. #include "terrtxm2.h"
  14. extern DWORD gameResourceHandle; //Default handle must be used for mc2res.dll due to shared game/editor code
  15. //----------------------------------------------------------------------
  16. void TerrainDlg::Init()
  17. {
  18. CListBox* pListBox = (CListBox*)GetDlgItem( IDC_TERRAINS );
  19. int numTerrains = TerrainColorMap::getNumTypes();
  20. for ( int i = 0; i < numTerrains; i++ )
  21. {
  22. char buffer[256];
  23. if ( !TerrainColorMap::getTextureNameID(i) ) // if we start to repeat, quit
  24. break;
  25. cLoadString( TerrainColorMap::getTextureNameID(i), buffer, 256 );
  26. int index = pListBox->AddString( buffer );
  27. pListBox->SetItemData( index, i );
  28. }
  29. pListBox->SetCurSel( terrain );
  30. }
  31. //----------------------------------------------------------------------
  32. void TerrainDlg::OnOK()
  33. {
  34. int index = ((CListBox*)GetDlgItem( IDC_TERRAINS ))->GetCurSel( );
  35. terrain = ((CListBox*)GetDlgItem( IDC_TERRAINS ))->GetItemData( index );
  36. CDialog::OnOK();
  37. }
  38. //----------------------------------------------------------------------