HomeWildfire Games

Adds a helper function to pick entities with a given component and a given…
AuditedrP22939

Description

Adds a helper function to pick entities with a given component and a given filter on screen.

Reviewed By: wraitii
Commented By: Stan, elexis
Differential Revision: https://code.wildfiregames.com/D2207

Event Timeline

elexis raised a concern with this commit.EditedSep 20 2019, 2:27 PM
elexis added a subscriber: elexis.

Edit: without precompiled headers

Cannot compile on clang 8.0.1:

In file included from ../../../source/simulation2/helpers/Selection.cpp:20:
../../../source/simulation2/helpers/Selection.h:85:2: error: use of undeclared identifier 'PROFILE2'
        PROFILE2("GetEntitiesWithObstructionInRect");
        ^
1 error generated.
make[1]: *** [simulation2.make:479: obj/simulation2_Release/Selection.o] Error 1
make: *** [Makefile:97: simulation2] Error 2
make: *** Waiting for unfinished jobs....
CChart.cpp
CCheckBox.cpp
In file included from ../../../source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp:53:
../../../source/simulation2/helpers/Selection.h:85:2: error: use of undeclared identifier 'PROFILE2'
        PROFILE2("GetEntitiesWithObstructionInRect");
        ^
1 error generated.
TerrainHandlers.cpp
make[1]: *** [atlas.make:193: obj/atlas_Release/ObjectHandlers.o] Error 1

On gcc 9.1.0:

In file included from ../../../source/simulation2/helpers/Selection.cpp:20:
../../../source/simulation2/helpers/Selection.h: In function ‘std::vector<unsigned int> EntitySelection::GetEntitiesWithComponentInRect(CSimulation2&, int, const CCamera&, int, int, int, int)’:
../../../source/simulation2/helpers/Selection.h:85:2: error: there are no arguments to ‘PROFILE2’ that depend on a template parameter, so a declaration of ‘PROFILE2’ must be available [-fpermissive]
   85 |  PROFILE2("GetEntitiesWithObstructionInRect");
      |  ^~~~~~~~
../../../source/simulation2/helpers/Selection.h:85:2: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
make[1]: *** [simulation2.make:479: obj/simulation2_Release/Selection.o] Error 1
make: *** [Makefile:97: simulation2] Error 2
make: *** Waiting for unfinished jobs....
CProgressBar.cpp
In file included from ../../../source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp:53:
../../../source/simulation2/helpers/Selection.h: In function ‘std::vector<unsigned int> EntitySelection::GetEntitiesWithComponentInRect(CSimulation2&, int, const CCamera&, int, int, int, int)’:
../../../source/simulation2/helpers/Selection.h:85:2: error: there are no arguments to ‘PROFILE2’ that depend on a template parameter, so a declaration of ‘PROFILE2’ must be available [-fpermissive]
   85 |  PROFILE2("GetEntitiesWithObstructionInRect");
      |  ^~~~~~~~
../../../source/simulation2/helpers/Selection.h:85:2: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
make[1]: *** [atlas.make:193: obj/atlas_Release/ObjectHandlers.o] Error 1
make: *** [Makefile:121: atlas] Error 2
This commit now has outstanding concerns.Sep 20 2019, 2:27 PM
elexis added inline comments.Sep 20 2019, 2:31 PM
/ps/trunk/source/simulation2/scripting/JSInterface_Simulation.cpp
131
../../../source/simulation2/scripting/JSInterface_Simulation.cpp: In function ‘std::vector<unsigned int> JSI_Simulation::GetEntitiesWithStaticObstructionOnScreen(ScriptInterface::CxPrivate*)’:
../../../source/simulation2/scripting/JSInterface_Simulation.cpp:120:111: warning: unused parameter ‘pCxPrivate’ [-Wunused-parameter]
  120 | std::vector<entity_id_t> JSI_Simulation::GetEntitiesWithStaticObstructionOnScreen(ScriptInterface::CxPrivate* pCxPrivate)
vladislavbelov requested verification of this commit.Sep 20 2019, 9:46 PM
This commit now requires verification by auditors.Sep 20 2019, 9:46 PM
elexis accepted this commit.Sep 20 2019, 9:49 PM

Thanks for the patch and the fix!

All concerns with this commit have now been addressed.Sep 20 2019, 9:49 PM