예제 #1
0
        /*
         * Save the game
         */
        public static void save_game()
        {
            /* Disturb the player */
            Cave.disturb(Misc.p_ptr, 1, 0);

            /* Clear messages */
            Utilities.message_flush();

            /* Handle stuff */
            Misc.p_ptr.handle_stuff();

            /* Message */
            Utilities.prt("Saving game...", 0, 0);

            /* Refresh */
            Term.fresh();

            /* The player is not dead */
            Misc.p_ptr.died_from = "(saved)";

            /* Forbid suspend */
            Signals.ignore_tstp();

            /* Save the player */
            if (Savefile.savefile_save(savefile))
            {
                Utilities.prt("Saving game... done.", 0, 0);
            }
            else
            {
                Utilities.prt("Saving game... failed!", 0, 0);
            }

            /* Allow suspend again */
            Signals.handle_tstp();

            /* Refresh */
            Term.fresh();

            /* Note that the player is not dead */
            Misc.p_ptr.died_from = "(alive and well)";
        }
예제 #2
0
        /*
         * Main function
         *
         * This function must do a lot of stuff.
         */
        public static void Main(string[] args)
        {
            /*for(char i = (char)0; i < char.MaxValue; i++) {
             *      Console.Out.Write((int)i + ": ");
             *      Console.Out.Write(i + " \n");
             *
             *      if (i % 256 == 0){
             *              Console.In.ReadLine();
             *              Console.Clear();
             *              Console.Write(((int)i) + "\n");
             *      }
             * }*/

            new_game = true;             //No loading support yet :/

            /* Save the "program name" XXX XXX XXX */
            Utilities.argv0 = args.Length > 0?args[0]:"CSAngband";

            Console.CursorVisible = false;

            /* Drop permissions */
            //safe_setuid_drop(); //meh, z-file stuff... let's just skip it for now

            /* Initialize the windows */
            if (init_xxx(args) != 0)
            {
                Utilities.quit("Oops!");
            }

            /* Install "quit" hook */
            Utilities.quit_aux = quit_hook;

            /* Get the file paths */
            Misc.ANGBAND_SYS = "xxx";

            /* Initialize some stuff */
            init_stuff();

            /* Set up the command hook */
            Game_Command.cmd_get_hook = default_get_cmd;

            /* Initialize */
            //Init.init_angband(); //We do this in play_game();

            /* Try the modules in the order specified by modules[] */
            //We don't load any modules... yet?
            //for (int i = 0; i < modules.Count; i++)
            //{
            //    /* User requested a specific module? */
            //    if (!mstr || (streq(mstr, modules[i].name)))
            //    {
            //        ANGBAND_SYS = modules[i].name;
            //        if (0 == modules[i].init(argc, argv))
            //        {
            //            done = true;
            //            break;
            //        }
            //    }
            //}

            /* Make sure we have a display! */             //Nick: Oops, this was grouped with the above
            //if (!done) Utilities.quit("Unable to prepare any 'display module'!");

            /* Process the player name */
            Files.process_player_name(true);

            /* Try the modules in the order specified by sound_modules[] */
            //Worry about sound later

            /*for (int i = 0; i < (int)N_ELEMENTS(sound_modules); i++)
             *      if (!soundstr || streq(soundstr, sound_modules[i].name))
             *              if (0 == sound_modules[i].init(argc, argv))
             *                      break;
             */

            /* Catch nasty signals */
            Signals.signals_init();

            /* Set up the display handlers and things. */
            Init.init_display();

            /* Play the game */
            Dungeon.play_game();

            /* Free resources */
            Init.cleanup_angband();

            //I added this, due to missing functions...? I don't think we need it though.
            Utilities.onexit();

            /* Quit */
            Utilities.quit();
        }