int main(void) { char *line; t_box box; int ret; int i; ret = 0; ft_bzero(&box, (sizeof(box))); while ((ret = get_next_line(0, &line) != 0)) { if ((i = -1) && box.b_play == 0) check_player(line, &box); else if ((ft_strnequ(line, "Plateau", 7))) create_grid(line, &box); else if ((ft_strnequ(line, "Piece", 5))) { get_piece(line, &box); print_map(&box); while (i < 69999999) i++; if (!try_rush(&box)) return (0); reinitialise_box(&box); } } return (0); }
int pdi_cmd(char **args, t_graphic *c) { if (check_player(atoi(args[0] + 1), c) == FAILURE) return (my_error("Unknown player id", FAILURE)); del_client(c, atoi(args[0] + 1)); return (SUCCESS); }
int look_floor(int x, int y, t_serv *serv, t_client *client) { int i; int tmp_i; i = 0; tmp_i = 0; check_player(x, y, serv, client); while (i < 7) { tmp_i = serv->map->blocks[x][y].items[i]; if (serv->map->blocks[x][y].items[i] != 0) { while (tmp_i != 0) { if (dprintf(client->fd, " %s", serv->items[i]) == -1) return (EXIT_FAILURE); tmp_i--; } } i++; } if (serv->see->end != 1) if (dprintf(client->fd, ",") == -1) return (EXIT_FAILURE); return (EXIT_SUCCESS); }
void allum(t_allum *s, int pvp) { if (pvp == 0) { get_cmd(s); check_player(s); aff_allum(s); my_printf("Press 'Enter' to continue..."); if (read(0, &s->buff, 1) == -1) error("Read"); ia(s); aff_allum(s); } else { s->player = 1; my_printf("------------Player %d-------------\n\n", s->player); get_cmd(s); check_player_pvp(s); aff_allum(s); s->player = 2; my_printf("------------Player %d-------------\n\n", s->player); get_cmd(s); check_player_pvp(s); aff_allum(s); } }
// calcule le nombre d'alum restantes sur chaques lignes void calc_l(int plateau[4][7], int tab[4][2]) { int l; int m; int tmp; l=0; tmp = 0; while(l <= 3) { m = 0; while(m <= 6) { if (plateau[l][m] == 1) { tmp++; } m++; } tab[l][0]=tmp; l++; tmp = 0; } check_player(plateau,tab); }
static int player_get_position(lua_State *L) { Player* player = check_player(L, 1); b2Vec2 p = player->Get_position(); lua_pushnumber(L, p.x); lua_pushnumber(L, p.y); return 2; }
static int player_set_position(lua_State *L) { Player* player = check_player(L, 1); float x = luaL_checknumber(L, 2); float y = luaL_checknumber(L, 3); player->Set_position(x, y); return 0; }
int main(int argc, char **argv) { int i; if (argc != 3) { fprintf(stderr, "Must be called in form 'extract <filename> <dbref>'\n"); exit(1); } if ((input_file = fopen(argv[1], "r")) == NULL) { fprintf(stderr, "Could not open file '%d'\n", argv[1]); exit(1); } me = atoi(argv[2]); db_free(); db_read(input_file); fprintf(stderr, "dbtop = %d\n", db_top); printf("MUCK 2.2fb extract for dbref #%d\n", me); for (i = 0; i < db_top; i++) { if (OWNER(i) != me) continue; if (!(i % 256)) fprintf(stderr, "Checking object %d..\n", i); check_common(i); switch (db[i].flags & TYPE_MASK) { case TYPE_ROOM: check_room(i); break; case TYPE_THING: check_thing(i); break; case TYPE_EXIT: check_exit(i); break; case TYPE_PLAYER: check_player(i); break; case TYPE_PROGRAM: check_program(i); break; case TYPE_GARBAGE: break; default: break; } } fclose(input_file); fprintf(stderr, "Completed extract normally.\n"); return 0; }
int pgt_cmd(char **args, t_graphic *c) { t_client *tmp; if (check_player(atoi(args[0] + 1), c) == FAILURE) return (my_error("Unknown player id", FAILURE)); tmp = c->client; while (tmp->id != (unsigned int)atoi(args[0] + 1)) tmp = tmp->next; tmp->anim = DROP; tmp->count_anim = 0; return (SUCCESS); }
int plv_cmd(char **args, t_graphic *c) { t_client *tmp; if (check_player(atoi(args[0] + 1), c) == FAILURE) return (my_error("Unknown player id", FAILURE)); if (atoi(args[1]) > 8 || atoi(args[1]) < 1) return (my_error("Invalid lvl", FAILURE)); tmp = c->client; while (tmp->id != (unsigned int)atoi(args[0] + 1)) tmp = tmp->next; tmp->lvl = atoi(args[1]); return (SUCCESS); }
void ft_change_player_pos(char *buffer, t_env *env) { char **arg; int id; arg = ft_strsplit(buffer, ' '); id = ft_atoi(arg[1]); env->map[env->pl[id].pos.y][env->pl[id].pos.x].ids[id] = FALSE; ft_move_player(env, id); env->pl[id].pos.x = ft_atoi(arg[2]); env->pl[id].pos.y = ft_atoi(arg[3]); env->pl[id].dvec.x = ft_atoi(arg[4]); env->map[env->pl[id].pos.y][env->pl[id].pos.x].ids[id] = TRUE; check_player(env, env->pl[id].pos.x, env->pl[id].pos.y, env->display->level); }
void start(int argc, char **argv, t_option option) { t_map map; t_stack *stack; char *p; p = argv[argc - 1]; if (check_map(p) && check_exit(p) && check_player(p)) { init_map(&map, argv, argc, option); if (map.width != 0) { stack = s_solve(&map, NULL, NULL); if (stack_empty(stack) && option.c == 1) { map.option.c = 0; stack = s_solve(&map, NULL, NULL); } result(map, stack, option); destruct(map); stack_clean(stack); } } else my_putstr("La carte n'est pas valide\n"); }
int main(int argc, char *argv[]) { int ready = 0; //Variable die das ende des Spiels signalisiert char *player; player = *argv++; init(); printf("*********VIER GEWINNT***********\n\n"); player = *argv++; if(player != NULL) //checken ob Argumente uebergeben wurde { check_player(player); player = *argv++; if(player != NULL) //checken ob 2. Argument angeben wurde { check_player(player); } } while(ready != 1) { print_spielfeld(); printf("Player "); if(two_human == 1 && two_player == 1) //player vs. bot { if(human_first == 1) { if(player_first == 2) { human(1); //mensch faengt an if(check_who_win(1)==1) { print_spielfeld(); printf("Human Player 'X' hat gewonnen!\n"); ready = 1; } } else { human(2); //player faengt an if(check_who_win(1)==1) { print_spielfeld(); printf("Human Player 'O' hat gewonnen!\n"); ready = 1; } } human_first = 0; }else { karl(player_first,spielfeld); if(check_who_win(player_first)==1) { print_spielfeld(); if(player_first == 2) { printf("Bot 'O' hat gewonnen!\n"); } else { printf("Bot Player 'X' hat gewonnen!\n"); } ready = 1; } human_first = 1; } } else if(two_human == 1) //player vs. player { if(human_first == 1) { human(1); human_first = 0; if(check_who_win(1)==1) { print_spielfeld(); printf("Human Player 1 'X' hat gewonnen!\n"); ready = 1; } }else { human(2); human_first = 1; if(check_who_win(2)==1) { print_spielfeld(); printf("Human Player 2 'O' hat gewonnen!\n"); ready = 1; } } } else //bot vs. bot { if(human_first == 1) { karl(1,spielfeld); if(check_who_win(1)==1) { print_spielfeld(); printf("Karl Player 1 'X' hat gewonnen!\n"); ready = 1; } human_first = 0; }else { karl(2,spielfeld); if(check_who_win(2)==1) { print_spielfeld(); printf("Karl Player 2 'O' hat gewonnen!\n"); ready = 1; } human_first = 1; } } } return 0; }