author | mark <mark> | 2002-04-14 17:08:03 (UTC) |
---|---|---|
committer | mark <mark> | 2002-04-14 17:08:03 (UTC) |
commit | bfeb067c8acfb5f1797fdc886ac71ca1b10ccf57 (patch) (unidiff) | |
tree | ad77e90c90f4bfb598bbe93aa4b3e14b689c96f4 /noncore/games/kbill/Network.cc | |
parent | a0fe593db4e700989cc19e28b67a58f87823afeb (diff) | |
download | opie-bfeb067c8acfb5f1797fdc886ac71ca1b10ccf57.zip opie-bfeb067c8acfb5f1797fdc886ac71ca1b10ccf57.tar.gz opie-bfeb067c8acfb5f1797fdc886ac71ca1b10ccf57.tar.bz2 |
Import of kbill
Diffstat (limited to 'noncore/games/kbill/Network.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/kbill/Network.cc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/noncore/games/kbill/Network.cc b/noncore/games/kbill/Network.cc new file mode 100644 index 0000000..d163b16 --- a/dev/null +++ b/noncore/games/kbill/Network.cc | |||
@@ -0,0 +1,49 @@ | |||
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 | } | ||