I've encountered a weird problem in the cygwin compiler. I'm using cygwin on win 98,
and am using circle with olc and dg_scripts. In the following function, I create the
integer j, with value 0. When I later try to give it a value in the code later on, it just
returns 0. Maybe it's just something that I did wrong.. maybe not.
The code may seem a bit messy but i'm still working on that :)
void config_parse(struct descriptor_data *d, char *arg)
{
int query = 0, j = 0; <--- j given value 0.
switch (OLC_MODE(d)) {
case CONFIG_MAIN_MENU:
switch (*arg) {
case 'q':
case 'Q':
case '0':
cfg_save();
SEND_TO_Q("Settings saved.\r\n", d);
free(d->olc);
d->olc = NULL;
act("$n stops editing setup.", TRUE, d->character, 0, 0, TO_ROOM);
REMOVE_BIT_AR(PLR_FLAGS(d->character), PLR_WRITING);
STATE(d) = CON_PLAYING;
break;
case '1':
configmenu(d->character, 1);
OLC_MODE(d) = CONFIG_MENU1;
break;
case '2':
configmenu(d->character, 2);
OLC_MODE(d) = CONFIG_MENU2;
break;
case '3':
configmenu(d->character, 3);
OLC_MODE(d) = CONFIG_MENU3;
break;
default:
SEND_TO_Q("Invalid choice!\r\n", d);
config_disp_menu(d);
break;
}
break;
case CONFIG_MENU1:
CREATE (d->olc, struct oasis_olc_data, 1);
switch (*arg) {
case '0':
case 'q':
case 'Q':
config_disp_menu(d);
OLC_MODE(d) = CONFIG_MAIN_MENU;
return;
case '1':
switcher(d->character, 0, 0);
configmenu(d->character, 1);
OLC_MODE(d) = CONFIG_MENU1;
break;
case '2':
switcher(d->character, 1, 0);
configmenu(d->character, 1);
OLC_MODE(d) = CONFIG_MENU1;
break;
case '3':
switcher(d->character, 2, 0);
configmenu(d->character, 1);
OLC_MODE(d) = CONFIG_MENU1;
break;
case '4':
switcher(d->character, 3, 0);
configmenu(d->character, 1);
OLC_MODE(d) = CONFIG_MENU1;
break;
case '5':
switcher(d->character, 4, 0);
configmenu(d->character, 1);
OLC_MODE(d) = CONFIG_MENU1;
break;
case '6':
switcher(d->character, 5, 0);
configmenu(d->character, 1);
OLC_MODE(d) = CONFIG_MENU1;
break;
case '7':
switcher(d->character, 6, 0);
configmenu(d->character, 1);
OLC_MODE(d) = CONFIG_MENU1;
break;
default:
SEND_TO_Q("Invalid choice!\r\n", d);
configmenu(d->character, 1);
OLC_MODE(d) = CONFIG_MENU1;
}
break;
case CONFIG_MENU2:
CREATE (d->olc, struct oasis_olc_data, 1);
switch (*arg) {
case '0':
case 'q':
case 'Q':
config_disp_menu(d);
OLC_MODE(d) = CONFIG_MAIN_MENU;
return;
case '1':
j = 7; <--- Here is it. Now it should give value 7 to j. (?)
SEND_TO_Q("Enter shout level: ", d);
OLC_MODE(d) = CONFIG_QUERY;
break;
case '2':
j = 8;
SEND_TO_Q("Enter movement cost for holler: ", d);
OLC_MODE(d) = CONFIG_QUERY;
break;
case '3':
SEND_TO_Q("Enter maximum experience gain: ", d);
j = 9;
OLC_MODE(d) = CONFIG_QUERY;
break;
case '4':
SEND_TO_Q("Enter shout level: ", d);
j = 10;
OLC_MODE(d) = CONFIG_QUERY;
break;
case '5':
SEND_TO_Q("Enter shout level: ", d);
j = 11;
OLC_MODE(d) = CONFIG_QUERY;
break;
case '6':
SEND_TO_Q("Enter shout level: ", d);
j = 12;
OLC_MODE(d) = CONFIG_QUERY;
break;
case '7':
SEND_TO_Q("Enter shout level: ", d);
j = 13;
OLC_MODE(d) = CONFIG_QUERY;
break;
default:
SEND_TO_Q("Invalid choice!\r\n", d);
configmenu(d->character, 2);
OLC_MODE(d) = CONFIG_MENU2;
break;
}
break;
case CONFIG_MENU3:
configmenu(d->character, 3);
break;
case CONFIG_QUERY:
sprintf(buf, "%d", j); <--- This is just a check. Returns 0..
SEND_TO_Q(buf, d);
query = atoi(arg);
switcher(d->character, j, query);
configmenu(d->character, 2);
OLC_MODE(d) = CONFIG_MENU2;
break;
default:
/*
* We should never get here.
*/
mudlog("SYSERR: Reached default case in config_parse", BRF, LVL_IMPL, TRUE);
STATE(d) = CON_PLAYING;
break;
}
}
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT