Andrettin {l Wrote}:I see; do you have a list with the parts of the code where it does that? The only instance of a reference being checked whether it is null I've found so far is in CleanUnits() (in unit.cpp).
The stderr log I had on 51a425569384366459f2b2e957f7db3e36afc427 (this commit didn't compiled, so I did a 1st commit to fix that, and I know myself, I probably cleaned some warns in the process, then I pulled again after playing a bit, and fixed other warnings):
- {l Code}: {l Select All Code}
** tolua warning: Mapping variable to global may degrade performance.
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_board.cpp:53:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_attack.cpp:61:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_build.cpp:60:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_built.cpp:50:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_defend.cpp:54:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_follow.cpp:54:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_move.cpp:55:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_pickup.cpp:56:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_patrol.cpp:54:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_repair.cpp:57:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_resource.cpp:56:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_spellcast.cpp:64:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_still.cpp:57:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_train.cpp:52:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/action/action_use.cpp:55:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
In file included from /home/berenger/contrib/Wyrmgus/src/action/actions.cpp:78:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/action/action_use.cpp:224:68: warning: expression result unused [-Wunused-value]
unit.Player->ChangeResource(goal->Type->GivesResource, (goal->ResourcesHeld, true));
~~~~ ^~~~~~~~~~~~~
1 warning generated.
2 warnings generated.
In file included from /home/berenger/contrib/Wyrmgus/src/action/command.cpp:56:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/ai/ai_building.cpp:45:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/ai/ai_building.cpp:306:30: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
if (unit.Type->Building && !unit.Type->GivesResource == resource) {
^ ~~
/home/berenger/contrib/Wyrmgus/src/ai/ai_building.cpp:306:30: note: add parentheses after the '!' to evaluate the comparison first
if (unit.Type->Building && !unit.Type->GivesResource == resource) {
^
( )
/home/berenger/contrib/Wyrmgus/src/ai/ai_building.cpp:306:30: note: add parentheses around left hand side expression to silence this warning
if (unit.Type->Building && !unit.Type->GivesResource == resource) {
^
( )
2 warnings generated.
In file included from /home/berenger/contrib/Wyrmgus/src/ai/ai_force.cpp:49:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/ai/ai_plan.cpp:47:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/ai/ai_plan.cpp:707:84: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
fprintf(stderr, "AI Player #%d's scout %d is null.\n", AiPlayer->Player->Index, i);
~~ ^
%zu
2 warnings generated.
In file included from /home/berenger/contrib/Wyrmgus/src/ai/ai_resource.cpp:51:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/ai/ai_resource.cpp:439:70: warning: address of array 'unit->Type->ResInfo' will always evaluate to 'true' [-Wpointer-bool-conversion]
return (unit->Type->BoolFlag[HARVESTER_INDEX].value && unit->Type->ResInfo && !unit->Removed);
~~ ~~~~~~~~~~~~^~~~~~~
2 warnings generated.
In file included from /home/berenger/contrib/Wyrmgus/src/editor/editloop.cpp:63:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/editor/editloop.cpp:1614:13: warning: adding 'char' to a string pointer does not append to the string [-Wstring-plus-char]
key = '0' + ptr - UiGroupKeys.c_str();
~~~~^~~~~
/home/berenger/contrib/Wyrmgus/src/editor/editloop.cpp:1614:13: note: use array indexing to silence this warning
2 warnings generated.
In file included from /home/berenger/contrib/Wyrmgus/src/game/trigger.cpp:47:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/map/map.cpp:49:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/map/map_wall.cpp:44:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/missile/missile.cpp:58:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/missile/missile.cpp:1214:8: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (&goal && goal.Variable[THORNSDAMAGE_INDEX].Value && missile.SourceUnit->MapDistanceTo(goal) <= 1) {
^~~~ ~~
2 warnings generated.
In file included from /home/berenger/contrib/Wyrmgus/src/missile/missile_deathcoil.cpp:43:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/missile/missile_flameshield.cpp:42:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/missile/missile_parabolic.cpp:44:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/missile/missile_tracer.cpp:45:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/pathfinder/astar.cpp:43:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/pathfinder/astar.cpp:602:8: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&unit) {
~ ^~~~
2 warnings generated.
/home/berenger/contrib/Wyrmgus/src/sound/sound.cpp:312:8: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&unit) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/sound/sound.cpp:332:8: warning: address of 'source' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (!&source) {
~ ^~~~~~
2 warnings generated.
In file included from /home/berenger/contrib/Wyrmgus/src/spell/spell_areaadjustvital.cpp:39:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/spell/spell_capture.cpp:44:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/spell/spell_demolish.cpp:40:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/spell/spell_polymorph.cpp:49:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/spell/spell_retrain.cpp:39:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/spell/spell_spawnmissile.cpp:41:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/spell/spell_summon.cpp:45:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/spell/spells.cpp:54:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
/home/berenger/contrib/Wyrmgus/src/stratagus/player.cpp:1483:82: warning: address of array 'unit.Type->ResInfo' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (unit.IsAlive() && unit.Type->BoolFlag[HARVESTER_INDEX].value && unit.Type->ResInfo && !unit.Removed) {
~~ ~~~~~~~~~~~^~~~~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/stratagus/script_player.cpp:59:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/stratagus/selection.cpp:51:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/stratagus/selection.cpp:851:64: warning: address of array 'unit.Type->ResInfo' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (unit.Type->BoolFlag[HARVESTER_INDEX].value && unit.Type->ResInfo) { //this selection mode is not for workers
~~ ~~~~~~~~~~~^~~~~~~
2 warnings generated.
/home/berenger/contrib/Wyrmgus/src/ui/botpanel.cpp:1377:10: warning: enumeration values 'ButtonUnit' and 'ButtonEditorUnit' not handled in switch [-Wswitch]
switch (buttonaction.Action) {
^
/home/berenger/contrib/Wyrmgus/src/ui/botpanel.cpp:2021:10: warning: enumeration values 'ButtonUnit' and 'ButtonEditorUnit' not handled in switch [-Wswitch]
switch (CurrentButtons[button].Action) {
^
2 warnings generated.
In file included from /home/berenger/contrib/Wyrmgus/src/ui/interface.cpp:56:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/ui/interface.cpp:702:13: warning: adding 'char' to a string pointer does not append to the string [-Wstring-plus-char]
key = '0' + ptr - UiGroupKeys.c_str();
~~~~^~~~~
/home/berenger/contrib/Wyrmgus/src/ui/interface.cpp:702:13: note: use array indexing to silence this warning
2 warnings generated.
/home/berenger/contrib/Wyrmgus/src/ui/mainscr.cpp:450:10: warning: enumeration values 'VariableChange' and 'VariableIncreaseChange' not handled in switch [-Wswitch]
switch (e) {
^
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/ui/mouse.cpp:66:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/unit/build.cpp:45:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/unit/script_unit.cpp:62:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/unit/unit_draw.cpp:62:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
In file included from /home/berenger/contrib/Wyrmgus/src/unit/unit.cpp:83:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/unit/unit.cpp:4552:73: warning: address of array 'unit.GetAnimations()->Death' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (type->CorpseType || (unit.GetAnimations() && unit.GetAnimations()->Death)) {
~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/home/berenger/contrib/Wyrmgus/src/unit/unit.cpp:5601:8: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; comparison may be assumed to always evaluate to false [-Wtautological-undefined-compare]
if (&unit == NULL) {
^~~~ ~~~~
1 warning generated.
In file included from /home/berenger/contrib/Wyrmgus/src/unit/unit_find.cpp:40:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/unit/unit_find.cpp:539:64: warning: address of array 'unit.Type->ResInfo' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (unit.Type->BoolFlag[HARVESTER_INDEX].value && unit.Type->ResInfo && !unit.Removed) {
~~ ~~~~~~~~~~~^~~~~~~
3 warnings generated.
2 warnings generated.
In file included from /home/berenger/contrib/Wyrmgus/src/unit/upgrade.cpp:75:
/home/berenger/contrib/Wyrmgus/src/include/unit_find.h:224:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&type) {
~ ^~~~
/home/berenger/contrib/Wyrmgus/src/unit/upgrade.cpp:1181:9: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
if (!&unit) {
~ ^~~~
2 warnings generated.
You will notice that unit_find.h:224:9 generates a lot of noise, which is normal, it's a header and is compiled every time it's included.
I didn't fixed some of those warns: the tolua one, which I don't understand anyway, the printf, switch not handling everything and the !GiveResource == resource one that I see you have fixed.
You might want to edit the comits I made, because I removed zombie code on several points. That zombie code is useless (git is here to keep old code, no need to do it manually) and annoying (distract from real code, and can block the feature to jump between corresponding {}() that I use a lot in vim).
Also, I used tabulations for indentation, since I felt like it was the more common but there are 4 space indentations in the files too. That could probably be fixed in few minutes (few seconds to let sed run, and few minutes to check it didn't made things worse, or eventually use astyle) if you have any preference.
Ah, I think it wouldn't be hard to track it by contributor. The contributors who did the code for Stratagus before it was forked into Wyrmgus all did so licensing their code under the GPLv2, for instance. And the contributors to Wyrmgus itself can be easily tracked on GitHub.
True, you can also use various git features like blame and alike, but there is nothing really handy that I know about to know how much of GPL code is still present in current status, which was my point.
Not that I really mind: yes, for my projects I tend to use BSD/MIT-style licences when possible, because I prefer licences I can actually understand, and (L)GPL is hard enough to understand even for lawyers, so... but, it's not my project.
Yeah, I intend to keep working on the game indefinitely
Games can't really be finished, from a coder point of view. There is always the little feature you can add...
Myself seeing this game I have various ideas coming quickly (but I know it's not easy to do): marking tiles of resources to be work on on priority (to clean path), military formations movements (keep ranged behind a nice line of melee while moving, can find that in several games like ages of empires 2), castle siege (but I guess you already have it in mind
)... oh, and now that I think about it, I noticed you can't ask a worker which have gathered some resources to harvest the trunks in which you can hide units.
But it's easy to speak.
I liked Lords of the Realm 2 quite a bit as well. It's mix of a strategic level with a top-down RTS-like mode was a great inspiration for me, actually.
Which explains the strategy mode, I guess. I probably still have the siege pack around, and I don't think I remember any other game having the siege feature. Sad that AI usually sucked a lot, but the feature was still fun and it's true in most games anyway.