~ubuntu-branches/ubuntu/vivid/empire/vivid-proposed

« back to all changes in this revision

Viewing changes to main.c

  • Committer: Package Import Robot
  • Author(s): Markus Koschany
  • Date: 2014-01-12 10:41:53 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20140112104153-iawyc84mk4v5qs6n
Tags: 1.11-1
* New maintainer Debian Games Team.
  - Add myself to Uploaders. (Closes: #733320)
* Imported Upstream version 1.11.
  - Fix several spelling errors in empire.6. Thanks to Bjarnig Ingi Gislason.
    (LP: #1070946)
  - Fix a typo in object.c that made a single city stop producing output.
    Thanks to the anonymous reporter. (Closes: #593434)
* Switch to source format 3.0 (quilt).
* Bump compat level to 9 and require debhelper >= 9. Add compat file.
* Drop lintian.override.
* Switch to dh-sequencer. Pass default build flags to upstream's Makefile.
* Add manpages file.
* debian/control:
  - Set priority from extra to optional.
  - Update package to Standards-Version 3.9.5.
  - Add VCS fields.
  - Add Homepage field.
  - Add ${misc:Depends} substvar.
  - Fix typo "they" in package description. (Closes: #668614)
  - Fix description-synopsis-starts-with-article.
* Use install file to install the binary, icons and desktop file.
* Drop dirs file. Not needed.
* Add watch file. Thanks to Bart Martens.
* Update debian/copyright to copyright format 1.0.
* Add icon entry to menu file.
* Install icons to /usr/share/pixmaps.
  - Convert to empire-logo.xpm with imagemagick at build time.
* Add empire.desktop file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: main.c,v 1.5 2002/08/01 18:58:22 esr Exp $  - (c) Copyright 1987, 1988 Chuck Simmons */
2
 
 
3
1
/*
4
2
 *    Copyright (C) 1987, 1988 Chuck Simmons
5
3
 * 
33
31
 
34
32
#define OPTFLAGS "w:s:d:S:f:"
35
33
 
36
 
int main (argc, argv)
 
34
int main(argc, argv)
37
35
int argc;
38
36
char *argv[];
39
37
{
40
 
        int c;
41
 
        extern char *optarg;
42
 
        extern int optind;
43
 
        extern int opterr;      /* set to 1 to suppress error msg */
44
 
        int errflg = 0;
45
 
        int wflg, sflg, dflg, Sflg;
46
 
        int land;
47
 
        
48
 
        wflg = 70; /* set defaults */
49
 
        sflg = 5;
50
 
        dflg = 2000;
51
 
        Sflg = 10;
52
 
        savefile = "empsave.dat";
53
 
 
54
 
        /*
55
 
         * extract command line options
56
 
         */
57
 
 
58
 
        while ((c = getopt (argc, argv, OPTFLAGS)) != EOF) {
59
 
                switch (c) {
60
 
                case 'w':
61
 
                        wflg = atoi (optarg);
62
 
                        break;
63
 
                case 's':
64
 
                        sflg = atoi (optarg);
65
 
                        break;
66
 
                case 'd':
67
 
                        dflg = atoi (optarg);
68
 
                        break;
69
 
                case 'S':
70
 
                        Sflg = atoi (optarg);
71
 
                        break;
72
 
                case 'f':
73
 
                        savefile = optarg;
74
 
                        break;
75
 
                case '?': /* illegal option? */
76
 
                        errflg++;
77
 
                        break;
78
 
                }
79
 
        }
80
 
        if (errflg || (argc-optind) != 0) {
81
 
                (void) printf ("empire: usage: empire [-w water] [-s smooth] [-d delay]\n");
82
 
                exit (1);
83
 
        }
84
 
 
85
 
        if (wflg < 10 || wflg > 90) {
86
 
                (void) printf ("empire: -w argument must be in the range 0..90.\n");
87
 
                exit (1);
88
 
        }
89
 
        if (sflg < 0) {
90
 
                (void) printf ("empire: -s argument must be greater or equal to zero.\n");
91
 
                exit (1);
92
 
        }
93
 
        
94
 
        if (dflg < 0 || dflg > 30000) {
95
 
                (void) printf ("empire: -d argument must be in the range 0..30000.\n");
96
 
                exit (1);
97
 
        }
98
 
 
99
 
        SMOOTH = sflg;
100
 
        WATER_RATIO = wflg;
101
 
        delay_time = dflg;
102
 
        save_interval = Sflg;
103
 
 
104
 
        /* compute min distance between cities */
105
 
        land = MAP_SIZE * (100 - WATER_RATIO) / 100; /* available land */
106
 
        land /= NUM_CITY; /* land per city */
107
 
        MIN_CITY_DIST = isqrt (land); /* distance between cities */
108
 
 
109
 
        empire (); /* call main routine */
110
 
        return (0);
 
38
    int c;
 
39
    extern char *optarg;
 
40
    extern int optind;
 
41
    extern int opterr;      /* set to 1 to suppress error msg */
 
42
    int errflg = 0;
 
43
    int wflg, sflg, dflg, Sflg;
 
44
    int land;
 
45
        
 
46
    wflg = 70; /* set defaults */
 
47
    sflg = 5;
 
48
    dflg = 2000;
 
49
    Sflg = 10;
 
50
    savefile = "empsave.dat";
 
51
 
 
52
    /*
 
53
     * extract command line options
 
54
     */
 
55
 
 
56
    while ((c = getopt (argc, argv, OPTFLAGS)) != EOF) {
 
57
        switch (c) {
 
58
        case 'w':
 
59
            wflg = atoi (optarg);
 
60
            break;
 
61
        case 's':
 
62
            sflg = atoi (optarg);
 
63
            break;
 
64
        case 'd':
 
65
            dflg = atoi (optarg);
 
66
            break;
 
67
        case 'S':
 
68
            Sflg = atoi (optarg);
 
69
            break;
 
70
        case 'f':
 
71
            savefile = optarg;
 
72
            break;
 
73
        case '?': /* illegal option? */
 
74
            errflg++;
 
75
            break;
 
76
        }
 
77
    }
 
78
    if (errflg || (argc-optind) != 0) {
 
79
        (void) printf ("empire: usage: empire [-w water] [-s smooth] [-d delay]\n");
 
80
        exit (1);
 
81
    }
 
82
 
 
83
    if (wflg < 10 || wflg > 90) {
 
84
        (void) printf ("empire: -w argument must be in the range 0..90.\n");
 
85
        exit (1);
 
86
    }
 
87
    if (sflg < 0) {
 
88
        (void) printf ("empire: -s argument must be greater or equal to zero.\n");
 
89
        exit (1);
 
90
    }
 
91
        
 
92
    if (dflg < 0 || dflg > 30000) {
 
93
        (void) printf ("empire: -d argument must be in the range 0..30000.\n");
 
94
        exit (1);
 
95
    }
 
96
 
 
97
    SMOOTH = sflg;
 
98
    WATER_RATIO = wflg;
 
99
    delay_time = dflg;
 
100
    save_interval = Sflg;
 
101
 
 
102
    /* compute min distance between cities */
 
103
    land = MAP_SIZE * (100 - WATER_RATIO) / 100; /* available land */
 
104
    land /= NUM_CITY; /* land per city */
 
105
    MIN_CITY_DIST = isqrt (land); /* distance between cities */
 
106
 
 
107
    empire (); /* call main routine */
 
108
    return (0);
111
109
}