Hi,

I'm thinking about global variables. We have to minimize their number.
Examples:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
extern ResourceManager resource_manager;
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

=>

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
(somewhere else)
ResourceManager res;
...
InitWeapons(res);    // void InitWeapons(ResourceManager &res);
...
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Why is it better? Because:
- We control when the object is create
- So we can manage dependancies (instead of having empty constructor and
then Init())
- We control when the object is destroyed
- So it's easier to manage memory

The problem is that the task is heavy and complicated, but it would be
cool to do that. I started with ... main menu.

Haypo
-- 
Victor Stinner - étudiant à l'UTBM (Belfort, France)
http://www.haypocalc.com/wiki/Accueil

Attachment: signature.asc
Description: This is a digitally signed message part

Répondre à