Skip to content

Commit

Permalink
Eliminate a few more typedefs
Browse files Browse the repository at this point in the history
  • Loading branch information
fragglet committed Oct 24, 2024
1 parent e287d20 commit 38548e5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/swasynio.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define ABORTMSG "\n\n (Ctrl-C to abort)"

int asynport = DEFAULT_PORT;
asynmode_t asynmode;
enum asyn_mode asynmode;
char asynhost[128];

#define SYNC_IM_PLAYER0 '?'
Expand Down
7 changes: 5 additions & 2 deletions src/swasynio.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
#ifndef __SWASYNIO_H__
#define __SWASYNIO_H__

typedef enum { ASYN_LISTEN, ASYN_CONNECT } asynmode_t;
enum asyn_mode {
ASYN_LISTEN,
ASYN_CONNECT,
};

extern asynmode_t asynmode;
extern enum asyn_mode asynmode;
extern char asynhost[128];
extern int asynport;

Expand Down
15 changes: 7 additions & 8 deletions src/swconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static char *GetConfigFilename(void)
return result;
}

static confoption_t confoptions[] = {
static const struct conf_option confoptions[] = {
{"conf_missiles", CONF_BOOL, {&conf_missiles}},
{"conf_solidground", CONF_BOOL, {&conf_solidground}},
{"conf_hudsplats", CONF_BOOL, {&conf_hudsplats}},
Expand All @@ -69,8 +69,7 @@ static confoption_t confoptions[] = {
{"conf_medals", CONF_BOOL, {&conf_medals}},
{"vid_fullscreen", CONF_BOOL, {&vid_fullscreen}},
{"snd_tinnyfilter", CONF_BOOL, {&snd_tinnyfilter}},

{"conf_video_palette", CONF_INT, {&conf_video_palette}},
{"conf_video_palette", CONF_INT, {&conf_video_palette}},

{"key_accelerate", CONF_KEY, {&keybindings[KEY_ACCEL]}},
{"key_decelerate", CONF_KEY, {&keybindings[KEY_DECEL]}},
Expand All @@ -92,7 +91,7 @@ static void Chomp(char *s)
}
}

static confoption_t *ConfOptionByName(char *name)
static const struct conf_option *ConfOptionByName(char *name)
{
int i;

Expand All @@ -109,7 +108,7 @@ static void ParseConfigLine(char *config_file, int lineno, char *line)
{
char *name, *value, *p;
int key;
confoption_t *opt;
const struct conf_option *opt;

p = line;
Chomp(p);
Expand Down Expand Up @@ -267,7 +266,7 @@ static const char menukeys[] = "1234567890ABCDEFGHIJKL";

static void ChangeKeyBinding(struct menuitem *item)
{
confoption_t *opt;
const struct conf_option *opt;
int key;

Vid_ClearBuf();
Expand Down Expand Up @@ -327,7 +326,7 @@ static void DrawMenu(char *title, struct menuitem *menu)
swcolor(3);

for (i=0, y=0, keynum=0; menu[i].config_name != NULL; ++i, ++y) {
confoption_t *opt;
const struct conf_option *opt;
char *suffix;
char buf[40];
int key;
Expand Down Expand Up @@ -420,7 +419,7 @@ static struct menuitem *MenuItemForKey(struct menuitem *menu, int key)
static int RunMenu(char *title, struct menuitem *menu)
{
struct menuitem *pressed;
confoption_t *opt;
const struct conf_option *opt;
int key;

for (;;) {
Expand Down
5 changes: 2 additions & 3 deletions src/swconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
#ifndef __SWCONF_H__
#define __SWCONF_H__

typedef struct
{
struct conf_option {
char *name;
enum {
CONF_BOOL,
Expand All @@ -30,7 +29,7 @@ typedef struct
bool *b;
int *i;
} value;
} confoption_t;
};

extern void swloadconf(void);
extern void swsaveconf(void);
Expand Down
14 changes: 7 additions & 7 deletions src/swsplat.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
#include "swsplat.h"
#include "swsymbol.h"

typedef struct {
struct splat {
int x, y;
int clr;
sopsym_t *sym;
} splat_t;
};

#define MAX_SPLATS 64

static bool oxsplatted = false;
static splat_t splats[MAX_SPLATS];
static struct splat splats[MAX_SPLATS];
static int num_splats = 0;

void swclearsplats(void)
Expand Down Expand Up @@ -71,18 +71,18 @@ static unsigned long randsd(void)
return 0;
}

static void AddSplat(splat_t *splat)
static void AddSplat(struct splat *splat)
{
if (num_splats < MAX_SPLATS) {
memcpy(&splats[num_splats], splat, sizeof(splat_t));
memcpy(&splats[num_splats], splat, sizeof(struct splat));
++num_splats;
}
}


void swsplatbird(void)
{
splat_t splat;
struct splat splat;

randsd();

Expand All @@ -96,7 +96,7 @@ void swsplatbird(void)

void swwindshot(void)
{
splat_t splat;
struct splat splat;

randsd();

Expand Down

0 comments on commit 38548e5

Please sign in to comment.