예제 #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
/**
 * 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
/**
 * 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;
	}
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
 void AddAttribute(TCHAR *name, TCHAR *value) {
   pAttribute.emplace_front(name, value);
 }
예제 #12
0
 void AddAttribute(tstring &&name,
                   const TCHAR *value, size_t value_length) {
   attributes.emplace_front(std::move(name), value, value_length);
 }