pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/input axis.hxx,1.4,1.5 axis_factory.c


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/input axis.hxx,1.4,1.5 axis_factory.cxx,1.5,1.6 button.hxx,1.4,1.5 button_factory.cxx,1.4,1.5 controller.cxx,1.11,1.12 event.hxx,1.3,1.4 pointer.hxx,1.5,1.6 pointer_factory.cxx,1.2,1.3 scroller.hxx,1.2,1.3 scroller_factory.cxx,1.3,1.4
Date: 16 Aug 2002 13:03:39 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/input
In directory dark:/tmp/cvs-serv7129/input

Modified Files:
        axis.hxx axis_factory.cxx button.hxx button_factory.cxx 
        controller.cxx event.hxx pointer.hxx pointer_factory.cxx 
        scroller.hxx scroller_factory.cxx 
Log Message:
- included src/pingus.hxx in every header not containing other pingus headers
- changed ClanLib/gui.h includes to the really required headers


Index: axis.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axis.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- axis.hxx    14 Aug 2002 12:41:22 -0000      1.4
+++ axis.hxx    16 Aug 2002 13:03:36 -0000      1.5
@@ -20,6 +20,8 @@
 #ifndef HEADER_PINGUS_INPUT_AXIS_HXX
 #define HEADER_PINGUS_INPUT_AXIS_HXX
 
+#include "../pingus.hxx"
+
 namespace Input
 {
   /// abstract base class which defines the axis interface

Index: axis_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/axis_factory.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- axis_factory.cxx    15 Aug 2002 11:33:38 -0000      1.5
+++ axis_factory.cxx    16 Aug 2002 13:03:36 -0000      1.6
@@ -36,9 +36,6 @@
     if (!cur)
       throw PingusError("AxisFactory called without an element");
 
-    if (xmlIsBlankNode(cur)) 
-      cur = cur->next;
-
     if ( ! strcmp(reinterpret_cast<const char*>(cur->name), "button-axis"))
       return button_axis(cur);
       
@@ -51,6 +48,9 @@
     else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), "mouse-axis"))
       return mouse_axis(cur);
 
+    else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"multiple-axis"))
+      return multiple_axis(cur->children);
+      
     else
       throw PingusError(std::string("Unknown axis type: ") + ((cur->name) ? 
reinterpret_cast<const char*>(cur->name) : ""));
   }
@@ -64,17 +64,10 @@
     float angle = strtod(angle_str, reinterpret_cast<char**>(NULL));
     free(angle_str);
 
-    cur = cur->children;
-    // FIXME: We should add a helper function for this
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
-
+    cur = XMLhelper::skip_blank(cur->children);
     Button* button1 = ButtonFactory::create(cur);   
 
-    cur = cur->next;
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
-
+    cur = XMLhelper::skip_blank(cur->next);
     Button* button2 = ButtonFactory::create(cur);
            
     return new ButtonAxis(angle, button1, button2);
@@ -132,7 +125,6 @@
   Axis* AxisFactory::multiple_axis (xmlNodePtr cur)
   {
     std::vector<Axis*> axes;
-    cur = cur->children;
     
     while (cur)
       {

Index: button.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/button.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- button.hxx  14 Aug 2002 12:41:22 -0000      1.4
+++ button.hxx  16 Aug 2002 13:03:36 -0000      1.5
@@ -20,6 +20,8 @@
 #ifndef HEADER_PINGUS_INPUT_BUTTON_HXX
 #define HEADER_PINGUS_INPUT_BUTTON_HXX
 
+#include "../pingus.hxx"
+
 namespace Input
 {
   /// abstract base class which defines the button interface

Index: button_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/button_factory.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- button_factory.cxx  11 Jul 2002 15:38:07 -0000      1.4
+++ button_factory.cxx  16 Aug 2002 13:03:36 -0000      1.5
@@ -36,11 +36,8 @@
     if (!cur)
       throw PingusError("ButtonFactory called without an element");
   
-    if (xmlIsBlankNode(cur)) 
-      cur = cur->next;
-
     if ( ! strcmp(reinterpret_cast<const char*>(cur->name), "double-button"))
-      return double_button(cur);
+      return double_button(XMLhelper::skip_blank(cur->children));
       
     else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"joystick-button"))
       return joystick_button(cur);
@@ -52,10 +49,10 @@
       return mouse_button(cur);
 
     else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"multiple-button"))
-      return multiple_button(cur);
+      return multiple_button(cur->children);
     
     else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"triple-button"))
-      return triple_button(cur);
+      return triple_button(XMLhelper::skip_blank(cur->children));
     
     else
       throw PingusError(std::string("Unknown button type: ") + ((cur->name) ? 
reinterpret_cast<const char*>(cur->name) : ""));
@@ -65,16 +62,9 @@
   {
     Button *button1, *button2;
     
-    cur = cur->children;
-
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
     button1 = create(cur);
     
-    cur = cur-> next;  
-
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
+    cur = XMLhelper::skip_blank(cur->next);    
     button2 = create(cur);
             
     return new DoubleButton(button1, button2);
@@ -128,8 +118,6 @@
   {
     std::vector<Button*> buttons;
     
-    cur = cur->children;
-    
     while (cur)
       {
         if (xmlIsBlankNode(cur)) {
@@ -148,22 +136,12 @@
   {
     Button *button1, *button2, *button3;
     
-    cur = cur->children;
-
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
     button1 = create(cur);
     
-    cur = cur-> next;  
-
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
+    cur = XMLhelper::skip_blank(cur->next);    
     button2 = create(cur);
     
-    cur = cur-> next;  
-
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
+    cur = XMLhelper::skip_blank(cur->next);
     button3 = create(cur);
             
     return new TripleButton(button1, button2, button3);

Index: controller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/controller.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- controller.cxx      15 Aug 2002 11:35:13 -0000      1.11
+++ controller.cxx      16 Aug 2002 13:03:36 -0000      1.12
@@ -53,52 +53,51 @@
     
     if (!cur || strcmp(reinterpret_cast<const char*>(cur->name), 
"pingus-controller") != 0)
       throw PingusError("Controller: invalid config file <" + configfile + 
">");
-      
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
+    
+    cur = XMLhelper::skip_blank(cur);  
       
     cur = cur->children;
     
     while (cur) 
       {
-        if (xmlIsBlankNode(cur))
+        if (xmlIsBlankNode(cur)) // explicit check cause we need the continue 
to check for cur again
          {
             cur = cur->next;
            continue;
          }
 
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"controller-config"))
-         cur = cur->children;
+         cur = XMLhelper::skip_blank(cur->children);
          
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"standard-pointer"))
-          standard_pointer = PointerFactory::create(cur->children);
+          standard_pointer = 
PointerFactory::create(XMLhelper::skip_blank(cur->children));
          
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"scroller"))
-         scroller = ScrollerFactory::create(cur->children);
+         scroller = 
ScrollerFactory::create(XMLhelper::skip_blank(cur->children));
          
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"primary-button"))
-         buttons.push_back(std::pair<int, Button*>(primary, 
ButtonFactory::create(cur->children)));
+         buttons.push_back(std::pair<int, Button*>(primary, 
ButtonFactory::create(XMLhelper::skip_blank(cur->children))));
          
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"secondary-button"))
-         buttons.push_back(std::pair<int, Button*>(secondary, 
ButtonFactory::create(cur->children)));
+         buttons.push_back(std::pair<int, Button*>(secondary, 
ButtonFactory::create(XMLhelper::skip_blank(cur->children))));
          
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"pause-button"))
-         buttons.push_back(std::pair<int, Button*>(pause, 
ButtonFactory::create(cur->children)));
+         buttons.push_back(std::pair<int, Button*>(pause, 
ButtonFactory::create(XMLhelper::skip_blank(cur->children))));
 
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"fast-forward-button"))
-         buttons.push_back(std::pair<int, Button*>(fast_forward, 
ButtonFactory::create(cur->children)));
+         buttons.push_back(std::pair<int, Button*>(fast_forward, 
ButtonFactory::create(XMLhelper::skip_blank(cur->children))));
        
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"armageddon-button"))
-         buttons.push_back(std::pair<int, Button*>(armageddon, 
ButtonFactory::create(cur->children)));
+         buttons.push_back(std::pair<int, Button*>(armageddon, 
ButtonFactory::create(XMLhelper::skip_blank(cur->children))));
        
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"escape-button"))
-         buttons.push_back(std::pair<int, Button*>(escape, 
ButtonFactory::create(cur->children)));
+         buttons.push_back(std::pair<int, Button*>(escape, 
ButtonFactory::create(XMLhelper::skip_blank(cur->children))));
        
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"action-buttons"))
-         create_action_buttons(cur->children);
+         create_action_buttons(XMLhelper::skip_blank(cur->children));
        
        else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"action-axis"))
-         action_axis = AxisFactory::create(cur->children);
+         action_axis = 
AxisFactory::create(XMLhelper::skip_blank(cur->children));
          
        else
          throw PingusError(std::string("Unkown Element in Controller Config: 
") + ((cur->name) ? reinterpret_cast<const char*>(cur->name) : ""));
@@ -128,7 +127,6 @@
   void
   Controller::create_action_buttons (xmlNodePtr cur)
   {
-    cur = cur->children;
     int count = 0;
     
     while (cur)
@@ -140,7 +138,7 @@
          }
          
        if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"action-button"))
-         buttons.push_back(std::pair<int, Button*>(action_1 + count, 
ButtonFactory::create(cur)));
+         buttons.push_back(std::pair<int, Button*>(action_1 + count, 
ButtonFactory::create(XMLhelper::skip_blank(cur->children))));
        else
          throw PingusError(std::string("Wrong Element in Controller Config 
(action-buttons): ") + ((cur->name) ? reinterpret_cast<const char*>(cur->name) 
: ""));
        
@@ -185,7 +183,6 @@
            events.push_back(new 
ButtonEvent(static_cast<ButtonName>(buttons[i].first), released));
        }
       
-    std::cout << "ActionAxis: " << action_axis->get_pos() << std::endl;
     if (action_axis->get_pos())
       if (action_axis->get_pos() > 0)
         events.push_back(new AxisEvent(up));

Index: event.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/event.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- event.hxx   11 Jul 2002 15:15:19 -0000      1.3
+++ event.hxx   16 Aug 2002 13:03:36 -0000      1.4
@@ -20,6 +20,8 @@
 #ifndef HEADER_PINGUS_INPUT_EVENT_HXX
 #define HEADER_PINGUS_INPUT_EVENT_HXX
 
+#include "../pingus.hxx"
+
 namespace Input {
 
   enum EventType { ButtonEventType, PointerEventType, AxisEventType, 
ScrollEventType };

Index: pointer.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/pointer.hxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pointer.hxx 14 Aug 2002 12:41:22 -0000      1.5
+++ pointer.hxx 16 Aug 2002 13:03:36 -0000      1.6
@@ -20,6 +20,8 @@
 #ifndef HEADER_PINGUS_INPUT_POINTER_HXX
 #define HEADER_PINGUS_INPUT_POINTER_HXX
 
+#include "../pingus.hxx"
+
 namespace Input
 {
   /// abstract base class defining the pointer interface

Index: pointer_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/pointer_factory.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pointer_factory.cxx 10 Jul 2002 14:06:20 -0000      1.2
+++ pointer_factory.cxx 16 Aug 2002 13:03:36 -0000      1.3
@@ -33,9 +33,6 @@
   {
     if (!cur)
       throw PingusError("PointerFactory called without an element");
-  
-    if (xmlIsBlankNode(cur)) 
-      cur = cur->next;
 
     if ( ! strcmp(reinterpret_cast<const char*>(cur->name), "axis-pointer"))
       return axis_pointer(cur);
@@ -44,7 +41,7 @@
       return mouse_pointer();
       
     else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"multiple-pointer"))
-      return multiple_pointer(cur);
+      return multiple_pointer(cur->children);
       
     else
       throw PingusError(std::string("Unknown pointer type: ") + ((cur->name) ? 
reinterpret_cast<const char*>(cur->name) : ""));
@@ -85,7 +82,6 @@
   Pointer* PointerFactory::multiple_pointer (xmlNodePtr cur)
   {
     std::vector<Pointer*> pointers;
-    cur = cur->children;
 
     while (cur)    
       {

Index: scroller.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/scroller.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- scroller.hxx        14 Aug 2002 12:41:22 -0000      1.2
+++ scroller.hxx        16 Aug 2002 13:03:36 -0000      1.3
@@ -20,6 +20,8 @@
 #ifndef HEADER_PINGUS_INPUT_SCROLLER_HXX
 #define HEADER_PINGUS_INPUT_SCROLLER_HXX
 
+#include "../pingus.hxx"
+
 namespace Input {
 
   /// abstract base class defining the scroller interface

Index: scroller_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/input/scroller_factory.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- scroller_factory.cxx        14 Aug 2002 12:41:22 -0000      1.3
+++ scroller_factory.cxx        16 Aug 2002 13:03:36 -0000      1.4
@@ -42,9 +42,6 @@
     if (!cur)
       throw PingusError("ScrollerFactory called without an element");
   
-    if (xmlIsBlankNode(cur)) 
-      cur = cur->next;
-
     if ( ! strcmp(reinterpret_cast<const char*>(cur->name), "axis-scroller"))
       return axis_scroller(cur);
       
@@ -58,10 +55,10 @@
       return mouse_scroller(cur);
       
     else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"multiple-scroller"))
-      return multiple_scroller(cur);
+      return multiple_scroller(cur->children);
       
     else if ( ! strcmp(reinterpret_cast<const char*>(cur->name), 
"pointer-scroller"))
-      return pointer_scroller(cur);
+      return pointer_scroller(XMLhelper::skip_blank(cur->children));
       
     else
       throw PingusError(std::string("Unknown scroller type: ") + ((cur->name) 
? reinterpret_cast<const char*>(cur->name) : ""));
@@ -113,11 +110,7 @@
     free(invert_y_str);
     
     Scroller* scroller;
-    cur = cur->children;
-    
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
-    
+    cur = XMLhelper::skip_blank(cur->children);
     scroller = create(cur);
     
     return new InvertedScroller(scroller, invert_x, invert_y);
@@ -154,8 +147,6 @@
   {
     std::vector<Scroller*> scrollers;
     
-    cur = cur->children;
-
     while (cur)
       {    
         if (xmlIsBlankNode(cur))
@@ -173,18 +164,10 @@
   {
     Pointer* pointer;
     Button*  button;
-    cur = cur->children;
     
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
-      
     pointer = PointerFactory::create(cur);
     
-    cur = cur->next;
-           
-    if (xmlIsBlankNode(cur))
-      cur = cur->next;
-      
+    cur = XMLhelper::skip_blank(cur->next);
     button = ButtonFactory::create(cur);
     
     return new PointerScroller(pointer, button);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]