Ok, this is now a bit heavier for me :wink:
At first i'll try to understand the system:
initial
|----tachyon
|----tachyonrifle
|----tachyonrifle_ammo
|----tachyonsniper
|----tachyonsniper_ammo
So, this is now a piece of the techtree.
Ok, now i wann research tachyonsniper_ammo.
R_GetFirstRequired should now return tachyon (i guess, initial is researched at the beginning of the game).
Hm, i think i don't get it completely. How about that:
void R_GetRequired(technology_t *t, char *required)
{
if (t->required->isResearched)
{
return;
} else
{
<pseudo>append t->required to required</pseudo>
R_GetRequired(t->required, required);
}
return;
}
technology_t *R_GetFirstRequired(technology_t *t)
{
char temp[MAX...]
R_GetRequired(t, temp);
<pseudo>reverse temp</pseudo>
return temp[0];
}
I don't know the structs and the pointer-wirrwarr :wink: that well, so it might look strange or be even not that, what you want
Why don't you take integers for the ids?
You could also try to get a list of pointers to the technologies needed.
Will there be technologies which will require two or more predecessors, ie:
tech oxyXen
{
type tech
name "Tachyon control"
requires oxygen
requires xentronium
description "oxyxen_txt"
time 100
}
And last but not least, there seems to be a bug in the research.ufo file:
tech plasma
{
type weapon
requires tachyonsniper
provides tachyonsniper_ammo
time 0
}
I hope i could help you somehow and did not get you dizzy
ox
edit: there are some errors in my sourcecode, but i hope the idea can be realized anyways.