Changes

Jump to navigation Jump to search
54 bytes added ,  15:16, 25 October 2018
m
Text replacement - "</source>" to "</syntaxhighlight>"
<syntaxhighlight lang="cpp">
#include "common/pack-start.h" // START STRUCT PACKING
</sourcesyntaxhighlight>
* After the struct(s) you need to be packed, insert
<syntaxhighlight lang="cpp">
#include "common/pack-end.h" // END STRUCT PACKING
</sourcesyntaxhighlight>
* At the "end" of each struct you need to be packed, insert the following between the closing } and the ; after it:
<syntaxhighlight lang="cpp">
PACKED_STRUCT
</sourcesyntaxhighlight>
You may want to look at some files which already do that, e.g. look at <code>engines/scumm/boxes.cpp</code>
return bar;
}
</sourcesyntaxhighlight>
Suppose this function is part of engine quux. When a new game using this engine is started, foo(false) will initially always return false. After foo(true) has been called the first time, foo will always return true. Maybe foo(true) is called when the user/player solves a certain puzzle in the game, and maybe the foo() function is meant to test whether this puzzle has already been solved.
Now imagine the player uses the "return to launcher" feature; once back in the launcher, they restart the game, again using the quux engine.
<syntaxhighlight lang="cpp">
static int myGlobal = 0;
</sourcesyntaxhighlight>
is ''not'' sufficient.
<syntaxhighlight lang="cpp">
// FIXME: non-const global var
</sourcesyntaxhighlight>
As a minor exception, if an existing engine uses many globals (due to not (yet) being objectified), it is permissible to use a single comment to document multiple globals at once.
TrustedUser
1,986

edits

Navigation menu