int movemap(char ***map, char ***bigtab, int piecen, int *xy) { if (bigtab[piecen] == NULL || piecen > 25) return (1); while (xy[0] < (int)ft_strlen(*map[0])) { while (xy[1] < (int)ft_strlen(*map[0])) { if (placepossible(*map, bigtab[piecen], xy[1], xy[0]) == 1) { *map = placemap(*map, bigtab[piecen], xy); if (movemap(map, bigtab, piecen + 1, ft_memalloc(2)) == 1) return (1); else retraitpiece(*map, piecen); } xy[1]++; } xy[1] = 0; xy[0]++; } if (piecen == 0) { *map = remap(*map); movemap(map, bigtab, piecen, ft_memalloc(2)); } return (0); }
void DreamGenContext::dealwithspecial(uint8 firstParam, uint8 secondParam) { uint8 type = firstParam - 220; if (type == 0) { placesetobject(secondParam); data.byte(kHavedoneobs) = 1; } else if (type == 1) { removesetobject(secondParam); data.byte(kHavedoneobs) = 1; } else if (type == 2) { al = secondParam; placefreeobject(); data.byte(kHavedoneobs) = 1; } else if (type == 3) { al = secondParam; removefreeobject(); data.byte(kHavedoneobs) = 1; } else if (type == 4) { switchryanoff(); } else if (type == 5) { data.byte(kTurntoface) = secondParam; data.byte(kFacing) = secondParam; switchryanon(); } else if (type == 6) { data.byte(kNewlocation) = secondParam; } else { movemap(secondParam); } }