Editing a global variable without a function.
Yo,
I have a global variable, an array of strings. I'm trying to edit this array in multiple files, but I want to do so without using a function. For context, this array is called RACE_NAMES. Each race file, ideally, will have something like: RACE_NAMES[RACE_XXX] = "XXX"; If I do this from inside a function, I have to call that function from somewhere else. The whole point is that, when I add a new race, I only have to edit the RACE_NAMES gVar without having to edit other parts of my plugin to include the race. Is there a way to do this inside each race's file, or would I just be better off initializing the array when I declare it? The whole point is that I want to minimize the number of things I need to edit when adding a new race. |
Re: Editing a global variable without a function.
What do you mean by "each race file"? What kind of file is this?
It is possible to make your code flexible enough to the point you only need to change a few things but the more flexible you make your code, the more complex code it is. |
Re: Editing a global variable without a function.
Quote:
By each race file..I mean that every race will have its own .inl file. I currently have two, race_human_alliance.inl and race_undead_scourge.inl . In each file, I would like to have some kind of declaration of the race name. Otherwise, I have to do: Code:
new RACE_NAMES[RACE_LAST][20] = { |
Re: Editing a global variable without a function.
Oh, so you want all of this done pre-compile. . . I doubt that is possible.
I've heard of API based systems that would probably work better than what you are trying to do with pre-compile integration. In an API style system, you would have a plugin for each race. Each plugin would then "register" with the main API giving all the relevant information (including race name, race functions, etc.) |
Re: Editing a global variable without a function.
Huh. That sounds kind of cool to be honest and I'd never considered it.
I'm just going to go with editing an array declaration and be done with it. It's not too hard to find and shouldn't be a pain. Thanks anyway! |
| All times are GMT -4. The time now is 12:54. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.