From 22bc606d07e6d5be5ebbbbe1e343b8e0d20afab2 Mon Sep 17 00:00:00 2001 From: skyjake Date: Fri, 13 Jul 2012 10:26:41 +0300 Subject: [PATCH] Bindings: Fixed a potentially dangerous assumption about cbdevtype_t The enumeration cbdevtype_e is now explicitly defined to match the values of the ddevent types, as that how it is expected to be used. --- doomsday/engine/portable/include/b_device.h | 6 +++--- doomsday/engine/portable/src/b_context.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doomsday/engine/portable/include/b_device.h b/doomsday/engine/portable/include/b_device.h index 709bacddbd..7ce9e52838 100644 --- a/doomsday/engine/portable/include/b_device.h +++ b/doomsday/engine/portable/include/b_device.h @@ -32,9 +32,9 @@ #include "b_util.h" typedef enum cbdevtype_e { - CBD_TOGGLE, - CBD_AXIS, - CBD_ANGLE, + CBD_TOGGLE = E_TOGGLE, + CBD_AXIS = E_AXIS, + CBD_ANGLE = E_ANGLE, NUM_CBD_TYPES } cbdevtype_t; diff --git a/doomsday/engine/portable/src/b_context.c b/doomsday/engine/portable/src/b_context.c index 3bd3bb943c..80e32a2bda 100644 --- a/doomsday/engine/portable/src/b_context.c +++ b/doomsday/engine/portable/src/b_context.c @@ -768,7 +768,7 @@ boolean B_FindMatchingBinding(bcontext_t* bc, evbinding_t* match1, { if(B_AreConditionsEqual(match2->numConds, match2->conds, e->numConds, e->conds) && match2->device == e->device && match2->id == e->id && - match2->type == e->type) + match2->type == (cbdevtype_t) e->type) { *evResult = e; return true; @@ -786,7 +786,7 @@ boolean B_FindMatchingBinding(bcontext_t* bc, evbinding_t* match1, { if(B_AreConditionsEqual(match1->numConds, match1->conds, d->numConds, d->conds) && match1->device == d->device && match1->id == d->id && - match1->type == d->type) + match1->type == (ddeventtype_t) d->type) { *dResult = d; return true;