123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- /*
- ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved.
- **
- ** File: partTypeIGC.cpp
- **
- ** Author:
- **
- ** Description:
- ** Implementation of the CpartTypeIGC class. This file was initially created by
- ** the ATL wizard for the core object.
- **
- ** History:
- */
- // partTypeIGC.cpp : Implementation of CpartTypeIGC
- #include "pch.h"
- #include "partTypeIGC.h"
- /////////////////////////////////////////////////////////////////////////////
- // CpartTypeIGC
- HRESULT CpartTypeIGC::Initialize(ImissionIGC* pMission,
- Time now,
- const void* data,
- int dataSize)
- {
- assert (pMission);
- m_pMission = pMission;
- ZRetailAssert (data && (dataSize >= sizeof(DataPartTypeIGC)));
- {
- //Note ... we need to allocate & copy the DataHullTypeIGC + the variable length fields
- m_dataSize = dataSize;
- m_data = (DataPartTypeIGC*)(new char [m_dataSize]);
- assert (m_data);
- memcpy(m_data, data, m_dataSize);
- if (m_data->successorPartID != NA)
- {
- m_pptSuccessor = pMission->GetPartType(m_data->successorPartID);
- assert (m_pptSuccessor);
- }
- pMission->AddPartType(this);
- }
- return S_OK;
- }
- void CpartTypeIGC::Terminate(void)
- {
- m_pMission->DeletePartType(this);
- }
- int CpartTypeIGC::Export(void* data) const
- {
- if (data)
- memcpy(data, m_data, m_dataSize);
- return m_dataSize;
- }
- /////////////////////////////////////////////////////////////////////////////
- // IpartTypeIGC
- const char* IpartTypeIGC::GetEquipmentTypeName(EquipmentType et)
- {
- switch (et)
- {
- case ET_ChaffLauncher:
- return "chaff";
- case ET_Weapon:
- return "weapon";
- case ET_Magazine:
- return "missile";
- case ET_Dispenser:
- return "mine";
- case ET_Shield:
- return "shield";
- case ET_Cloak:
- return "cloak";
- case ET_Pack:
- return "ammo";
- case ET_Afterburner:
- return "afterburner";
- default:
- assert(false);
- return "";
- }
- }
|