コード例 #1
0
void TutorialMobManager::AddCollideLine(std::forward_list<Line>& lines)
{
	std::forward_list<ActorPtr> children;
	children.swap(this->GetChildren());
	const size_t listCount = Utility::GetListSize(children);
	std::vector<ActorPtr> mobs;
	for (auto& m : children) {
		mobs.emplace_back(m);
	}

	for (unsigned int i = 0; i < listCount; ++i) {
		for (unsigned int j = 0; j < listCount; ++j) {

			if (i == j || i > j)
				continue;

			if (IsLongDistancePlayer(mobs, i, j))
				continue;

			if (IsBackSidePlayer(mobs, i, j))
				continue;

			Vector3 playerFront = -player->GetMatrix().GetFront();

			Line line = Line(mobs[i]->GetPosition() + playerFront * 5.0f, mobs[j]->GetPosition() + playerFront * 5.0f);

			lines.emplace_front(line);

		}
	}
}
コード例 #2
0
ファイル: source.cpp プロジェクト: ariosx/mapbox-gl-native
/**
 * Find a loaded parent of the given tile.
 *
 * @param id The tile ID that we should find children for.
 * @param minCoveringZoom The minimum zoom level of parents to look for.
 * @param retain An object that we add the found tiles to.
 *
 * @return boolean Whether a parent was found.
 */
bool Source::findLoadedParent(const Tile::ID& id, int32_t minCoveringZoom, std::forward_list<Tile::ID>& retain) {
    for (int32_t z = id.z - 1; z >= minCoveringZoom; --z) {
        const Tile::ID parent_id = id.parent(z);
        const TileData::State state = hasTile(parent_id);
        if (state == TileData::State::parsed) {
            retain.emplace_front(parent_id);
            return true;
        }
    }
    return false;
}
コード例 #3
0
  /* virtual methods from class LeScanCallback */
  void OnLeScan(const char *address, const char *name) override {
    {
      std::string address2(address);
      if (addresses.find(address2) != addresses.end())
        /* already in the list */
        return;

      addresses.emplace(std::move(address2));
    }

    {
      const ScopeLock protect(mutex);
      new_items.emplace_front(address, name);
    }

    Notify::SendNotification();
  };
コード例 #4
0
ファイル: source.cpp プロジェクト: ariosx/mapbox-gl-native
/**
 * Recursively find children of the given tile that are already loaded.
 *
 * @param id The tile ID that we should find children for.
 * @param maxCoveringZoom The maximum zoom level of children to look for.
 * @param retain An object that we add the found tiles to.
 *
 * @return boolean Whether the children found completely cover the tile.
 */
bool Source::findLoadedChildren(const Tile::ID& id, int32_t maxCoveringZoom, std::forward_list<Tile::ID>& retain) {
    bool complete = true;
    int32_t z = id.z;
    auto ids = id.children(z + 1);
    for (const Tile::ID& child_id : ids) {
        const TileData::State state = hasTile(child_id);
        if (state == TileData::State::parsed) {
            retain.emplace_front(child_id);
        } else {
            complete = false;
            if (z < maxCoveringZoom) {
                // Go further down the hierarchy to find more unloaded children.
                findLoadedChildren(child_id, maxCoveringZoom, retain);
            }
        }
    }
    return complete;
}
コード例 #5
0
ファイル: Node.hpp プロジェクト: damianob/xcsoar
 void AddAttribute(const TCHAR *name, size_t name_length,
                   const TCHAR *value, size_t value_length) {
   attributes.emplace_front(name, name_length, value, value_length);
 }
コード例 #6
0
ファイル: Node.hpp プロジェクト: damianob/xcsoar
 void AddAttribute(const TCHAR *name, const TCHAR *value) {
   attributes.emplace_front(name, value);
 }
コード例 #7
0
ファイル: pulley.cpp プロジェクト: arpa2/steamworks
	int add_follower(const std::string& base, const std::string& filter, Object& response)
	{
		m_following.emplace_front(new PulleySyncRepl(base, filter, m_parser));
		m_following.front()->execute(*m_connection, &response);
		return 0;
	}
コード例 #8
0
void good_emplace_front_forward_list1(std::forward_list<int> &FL, int n) {
  auto i0 = FL.cbegin(), i1 = FL.cend();
  FL.emplace_front(n);
  *i0; // no-warning
}
コード例 #9
0
jmp_buf *
exceptions_state_mc_init ()
{
  catchers.emplace_front ();
  return &catchers.front ().buf;
}
コード例 #10
0
ファイル: signal.hpp プロジェクト: ftk/niceamx
 inline void emplace(EArgs&&... args)
 {
     slots.emplace_front(std::forward<EArgs>(args)...);
 }
コード例 #11
0
ファイル: xmlParser.hpp プロジェクト: davidswelt/XCSoar
 void AddAttribute(TCHAR *name, TCHAR *value) {
   pAttribute.emplace_front(name, value);
 }
コード例 #12
0
ファイル: Node.hpp プロジェクト: MaxPower-No1/XCSoar
 void AddAttribute(tstring &&name,
                   const TCHAR *value, size_t value_length) {
   attributes.emplace_front(std::move(name), value, value_length);
 }