Ok I've looked over your code, even though every time I look at someone else's code I have an urge to nuke it from orbit.
j/k I'm sure every programmer feels the same way.
Here's some feedback:
- You don't need to keep around pointers to various states to update them, they have a init() function that's called whenever the State is focused again, which you can use for updating contents and restoring palettes.
- Geoscape windows should use the GeoscapeState::popup function instead of the Game pushState, it handles multiple popups showing up at once.
- The code could use some cleanup. There's functions spread around in the global namespace which belong elsewhere, like the getFreeLabSpace and getFreeScientist in ResearchProjectState. There's also various leftovers from the code you copied like unused includes and such.
- The UI is also a bit messy, some text and buttons not matching the original, though if it's not your thing I can fix it up later.
- Also the UI is completely static, so I don't think you need a lot of calculations like you did in ResearchProjectState.
- What's the findRuleResearchProjectByString in RuleResearchProject for? I've never even seen a std::unary_function before.
- Why are the ResearchProject costs floats? From what I could gather in Ufopaedia.org they should all be integer values, and in RuleResearchProject it's an integer too.
- Regarding Doxygen comments, we usually put comments at the start of every class and function. You seem to have covered everything except your new States.
As for the research functionality itself, it seems fine and it's nice to see it's already externalized. Mind you if the research projects already have dependencies, do they really need the unlocks? It would cause problems with things that require multiple researches. I was thinking it might be simpler just keep a list of unlocked researches per savegame and have everything else have research dependencies, instead of having to keep lists of unlocks for everything.
I will have a look at that "astyle" program to bring everything up to the same style.