Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Network.cc

Go to the documentation of this file.
00001 #include "objects.h"
00002 
00003 /*sets up network for each level*/
00004 void Network::setup() {
00005         int i;  
00006         units = on (game.level);
00007         for (i=0; i<units; i++)
00008                 if (!net.computers[i].setup(i)) {
00009                         units = i-1;
00010                         break;
00011                 }
00012         base = units;
00013         off = win = 0;
00014         ncables = game.MIN(game.level, units/2);
00015         for (i=0; i<ncables; i++) cables[i].setup();
00016 }
00017 
00018 /*redraws the computers at their location with the proper image*/
00019 void Network::draw () {
00020         int i;
00021         for (i=0; i<ncables; i++) cables[i].draw();
00022         for (i=0; i<units; i++) computers[i].draw();
00023 }
00024 
00025 void Network::update () {
00026         for (int i=0; i<ncables; i++) cables[i].update();
00027 }
00028 
00029 void Network::toasters () {
00030         for (int i=0; i<units; i++) {
00031                 computers[i].type = computers[i].TOASTER;
00032                 computers[i].os = OS.OFF;
00033         }
00034         ncables=0;
00035 }
00036 
00037 int Network::on(int lev) {
00038         return game.MIN(8+lev, MAX_COMPUTERS);
00039 }
00040 
00041 void Network::load_pix () {
00042         int i;
00043         char *name[] = {"toaster", "maccpu", "nextcpu", "sgicpu", "suncpu",
00044                 "os2cpu", "bsdcpu"};
00045         for (i=0; i <= NUM_SYS; i++)
00046                 pictures[i].load(name[i]);
00047         width = pictures[0].width;
00048         height = pictures[0].height;
00049 }

Generated on Sat Nov 5 16:17:20 2005 for OPIE by  doxygen 1.4.2