Style Guidelines

Use Allman brace style: opening and closing braces go on their own line.

Use of braceless blocks is allowed.

Try to limit functions to a maximum size (like the amount that would fit on a monitor with a reasonable screen resolution).

Set your editor to strip trailing whitespace on save.

File Operations

When using file i/o based functions, such as fopen() etc or filename string functions, there are some that are not provided, ie retrieving the length of a file, checking if a file exists or not.

Thankfully, Odamex provides some internal functions for doing such. Be sure to check out m_fileio.h before writing your own, it may have already been implemented! If it isn't, write us a patch and send it in.

Some of the useful functions included are:

SDWORD M_FileLength(FILE *) - Returns the length of an open file handle

Filename operations:

BOOL M_FileExists(std::string Filename) - Checks if a file exists or not

BOOL M_AppendExtension(std::string &Filename, std::string Extension, bool If_Needed = true) - Add an extension on to the end of a filename, If_Needed detects if Extension is in Filename, if it isn't, it is added