[Scummvm-cvs-logs] SF.net SVN: scummvm:[43881] scummvm/trunk/engines

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Sep 1 15:02:47 CEST 2009


Revision: 43881
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43881&view=rev
Author:   fingolfin
Date:     2009-09-01 13:02:47 +0000 (Tue, 01 Sep 2009)

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

Modified Paths:
--------------
    scummvm/trunk/engines/sci/resource.h
    scummvm/trunk/engines/sword2/memory.h

Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h	2009-09-01 13:02:24 UTC (rev 43880)
+++ scummvm/trunk/engines/sci/resource.h	2009-09-01 13:02:47 UTC (rev 43881)
@@ -69,7 +69,9 @@
 	/* 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 @@
 	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 @@
 	// 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;

Modified: scummvm/trunk/engines/sword2/memory.h
===================================================================
--- scummvm/trunk/engines/sword2/memory.h	2009-09-01 13:02:24 UTC (rev 43880)
+++ scummvm/trunk/engines/sword2/memory.h	2009-09-01 13:02:47 UTC (rev 43881)
@@ -28,7 +28,9 @@
 #ifndef	SWORD2_MEMORY_H
 #define	SWORD2_MEMORY_H
 
-#define MAX_MEMORY_BLOCKS 999
+enum {
+	MAX_MEMORY_BLOCKS = 999
+};
 
 namespace Sword2 {
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list