Fixed issue where send_event() didn't send the optional argument anymore
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sat, 21 Jun 2014 18:24:41 +0000 (18:24 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sat, 21 Jun 2014 18:24:41 +0000 (18:24 +0000)
mmsoftware/mystic_ships/client/src/main.c

index 9d711d8..0c58119 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.3 2014/06/21 17:16:32 mmondor Exp $ */
+/* $Id: main.c,v 1.4 2014/06/21 18:24:41 mmondor Exp $ */
 
 /*
  * Copyright (c) 2006, Matthew Mondor
@@ -70,7 +70,7 @@ int                   main(int, char **);
 
 static void            axis_angle_update(void);
 static void            handle_uevent(SDL_Event *);
-static void            send_event(int, ...);
+static void            send_event(int, int);
 
 static SDL_Surface     *bmp_load_key(void *, size_t);
 static int             surface_blit_angle(SDL_Surface *, int, int, int);
@@ -470,28 +470,28 @@ handle_uevent(SDL_Event *ev)
 
                switch (ev->jbutton.button) {
                case 0:
-                       send_event(UE_TORP);
+                       send_event(UE_TORP, -1);
                        break;
                case 1:
-                       send_event(UE_PHASER);
+                       send_event(UE_PHASER, -1);
                        break;
                case 2:
                        send_event(UE_DIRECTION, joy_angle);
                        break;
                case 3:
-                       send_event(UE_PLASMA);
+                       send_event(UE_PLASMA, -1);
                        break;
                case 4:
-                       send_event(UE_SHIELD);
+                       send_event(UE_SHIELD, -1);
                        break;
                case 5:
-                       send_event(UE_CLOAK);
+                       send_event(UE_CLOAK, -1);
                        break;
                case 6:
-                       send_event(UE_THRUST_ACC);
+                       send_event(UE_THRUST_ACC, -1);
                        break;
                case 7:
-                       send_event(UE_THRUST_DEC);
+                       send_event(UE_THRUST_DEC, -1);
                        break;
                }
 
@@ -535,27 +535,27 @@ handle_uevent(SDL_Event *ev)
                        send_event(UE_DIRECTION, joy_angle);
                        break;
                case SDLK_z:
-                       send_event(UE_THRUST_ACC);
+                       send_event(UE_THRUST_ACC, -1);
                        break;
                case SDLK_a:
-                       send_event(UE_THRUST_DEC);
+                       send_event(UE_THRUST_DEC, -1);
                        break;
                /* Weapons */
                case SDLK_SPACE:
-                       send_event(UE_TORP);
+                       send_event(UE_TORP, -1);
                        break;
                case SDLK_f:
-                       send_event(UE_PHASER);
+                       send_event(UE_PHASER, -1);
                        break;
                case SDLK_g:
-                       send_event(UE_PLASMA);
+                       send_event(UE_PLASMA, -1);
                        break;
                /* Toggles */
                case SDLK_s:
-                       send_event(UE_SHIELD);
+                       send_event(UE_SHIELD, -1);
                        break;
                case SDLK_w:
-                       send_event(UE_CLOAK);
+                       send_event(UE_CLOAK, -1);
                        break;
                default:
                        break;
@@ -570,13 +570,13 @@ handle_uevent(SDL_Event *ev)
 }
 
 static void
-send_event(int type, ...)
+send_event(int type, int arg1)
 {
        int     ch, err = 0;
 
        switch (type) {
        case UE_DIRECTION:
-               err = cpacket_direction_send(((int *)&type)[1]);
+               err = cpacket_direction_send(arg1);
                break;
        case UE_TORP:
                if ((ch = Mix_PlayChannel(-1, snd_torp, 0)) != -1)