void CControl_Manager::reinit() { if( m_object->CCustomMonster::use_simplified_visual() ) return; // todo: make it simpler // reinit pure first, base second, custom third CONTROLLERS_MAP_IT it; for (it = m_control_elems.begin(); it != m_control_elems.end(); ++it) if (is_pure(it->second)) it->second->reinit(); for (it = m_control_elems.begin(); it != m_control_elems.end(); ++it) if (is_base(it->second)) it->second->reinit(); for (it = m_control_elems.begin(); it != m_control_elems.end(); ++it) if (!is_pure(it->second) && !is_base(it->second)) it->second->reinit(); // fill active elems m_active_elems.clear (); m_active_elems.reserve (ControlCom::eControllersCount); for (it = m_control_elems.begin(); it != m_control_elems.end(); ++it) { if (it->second->is_active() && !is_locked(it->second)) { m_active_elems.push_back(it->second); } } }
bool CControl_Manager::is_captured(ControlCom::EControlType type) { CControl_Com *capturer = m_control_elems[type]->ced()->capturer(); if (!capturer || is_base(capturer)) return false; return true; }
int is_one_base(char *expr, PARAM param) { int i; i = 0; while (is_base(expr[i], param) == 0 && expr[i] != '\0') i = i + 1; if (expr[i] == '\0') return (0); while (is_base(expr[i], param) && expr[i] != '\0') i = i + 1; if (expr[i] == '\0') return (1); while (is_base(expr[i], param) == 0 && expr[i] != '\0') i = i + 1; if (expr[i] != '\0') return (0); return (1); }
static sql_exp * rel_find_exp_( sql_rel *rel, sql_exp *e) { sql_exp *ne = NULL; switch(e->type) { case e_column: if (rel->exps && (is_project(rel->op) || is_base(rel->op))) { if (e->l) { ne = exps_bind_column2(rel->exps, e->l, e->r); } else { ne = exps_bind_column(rel->exps, e->r, NULL); } } return ne; case e_convert: return rel_find_exp_(rel, e->l); case e_aggr: case e_func: if (e->l) { list *l = e->l; node *n = l->h; ne = n->data; while (ne != NULL && n != NULL) { ne = rel_find_exp_(rel, n->data); n = n->next; } return ne; } case e_cmp: case e_psm: return NULL; case e_atom: return e; } return ne; }
// capture void CControl_Manager::capture(CControl_Com *com, ControlCom::EControlType type) // who, type { CControl_Com *target = m_control_elems[type]; // 1. Check if can capture CControl_Com *capturer = target->ced()->capturer(); VERIFY(!capturer || is_base(capturer)); if (target->is_active()) { target->ced()->on_release (); // if there is base capturer - stop control com if (capturer) capturer->cing()->on_stop_control (type); } // 3. target->ced()->set_capturer (com); // 4. target->ced()->on_capture (); // 5. com->cing()->on_start_control (type); }
int my_ngetnbr(char *str) { int i; int output; int neg; if (str == NULL) return (0); i = 0; output = 0; neg = is_neg(str); while (str[i] == '-' || str[i] == '+') i++; while (is_base(str[i]) == 1) { output = (output * 10) + (str[i] - 48); i++; } if (neg == 0) return (output); else return (-output); }