civilizationigc.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** File: civilizationIGC.cpp
  5. **
  6. ** Author:
  7. **
  8. ** Description:
  9. ** Implementation of the CcivilizationIGC class. This file was initially created by
  10. ** the ATL wizard for the core object.
  11. **
  12. ** History:
  13. */
  14. // civilizationIGC.cpp : Implementation of CcivilizationIGC
  15. #include "pch.h"
  16. #include "civilizationIGC.h"
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CcivilizationIGC
  19. HRESULT CcivilizationIGC::Initialize(ImissionIGC* pMission,
  20. Time now,
  21. const void* data,
  22. int dataSize)
  23. {
  24. assert (pMission);
  25. m_pMission = pMission;
  26. ZRetailAssert (data && (dataSize == sizeof(DataCivilizationIGC)));
  27. m_data = *((DataCivilizationIGC*)data);
  28. pMission->AddCivilization(this);
  29. m_pstInitial = pMission->GetStationType(m_data.initialStationTypeID);
  30. assert (m_pstInitial);
  31. m_pstInitial->AddRef();
  32. assert (m_pstInitial->HasCapability(c_sabmRestart));
  33. m_phtLifepod = pMission->GetHullType(m_data.lifepod);
  34. assert (m_phtLifepod);
  35. m_phtLifepod->AddRef();
  36. return S_OK;
  37. }
  38. void CcivilizationIGC::Terminate(void)
  39. {
  40. assert (m_pstInitial);
  41. m_pstInitial->Release();
  42. m_pstInitial = NULL;
  43. assert (m_phtLifepod);
  44. m_phtLifepod->Release();
  45. m_phtLifepod = NULL;
  46. m_pMission->DeleteCivilization(this);
  47. }
  48. int CcivilizationIGC::Export(void* data) const
  49. {
  50. if (data)
  51. {
  52. *((DataCivilizationIGC*)data) = m_data;
  53. }
  54. return sizeof(DataCivilizationIGC);
  55. }