~ubuntu-branches/ubuntu/trusty/xsok/trusty

« back to all changes in this revision

Viewing changes to src/convertscore.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-11-16 09:49:02 UTC
  • Revision ID: james.westby@ubuntu.com-20031116094902-9x37m9fwmgt50q5p
Tags: upstream-1.02
ImportĀ upstreamĀ versionĀ 1.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <stdlib.h>
 
3
 
 
4
/* convert a savegame file from the alpha version to the beta version */
 
5
 
 
6
int main(void) {
 
7
    long len;
 
8
    unsigned char p[64];
 
9
    unsigned char s[10000];
 
10
    memset(p, 0xff, sizeof(p));
 
11
    fread(p, 32, 1, stdin);
 
12
    
 
13
    len = fread(s, 1, 10000, stdin);
 
14
 
 
15
    memcpy(p+28, p+12, 4);      /* stored move */
 
16
    memset(p+20, 0, 8);
 
17
    p[23] = 1;          /* assume it's finished */
 
18
    p[27] = s[7];       /* level */
 
19
    memcpy(p+48, p+12, 4);      /* bookmark where started */
 
20
    if (s[0] == 'C')
 
21
        s[7] = 'x';
 
22
    else
 
23
        s[7] = '\0';
 
24
    fwrite(p, 1, 64, stdout);
 
25
    fwrite(s, 1, len, stdout);
 
26
    return 0;
 
27
}