⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 globals.cpp

📁 with vxworks we can develope a group of control software for industry.
💻 CPP
字号:
/*    BladeMaster 2, a text, rougelike(kinda), arena combat simulation game.   Copyright (C) 2002 Blademaster 2 Team, see CREDITS   Clone of BladeMaster by Logicom, Inc. Copyright(C) 1990/1993   In no means affliated with the original Blademaster or the original   Blademaster creators/programmers.   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   Useful contact information:       Website: blademaster2.sourceforge.net       Project page: www.sf.net/projects/blademaster2/   Project Lead (see CREDITS for other members of the developement team)       E-Mail: ilswyn@users.sourceforge.net       AIM: ilswyn*/#include <string>#include <ncurses.h>#include <cstdlib>#include "arena.h"#include "items.h"#include "players.h"#include "shops.h"#include "globals.h"// **********************// Global variables     *// **********************// Global variable used to tell what menu the player is atint whereis;// Boundaries for the arena, so you cant walk out of the arena// Initalized in main.cpp:init()Position arena_boundary;// This isnt working, I get a segfault and:// Program received signal SIGILL, Illegal instruction.// 0x4000912e in _dl_runtime_resolve () from /lib/ld-linux.so.2/*Healer* healer = new Healer();Tavern* tavern = new Tavern();EqShop* eqshop = new EqShop();Bank* bank = new Bank();*/// I will statically define for nowHealer healer;Tavern tavern;EqShop eqshop;Bank bank;// Window declarationsWINDOW *screen;WINDOW *charsheet;WINDOW *arena;WINDOW *outputm;WINDOW *inventory;WINDOW *estats;Arena* main_arena;// Maximum number of objects in the arenaconst int MAX_ARENA_OBJECTS = 255;// The first empty element after all of the filled slotsint end_arena_object = 0;// List of all the objects in the arenaArenaObject* arena_obj_list[MAX_ARENA_OBJECTS];// Contains the types of objects which are in the arena, types// correlate with objects in arena_obj_list.. ie if the 0th// element of arena_obj_list is human the number stored will// be the value for a human player typeint arena_obj_types[MAX_ARENA_OBJECTS];// For add_arena_object and current_object_typeconst int HUMAN = 1;const int COMP = 2;// *** End global variable declaration ***// *********************// Global functions    *// *********************// Add a new member into arena_obj_listvoid add_arena_object(ArenaObject* aobj, int obj_type){  arena_obj_list[end_arena_object] = aobj;  arena_obj_types[end_arena_object] = obj_type;  end_arena_object++;}ArenaObject* check_for_obstacle(int x, int y){  Position dest_pos;  dest_pos.setPos_X(x);  dest_pos.setPos_Y(y);  // Index for arena_object_list  int acc = 0;  while (acc < end_arena_object)    {      if (arena_obj_list[acc]->check_collision(dest_pos))	return arena_obj_list[acc];      else acc++;    }  return 0;}// Returns a random number between 2 given numbers (max and min)int getrandom(int min, int max) {  return ((rand() % ((max+1)-min)) + (min));}int get_input() {  return getch();}// *** End global function declaration ***

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -