int Picker::restoreOpenCategories(const std::list<std::list<std::string> >& idList) {
	int numRestored=0;
	PickerCell *selectedCell = NULL;
	for (std::list<std::list<std::string> >::const_iterator catIt = idList.begin();
		 catIt!=idList.end();
		 ++catIt) {
		PickerCells *celllist = cells();
		for (std::list<std::string>::const_iterator travIt = (*catIt).begin();
			 travIt!=(*catIt).end();
			 ++travIt) {
			PickerCell *cell = celllist->cellWithId((*travIt));
			if (!cell) {
				break;
			}
			celllist = cell->children();
			if (!celllist || celllist->count() == 0) {
				selectedCell = cell;
				break;
			}
			cell->setHideChildren(false);
		}
	}
	
	setMustRecalc();
	if (selectedCell) {
		selectCell(selectedCell, true);
	}
	return numRestored;
}
Example #2
0
 void FilterTargets(std::list<WorldObject*>& targets)
 {
     targets.clear();
     targets.push_back(GetCaster());
     if (Unit* owner = GetCaster()->GetOwner())
         targets.push_back(owner);
 }
Example #3
0
    void CaveDestruction(bool bBool)
    {
        if (GoSummonList.empty())
            return;

        for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
        {
            if (GameObject* pGo = GameObject::GetGameObject(*me, *itr))
            {
                if (pGo)
                {
                    if (Creature* trigger = pGo->SummonTrigger(pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, 1))
                    {
                        //visual effects are not working! ¬¬
                        trigger->CastSpell(trigger, 11542, true);
                        trigger->CastSpell(trigger, 35470, true);
                    }
                    pGo->RemoveFromWorld();
                    //pGo->CastSpell(me,12158); makes all die?!
                }
            }
        }

        if (bBool)
        {
            if (pInstance)
                if (GameObject* pGo = GameObject::GetGameObject((*me), pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
                    pInstance->HandleGameObject(0, false, pGo);
        }
        else if (pInstance)
            if (GameObject* pGo = GameObject::GetGameObject((*me), pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
                pInstance->HandleGameObject(0, false, pGo);
    }
Example #4
0
Direction MaxOfFewSearch::move(GameState& state, int ms
#ifdef DEBUG
							   , std::list<Direction>& moveSequence
#endif
  							  )
{
	Direction bestMove = DIR_END;
	double bestValue = -std::numeric_limits<double>::infinity();
	for(int i = 0; i < k_ || bestMove == DIR_END; ++i)
	{
		Direction direction = rand() % DIR_END;
		if(!state.canMove(direction))
			continue;
		
		state.move(direction);
		double value = heuristic_(state);
		state.undo(direction);
		
		if(value > bestValue || bestMove == DIR_END)
		{
			bestMove = direction;
			bestValue = value;
		}
	}
	
#ifdef DEBUG
	moveSequence.clear();
	moveSequence.push_front(bestMove);
#endif
	
	return bestMove;
}
Example #5
0
/* Returns a pointer to a mapping if it exists - NULL otherwise */
KEY_MAPPING *keyFindMapping(KEY_CODE metaCode, KEY_CODE subCode)
{
	auto mapping = std::find_if(keyMappings.begin(), keyMappings.end(), [metaCode, subCode](KEY_MAPPING const &mapping) {
		return mapping.metaKeyCode == metaCode && mapping.subKeyCode == subCode;
	});
	return mapping != keyMappings.end()? &*mapping : nullptr;
}
void ProcessCOMPIL::insertScenario(TScenario sc, std::list<TVGuard>& lg) {
  std::list<TVarInfo> comb;
  comb.push_back(TVarAux()); // Insert a useless node which will play the role of the root in the tree

  while (!sc.empty()) {
    TVarInfo headSc = sc.front();
    // If there is many consecutive same variables in the scenario,
    // we kept the last one, the most precise. Occurs when branching doesn't
    // instantiate a value (for example a INT_VAL_MIN())
    while (headSc.id == sc.front().id) {
      headSc = sc.front();
      sc.pop_front();
    }

    if (headSc.q == FORALL) {
      comb.push_back(headSc);
    } else {
      // We are looking for the next guard involved sc.front()
      std::list<TVGuard>::iterator it    = lg.begin();
      std::list<TVGuard>::iterator itEnd = lg.end();
      for ( ; (it != itEnd) && ((*it).x.id != headSc.id) ; ++it);
      if (it == itEnd)
        lg.push_back(TVGuard(headSc));
      else
        updateGuard(headSc,comb,(*it).g);
    }
  }
}
Example #7
0
//从全局消息队列中取出消息并处理完队列里面所有的消息
int handle_player_msgs()
{
	auto it_cache = glb_msg_list_.begin();
	while (it_cache != glb_msg_list_.end())
	{
		auto cmd = *it_cache;	it_cache++;
		auto pauth_msg = boost::dynamic_pointer_cast<msg_authrized<koko_socket_ptr>>(cmd);
		//如果需要授权的消息,没有得到授权,则退出
		if (pauth_msg.get() && 
			!pauth_msg->from_sock_->is_authorized()){
			pauth_msg->from_sock_->close();
		}
		else{
			int ret = cmd->handle_this();
			if (ret != 0){
				msg_common_reply<koko_socket_ptr> msg;
				msg.err_ = ret;
				msg.rp_cmd_ = cmd->head_.cmd_;
				send_msg(cmd->from_sock_, msg);
			}
		}
		msg_handled++;
	}
	glb_msg_list_.clear();
	return 0;
}
Example #8
0
     int chooseBestBot(std::list<int>& freeBots, const Tactic::Param* tParam, int prevID) const
    {
        //returns the bot with minimum distance
        Vector2D<int> ball = BP;
        float mindist = 2*(HALF_FIELD_MAXX+HALF_FIELD_MAXY);
        int best_bot = 0;

      for(std::list<int>::iterator it=freeBots.begin(); it != freeBots.end();++it)
      {
        int radius;
        int i = *it;
        Vector2D<int> delta;
        delta.x =  HP(i).x - ball.x;
        delta.y =  HP(i).y - ball.y;
        radius = (int) sqrt( (delta.x)*(delta.x) + (delta.y)*(delta.y)  ); //euclidian distance THANKU :P mention not :P

        if( radius < mindist )
        {
          mindist = radius;
          best_bot = i;
        }

      }
                return best_bot;
        }
Example #9
0
void SourceWindow::disassembled(int lineNo, const std::list<DisassembledCode>& disass)
{
    TRACE("disassembled line " + QString().setNum(lineNo));
    if (lineNo < 0 || lineNo >= int(m_sourceCode.size()))
	return;

    SourceLine& sl = m_sourceCode[lineNo];

    // copy disassembled code and its addresses
    sl.disass.resize(disass.size());
    sl.disassAddr.resize(disass.size());
    sl.canDisass = !disass.empty();
    int i = 0;
    for (std::list<DisassembledCode>::const_iterator c = disass.begin(); c != disass.end(); ++c, ++i)
    {
	QString code = c->code;
	while (code.endsWith("\n"))
	    code.truncate(code.length()-1);
	sl.disass[i] = c->address.asString() + ' ' + code;
	sl.disassAddr[i] = c->address;
    }

    int row = lineToRow(lineNo);
    if (sl.canDisass) {
	expandRow(row);
    } else {
	// clear expansion marker
	m_lineInfoArea->update();
    }
}
Example #10
0
static void de_robv_android_xposed_XposedBridge_hookMethodNative(JNIEnv* env, jclass clazz, jobject declaredClassIndirect, jint slot) {
    // Usage errors?
    if (declaredClassIndirect == NULL) {
        dvmThrowIllegalArgumentException("declaredClass must not be null");
        return;
    }
    
    // Find the internal representation of the method
    ClassObject* declaredClass = (ClassObject*) dvmDecodeIndirectRef(dvmThreadSelf(), declaredClassIndirect);
    Method* method = dvmSlotToMethod(declaredClass, slot);
    if (method == NULL) {
        dvmThrowNoSuchMethodError("could not get internal representation for method");
        return;
    }
    
    if (findXposedOriginalMethod(method) != xposedOriginalMethods.end()) {
        // already hooked
        return;
    }
    
    // Save a copy of the original method
    xposedOriginalMethods.push_front(*((MethodXposedExt*)method));

    // Replace method with our own code
    SET_METHOD_FLAG(method, ACC_NATIVE);
    method->nativeFunc = &xposedCallHandler;
    method->registersSize = method->insSize;
    method->outsSize = 0;

    if (PTR_gDvmJit != NULL) {
        // reset JIT cache
        MEMBER_VAL(PTR_gDvmJit, DvmJitGlobals, codeCacheFull) = true;
    }
}
Example #11
0
        void Reset()
        {
            Phase = IDLE;
            luiCrystals.clear();
            ohNovos = true;
            me->CastStop();
            lSummons.DespawnAll();
            crystalHandlerAmount = 0;

            if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
            if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

            if (instance)
            {
                instance->SetData(DATA_NOVOS_EVENT, NOT_STARTED);
                for (uint8 n = 0; n < 4; ++n)
                    luiCrystals.push_back(instance->GetData64(DATA_NOVOS_CRYSTAL_1 + n));
                for (std::list<uint64>::const_iterator itr = luiCrystals.begin(); itr != luiCrystals.end(); ++itr)
                {
                    if (GameObject* temp = instance->instance->GetGameObject(*itr))
                        temp->SetGoState(GO_STATE_READY);
                }
            }
        }
void SpellSindragosaUnchainedMagicSpellScript::FilterTargets(std::list<WorldObject*>& unitList)
{
    unitList.remove_if(UnchainedMagicTargetSelector());
    uint32 maxSize = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 2);
    if (unitList.size() > maxSize)
        Trinity::Containers::RandomResizeList(unitList, maxSize);
}
Example #13
0
/** This runs in a separate thread */
static int fpathThreadFunc(void *)
{
	wzMutexLock(fpathMutex);

	while (!fpathQuit)
	{
		if (pathJobs.empty())
		{
			ASSERT(!waitingForResult, "Waiting for a result (id %u) that doesn't exist.", waitingForResultId);
			wzMutexUnlock(fpathMutex);
			wzSemaphoreWait(fpathSemaphore);  // Go to sleep until needed.
			wzMutexLock(fpathMutex);
			continue;
		}

		// Copy the first job from the queue.
		packagedPathJob job = std::move(pathJobs.front());
		pathJobs.pop_front();

		wzMutexUnlock(fpathMutex);
		job();
		wzMutexLock(fpathMutex);

		waitingForResult = false;
		objTrace(waitingForResultId, "These are the droids you are looking for.");
		wzSemaphorePost(waitingForResultSemaphore);
	}
	wzMutexUnlock(fpathMutex);
	return 0;
}
Example #14
0
bool update_id_list(
  std::list<std::shared_ptr<MODEL> >& model_list,
  Data model_ids)
{
#  ifndef ODB_COMPILER
  std::vector<ODB::id_type> ids = model_ids;
  {
    auto it = model_list.begin();

    while (it != model_list.end())
    {
      std::shared_ptr<MODEL> model(*it);
      auto               exists_in_new_list = find(ids.begin(), ids.end(), model->get_id());

      if (exists_in_new_list == ids.end())
        it = model_list.erase(it); // if it isn't in the new list, remove the building
      else
      {
        ids.erase(exists_in_new_list); // if it is in both lists, ignore it
        it++;
      }
    }
  }

  for (ODB::id_type id : ids)
  {
    std::shared_ptr<MODEL> model;

    if (!ODB::Connection::instance->find_one(model, odb::query<MODEL>::id == id))
      return false;
    model_list.push_back(model);
  }
#  endif
  return true;
}
Example #15
0
synfig::String
Action::Base::get_layer_descriptions(const std::list<std::pair<synfig::Layer::Handle,int> > layers, synfig::String singular_prefix, synfig::String plural_prefix)
{
	String ret;
	bool first = true;

	if (plural_prefix.empty())
		plural_prefix = singular_prefix;

	if (layers.empty())
		return plural_prefix;

	if (layers.size() == 1)
		ret = singular_prefix;
	else
		ret = plural_prefix;

	if (!ret.empty())
		ret.push_back(' ');

	for(std::list<std::pair<synfig::Layer::Handle,int> >::const_iterator iter=layers.begin(); iter!=layers.end(); ++iter)
	{
		if (first)
			first = false;
		else
			ret += ", ";

		ret += strprintf("'%s'", iter->first->get_non_empty_description().c_str());
	}

	return ret;
}
Example #16
0
	int TDefendARC_right::chooseBestBot(const BeliefState& state, std::list<int>& freebots, const Param& tParam, int prevID) const {
		Vector2D<float> p_threat;
		Vector2D<float> upper_limit(-HALF_FIELD_MAXX, OUR_GOAL_MAXY *(2.0/ 3.0f));
		// Vector2D<float> upper_limit(-HALF_FIELD_MAXX, 0);
		Vector2D<float> lower_limit(upper_limit.x, -1 * upper_limit.y);
		Vector2D<float> sol_right;
        Vector2D<float> C(-HALF_FIELD_MAXX, 0.0f);
        float R = HALF_FIELD_MAXY / 2.5f;

		p_threat.x = state.ballPos.x;
		p_threat.y = state.ballPos.y;
		inter_circle_and_line(p_threat, lower_limit, C, R, sol_right);
		Vector2D<float> P1(sol_right.x, sol_right.y);
		int best_bot = -1;
		float min_dis = 999999.9f;

		//iterate over all the bots and see the one closest to the point
		for(std::list<int>::const_iterator itr = freebots.begin(); itr != freebots.end(); ++itr) {
			Vector2D<float> bot(state.homePos[*itr].x, state.homePos[*itr].y);
			if(Vector2D<float>::dist(P1, bot) < min_dis){
				best_bot = *itr;
				min_dis = Vector2D<float>::dist(P1, bot);
			}
		}

		assert(best_bot != -1);

		return best_bot;
	}//choosebestbot
Example #17
0
void
test_ns::matrix::
find_one_puddle_and_update(int entry_h, const entry_pos_t& entry_pos,
        entry_pos_set_t& puddle_pos, entry_pos_set_t& leaks_pos,
        std::list<puddle>& puddles,
        size_t& yet_not_found_positions) const {
    entry_pos_set_t searched_entries;
    entry_pos_set_t below_level_entries;
    bool is_puddle = find_one_puddle(entry_h, entry_pos, leaks_pos,
            searched_entries, below_level_entries);
    yet_not_found_positions -= searched_entries.size();
    if (is_puddle) {
        for (const auto & e : searched_entries) {
            puddle_pos.insert(e);
        }
        if (!below_level_entries.empty()) {
            for (auto const & below_entry : below_level_entries) {
                for (auto i = puddles.rbegin(); i != puddles.rend(); ++i) {
                    const auto & puddle = *i;
                    auto & entries = puddle.entries_;
                    if (entries.find(below_entry) != entries.end()) {
                        puddles.erase(std::prev (i.base()));
                        break;
                    }
                }
            }
        }
        puddle a_puddle{searched_entries, entry_h};
        puddles.push_back(std::move(a_puddle));
    } else {
        for (const auto & e : searched_entries) {
            leaks_pos.insert(e);
        }
    }
}
Example #18
0
//Encontra o menor caminho até o objetivo
void mazeProcessing::encontra_menor_caminho(int* pos_obj, int** mapa_distancias, int** paredes, std::list<int> &caminho_x, std::list<int> &caminho_y)
{
	caminho_y.push_front(pos_obj[0]);
	caminho_x.push_front(pos_obj[1]);

    int pos_atual[2], pos_prox[2];
	pos_atual[0] = pos_obj[0];
	pos_atual[1] = pos_obj[1];
    while(mapa_distancias[pos_atual[0]][pos_atual[1]] != 0)
    {
    	int j = -1;
    	for(int i = 0; i < 4; i++)
		{
			pos_prox[0] = pos_atual[0] + (i / 2) * j;
			pos_prox[1] = pos_atual[1] + ((3 - i) / 2) * j;
			if(verifica_conexao(pos_atual, pos_prox, paredes))
		    	if(mapa_distancias[pos_prox[0]][pos_prox[1]] == mapa_distancias[pos_atual[0]][pos_atual[1]] - 1)
		    	{
		    		caminho_y.push_front(pos_prox[0]);
		    		caminho_x.push_front(pos_prox[1]);
		    		pos_atual[0] = pos_prox[0];
		    		pos_atual[1] = pos_prox[1];
		    		break;
		    	}
		    j *= -1;
		}
    }
}
Example #19
0
void ensureAtLeastIdentityOperation(std::list<ICalcOperation_shptr>& ops)
{
    if (ops.empty())
    {
        ops.push_back( CreateCalcOperation(1.0) );
    }
}
Example #20
0
void Pickup::do_pickup( const tripoint &pickup_target_arg, bool from_vehicle,
                        std::list<int> &indices, std::list<int> &quantities, bool autopickup )
{
    bool got_water = false;
    int cargo_part = -1;
    vehicle *veh = nullptr;
    bool weight_is_okay = (g->u.weight_carried() <= g->u.weight_capacity());
    bool volume_is_okay = (g->u.volume_carried() <= g->u.volume_capacity());
    bool offered_swap = false;
    // Convert from player-relative to map-relative.
    tripoint pickup_target = pickup_target_arg + g->u.pos();
    // Map of items picked up so we can output them all at the end and
    // merge dropping items with the same name.
    PickupMap mapPickup;

    if( from_vehicle ) {
        int veh_root_part = -1;
        veh = g->m.veh_at( pickup_target, veh_root_part );
        cargo_part = veh->part_with_feature( veh_root_part, "CARGO", false );
    }

    while( g->u.moves >= 0 && !indices.empty() ) {
        // Pulling from the back of the (in-order) list of indices insures
        // that we pull from the end of the vector.
        int index = indices.back();
        int quantity = quantities.back();
        // Whether we pick the item up or not, we're done trying to do so,
        // so remove it from the list.
        indices.pop_back();
        quantities.pop_back();

        item *target = nullptr;
        if( from_vehicle ) {
            target = g->m.item_from( veh, cargo_part, index );
        } else {
            target = g->m.item_from( pickup_target, index );
        }

        if( target == nullptr ) {
            continue; // No such item.
        }

        pick_one_up( pickup_target, *target, veh, cargo_part, index, quantity,
                     got_water, offered_swap, mapPickup, autopickup );
    }

    if( !mapPickup.empty() ) {
        show_pickup_message(mapPickup);
    }

    if (got_water) {
        add_msg(m_info, _("You can't pick up a liquid!"));
    }
    if (weight_is_okay && g->u.weight_carried() > g->u.weight_capacity()) {
        add_msg(m_bad, _("You're overburdened!"));
    }
    if (volume_is_okay && g->u.volume_carried() > g->u.volume_capacity()) {
        add_msg(m_bad, _("You struggle to carry such a large volume!"));
    }
}
Example #21
0
        void MoveInLineOfSight(Unit* /*who*/)
        {
            if (!GridSearcherSucceeded)
            {
                FindChannelers();

                if (!Channelers.empty())
                {
                    for (std::list<uint64>::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
                    {
                        Creature* Channeler = (Unit::GetCreature(*me, *itr));
                        if (Channeler)
                        {
                            if (Channeler->isDead())
                            {
                                Channeler->RemoveCorpse();
                                Channeler->Respawn();
                            }

                            Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL, true);
                            Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL_2, true);
                            Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                            GridSearcherSucceeded = true;
                        }
                    }
                }
                else
                    TC_LOG_ERROR(LOG_FILTER_TSCR, "SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly");
            }
        }
Example #22
0
void inventory::add_stack(const std::list<item> newits)
{
    for (std::list<item>::const_iterator iter = newits.begin(); iter != newits.end(); ++iter)
    {
        add_item(*iter, true);
    }
}
Example #23
0
void DBSearch::select_data(const std::string& schema_name, const std::string& table_name, const std::list<std::string>& pk_columns, const std::list<std::string>& select_columns, const std::string& limit_clause, const bool match_PK)
{
    std::string query = build_select_query(schema_name, table_name, select_columns, limit_clause, match_PK);
    if (query.empty())
        return;
    boost::scoped_ptr<sql::Statement> stmt(_db_conn->createStatement());
    boost::scoped_ptr<sql::ResultSet> rs(stmt->executeQuery(query));
    if (_limit_counter > 0)
      _limit_counter -= (int)rs->rowsCount();
    SearchResultEntry result;
    result.schema = schema_name;
    result.table = table_name;
    result.query = query;
    result.keys = pk_columns;
    while(rs->next())
    {
        size_t col_idx = 1;
        std::vector<std::pair<std::string, std::string> > data;
        data.reserve(select_columns.size());
        for (std::list<std::string>::const_iterator It = select_columns.begin(); It != select_columns.end(); ++It)
           data.push_back(std::pair<std::string, std::string>(*It, rs->getString((int)col_idx++)));
        if (!data.empty())
            result.data.push_back(data);
    }
    _matched_rows += (int)result.data.size();
    if (!result.data.empty())
    {
        base::MutexLock lock(_search_result_mutex);
        _search_result.push_back(result);
    }
};
void
AGActivities::addTrips(std::list<AGTrip> t, std::list<AGTrip>* tripSet) {
    std::list<AGTrip>::iterator it;
    for (it = t.begin(); it != t.end(); ++it) {
        tripSet->push_back(*it);
    }
}
 void FilterTargets(std::list<Unit*>& unitList)
 {
     unitList.remove_if(ConflagrationTargetSelector());
     uint8 maxSize = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 6 : 3);
     if (unitList.size() > maxSize)
         Trinity::RandomResizeList(unitList, maxSize);
 }
Example #26
0
AuthorizationProvider::AuthorizationProvider( const std::list< config::NamedConfiguration* >& confs,
					      bool authzDefault,
					      const module::ModulesDirectory* modules )
{
	for ( std::list<config::NamedConfiguration*>::const_iterator it = confs.begin();
								it != confs.end(); it++ )	{
		module::ConfiguredBuilder* builder = modules->getBuilder((*it)->className());
		if ( builder )	{
			ConfiguredObjectConstructor< AuthorizationUnit >* authz =
					dynamic_cast< ConfiguredObjectConstructor< AuthorizationUnit >* >( builder->constructor());
			if ( authz == NULL )	{
				LOG_ALERT << "AuthorizationProvider: '" << builder->objectClassName()
					  << "' is not an Authorization Unit builder";
				throw std::logic_error( "object is not an AuthorizationUnit builder" );
			}
			m_authorizeUnits.push_back( authz->object( **it ) );
			LOG_TRACE << "'" << authz->objectClassName() << "' authorization unit registered";
		}
		else	{
			LOG_ALERT << "AuthorizationProvider: unknown authorization type '" << (*it)->className() << "'";
			throw std::domain_error( "Unknown authorization mechanism type in AAAAprovider constructor. See log" );
		}
	}
	m_authorizer = new StandardAuthorizer( m_authorizeUnits, authzDefault );
}
Example #27
0
void print_packets(std::list<std::shared_ptr<parse4880::PGPPacket>> packets,
                   int level) {

  for (auto i = packets.begin(); i != packets.end(); i++) {
    print_packet(**i, level);
  }
}
Example #28
0
static bool get_conditions(std::string s,std::list<std::string>& patterns) {
  std::string id;
  patterns.resize(0);
  get_word(s,id);
  if(id.empty()) return true;
  if(id.compare(0,strlen(conditions_id),conditions_id) != 0) {
    logger.msg(WARNING,"Was expecting %s at the beginning of \"%s\"",conditions_id,id);
    return false;
  };
  id=id.substr(strlen(conditions_id));
  if(id != "subjects") {
    logger.msg(WARNING,"We only support subjects conditions in Globus signing policy - %s is not supported",id);
    return false;
  };
  get_word(s,id);
  if(id != globus_id) {
    logger.msg(WARNING,"We only support globus conditions in Globus signing policy - %s is not supported",id);
    return false;
  };
  std::string subjects;
  get_word(s,subjects);
  if(subjects.empty()) {
    logger.msg(WARNING,"Missing condition subjects in Globus signing policy");
    return false;
  };
  std::string subject;
  for(;;) {
    get_word(subjects,subject);
    if(subject.empty()) break;
    patterns.push_back(subject);
  };
  return true;
}
Example #29
0
    void RestoreAll()
    {
        if (!pInstance)
            return;

        if (GameObject* pGo = GameObject::GetGameObject((*me), pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
            pInstance->HandleGameObject(0, false, pGo);

        if (GameObject* pGo = GameObject::GetGameObject((*me), pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
            pInstance->HandleGameObject(0, false, pGo);

        if (!GoSummonList.empty())
            for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
            {
                if (GameObject* pGo = GameObject::GetGameObject(*me, *itr))
                    pGo->RemoveFromWorld();
            }

        if (!SummonList.empty())
            for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
            {
                if (Creature* pSummon = Unit::GetCreature(*me, *itr))
                {
                    if (pSummon->IsAlive())
                        pSummon->DisappearAndDie();
                    else
                        pSummon->RemoveCorpse();
                }
            }
    }
bool PickerCells::saveOpenCategories(std::list<std::list<std::string> >& masterList,
			const std::list<std::string> &parentHier,
			PickerCell *selectedCell) const {
	bool hasSelectedCell=false;
	for (int i=0; i<count(); i++) {
		const PickerCell* cell = cellAt(i);
		if (cell == selectedCell) {
			hasSelectedCell=true;
		}
		if (!cell->hideChildren()) {
			masterList.push_back(parentHier);
			std::list<std::string> * newItem = &masterList.back();
			(*newItem).push_back(cell->id());
			PickerCells *newCells = cell->children();
			bool savedCell=false;
			if (newCells) {
				savedCell = newCells->saveOpenCategories(masterList, (*newItem), selectedCell);
			}
			if (savedCell) {
				(*newItem).push_back(selectedCell->id());
			}
		}
	}
	return hasSelectedCell;
}