DynamicVectorClass problems [message #453970] |
Sat, 10 September 2011 13:49 |
|
halo2pac
Messages: 659 Registered: December 2006 Location: Near Cleveland, Ohio
Karma: 0
|
Colonel |
|
|
Hey guys,
So I am trying to make a .. of my custom class 'Gamer'
But the compiler keeps erroring at :
engine_vector.h
virtual int ID(T const &object)
{
for (int index = 0; index < Count(); index++)
{
------------------>> if ((*this)[index] == object)
{
return(index);
}
}
return -1;
}
my code:
DynamicVectorClass<Gamer> Gamers;
#include "engine_io.h"
class Gamer
{
public:
//Gamer();
Gamer(const char *Nick);
StringClass PlayerName;
int Deaths;
int CurrentKills;
};
Gamer::Gamer(const char *Nick)
{
PlayerName = Nick;
}
I have no idea why this is not working...
any help is appreciated!
Rene-Buddy | Renegade X
Join the fight against Obsessive-Compulsive Posting Disorder. Cancel is ur friend.
*Renegade X Dev Team Member*
[Updated on: Sat, 10 September 2011 13:50] Report message to a moderator
|
|
|
|
|
Re: DynamicVectorClass problems [message #453974 is a reply to message #453973] |
Sat, 10 September 2011 14:58 |
|
saberhawk
Messages: 1068 Registered: January 2006 Location: ::1
Karma: 0
|
General (1 Star) |
|
|
halo2pac wrote on Sat, 10 September 2011 14:36 | I'm curious as to why I would have to do that in the first place for creating a class :S
also now it s saying the same thing for !=
do I replicate the code?
|
Yeah, and replace false with true. DynamicvectorClass tries supplying additional functionality to a vector (like Find), but it requires certain operators to be defined in the class.
|
|
|
|
Re: DynamicVectorClass problems [message #453976 is a reply to message #453975] |
Sat, 10 September 2011 15:14 |
|
saberhawk
Messages: 1068 Registered: January 2006 Location: ::1
Karma: 0
|
General (1 Star) |
|
|
halo2pac wrote on Sat, 10 September 2011 15:07 | ah, I see.
Also it is requiring that I use a default constructor, which I do not want the default constructor because apparently it is setting my integers to integer.max.
Is there a way around this?
I am trying to do a simple class to store player information.. so that if they disconnected and rejoin they don't loose some levels/powerups/ect. Which requires maintaining a custom list of player data.
|
The default constructor isn't setting them to anything. You do need to provide a constructor and have it set the values to whatever you want the defaults to be.
|
|
|
|