Exemplo n.º 1
0
unit_map::const_unit_iterator unit_map::find(const size_t &id) const {
	umap::const_iterator iter = map_.find(id);
	if (iter == map_.end() || !iter->second.first) {
		return const_unit_iterator(map_.end(), this);
	}
	return const_unit_iterator(iter, this);
}
Exemplo n.º 2
0
unit_map::const_unit_iterator unit_map::find(const std::string& id) const {
	WRN_NG << "Finding using id is slow operation\n";
	umap::const_iterator iter = std::find_if(map_.begin(), map_.end(), match_unit_id(id));
	if (iter == map_.end() || !iter->second.first) {
		return const_unit_iterator(map_.end(), this);
	}
	return const_unit_iterator(iter, this);
}
Exemplo n.º 3
0
unit_map::const_unit_iterator unit_map::find(const map_location &loc) const {
	lmap::const_iterator iter = lmap_.find(loc);
	if (iter == lmap_.end()) {
		return const_unit_iterator(map_.end(), this);
	}

	umap::const_iterator i = map_.find(iter->second);

	assert(i->second.first);
	return const_unit_iterator(i , this);
}
Exemplo n.º 4
0
unit_map::const_unit_iterator unit_map::begin() const {
	umap::const_iterator i = map_.begin();
	while (i != map_.end() && !is_valid(i)) {
		++i;
	}

	return const_unit_iterator(i, this);
}
Exemplo n.º 5
0
unit_map::const_unit_iterator unit_map::const_unit_iterator::operator++(int){

	assert(i_ != map_->map_.end());

	umap::const_iterator iter(i_);
	++i_;
	while (i_ != map_->map_.end() && !valid()) {
		++i_;
	}

	return const_unit_iterator(iter, map_);
}