Coding best practice: Always use enums instead of #defines to define integer constants (for many good reasons)

svn-id: r43881
This commit is contained in:
Max Horn 2009-09-01 13:02:47 +00:00
parent 2ed53f98b4
commit 8e28469f1f
2 changed files with 14 additions and 6 deletions

View file

@ -69,7 +69,9 @@ enum {
/* the first critical error number */
};
#define MAX_OPENED_VOLUMES 5 // Max number of simultaneously opened volumes
enum {
MAX_OPENED_VOLUMES = 5 // Max number of simultaneously opened volumes
};
enum ResSourceType {
kSourceDirectory = 0,
@ -81,9 +83,11 @@ enum ResSourceType {
kSourceExtAudioMap
};
#define SCI0_RESMAP_ENTRIES_SIZE 6
#define SCI1_RESMAP_ENTRIES_SIZE 6
#define SCI11_RESMAP_ENTRIES_SIZE 5
enum {
SCI0_RESMAP_ENTRIES_SIZE = 6,
SCI1_RESMAP_ENTRIES_SIZE = 6,
SCI11_RESMAP_ENTRIES_SIZE = 5
};
enum ResourceType {
kResourceTypeView = 0,
@ -278,7 +282,9 @@ protected:
// Note: maxMemory will not be interpreted as a hard limit, only as a restriction
// for resources which are not explicitly locked. However, a warning will be
// issued whenever this limit is exceeded.
#define MAX_MEMORY 256 * 1024 // 256KB
enum {
MAX_MEMORY = 256 * 1024 // 256KB
};
ViewType _viewType; // Used to determine if the game has EGA or VGA graphics
Common::List<ResourceSource *> _sources;