View Single Post
  #38  
Old August 16th, 2006, 02:09 AM
narf poit chez BOOM's Avatar

narf poit chez BOOM narf poit chez BOOM is offline
Shrapnel Fanatic
 
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
narf poit chez BOOM is on a distinguished road
Default Re: OT: Stupid c++

Can anybody see a problem with this:
Quote:
void setupItems () {
srand ( time(NULL) );
// NewWeapon.initialize (); NewPotion.initialize ();
// WeaponList.push_back ( NewWeapon ); PotionList.push_back ( NewPotion );
for ( t = 0; t < 40; ++t ) {
t2 = rand () % 2;
if ( t2 = 0 ) {
NewWeapon.initialize (); WeaponList.push_back ( NewWeapon );
WeaponList[WeaponList.size () - 1].initialize ();
ItemList.push_back ( &WeaponList [WeaponList.size () - 1] );
};
if ( t2 = 1 ) {
NewPotion.initialize (); PotionList.push_back ( NewPotion );
PotionList[PotionList.size () - 1].initialize ();
ItemList.push_back ( &PotionList [PotionList.size () - 1] );
};
};
for ( t = 0; t < ItemList.size (); ++t ) {
ItemList[t]->initialize ();
std::cout << t << " " << ItemList [t]->XPos << " " << ItemList [t]->YPos << " " << ItemList[t]->Colour << " ";
};
std::cin >> wait;
};
It doesn't seem to work right - It seems like all the slots still reference as the base Item class.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
Reply With Quote