Skip to content

Commit

Permalink
Change time to harris_time to not clash with system symbol
Browse files Browse the repository at this point in the history
    ./types.h:40:1: error: redefinition of 'time' as different kind of symbol
    time;
    ^
    /usr/include/time.h:154:8: note: previous definition is here
    time_t time(time_t *);
           ^
  • Loading branch information
AMDmi3 committed Mar 14, 2015
1 parent 3d097a3 commit 439b2d4
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 73 deletions.
6 changes: 3 additions & 3 deletions date.c
Expand Up @@ -96,12 +96,12 @@ void drawmoon(SDL_Surface *s, double phase)
}
}

inline time maketime(int t)
inline harris_time maketime(int t)
{
return((time){(12+(t/120))%24, (t/2)%60});
return((harris_time){(12+(t/120))%24, (t/2)%60});
}

inline unsigned int rrtime(time t)
inline unsigned int rrtime(harris_time t)
{
int h=t.hour-12;
if(h<0) h+=24;
Expand Down
6 changes: 3 additions & 3 deletions date.h
Expand Up @@ -20,8 +20,8 @@ int diffdate(date date1, date date2); // returns <0 if date1<date2, >0 if date1>
double pom(date when); // returns in [0,1); 0 for new moon, 0.5 for full moon
double foldpom(double pom); // returns illumination in [0,1]
void drawmoon(SDL_Surface *s, double phase); // renders moon to image
time maketime(int t); // converts run_raid time to clock time
unsigned int rrtime(time t); // converts clock time to run_raid time
harris_time maketime(int t); // converts run_raid time to clock time
unsigned int rrtime(harris_time t); // converts clock time to run_raid time
date nextday(date when); // computes the date 1 day after the given one
#define TM(H,M) (time){.hour=(H), .minute=(M)}
#define TM(H,M) (harris_time){.hour=(H), .minute=(M)}
#define RRT(H,M) rrtime(TM((H),(M)))
44 changes: 22 additions & 22 deletions history.c
Expand Up @@ -124,7 +124,7 @@ int hist_load(FILE *in, size_t nents, history *hist)
return(0);
}

int ev_append(history *hist, date d, time t, const char *ev)
int ev_append(history *hist, date d, harris_time t, const char *ev)
{
char *p=hist_alloc(hist);
if(!p) return(1);
Expand All @@ -136,7 +136,7 @@ int ev_append(history *hist, date d, time t, const char *ev)
return(0);
}

int eva_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, const char *ev)
int eva_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, const char *ev)
{
char buf[HIST_LINE];
size_t i=sprintf(buf, "A ");
Expand All @@ -148,133 +148,133 @@ int eva_append(history *hist, date d, time t, acid id, bool ftr, unsigned int ty
return(ev_append(hist, d, t, buf));
}

int ct_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type)
int ct_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type)
{
return(eva_append(hist, d, t, id, ftr, type, "CT"));
}

int na_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, unsigned int nid)
int na_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, unsigned int nid)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "NA %u", nid);
return(eva_append(hist, d, t, id, ftr, type, buf));
}

int pf_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type)
int pf_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type)
{
return(eva_append(hist, d, t, id, ftr, type, "PF"));
}

int ra_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, unsigned int tid)
int ra_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, unsigned int tid)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "RA %u", tid);
return(eva_append(hist, d, t, id, ftr, type, buf));
}

int hi_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, unsigned int tid, unsigned int bmb)
int hi_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, unsigned int tid, unsigned int bmb)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "HI %u %u", tid, bmb);
return(eva_append(hist, d, t, id, ftr, type, buf));
}

int dmac_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, acid src)
int dmac_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, acid src)
{
char buf[HIST_LINE];
size_t i=snprintf(buf, 72, "DM %a %a AC ", ddmg, cdmg);
pacid(src, buf+i);
return(eva_append(hist, d, t, id, ftr, type, buf));
}

int dmfk_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, unsigned int fid)
int dmfk_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, unsigned int fid)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "DM %a %a FK %u", ddmg, cdmg, fid);
return(eva_append(hist, d, t, id, ftr, type, buf));
}

int dmtf_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, unsigned int tid)
int dmtf_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, unsigned int tid)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "DM %a %a TF %u", ddmg, cdmg, tid);
return(eva_append(hist, d, t, id, ftr, type, buf));
}

int fa_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, unsigned int fa)
int fa_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, unsigned int fa)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "FA %u", fa);
return(eva_append(hist, d, t, id, ftr, type, buf));
}

int cr_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type)
int cr_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type)
{
return(eva_append(hist, d, t, id, ftr, type, "CR"));
}

int ob_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type)
int ob_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type)
{
return(eva_append(hist, d, t, id, ftr, type, "OB"));
}

int evt_append(history *hist, date d, time t, unsigned int tid, const char *ev)
int evt_append(history *hist, date d, harris_time t, unsigned int tid, const char *ev)
{
char buf[HIST_LINE];
size_t i=snprintf(buf, HIST_LINE, "T %u ", tid);
strncpy(buf+i, ev, HIST_LINE-i);
return(ev_append(hist, d, t, buf));
}

int tdm_append(history *hist, date d, time t, unsigned int tid, double ddmg, double cdmg)
int tdm_append(history *hist, date d, harris_time t, unsigned int tid, double ddmg, double cdmg)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "DM %a %a", ddmg, cdmg);
return(evt_append(hist, d, t, tid, buf));
}

int tfk_append(history *hist, date d, time t, unsigned int tid, double dflk, double cflk)
int tfk_append(history *hist, date d, harris_time t, unsigned int tid, double dflk, double cflk)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "FK %a %a", dflk, cflk);
return(evt_append(hist, d, t, tid, buf));
}

int tsh_append(history *hist, date d, time t, unsigned int tid)
int tsh_append(history *hist, date d, harris_time t, unsigned int tid)
{
return(evt_append(hist, d, t, tid, "SH"));
}

int evm_append(history *hist, date d, time t, const char *ev)
int evm_append(history *hist, date d, harris_time t, const char *ev)
{
char buf[HIST_LINE];
size_t i=sprintf(buf, "M ");
strncpy(buf+i, ev, HIST_LINE-i);
return(ev_append(hist, d, t, buf));
}

int ca_append(history *hist, date d, time t, unsigned int cshr, unsigned int cash)
int ca_append(history *hist, date d, harris_time t, unsigned int cshr, unsigned int cash)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "CA %u %u", cshr, cash);
return(evm_append(hist, d, t, buf));
}

int co_append(history *hist, date d, time t, double confid)
int co_append(history *hist, date d, harris_time t, double confid)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "CO %a", confid);
return(evm_append(hist, d, t, buf));
}

int mo_append(history *hist, date d, time t, double morale)
int mo_append(history *hist, date d, harris_time t, double morale)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "MO %a", morale);
return(evm_append(hist, d, t, buf));
}

int gp_append(history *hist, date d, time t, unsigned int iclass, double gprod, double dprod)
int gp_append(history *hist, date d, harris_time t, unsigned int iclass, double gprod, double dprod)
{
char buf[HIST_LINE];
snprintf(buf, HIST_LINE, "GP %u %a %a", iclass, gprod, dprod);
Expand Down
42 changes: 21 additions & 21 deletions history.h
Expand Up @@ -17,26 +17,26 @@ int hist_clear(history *hist); // Empty the history (freeing all events)
int hist_save(history hist, FILE *out); // Write history out to file
int hist_load(FILE *in, size_t nents, history *hist); // Read history in from file. Not a mirror of hist_save, since it doesn't read nents itself (this is for reasons related to how loadgame functions)

int eva_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, const char *ev); // Append an aircraft event to the history
int ct_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type); // Append a CT (constructed) event to the history
int na_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, unsigned int nid); // Append a NA (navaid) event to the history
int pf_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type); // Append a PF (PFF assign) event to the history
int ra_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, unsigned int tid); // Append a RA (raid targ) event to the history
int hi_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, unsigned int tid, unsigned int bmb); // Append a HI (hit targ) event to the history
int dmac_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, acid src); // Append a DM AC (damaged by aircraft) event to the history
int dmfk_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, unsigned int fid); // Append a DM FK (damaged by flak) event to the history
int dmtf_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, unsigned int tid); // Append a DM TF (damaged by target flak) event to the history
int fa_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type, unsigned int fa); // Append a FA (failed) event to the history
int cr_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type); // Append a CR (crashed) event to the history
int ob_append(history *hist, date d, time t, acid id, bool ftr, unsigned int type); // Append an OB (obsolete) event to the history
int eva_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, const char *ev); // Append an aircraft event to the history
int ct_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type); // Append a CT (constructed) event to the history
int na_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, unsigned int nid); // Append a NA (navaid) event to the history
int pf_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type); // Append a PF (PFF assign) event to the history
int ra_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, unsigned int tid); // Append a RA (raid targ) event to the history
int hi_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, unsigned int tid, unsigned int bmb); // Append a HI (hit targ) event to the history
int dmac_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, acid src); // Append a DM AC (damaged by aircraft) event to the history
int dmfk_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, unsigned int fid); // Append a DM FK (damaged by flak) event to the history
int dmtf_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, double ddmg, double cdmg, unsigned int tid); // Append a DM TF (damaged by target flak) event to the history
int fa_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type, unsigned int fa); // Append a FA (failed) event to the history
int cr_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type); // Append a CR (crashed) event to the history
int ob_append(history *hist, date d, harris_time t, acid id, bool ftr, unsigned int type); // Append an OB (obsolete) event to the history

int evt_append(history *hist, date d, time t, unsigned int tid, const char *ev); // Append a target event to the history
int tdm_append(history *hist, date d, time t, unsigned int tid, double ddmg, double cdmg); // Append a DM (damaged or repaired) event to the history
int tfk_append(history *hist, date d, time t, unsigned int tid, double dflk, double cflk); // Append a FK (flak-change) event to the history
int tsh_append(history *hist, date d, time t, unsigned int tid); // Append a SH (ship sunk) event to the history
int evt_append(history *hist, date d, harris_time t, unsigned int tid, const char *ev); // Append a target event to the history
int tdm_append(history *hist, date d, harris_time t, unsigned int tid, double ddmg, double cdmg); // Append a DM (damaged or repaired) event to the history
int tfk_append(history *hist, date d, harris_time t, unsigned int tid, double dflk, double cflk); // Append a FK (flak-change) event to the history
int tsh_append(history *hist, date d, harris_time t, unsigned int tid); // Append a SH (ship sunk) event to the history

int evm_append(history *hist, date d, time t, const char *ev); // Append a miscellaneous event to the history
int ca_append(history *hist, date d, time t, unsigned int cshr, unsigned int cash); // Append a CA (cash) event to the history
int co_append(history *hist, date d, time t, double confid); // Append a CO (confid) event to the history
int mo_append(history *hist, date d, time t, double morale); // Append a MO (morale) event to the history
int gp_append(history *hist, date d, time t, unsigned int iclass, double gprod, double dprod); // Append a GP (GProd) event to the history
int evm_append(history *hist, date d, harris_time t, const char *ev); // Append a miscellaneous event to the history
int ca_append(history *hist, date d, harris_time t, unsigned int cshr, unsigned int cash); // Append a CA (cash) event to the history
int co_append(history *hist, date d, harris_time t, double confid); // Append a CO (confid) event to the history
int mo_append(history *hist, date d, harris_time t, double morale); // Append a MO (morale) event to the history
int gp_append(history *hist, date d, harris_time t, unsigned int iclass, double gprod, double dprod); // Append a GP (GProd) event to the history

0 comments on commit 439b2d4

Please sign in to comment.