Skip to content

Commit

Permalink
Various build fixes for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ec429 committed Dec 2, 2019
1 parent 0e89c89 commit 05e5aab
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static: all

windows: all
mkdir windows
cp -r art dat map save stats *.c *.h *.o *.py README HOWTOPLAY STRATEGY COPYING windows/
cp -r art dat map save stats *.c *.h *.py README HOWTOPLAY STRATEGY COPYING windows/
cp lib-w/* windows/
make -C windows -f Makefile.w32 -B
rm windows/*.o
Binary file modified lib-w/libatg.dll
Binary file not shown.
4 changes: 3 additions & 1 deletion load_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,14 @@ int load_fighters(void)
this.manu=(char *)malloc(strcspn(next, ":")+1);
ssize_t db;
int e;
if((e=sscanf(next, "%[^:]:%[^:]:%u:%u:%u:%u:%hhu:"zn, this.manu, this.name, &this.cost, &this.speed, &this.arm, &this.mnv, &this.radpri, &db))!=7)
unsigned int radpri;
if((e=sscanf(next, "%[^:]:%[^:]:%u:%u:%u:%u:%u:"zn, this.manu, this.name, &this.cost, &this.speed, &this.arm, &this.mnv, &radpri, &db))!=7)
{
fprintf(stderr, "Malformed `fighters' line `%s'\n", next);
fprintf(stderr, " sscanf returned %d\n", e);
return(1);
}
this.radpri=radpri;
size_t nlen=strlen(this.name)+1;
this.name=realloc(this.name, nlen);
this.entry=readdate(next+db, (date){0, 0, 0});
Expand Down
6 changes: 3 additions & 3 deletions saving.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,12 @@ int loadgame(const char *fn, game *state)
unsigned int lrate, tops, ft;
int assi;
char p_id[17];
f=sscanf(line, "%10s %c:%la,%la,%la,%u,%u,%u,%d,%16s\n", status, &class, &skill, &heavy, &lanc, &lrate, &tops, &ft, &assi, p_id);
f=sscanf(line, "%10s %c:"FLOAT","FLOAT","FLOAT",%u,%u,%u,%d,%16s\n", status, &class, CAST_FLOAT_PTR &skill, CAST_FLOAT_PTR &heavy, CAST_FLOAT_PTR &lanc, &lrate, &tops, &ft, &assi, p_id);
if(f!=10)
{
heavy=0;
lanc=0;
f=sscanf(line, "%10s %c:%la,%u,%u,%u,%d,%16s\n", status, &class, &skill, &lrate, &tops, &ft, &assi, p_id);
f=sscanf(line, "%10s %c:"FLOAT",%u,%u,%u,%d,%16s\n", status, &class, CAST_FLOAT_PTR &skill, &lrate, &tops, &ft, &assi, p_id);
if(f!=8)
{
fprintf(stderr, "1 Too few arguments to part %u of tag \"%s\"\n", i, tag);
Expand Down Expand Up @@ -1001,7 +1001,7 @@ int savegame(const char *fn, game state)
for(unsigned int i=0;i<state.ncrews;i++)
{
pcmid(state.crews[i].id, p_id);
fprintf(fs, "%s %c:%la,%la,%la,%u,%u,%u,%d,%s\n", cstatuses[state.crews[i].status], cclasses[state.crews[i].class].letter, state.crews[i].skill, state.crews[i].heavy, state.crews[i].lanc, state.crews[i].lrate, state.crews[i].tour_ops, state.crews[i].full_tours, state.crews[i].assignment, p_id);
fprintf(fs, "%s %c:"FLOAT","FLOAT","FLOAT",%u,%u,%u,%d,%s\n", cstatuses[state.crews[i].status], cclasses[state.crews[i].class].letter, CAST_FLOAT state.crews[i].skill, CAST_FLOAT state.crews[i].heavy, CAST_FLOAT state.crews[i].lanc, state.crews[i].lrate, state.crews[i].tour_ops, state.crews[i].full_tours, state.crews[i].assignment, p_id);
}
fprintf(fs, "GProd:%u\n", ICLASS_MIXED);
for(unsigned int i=0;i<ICLASS_MIXED;i++)
Expand Down
2 changes: 1 addition & 1 deletion saving.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "types.h"

#ifdef WINDOWS /* Because of this little bugger, savegames from Windows won't work on Linux/Unix and vice-versa */
#define FLOAT "%llx"
#define FLOAT "%I64x"
#define CAST_FLOAT_PTR (unsigned long long *)
#define CAST_FLOAT (unsigned long long)
#else
Expand Down
2 changes: 2 additions & 0 deletions stats/kills.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ int main(int argc, char **argv)
game initgame;
struct hashtable fighters, bombers;
bool dmg_cleared = true;
#ifndef WINDOWS
bool localdat = false;
#endif
char cwd_buf[1024];
int arg;
int rc;
Expand Down

0 comments on commit 05e5aab

Please sign in to comment.