351
General discussion / c++ problems :/
« on: 21 February 2010, 12:09:04 »
Hi, I have a little problem with typedefs:
in skill_type.h I want to define this:
and in unit.cpp I want to use the type "UnitParticleSystemTypes" like this:
I get an error in this line :
for(UnitParticleSystemTypes::iterator it= currSkill->unitParticleSystemTypes.begin();it!=currSkill->unitParticleSystemTypes.end(); ++it){
...
saying
Whats wrong? how can I fix it?
in skill_type.h I want to define this:
Code: [Select]
typedef list<UnitParticleSystemType*> UnitParticleSystemTypes;
// =====================================================
// class SkillType
//
/// A basic action that an unit can perform
// =====================================================
class SkillType{
protected:
SkillClass skillClass;
string name;
int mpCost;
int speed;
int animSpeed;
Model *animation;
SoundContainer sounds;
float soundStartTime;
public:
UnitParticleSystemTypes unitParticleSystemTypes;
....and in unit.cpp I want to use the type "UnitParticleSystemTypes" like this:
Code: [Select]
if((!currSkill->unitParticleSystemTypes.empty())
&& (unitParticleSystems.empty()) ){
for(UnitParticleSystemTypes::iterator it= currSkill->unitParticleSystemTypes.begin(); it!=currSkill->unitParticleSystemTypes.end(); ++it){
UnitParticleSystem *ups;
ups= new UnitParticleSystem(200);
(*it)->setValues(ups);
ups->setPos(getCurrVector());
ups->setTeamNumber(getTeam());
unitParticleSystems.push_back(ups);
Renderer::getInstance().manageParticleSystem(ups, rsGame);
}
}
I get an error in this line :
for(UnitParticleSystemTypes::iterator it= currSkill->unitParticleSystemTypes.begin();it!=currSkill->unitParticleSystemTypes.end(); ++it){
...
saying
Code: [Select]
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/type_instances/unit.o
glest_game/type_instances/unit.cpp: In member function 'void Glest::Game::Unit::setCurrSkill(const Glest::Game::SkillType*)':
glest_game/type_instances/unit.cpp:324: error: conversion from 'std::_List_const_iterator<Glest::Game::UnitParticleSystemType*>' to non-scalar type 'std::_List_iterator<Glest::Game::UnitParticleSystemType*>' requested
Whats wrong? how can I fix it?

.
so I needed this one.




