static int exec_key(t_env *env, int key) { int ret_move; int ret_end; if (key == 27) return (1); else if (key == KEY_UP || key == KEY_LEFT || key == KEY_RIGHT || key == KEY_DOWN) { ret_move = move_plate(env, key); if (ret_move != -1) { env->score += ret_move; pop_new(env->plate, env->size); } ret_end = check_end(env); if (ret_end == -1) return (1); } else if (key == 'u' && env->undo-- > 0) dup_plate(env->plate, env->last_plate, env->size); else if (key == KEY_F(1)) save_plate(env); else if (env->ascii.ascii_on && key >= '1' && key <= MAX_ASCII + '0') load_ascii(env, key - '0'); return (0); }
bool load( const char* const file_name ) { /* * TODO: * 1) trim right of file name * 2) if file name with '.mat' extension * call load_mat * 3) else * call load_ascii */ return load_ascii( file_name ); }
int load_timestep() { switch (env.cfg.input_filetype) { case TIPSY_STANDARD: load_standard_tipsy(env.cfg.base_input_filename); break; case TIPSY_NATIVE: load_native_tipsy(env.cfg.base_input_filename); break; case ASCII: load_ascii(env.cfg.base_input_filename); break; case MEM_FILE: load_memfile(env.cfg.base_input_filename); break; default: myassert(0, "Tried to load file, but the filetype is wrong."); break; } return 0; }
void main_init(t_env *env, int *argc, char ***argv) { int i; env->tsize = NULL; env->score = 0; env->undo = 0; env->ascii.ascii_on = 0; env->win = 0; env->load = 0; i = -1; while (++i < MAX_SCORE) { env->scoreboard[i].player = NULL; env->scoreboard[i].score = 0; } init_opt(env, argc, argv); load_ascii(env, 2); init_ncurses(env); init_game(env); signal(SIGINT, handle_sigint); signal(SIGQUIT, handle_sigint); }
void base::load_file(char *fname) // read in ASCII text format (uuencoded like) from the file. { ifstream f(fname); load_ascii(f); }