bool CBaseMonster::check_start_conditions(ControlCom::EControlType type) { if ( !StateMan->check_control_start_conditions(type) ) { return false; } if ( type == ControlCom::eControlRotationJump ) { EMonsterState state = StateMan->get_state_type(); if ( !is_state(state, eStateAttack_Run) && !is_state(state, eStateAttack_RunAttack) ) { return false; } } if ( type == ControlCom::eControlMeleeJump ) { EMonsterState state = StateMan->get_state_type(); if (!is_state(state, eStateAttack_Run) && !is_state(state, eStateAttack_Melee) && !is_state(state, eStateAttack_RunAttack) ) { return false; } } return true; }
void Enemy::update(){ int now_frame = frame->get_frame(); //printf("%d\n",now_frame); while(true){ Action action = action_list->get_action(now_frame); if(action.get_type() == Action::TYPE_MOVE){ set_state(STATE_MOVE); move_frame = action.get_move_frame(); } else if(action.get_type() == Action::TYPE_SHOOT){ set_state(STATE_SHOOT); } else{ break; } if(is_state(STATE_SHOOT)){ action.get_bullet()->shoot(); remove_state(STATE_SHOOT); } } if(is_state(STATE_MOVE)){ if(move_frame > 0){ obj_pos->x += dx; obj_pos->y += dy; move_frame--; }else{ remove_state(STATE_MOVE); } } for(int i = 0; i < bullet_num; i++){ if(bullets[i]->is_shoot()){ bullets[i]->update(); } } }
bool ignore(struct file *file) { if ((file->is_config) || is_config(file->filename) || // ideally we trust the manifest but short term reapply check here (file->is_state) || is_state(file->filename) || // ideally we trust the manifest but short term reapply check here (file->is_boot && fix && file->is_deleted) || // shouldn't happen (file->is_boot && !fix && !file->is_deleted) || // default ignore (ignore_orphans && file->is_orphan)) { update_skip++; file->do_not_update = 1; return true; } return false; }
/* Determines whether or not FILE should be ignored for this swupd action. Note * that boot files are ignored only if they are marked as deleted; this does * not happen in current manifests produced by swupd-server, but this check is * enabled in case swupd-server ever allows for deleted boot files in manifests * in the future. */ bool ignore(struct file *file) { if ((OS_IS_STATELESS && file->is_config) || (OS_IS_STATELESS && is_config(file->filename)) || // ideally we trust the manifest but short term reapply check here (file->is_state) || is_state(file->filename) || // ideally we trust the manifest but short term reapply check here (file->is_boot && file->is_deleted) || (ignore_orphans && file->is_orphan) || (file->is_ghosted)) { update_skip++; file->do_not_update = 1; return true; } return false; }
static void runtime_state_heuristics(struct file *file) { if (is_state(file->filename)) { file->is_state = 1; } }
bool Connection::is_established() { return is_state("ESTABLISHED"); }
bool Connection::is_listening() { return is_state("LISTENING"); }
/* Select from 3 available modes and process accordingly */ void mode_selection(XnPoint3D* handPointList, hand_h* rhand){ //-------------------sculpting-------------------------- if(is_mode(1)){ checkRCursor(1, rhand); //right //if(hasTwoHands()) checkLCursor(lhand); //left //SELECTION if(is_state(1)){ float* cursor = getCursor(); cursorX = cursor[0]; cursorY = cursor[1]; drawPickVMModel(); processPick(cursorX, cursorY); set_state(2); } //RENDER else { draw_hand(handPointList); //draw every hands //show back buffer? if(!BACK_BUFF){ drawVMModel(); } else{ drawPickVMModel(); } set_state(1); glutSwapBuffers(); } } //-------------------paint---------------------------- else if(is_mode(2)) { checkRCursor(2, rhand); //SELECTION if(is_state(1)){ //update cursor for paint effect float* cursor = getCursor(); cursorX = cursor[0]; cursorY = cursor[1]; drawPickVMModel(); processPick(cursorX, cursorY); set_state(2); } //RENDER else { //////////////////////////////////////////////////** in gesture//////////////// draw_hand(handPointList); if(!BACK_BUFF) drawVMModel(); else drawPickVMModel(); //back to select other mesh set_state(1); glutSwapBuffers(); } } //------------------ Selection ------------------------ else if(is_mode(3)) { checkRCursor(3, rhand); if(is_state(1)){ drawPickVMModel(); set_state(2); } else { //////////////////////////////////////////////////** in gesture//////////////// draw_hand(handPointList); if(!BACK_BUFF) drawVMModel(); else drawPickVMModel(); drawVMModel(); glutSwapBuffers(); } } }
int runcmd_cmd2strv(const char *str, int *out_argc, char **out_argv) { int arg = 0, i, a = 0; int state, ret = 0; size_t len; char *argz; set_state(STATE_NONE); len = strlen(str); argz = malloc(len + 10); for (i = 0; i < len; i++) { const char *p = &str[i]; switch (*p) { case 0: return ret; case ' ': case '\t': case '\r': case '\n': if (is_state(STATE_INARG)) { set_state(STATE_NONE); argz[a++] = 0; continue; } if (!in_quotes) continue; break; case '\\': i++; break; case '\'': if (have_state(STATE_INDQ)) break; if (have_state(STATE_INSQ)) { del_state(STATE_INSQ); continue; } /* * quotes can come inside arguments or * at the start of them */ if (is_state(STATE_NONE) || is_state(STATE_INARG)) { if (is_state(STATE_NONE)) { /* starting a new argument */ out_argv[arg++] = &argz[a]; } set_state(STATE_INSQ | STATE_INARG); continue; } case '"': if (have_state(STATE_INSQ)) break; if (have_state(STATE_INDQ)) { del_state(STATE_INDQ); continue; } if (is_state(STATE_NONE) || is_state(STATE_INARG)) { if (is_state(STATE_NONE)) { out_argv[arg++] = &argz[a]; } set_state(STATE_INDQ | STATE_INARG); continue; } break; case '|': if (!in_quotes) { add_ret(CMD_HAS_REDIR); } break; case '&': case ';': if (!in_quotes) { set_state(STATE_SPECIAL); add_ret(CMD_HAS_JOBCONTROL); if (i && str[i - 1] != *p) { argz[a++] = 0; out_argv[arg++] = &argz[a]; } } break; case '`': if (!in_quotes) { add_ret(CMD_HAS_SUBCOMMAND); } break; case '(': if (!in_quotes) { add_ret(CMD_HAS_PAREN); } break; case '*': case '?': if (!in_quotes) { add_ret(CMD_HAS_WILDCARD); } /* fallthrough */ default: break; } if (is_state(STATE_NONE)) { set_state(STATE_INARG); out_argv[arg++] = &argz[a]; } /* by default we simply copy the byte */ argz[a++] = str[i]; } /* make sure we nul-terminate the last argument */ argz[a++] = 0; if (have_state(STATE_INSQ)) add_ret(CMD_HAS_UBSQ); if (have_state(STATE_INDQ)) add_ret(CMD_HAS_UBDQ); *out_argc = arg; return ret; }