if (!vec.empty()) return dynamic_cast<Barge_object *> (vec.front()); else return 0;
Tile_coord pos = obj->get_tile(); Barge_object *best = 0; for (Game_object_vector::const_iterator it = vec.begin(); it != vec.end(); it++) { barge = dynamic_cast<Barge_object *> (*it); if (barge && barge->get_tile_footprint().has_point( pos.tx, pos.ty)) { int lift = barge->get_lift(); if (!best ||  (best->get_lift() > pos.tz && lift <= pos.tz) ||  (lift <= pos.tz && lift > best->get_lift())) best = barge; } } return best;
Barge_object *Get_barge	(	Game_object *obj	)	{	Game_object_vector vec;		// Find it within 20 tiles (egglike).	obj->find_nearby(vec, 961, 20, 0x10);	if (vec.size() > 1)		// Sort right-left, near-far.		std::sort(vec.begin(), vec.end(), Object_reverse_sorter());	if (!vec.empty())		return dynamic_cast<Barge_object *> (vec.front());	else		return 0;	}