[DGD] break bug?

chris . psych_mayo at hotmail.com
Tue Oct 30 16:28:52 CET 2007


I am probably not using break right, but i do not see how, so here is the relevant code 
from my gpl lib, Windfall.
I took out comments originally in place and commented where i think my problems are.

<omitted>

# define STATE_NORMAL        0
# define STATE_INPUT_TO     1
# define STATE_EDITOR        2

<omitted> 

int receive_message(string str) {
  if(previous_program() == LIB_CONN) {
    string cmd, arg; 
    object user, *users;
    int i, ii;

<omitted>

case STATE_NORMAL:
        if(sscanf(str,"%s %s",cmd,arg) != 2)
                cmd = str;
            for(i=0;i < sizeof(cmd_dirs);i++) {
                if(read_file(COMMANDS+cmd_dirs[i]+"/"+cmd+".c") ) {
            i = call_other( (COMMANDS+cmd_dirs[i]+"/"+cmd), "main", arg); 
/*sets i to 0, STATE_NORMAL, in my test condition*/ 
              if(i >= 0) {
                  previous_object()->message((string)i+"\n"); /*is 0 when testing*/
                state[previous_object()] = i;
                    previous_object()->message((string)state[previous_object()]); 
/*copy of i is still 0*/
                    }
              else { 
                return MODE_DISCONNECT;
                }
                break; 
/*breaking out of the for loop?*/
            }
          }
      case STATE_INPUT_TO:
          previous_object()->message((string)i);
/*still 0?..whats up?*/

Thanks for help as always.


_________________________________________________________________
Windows Live Hotmail and Microsoft Office Outlook – together at last.  Get it now.
http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033


More information about the DGD mailing list