+struct gate_hit
+{
+ struct nonlocal_gate *nonlocal;
+ struct route_gate *route;
+ teleport_gate *gate;
+};
+
+/*
+ * Intersect all gates in the world
+ */
+VG_STATIC int world_intersect_gates( world_instance *world,
+ v3f pos, v3f last, struct gate_hit *hit )
+{
+ for( int i=0; i<world->gate_count; i++ )
+ {
+ struct route_gate *rg = &world->gates[i];
+ teleport_gate *gate = &rg->gate;
+
+ if( gate_intersect( gate, pos, last ) )
+ {
+ hit->gate = gate;
+ hit->nonlocal = NULL;
+ hit->route = rg;
+ return 1;