Diffstat (limited to 'noncore/games/kbill/Network.cc') (more/less context) (ignore 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 @@ +#include "objects.h" + +/*sets up network for each level*/ +void Network::setup() { + int i; + units = on (game.level); + for (i=0; i<units; i++) + if (!net.computers[i].setup(i)) { + units = i-1; + break; + } + base = units; + off = win = 0; + ncables = game.MIN(game.level, units/2); + for (i=0; i<ncables; i++) cables[i].setup(); +} + +/*redraws the computers at their location with the proper image*/ +void Network::draw () { + int i; + for (i=0; i<ncables; i++) cables[i].draw(); + for (i=0; i<units; i++) computers[i].draw(); +} + +void Network::update () { + for (int i=0; i<ncables; i++) cables[i].update(); +} + +void Network::toasters () { + for (int i=0; i<units; i++) { + computers[i].type = computers[i].TOASTER; + computers[i].os = OS.OFF; + } + ncables=0; +} + +int Network::on(int lev) { + return game.MIN(8+lev, MAX_COMPUTERS); +} + +void Network::load_pix () { + int i; + char *name[] = {"toaster", "maccpu", "nextcpu", "sgicpu", "suncpu", + "os2cpu", "bsdcpu"}; + for (i=0; i <= NUM_SYS; i++) + pictures[i].load(name[i]); + width = pictures[0].width; + height = pictures[0].height; +} |