int gere_mouse(int button, int x, int y, t_mlx **p) { int i; int j; t_mlx *tmp; i = (int) ((x - WINX_RAY) / (200 / my_strlen((*p)->tab[0]))); j = (int) ((y - WINY_RAY) / (200 / my_strlen((*p)->tab[0]))); if (button == 1 && i < (my_strlen((*p)->tab[0]) - 1) && j < (my_strlen((*p)->tab[0]) - 2) && i > 0 && j > 0) { if ((*p)->tab[j][i] == '1') (*p)->tab[j][i] = '0'; else if ((*p)->tab[j][i] == '0') (*p)->tab[j][i] = '1'; tmp = (*p); tmp = put_sol_and_sky(tmp); calcul(&tmp); cadre(&tmp); map(&tmp); viseur(&tmp); weapon(&tmp); pos_map(&tmp); (*p) = tmp; mlx_put_image_to_window(tmp->mlx_ptr, tmp->win_ptr, tmp->img, 0, 0); } return (0); }
int t_pos_list_open(char *name, int thread_num) { PR_DEBUG("[t_pos_list_open] called\n") ; if (!pos_map(name) == 1){ PR_DEBUG("[pos_map] already mapped\n") ; return -1; }// In this case -1 return is not error value return 0 ; }
int pos_list_destroy(char *name) { pos_map(name); #if CONSISTENCY == 1 #if UNDO_CONSISTENCY == 1 pos_log_map(name); pos_log_delete(name); #endif #endif pos_delete(name); return 0; }
int pos_hashtable_destroy(char *name) { pos_map(name); #if CONSISTENCY == 1 pos_log_map(name); #endif //hashtable_destroy(name); #if CONSISTENCY == 1 pos_log_delete(name); #endif pos_delete(name); return 0; }
int pos_hashtable_open(char *name) { if (pos_map(name) == 1) { #if CONSISTENCY == 1 #if UNDO_CONSISTENCY == 1 pos_log_map(name); // If transaction was ended abnormally. // Recovery is executed. pos_recovery(name); #endif #endif return 0; } else return -1; }
int stm_pos_hashtable_open( char *name ){ /* TRANSACTION MEMORY INIT */ TM_INIT ; int ret_val = 0 ; PR_DEBUG("[%s] pos_map called\n" , __func__ ) ; ret_val = pos_map(name) ; PR_DEBUG("[%s] stm_pos_log_map called\n" , __func__ ) ; ret_val = stm_pos_log_map(name) ; PR_DEBUG("[%s]\n" , __func__ ) ; SLEEP_DEBUG(2) ; ret_val = stm_pos_recovery(name) ; if(ret_val != 0){ perror("[stm_pos_hashtable_open] recovery failed\n") ; exit(-1) ; } return 0 ; }
int gere_key(int keycode, t_mlx **s) { int i; t_mlx *tmp; i = 0; tmp = (*s); reduckey(keycode, &tmp); reduckeytwo(keycode, &tmp); tmp = put_sol_and_sky(tmp); calcul(&tmp); cadre(&tmp); map(&tmp); viseur(&tmp); weapon(&tmp); pos_map(&tmp); (*s) = tmp; mlx_put_image_to_window(tmp->mlx_ptr, tmp->win_ptr, tmp->img, 0, 0); return (0); }