Re: goto's, and loops

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Thu, 29 Jul 1999 21:35:24 -0700, Jason Gade <jgade at PCEZ.COM> wrote:

>Although I haven't worked on the program for awhile, I wondered about
goto's
>when trying to port the Rogue role-playing game from C to Euphoria as an
>exercise.  Here is the original code:
>
>main(argc, argv)
>int argc;
>char *argv[];
>{
> /* Save the setuid we have got, then turn back into the player */
> saved_uid=geteuid();
> setuid(true_uid=getuid());
>
> if (init(argc, argv)) {  /* restored game */

  SET NEW GAME FLAG                 >  goto PL;
> }
>
> for (;;) {

  IF ( NEW GAME ) {

>  clear_level();
>  make_level();
>  put_objects();
>  put_stairs();
>  add_traps();
>  put_mons();
>  put_player(party_room);
>  print_stats(STAT_ALL);

   }
                                      >PL:
>  play_level();
>  free_stuff(&level_objects);
>  free_stuff(&level_monsters);
> }
>}


Bernie

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu