//cell seeking void seek(int ***map, int* cell, int i, int j) { int *xy; int count = 0; if (cell[TYPE] == HUMAN) { while (true) { if (count >= 4) { cell[MOVED] = true; return; } else { xy = getCoordinate(HSPEED, i, j); if (map[xy[0]][xy[1]][TYPE] == EMPTY) { cellMove(cell, map[xy[0]][xy[1]]); return; } else if (map[xy[0]][xy[1]][TYPE] == HUMAN) { // cellMove(cell, map[xy[0]][xy[1]]); xy = getCoordinate(HSPEED, i, j); if (map[xy[0]][xy[1]][TYPE] == EMPTY) { int isBorn = random(0, BIRTHRATE); if (isBorn == true) { map[xy[0]][xy[1]][TYPE] = HUMAN; map[xy[0]][xy[1]][AGE] = 0; map[xy[0]][xy[1]][SPEED] = HSPEED; map[xy[0]][xy[1]][MOVED] = true; } cell[MOVED] = true; } return; } } ++count; } } else if (cell[TYPE] == ZOMBIE) { while (true) { if (count >= 4) { cell[MOVED] = true; delete xy; return; } else { xy = getCoordinate(ZSPEED, i, j); if (map[xy[0]][xy[1]][TYPE] == EMPTY) { cellMove(cell, map[xy[0]][xy[1]]); return; } else if (map[xy[0]][xy[1]][TYPE] == HUMAN) { attack(map[xy[0]][xy[1]]); cell[MOVED] = true; return; } ++count; } } } }
//cell seeking void seek(int ***map,int* cell, int i,int j) { int ni,nj; int count = 0; if (cell[TYPE] == HUMAN) { while (true) { if (count >= 50) { cell[MOVED] = true; return; } else{ ni = getCoordinate(HSPEED, i, I); nj = getCoordinate(HSPEED, j, J); if (map[ni][nj][TYPE] == EMPTY) { cellMove(cell, map[ni][nj]); return; } } ++count; } } else if (cell[TYPE] == ZOMBIE) { while (true) { if (count >= 50) { cell[MOVED] = true; return; } else { ni = getCoordinate(ZSPEED, i, I); nj = getCoordinate(ZSPEED, j, J); if (map[ni][nj][TYPE] == EMPTY) { cellMove(cell, map[ni][nj]); return; } else if (map[ni][nj][TYPE]== HUMAN) { attack(map[ni][nj]); cell[MOVED] = true; return; } ++count; } } } }
void throwable_init(ObjectData* throwable) { assertx(is_throwable(throwable)); assertx(throwable_has_expected_props()); auto trace = HHVM_FN(debug_backtrace)(exception_get_trace_options()); cellMove( make_tv<KindOfArray>(trace.detach()), throwable->propVec()[s_traceIdx]); VMRegAnchor _; auto const fp = vmfp(); if (UNLIKELY(!fp)) return; if (UNLIKELY(fp->func()->isBuiltin())) { throwable_init_file_and_line_from_builtin(throwable); } else { assertx(throwable->propVec()[s_fileIdx].m_type == KindOfNull); assertx(throwable->propVec()[s_lineIdx].m_type == KindOfNull); auto const unit = fp->func()->unit(); auto const file = const_cast<StringData*>(unit->filepath()); auto const line = unit->getLineNumber(unit->offsetOf(vmpc())); cellDup(make_tv<KindOfString>(file), throwable->propVec()[s_fileIdx]); cellDup(make_tv<KindOfInt64>(line), throwable->propVec()[s_lineIdx]); } }