GET-TUDA-CHOPPA / SpelunkBots

An API that allows for AI bots to be written in the original 2009 version of Spelunky.
33 stars 13 forks source link

Avoid #define #7

Closed donaldm closed 9 years ago

donaldm commented 9 years ago

I really don't like the use of #define in the code base.

"#pragma region Defines

// Use for functions that take either pixel or node coordinates

define NODE_COORDS 0

define PIXEL_COORDS 1

// Nodes in the x and y axes

define Y_NODES 34

define X_NODES 42

// Number of pixels in each node

define PIXELS_IN_NODES 16

// Variable types - useful for when calling UpdatePlayerVariables()

define BOOLEAN 0

define DOUBLE 1

define STRING 2

pragma endregion"

Most of these values could be const int...

IE:

const int NODE_COORDS = 0;

Also it does not appear that the "Variable types" BOOLEAN, DOUBLE, and STRING are actually used anywhere.

Poliziano commented 9 years ago

Hi donaldm,

As stated, BOOLEAN, DOUBLE and STRING are used in the API function UpdatePlayerVariables. This functions is most useful when using Game Maker Language to write to the console, however in the Bot DLL it is not necessary to use this function as one can use the standard output - it was still included nonetheless.

Kind regards.

donaldm commented 9 years ago

Poliziano,

Perhaps this could be an enum instead of a #define then?