summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/copsnrob.h
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-02-25 06:28:03 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-02-25 06:28:03 +0000
commitcfa887f3de933df22134893751072819c7aa1e02 (patch)
tree7e048056ee2487e7a98d54eeb93a15f052a59746 /src/mame/includes/copsnrob.h
parentcff01e5501239ea93293e26b28b04b915d4d0c1c (diff)
Changed all driver_data structs into classes with a simple
constructor and a static allocation function. Changed MDRV_DRIVER_DATA to reference driver_data::alloc instead of just providing a size. This function is called to allocate the driver data. This allows objects to be embedded in the state data and be properly initialized. Ideally, new driver_data constructors should perform initialization actions in the constructor, but for now most just use auto_alloc_clear() to blast everything to zero. Moved driver data allocation after device list construction so that devices can be found when the driver data is constructed.
Diffstat (limited to 'src/mame/includes/copsnrob.h')
-rw-r--r--src/mame/includes/copsnrob.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mame/includes/copsnrob.h b/src/mame/includes/copsnrob.h
index 7bbb8a55f60..d826702bb77 100644
--- a/src/mame/includes/copsnrob.h
+++ b/src/mame/includes/copsnrob.h
@@ -4,9 +4,13 @@
*************************************************************************/
-typedef struct _copsnrob_state copsnrob_state;
-struct _copsnrob_state
+class copsnrob_state
{
+public:
+ static void *alloc(running_machine &machine) { return auto_alloc_clear(&machine, copsnrob_state(machine)); }
+
+ copsnrob_state(running_machine &machine) { }
+
/* memory pointers */
UINT8 * videoram;
UINT8 * trucky;