I think naming is a minor issue, comparing to indentation/braces stuff.
Cataclysm uses sort of C-like STL-ish naming.
Here’s my proposal, it’s sort of Java-like, and I’ve managed to convience at least few people to this naming scheme
(although initially some of them were rather sceptic, it just works IRL).
[ul][li] name of classes, structs and enums (any type basically, [tt]CamelCaps[/tt] [/li]
[li] name of variables, fields, objects, arguments: [tt]headlessCamelCase[/tt]
[list]
[li] Additionally class/struct members prefixed with [tt]“m_”[/tt] [/li]
[/list]
[/li]
[li] macros and defines: [tt]ALL_UPPER_UNDERSCORE_DELIMITED[/tt] [/li]
[li] name of constants and enum elements: [tt]Camel_Caps_Underscore_Delimited[/tt] [/li][/ul]
There are few ‘pro-s’ of this naming, which boils to the thing, that differentiation of different thing is much easier:
[ul][li]differentiate between classes and functions[/li]
[li]differentiate constants from macros/defines[/li]
[li]distinguish locals from members on the spot (and easier completion, you usually know whether you want member or local when typing…)[/li][/ul]
example follows:
static const size_t Lightmap_X = (2 * See_X + 1);
static const size_t Lightmap_Y = (2 * See_Y + 1);
static const size_t Lightmap_Cache_X = (2 * Lightmap_Range_X + 1);
static const size_t Lightmap_Cache_Y = (2 * Lightmap_Range_Y + 1);
class LightMap
{
public:
LightMap();
void generate(Game* g, int x, int y, float naturalLight, float luminance);
LitLevel at(int dx, int dy); // Assumes 0,0 is light map center
float ambientAt(int dx, int dy); // Raw values for tilesets
bool isOutside(int dx, int dy);
bool sees(int fx, int fy, int tx, int ty, int maxRange);
private:
typedef LightMapCache LightCache[Lightmap_Cache_X][Lightmap_Cache_Y];
float m_lm[Lightmap_X][Lightmap_Y];
float m_sm[Lightmap_X][Lightmap_Y];
bool m_outsideCache[Lightmap_Cache_X][Lightmap_Cache_Y];
LightCache m_cache;
void applyLightSource(int x, int y, int cx, int cy, float luminance);
void applyLightArc(int x, int y, int angle, int cx, int cy, float luminance);
void applyLightRay(bool lit[Lightmap_X][Lightmap_Y], int sx, int sy,
int ex, int ey, int cx, int cy, float luminance);
void buildOutsideCache(Map* m, const int x, const int y, const int sx, const int sy);
void buildLightCache(Game* g, int x, int y);
};
As I’ve said, I don’t think it’s really important, but just wanted to know your opinion