📄 network.cc
字号:
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include "objects.h"/*sets up network for each level*/voidNetwork::setup(){ int i; units = on(game.level); i = 0; while (1) { if (i == units) break; if (!net.computers[i].setup(i)) units--; else i++; } 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*/voidNetwork::draw(){ int i; for (i = 0; i < ncables; i++) cables[i].draw(); for (i = 0; i < units; i++) computers[i].draw();}voidNetwork::update(){ for (int i = 0; i < ncables; i++) cables[i].update();}voidNetwork::toasters(){ for (int i = 0; i < units; i++) { computers[i].type = computers[i].TOASTER; computers[i].os = OS.OFF; } ncables = 0;}intNetwork::on(int lev){ return game.MIN(8 + lev, MAX_COMPUTERS);}voidNetwork::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;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -