@ Laserlight. I appreciate your response, I feel nervous as I am a newbie and hope that I explained the problem fully; I did not mention that I use base classes.
The problem may be in the creation of my classes. I have several base classes for example an ArtBase(), a PodBase(), an IslandBase(), a WarriorBase(). Then there are team classes that have the vectors to iterate through each base class. For example the PodTeam() iterates through the PodBase class. . If I understand what you are saying is that when I use
Code:
std::vector<ArtItem>
The information is preserved? Would that be correct of the <PodBase*> class below.
So in this code below all the PodBase information is retained as long as the initialization is like this std::vector<PodBase*> m_Pods; //here I am not creating a new PodBase Object?
However Do I still have to do the “new” as you see in this function SpawnPod() below continuously for each function to access the classes it needs it seems redundant(it must be me ?
Code:
Model* m_pModel = new Model;
PierTeam* m_pPierTeam = new PierTeam;
Here is the full function where you can see that I have to use new to create access to needed classes. And the use of std::vector<PodBase*> Is this the proper protocol or can I initialize all the classes I need in one place so that I do not have to do this in each function?
Code:
//------------------------- SpawnPod ---------------------------------
//this places the first angel pod on the island
//PodTeam->PlaceFisrtPodsOnIsland(RegionManager->GetGameLevel());
//------------------------------------------------------------------------
int PodTeam::SpawnPod(int regionLevel)
{
Model* m_pModel = new Model;
PierTeam* m_pPierTeam = new PierTeam;
int spawnedPod = 0;
std::vector<PodBase*> m_Pods;
if(m_pModel->GetGameLevel() == 1)
{
if(m_pPierTeam->IsTherePodAtPierLocation(100) == false )
{
std::vector<PodBase*>::iterator it = m_Pods.begin();
for (it; it != m_Pods.end(); ++it)
{
if ((*it)->GetRegionLocation()== regionLevel && (*it)->GetAliveStatus()== 1)
{
(*it)->SetAliveStatus(2);
(*it)->SetPierLocation(100);
spawnedPod = (*it)->PodESPR();
std::cout << "This is the Pod ESPR Gw!!!" << std::endl;
std::cout << (*it)->PodESPR() << std::endl;
}
}
}
}
std::cout << "Spawn Pod Number!!!" << std::endl;
return spawnedPod;
std::cout << spawnedPod << std::endl;
}
Thank you for your response