File armagetronad-0.2.8.2.1-no_type_punning.patch of Package armagetron

--- src/network/nConfig.cpp
+++ src/network/nConfig.cpp
@@ -378,7 +378,7 @@
         , reverted_( false )
         , group_( c )
         , overrideGroupBehavior_( Behavior_Default )
-        , overrideGroupBehaviorConf_( item.GetTitle() + "_OVERRIDE", reinterpret_cast< int & >( overrideGroupBehavior_ ) )
+        , overrideGroupBehaviorConf_( item.GetTitle() + "_OVERRIDE", overrideGroupBehavior_ )
 {
     sn_StrongWatchersAddRef();
     sn_GetStrongWatchers().insert(this);
@@ -588,18 +588,18 @@
 
 static nConfItemVersionWatcher::Behavior sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Max ] =
     {
-        nConfItemVersionWatcher::Behavior_Block,
-        nConfItemVersionWatcher::Behavior_Block,
-        nConfItemVersionWatcher::Behavior_Nothing,
-        nConfItemVersionWatcher::Behavior_Block,
-        nConfItemVersionWatcher::Behavior_Nothing,
+        Behavior_Block,
+        Behavior_Block,
+        Behavior_Nothing,
+        Behavior_Block,
+        Behavior_Nothing,
     };
 
-static tSettingItem< int > sn_GroupBehaviorBreaks( "SETTING_LEGACY_BEHAVIOR_BREAKING", reinterpret_cast< int & >( sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Breaking] ) );
-static tSettingItem< int > sn_GroupBehaviorBumpy( "SETTING_LEGACY_BEHAVIOR_BUMPY", reinterpret_cast< int & >( sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Bumpy] ) );
-static tSettingItem< int > sn_GroupBehaviorAnnoyance( "SETTING_LEGACY_BEHAVIOR_ANNOYING", reinterpret_cast< int & >( sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Annoying] ) );
-static tSettingItem< int > sn_GroupBehaviorCheat( "SETTING_LEGACY_BEHAVIOR_CHEATING", reinterpret_cast< int & >( sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Cheating] ) );
-static tSettingItem< int > sn_GroupBehaviorDisplay( "SETTING_LEGACY_BEHAVIOR_VISUAL", reinterpret_cast< int & >( sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Visual] ) );
+static tSettingItem< nConfItemVersionWatcher::Behavior > sn_GroupBehaviorBreaks( "SETTING_LEGACY_BEHAVIOR_BREAKING", sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Breaking] );
+static tSettingItem< nConfItemVersionWatcher::Behavior > sn_GroupBehaviorBumpy( "SETTING_LEGACY_BEHAVIOR_BUMPY", sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Bumpy] );
+static tSettingItem< nConfItemVersionWatcher::Behavior > sn_GroupBehaviorAnnoyance( "SETTING_LEGACY_BEHAVIOR_ANNOYING", sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Annoying] );
+static tSettingItem< nConfItemVersionWatcher::Behavior > sn_GroupBehaviorCheat( "SETTING_LEGACY_BEHAVIOR_CHEATING", sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Cheating] );
+static tSettingItem< nConfItemVersionWatcher::Behavior > sn_GroupBehaviorDisplay( "SETTING_LEGACY_BEHAVIOR_VISUAL", sn_GroupBehaviors[ nConfItemVersionWatcher::Group_Visual] );
 
 // *******************************************************************************************
 // *
--- src/network/nConfig.h
+++ src/network/nConfig.h
@@ -210,6 +210,18 @@
     virtual void ReadVal(std::istream &s);
 };
 
+//! how we react on a client with a version incompatible with a setting
+enum nConfigItemBehavior
+{
+    Behavior_Nothing = 0, //!< do nothing, let client on
+    Behavior_Revert = 1,  //!< revert setting to default value
+    Behavior_Block = 2,   //!< don't let the client play at all
+    Behavior_Default = 3  //!< do whatever someone else says
+};
+
+class nConfItemVersionWatcher;
+tCONFIG_ENUM( nConfigItemBehavior );
+
 //! configuration item watcher that shuts out clients that don't support a certain interface
 class nConfItemVersionWatcher: public nIConfItemWatcher
 {
@@ -226,14 +238,7 @@
         Group_Max
     };
 
-    //! how we react on a client with a version incompatible with a setting
-    enum Behavior
-    {
-        Behavior_Nothing = 0, //!< do nothing, let client on
-        Behavior_Revert = 1,  //!< revert setting to default value
-        Behavior_Block = 2,   //!< don't let the client play at all
-        Behavior_Default = 3  //!< do whatever someone else says
-    };
+    typedef nConfigItemBehavior Behavior;
 
     nConfItemVersionWatcher( nConfItemBase & item, Group group, int min, int max = -1 );          //!< constructor
     virtual ~nConfItemVersionWatcher();                      //!< destructor
@@ -255,7 +260,7 @@
 
     Group group_;                                            //!< class of incompatibility
     Behavior overrideGroupBehavior_;                         //!< if set, the global behavior for the class gets ignored
-    tSettingItem< int > overrideGroupBehaviorConf_;          //!< setting item for override
+    tSettingItem< Behavior > overrideGroupBehaviorConf_;     //!< setting item for override
 };
 
 //! convenience helper class: setting item and version watcher combined
--- src/tron/gMenus.cpp
+++ src/tron/gMenus.cpp
@@ -555,7 +555,9 @@
 static uSelectEntry<rSysDep::rSwapMode> swapMode_60Hz(swapMode,"$swapmode_60hz_text","$swapmode_60hz_help",rSysDep::rSwap_60Hz);
 */
 
-static tConfItem<int> swapModeCI("SWAP_MODE", reinterpret_cast< int & >( rSysDep::swapMode_ ) );
+tCONFIG_ENUM( rSysDep::rSwapMode );
+
+static tConfItem< rSysDep::rSwapMode > swapModeCI("SWAP_MODE", rSysDep::swapMode_ );
 
 static tConfItem<REAL> sgs("SPEED_GAUGE_SIZE",subby_SpeedGaugeSize);
 static tConfItem<REAL> sgx("SPEED_GAUGE_LOCX",subby_SpeedGaugeLocX);
--- src/tron/gServerBrowser.cpp
+++ src/tron/gServerBrowser.cpp
@@ -57,7 +57,8 @@
 static tOutput *sg_StartHelpText = NULL;
 
 nServerInfo::QueryType sg_queryType = nServerInfo::QUERY_OPTOUT;
-static tSettingItem< int > sg_query_type( "BROWSER_QUERY_FILTER", reinterpret_cast< int & >( sg_queryType ) );
+tCONFIG_ENUM( nServerInfo::QueryType );
+static tSettingItem< nServerInfo::QueryType > sg_query_type( "BROWSER_QUERY_FILTER", sg_queryType );
 
 class gServerMenuItem;
openSUSE Build Service is sponsored by