~ubuntu-branches/ubuntu/gutsy/xbill/gutsy

« back to all changes in this revision

Viewing changes to Network.cc

  • Committer: Bazaar Package Importer
  • Author(s): Adrian Bridgett
  • Date: 2001-06-24 22:44:40 UTC
  • Revision ID: james.westby@ubuntu.com-20010624224440-r8kbgt5ae7q1230g
Tags: upstream-2.0
ImportĀ upstreamĀ versionĀ 2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "objects.h"
 
2
 
 
3
/*sets up network for each level*/
 
4
void Network::setup() {
 
5
        int i;  
 
6
        units = on (game.level);
 
7
        for (i=0; i<units; i++)
 
8
                if (!net.computers[i].setup(i)) {
 
9
                        units = i-1;
 
10
                        break;
 
11
                }
 
12
        base = units;
 
13
        off = win = 0;
 
14
        ncables = game.MIN(game.level, units/2);
 
15
        for (i=0; i<ncables; i++) cables[i].setup();
 
16
}
 
17
 
 
18
/*redraws the computers at their location with the proper image*/
 
19
void Network::draw () {
 
20
        int i;
 
21
        for (i=0; i<ncables; i++) cables[i].draw();
 
22
        for (i=0; i<units; i++) computers[i].draw();
 
23
}
 
24
 
 
25
void Network::update () {
 
26
        for (int i=0; i<ncables; i++) cables[i].update();
 
27
}
 
28
 
 
29
void Network::toasters () {
 
30
        for (int i=0; i<units; i++) {
 
31
                computers[i].type = computers[i].TOASTER;
 
32
                computers[i].os = OS.OFF;
 
33
        }
 
34
        ncables=0;
 
35
}
 
36
 
 
37
int Network::on(int lev) {
 
38
        return game.MIN(8+lev, MAX_COMPUTERS);
 
39
}
 
40
 
 
41
void Network::load_pix () {
 
42
        int i;
 
43
        char *name[] = {"toaster", "maccpu", "nextcpu", "sgicpu", "suncpu",
 
44
                "os2cpu", "bsdcpu"};
 
45
        for (i=0; i <= NUM_SYS; i++)
 
46
                pictures[i].load(name[i]);
 
47
        width = pictures[0].width;
 
48
        height = pictures[0].height;
 
49
}