I need help with the pointer thing. In worker.cc, I have a working implementation, looks like this:
for (const ImmovableFound& tmp_flag : flags) { Flag & flag = ref_cast<Flag, BaseImmovable>(*tmp_flag.object);
if (game.logic_rand() % 2 == 0) continue;
int32_t const dist = map.calc_distance(get_position(), tmp_flag.coords);
"flags" is of the sollowing type:
std::vector<ImmovableFound> flags;
And ImmovableFound is:
struct ImmovableFound { BaseImmovable * object; Coords coords; };
Now, I'm rtying to do the same thing in flag.cc. My attempts compile, but I get an error when I start a game and place a flag.
Attempt1: for (const FlagJob& tmp_flagjobs: m_flag_jobs) *tmp_flagjobs.request->set_economy(e);
Attempt2:
for (const FlagJob tmp_flagjobs: m_flag_jobs) tmp_flagjobs.request->set_economy(e);
and the types are:
typedef std::list<FlagJob> FlagJobs; FlagJobs m_flag_jobs;
struct FlagJob { Request * request; std::string program; };
I need help with the pointer thing. In worker.cc, I have a working implementation, looks like this:
for (const ImmovableFound& tmp_flag : flags) (*tmp_flag. object) ;
{
Flag & flag = ref_cast<Flag, BaseImmovable>
if (game.logic_rand() % 2 == 0)
continue;
int32_t const dist = calc_distance( get_position( ), tmp_flag.coords);
map.
"flags" is of the sollowing type:
std::vector< ImmovableFound> flags;
And ImmovableFound is:
struct ImmovableFound {
BaseImmovable * object;
Coords coords;
};
Now, I'm rtying to do the same thing in flag.cc. My attempts compile, but I get an error when I start a game and place a flag.
Attempt1: flagjobs. request- >set_economy( e);
for (const FlagJob& tmp_flagjobs: m_flag_jobs)
*tmp_
Attempt2:
for (const FlagJob tmp_flagjobs: m_flag_jobs) request- >set_economy( e);
tmp_flagjobs.
and the types are:
typedef std::list<FlagJob> FlagJobs;
FlagJobs m_flag_jobs;
struct FlagJob {
Request * request;
std::string program;
};