Skip to content

Kaiotic/GameCompilation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Each time you edit code online god kills a member of the Itteh-Bitteh-Kitteh-Committeh

Error Logging

If there are unstable passages in the code, or you just need more help to debug, use the ErrorHandler's log(...) method.
It will create an error.txt file (in the directory, where the *.exe is located) with timestamp and a given error message.
Don't log everything as constant file access will be a huge performance issue at some point.

Miscellaneous

Utility.h

Utility also contains a method to initialize a game board (init(...)) and a method to cleanUp a game board (cleanUp(...)).
init() initializes all X/Y coordinates and its value. cleanUp() frees the memory.

nansi_Utility.h

nansi_Utility.h contains utility methods that are not covered by the ANSI C standard.

Boolean.h

If you need a boolean somewhere, include Boolean.h and use TRUE / FALSE.

Field.h

Field.h has a typedef Field_t.
This holds a color and a character value.
This will be used to represent the game board.

GameCompilation

Style Guidelines

  • Function parameters are prefixed with an underscore

    int add(int _iX, int _iY) { ... }
  • Strings are passed to functions as a const char*

    void print(const char* _String) { ... }
  • External variables are prefixed with "ext_"

    external int ext_iAge
  • Structs are declared as typedef and suffixed with "_t"

      typedef struct Person { ... } Person_t
      Person_t* person = (Person_t*)malloc(...)
      
  • Pointers are declared as follows

    int* x = &myInt
  • Initialize variables in the declaration

      int i = 0;
      char c = '\0';
      float f = 0.0;
      double d = 0.0;
      
  • Header Guard (for every header file, replace HEADERNAME with actual name)

      #ifndef HEADERNAME_H_INCLUDED
      #define HEADERNAME_H_INCLUDED
        ... code ...
      #endif //HEADERNAME_H_INCLUDED
      
  • Global variables are prefixed with "g_"

    Field_t* g_Board;

Releases

No releases published

Packages

No packages published