Raised This Month: $ Target: $400
 0% 

Variable already declared?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PreDominance
Member
Join Date: Jul 2014
Old 08-08-2014 , 10:16   Variable already declared?
Reply With Quote #1

Greetings,
I have an odd case where I have a chain of else-if's, and a variable declared in one elif is in the same scope as another. Am I not fully understanding scope, or is it just not a good idea to program at 8am?

Code:
....     else if (strfind(name, "numberoflevels") != -1) {         if (consistent) {             for (i = 0; i < RACE_MAXSKILLS; i++) RACE_SKILL_LEVELS[num][i] = str_to_num(value);         } else {             new arrIds[RACE_MAXSKILLS][3];             util_explodeString(arrIds, RACE_MAXSKILLS, 2, value, '|');             for (i = 0; i < RACE_MAXSKILLS; i++) RACE_SKILL_LEVELS[num][i] = str_to_num(arrIds[i]);         }     } else if (strfind(name, "skillnames") != -1) {         new arrIds[RACE_MAXSKILLS][20]; //Is fine????         util_explodeString(arrIds, RACE_MAXSKILLS, 19, value, '|');         for (i = 0; i < RACE_MAXSKILLS; i++) RACE_SKILL_NAMES[num][i] = arrIds[i];     } else if (strfind(name, "skilldesc") != -1) {         new arrIds[RACE_MAXSKILLS][50]; // LINE 79         util_explodeString(arrIds, RACE_MAXSKILLS, 49, value, '|');         for (i = 0; i < RACE_MAXSKILLS; i++) RACE_SKILL_INFO[num][i] = arrIds[i];     } else if (strfind(name, "skillreqlevel") != -1) {         new arrIds[RACE_MAXSKILLS][3]; //LINE 83         util_explodeString(arrIds, RACE_MAXSKILLS, 2, value, '|');         for (i = 0; i < RACE_MAXSKILLS; i++) RACE_SKILL_REQ_LEVEL[num][i] = str_to_num(arrIds[i]);     } ...

Last edited by PreDominance; 08-08-2014 at 10:16.
PreDominance is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode