Fix clang build of fuelcen.cpp

clang treats names introduced by structured bindings specially, and
refuses to capture them for a lambda, even when it should be capturing
an rvalue reference.  gcc accepts this capture.

Switch to initializing a lambda local variable from the structured
binding in the outer scope, which works with both compilers.

Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/issues/609>
This commit is contained in:
Kp 2021-11-04 03:24:43 +00:00
parent d604518563
commit 4ac9845f07

View file

@ -653,7 +653,7 @@ void init_all_matcens(void)
station.Enabled = 0;
station.Disable_time = 0;
// Make sure this fuelcen is pointed at by a matcen.
if (std::find_if(robot_range.begin(), robot_range.end(), [i](const matcen_info &mi) {
if (std::find_if(robot_range.begin(), robot_range.end(), [i = i](const matcen_info &mi) {
return mi.fuelcen_num == i;
}) == robot_range.end())
{