Open yakra opened 1 year ago
HighwaySegment::waypoint1 and waypoint2 could become functions. Saves a chunk of RAM, but would things run slower?
HighwaySegment::waypoint1
waypoint2
Waypoint* HighwaySegment::waypoint1() { return this - route->segment_list.data() + route->point_list.data(); } Waypoint* HighwaySegment::waypoint2() { return this - route->segment_list.data() + route->point_list.data() + 1; }
Would functions returning pointers to a Waypoint's adjacent HighwaySegments be useful? Maybe for concurrency detection or concurrency augments?
HighwaySegment* Waypoint::segment1() { size_t index = this - route->point_list.data(); return index ? route->segment_list.data() + index - 1 : 0; } HighwaySegment* Waypoint::segment2() { size_t index = this - route->point_list.data(); return index != route->point_list.data() + route->point_list.size() - 1 ? route->segment_list.data() + index - 1 : 0; }
After Waypoints & HighwaySegment objects are stored in sequential memory:
HighwaySegment::waypoint1
andwaypoint2
could become functions. Saves a chunk of RAM, but would things run slower?Would functions returning pointers to a Waypoint's adjacent HighwaySegments be useful? Maybe for concurrency detection or concurrency augments?