ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
whatever you end up with, make it subscription based, not one-time purchase based. Learn from the masters and those who are now multi-multi millionaires like the guys who created WOW.
Such a pity that I believe in libre (My definition on my last reply) software. And most game players nowadays are not really interested in text based games.
So getting it messed up should not be too much on an issue.
Well, it is your time, so do what you like.
Quote:
Originally Posted by ThatPerson
I did look at that, But I cannot see a way of using a variable as a variable name,
You'll need macro black magic for that. There's a "stringize" operator. You can make macros like ("MAKE_GLOBAL_VAR(variableName, variableType)") that will decalre a variable, store its name somewhere, register that name within global std::map<string, someclass> or std::map<string, type*>, etc. Such things are easier to do in C++, not in C, since in C++ you can create a class instance anywhere, and that instance can perform some operation when being constructed/destroyed. Global class variables will perform operations within their constructor during program startup/shutdown, which is quite useful.
You'll need macro black magic for that. There's a "stringize" operator. You can make macros like ("MAKE_GLOBAL_VAR(variableName, variableType)") that will decalre a variable, store its name somewhere, register that name within global std::map<string, someclass> or std::map<string, type*>, etc. Such things are easier to do in C++, not in C, since in C++ you can create a class instance anywhere, and that instance can perform some operation when being constructed/destroyed. Global class variables will perform operations within their constructor during program startup/shutdown, which is quite useful.
Thanks for the tip. As I do not need to add many more weapons it should not be too much or an issue.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.