From: Martin Read Date: Wed, 25 Sep 2013 18:52:07 +0000 (+0100) Subject: C++ conversion changes X-Git-Tag: printmsg-purged~64 X-Git-Url: http://git.blackswordsonics.com/?a=commitdiff_plain;h=1449763fa636cc4de993bd2d6ec9f8db8d9c6d48;p=victrix-abyssi C++ conversion changes --- diff --git a/Makefile b/Makefile index 3ce605a..81d0d66 100644 --- a/Makefile +++ b/Makefile @@ -8,16 +8,18 @@ include features.mk GAME:=victrix-abyssi MAJVERS:=1 MINVERS:=0 -PRODUCTION_CFLAGS:=-std=gnu99 -c -Wall -Wstrict-prototypes -Wwrite-strings -Wmissing-prototypes -Wno-unused-but-set-variable -Wredundant-decls -Wunreachable-code -DMAJVERS=$(MAJVERS) -DMINVERS=$(MINVERS) -DEVELOPMENT_CFLAGS:=-std=gnu99 -c -g -Wall -Wstrict-prototypes -Wwrite-strings -Wmissing-prototypes -Wno-unused-but-set-variable -Wredundant-decls -Wunreachable-code -Werror -DMAJVERS=$(MAJVERS) -DMINVERS=$(MINVERS) -CFLAGS=$(PRODUCTION_CFLAGS) +PRODUCTION_CXXFLAGS:=-c -Wall -Wwrite-strings -Wno-unused-but-set-variable -Wredundant-decls -Wunreachable-code -DMAJVERS=$(MAJVERS) -DMINVERS=$(MINVERS) +DEVELOPMENT_CXXFLAGS:=-c -g -Wall -Wwrite-strings -Wno-unused-but-set-variable -Wredundant-decls -Wunreachable-code -Werror -DMAJVERS=$(MAJVERS) -DMINVERS=$(MINVERS) LINKFLAGS=-lm -lpanelw -lncursesw -g ARCHIVEDIR:=victrix-abyssi_$(MAJVERS).$(MINVERS) +.cc.o: + $(CXX) $(DEVELOPMENT_CXXFLAGS) $(CXXFLAGS) $< -o $@ + all: $(GAME) $(GAME): $(OBJS) - $(CC) $(OBJS) $(LINKFLAGS) -o $(GAME) + $(CXX) $(OBJS) $(LINKFLAGS) -o $(GAME) archive: clean mkdir $(ARCHIVEDIR) @@ -28,30 +30,30 @@ archive: clean clean: -rm -f *.o $(GAME) victrix-abyssi.log victrix-abyssi.sav.gz *.tgz -display-nc.o: display-nc.c victrix-abyssi.h +display-nc.o: display-nc.cc victrix-abyssi.hh -main.o: main.c combat.h victrix-abyssi.h monsters.h +main.o: main.cc combat.hh victrix-abyssi.hh monsters.hh -combat.o: combat.c combat.h victrix-abyssi.h +combat.o: combat.cc combat.hh victrix-abyssi.hh -u.o: u.c combat.h victrix-abyssi.h +u.o: u.cc combat.hh victrix-abyssi.hh -permobj.o: permobj.c victrix-abyssi.h +permobj.o: permobj.cc victrix-abyssi.hh -map.o: map.c victrix-abyssi.h +map.o: map.cc victrix-abyssi.hh -permons.o: permons.c victrix-abyssi.h +permons.o: permons.cc victrix-abyssi.hh -pmon2.o: pmon2.c victrix-abyssi.h monsters.h +pmon2.o: pmon2.cc victrix-abyssi.hh monsters.hh -objects.o: objects.c victrix-abyssi.h +objects.o: objects.cc victrix-abyssi.hh -monsters.o: monsters.c victrix-abyssi.h monsters.h +monsters.o: monsters.cc victrix-abyssi.hh monsters.hh -mon2.o: mon2.c victrix-abyssi.h sorcery.h monsters.h +mon2.o: mon2.cc victrix-abyssi.hh sorcery.hh monsters.hh -vector.o: vector.c victrix-abyssi.h +vector.o: vector.cc victrix-abyssi.hh -sorcery.o: sorcery.c victrix-abyssi.h sorcery.h +sorcery.o: sorcery.cc victrix-abyssi.hh sorcery.hh -# vim:ts=8:sw=8:noexpandtab +# vim:ts=8:sts=8:sw=8:noexpandtab diff --git a/combat.cc b/combat.cc index a5765b6..a7e2044 100644 --- a/combat.cc +++ b/combat.cc @@ -1,4 +1,4 @@ -/*! \file combat.c +/*! \file combat.cc * \brief combat mechanics */ @@ -26,9 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "victrix-abyssi.h" -#include "combat.h" -#include "monsters.h" +#include "victrix-abyssi.hh" +#include "combat.hh" +#include "monsters.hh" int player_attack(int dy, int dx) { diff --git a/combat.hh b/combat.hh index 51a34d0..c5995ed 100644 --- a/combat.hh +++ b/combat.hh @@ -1,6 +1,8 @@ -/* combat.h - * - * Copyright 2005-2012 Martin Read +/* \file combat.hh + * \brief Combat functions header + */ + +/* Copyright 2005-2012 Martin Read * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,14 +26,14 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef COMBAT_H -#define COMBAT_H +#ifndef COMBAT_HH +#define COMBAT_HH -#ifndef VICTRIX_ABYSSI_H -#include "victrix-abyssi.h" +#ifndef VICTRIX_ABYSSI_HH +#include "victrix-abyssi.hh" #endif -#include "monsters.h" +#include "monsters.hh" #define agility_modifier() (u.withering ? (u.agility / 10) : (u.agility / 5)) /* XXX combat.c data and funcs */ diff --git a/display-nc.cc b/display-nc.cc index e180f22..f61f2b8 100644 --- a/display-nc.cc +++ b/display-nc.cc @@ -1,4 +1,4 @@ -/*! \file display-nc.c +/*! \file display-nc.cc * \brief ncurses display support */ @@ -26,9 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define DISPLAY_NC_C -#include "victrix-abyssi.h" -#include "monsters.h" +#define DISPLAY_NC_CC +#include "victrix-abyssi.hh" +#include "monsters.hh" #include #include #include @@ -629,8 +629,7 @@ int select_dir(int *psy, int *psx) enum game_cmd get_command(void) { int ch; - int done = 0; - while (!done) + while (1) { ch = wgetch(message_window); if (!panel_hidden(inventory_panel)) @@ -738,7 +737,7 @@ enum game_cmd get_command(void) return WIZARD_LEVELUP; } } - return 0; + return QUIT; } int display_shutdown(void) diff --git a/display.hh b/display.hh index 1ec39ca..2af53c1 100644 --- a/display.hh +++ b/display.hh @@ -1,4 +1,4 @@ -/*! \file display.h +/*! \file display.hh * \brief Display-related definitions for Victrix Abyssi */ @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DISPLAY_H -#define DISPLAY_H +#ifndef DISPLAY_HH +#define DISPLAY_HH #define DBCLR_L_GREY 0 #define DBCLR_D_GREY 1 diff --git a/fov.cc b/fov.cc index e84471d..092c90d 100644 --- a/fov.cc +++ b/fov.cc @@ -1,4 +1,4 @@ -/*! \file fov.c +/*! \file fov.cc * \brief field-of-view computation (recursive shadowcasting) * * A recursive shadowcasting implementation using diamond (rather than whole- @@ -29,8 +29,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "victrix-abyssi.h" -#include "fov.h" +#include "victrix-abyssi.hh" +#include "fov.hh" #include #include diff --git a/fov.hh b/fov.hh index f0b6613..bd9ea2a 100644 --- a/fov.hh +++ b/fov.hh @@ -1,4 +1,4 @@ -/*! \file fov.h +/*! \file fov.hh * \brief field-of-view header */ @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef FOV_H -#define FOV_H +#ifndef FOV_HH +#define FOV_HH #define MAX_FOV_RADIUS 10 diff --git a/main.cc b/main.cc index e20e48a..3f213d5 100644 --- a/main.cc +++ b/main.cc @@ -1,4 +1,4 @@ -/* \file main.c +/* \file main.cc * \brief main core of Victrix Abyssi */ @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "victrix-abyssi.h" -#include "combat.h" +#include "victrix-abyssi.hh" +#include "combat.hh" #include #include #include diff --git a/map.cc b/map.cc index 7ecca79..ca55395 100644 --- a/map.cc +++ b/map.cc @@ -1,4 +1,4 @@ -/*! \file map.c +/*! \file map.cc * \brief Map generation and population */ @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "victrix-abyssi.h" -#include "fov.h" +#include "victrix-abyssi.hh" +#include "fov.hh" #include int mapobject[DUN_HEIGHT][DUN_WIDTH]; @@ -361,7 +361,7 @@ static int excavation_write(int y, int x, void *data) { if (terrain[y][x] == overwrite[j]) { - terrain[y][x] = newterr; + terrain[y][x] = (terrain_num) newterr; return 1; } } diff --git a/map.hh b/map.hh index e4277f1..5f0d337 100644 --- a/map.hh +++ b/map.hh @@ -1,4 +1,4 @@ -/*! \file map.h +/*! \file map.hh * \brief Map-related header */ @@ -26,11 +26,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef MAP_H -#define MAP_H +#ifndef MAP_HH +#define MAP_HH -#ifndef VICTRIX_ABYSSI_H -#include "victrix-abyssi.h" +#ifndef VICTRIX_ABYSSI_HH +#include "victrix-abyssi.hh" #endif /* XXX enum terrain_num */ diff --git a/misc.cc b/misc.cc index f20e66c..ee6a077 100644 --- a/misc.cc +++ b/misc.cc @@ -1,4 +1,4 @@ -/* \file misc.c +/* \file misc.cc * \brief Stuff. */ @@ -26,15 +26,15 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "victrix-abyssi.h" +#include "victrix-abyssi.hh" const char *damtype_names[DT_COUNT] = { - [DT_PHYS] = "physical damage", - [DT_FIRE] = "fire", - [DT_COLD] = "cold", - [DT_ELEC] = "electricity", - [DT_NECRO] = "necromantic force", - [DT_POISON] = "poison", + "physical damage", + "fire", + "cold", + "electricity", + "necromantic force", + "poison", }; /* main.c */ diff --git a/mon2.cc b/mon2.cc index 33b7705..84352a9 100644 --- a/mon2.cc +++ b/mon2.cc @@ -1,4 +1,4 @@ -/* \file mon2.c +/* \file mon2.cc * \brief More monster functions */ @@ -27,11 +27,11 @@ */ /* TODO: Convert missile AI to a new-style AI function. */ -#define MON2_C -#include "victrix-abyssi.h" -#include "sorcery.h" -#include "monsters.h" -#include "combat.h" +#define MON2_CC +#include "victrix-abyssi.hh" +#include "sorcery.hh" +#include "monsters.hh" +#include "combat.hh" /* AI map cell descriptor. */ struct ai_cell { diff --git a/monsters.cc b/monsters.cc index dfa17ce..e8d5c53 100644 --- a/monsters.cc +++ b/monsters.cc @@ -1,8 +1,8 @@ -/*! \file monsters.c +/*! \file monsters.cc * \brief Monster-related functions */ -/* Copyright 2005-2012 Martin Read +/* Copyright 2005-2013 Martin Read * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,9 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define MONSTERS_C -#include "victrix-abyssi.h" -#include "monsters.h" +#define MONSTERS_CC +#include "victrix-abyssi.hh" +#include "monsters.hh" struct mon monsters[100]; static int reject_mon(int pm); diff --git a/monsters.hh b/monsters.hh index fbda849..6cea8d0 100644 --- a/monsters.hh +++ b/monsters.hh @@ -1,4 +1,4 @@ -/*! \file monsters.h +/*! \file monsters.hh * \brief Monster-related header */ @@ -26,11 +26,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef MONSTERS_H -#define MONSTERS_H +#ifndef MONSTERS_HH +#define MONSTERS_HH -#ifndef VICTRIX_ABYSSI_H -#include "victrix-abyssi.h" +#ifndef VICTRIX_ABYSSI_HH +#include "victrix-abyssi.hh" #endif /* XXX struct permon */ diff --git a/objects.cc b/objects.cc index 4d7b768..2ec5d4b 100644 --- a/objects.cc +++ b/objects.cc @@ -1,6 +1,8 @@ -/* objects.c - * - * Copyright 2005-2012 Martin Read +/* \file objects.cc + * \brief Object handling for Victrix Abyssi + */ + +/* Copyright 2005-2013 Martin Read * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,9 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define OBJECTS_C -#include "victrix-abyssi.h" -#include "monsters.h" +#define OBJECTS_CC +#include "victrix-abyssi.hh" +#include "monsters.hh" struct obj objects[100]; int get_random_pobj(void); diff --git a/objects.hh b/objects.hh index fcea150..fca5008 100644 --- a/objects.hh +++ b/objects.hh @@ -1,4 +1,4 @@ -/*! \file objects.h +/*! \file objects.hh * \brief object-related header for Victrix Abyssi */ @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef OBJECTS_H -#define OBJECTS_H +#ifndef OBJECTS_HH +#define OBJECTS_HH /* XXX enum poclass_num */ /* Categories of permanent object. */ diff --git a/permobj.cc b/permobj.cc index b7e23c6..482e4f3 100644 --- a/permobj.cc +++ b/permobj.cc @@ -1,6 +1,7 @@ -/* permobj.c - * - * Copyright 2005-2012 Martin Read +/* \file permobj.cc + * \brief object database for Victrix Abyssi + */ +/* Copyright 2005-2012 Martin Read * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,176 +25,134 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define PERMOBJ_C -#include "victrix-abyssi.h" +#define PERMOBJ_CC +#include "victrix-abyssi.hh" struct permobj permobjs[NUM_OF_PERMOBJS] = { - [PO_DAGGER] = { "dagger", "daggers", "A long knife, designed for stabbing.", POCLASS_WEAPON, 25, ')', 4, 1, 1 }, - [PO_LONG_SWORD] = { "long sword", "long swords", "A steel sword of simple but sturdy construction; the\nblade is three feet long.", POCLASS_WEAPON, 30, ')', 10, 1, 4 }, - [PO_MACE] = { "mace", "maces", "A flanged lump of iron on an iron haft.", POCLASS_WEAPON, 30, ')', 7, 1, 2 }, - [PO_RUNESWORD] = { "runesword", "runeswords", "An eerily glowing sword engraved with many strange\nrunes.", POCLASS_WEAPON, 80, ')', 20, 1, 12 }, - [PO_BOW] = { "bow", "bows", "A recurve composite bow.", POCLASS_WEAPON, 45, '(', 8, 1, 1 }, - [PO_CROSSBOW] = { "crossbow", "crossbows", "A crossbow.", POCLASS_WEAPON, 70, '(', 16, 1, 6 }, - [PO_THUNDERBOW] = { "thunderbow", "thunderbows", "A recurve composite bow decorated with eldritch signs.\nArrows fired with this bow strike with staggering force.", POCLASS_WEAPON, 70, '(', 16, 1, 30 }, - [PO_TORMENTORS_LASH] = { "tormentor's lash", "tormentor's lash", "A bone-handled whip that crackles with malefic energies.", POCLASS_WEAPON, 80, ')', 20, 1, 30 }, - [PO_STAFF_OF_FIRE] = { "staff of fire", "staff of fire", "A jet-black staff with a glowing ruby in its headpiece.", POCLASS_WEAPON, 80, ')', 10, 1, 20 }, - [PO_POT_HEAL] = { "healing potion", "healing potions", "This magic elixir restores some lost hit points.", POCLASS_POTION, 10, '!', 0, 1, 1 }, - [PO_POT_BODY] = { "body potion", "body potions", "This magic elixir will improve your physique.", POCLASS_POTION, 70, '!', 0, 1, 5 }, - [PO_POT_AGILITY] = { "agility potion", "agility potions", "This magic elixir will sharpen your reflexes.", POCLASS_POTION, 70, '!', 0, 1, 5 }, - [PO_POT_RESTORATION] = { "restoration potion", "restoration potions", "This magic elixir cures temporary damage to one's\nabilities.", POCLASS_POTION, 70, '!', 0, 1, 1 }, - [PO_FLASK_POISON] = { "poison flask", "poison flask", "This fragile bottle is full of contact poison.", POCLASS_FLASK, 10, '~', 0, 1, 1 }, - [PO_FLASK_FIRE] = { "fire flask", "fire flasks", "The volatile, phosphorus-laced liquid in this sealed\nflask will ignite spontaneously when exposed to the air.", POCLASS_FLASK, 40, '~', 0, 1, 20 }, - [PO_FLASK_WEAKNESS] = { "weakness flask", "weakness flasks", "Dousing the living in this vile liquid causes immediate\nand severe physical degeneration.", POCLASS_FLASK, 40, '~', 0, 1, 20 }, - [PO_SCR_TELEPORT] = { "teleport scroll", "teleport scrolls", "Reading this scroll will teleport you to a random\nlocation.", POCLASS_SCROLL, 40, '?', 0, 1, 1 }, - [PO_SCR_FIRE] = { "fire scroll", "fire scrolls", "Reading this scroll will engulf all nearby creatures\n(including you) in flames.", POCLASS_SCROLL, 30, '?', 0, 1, 1 }, - [PO_SCR_PROTECTION] = { "protection scroll", "protection scrolls", "Reading this scroll will dispel any curses afflicting\nyou and protect you from curses for a time.", POCLASS_SCROLL, 80, '?', 0, 1, 8 }, - [PO_LEATHER_ARMOUR] = { "leather armour", "suits of leather armour", "A heavy leather jerkin and breeches, providing some\nprotection.", POCLASS_ARMOUR, 25, '[', 3, 1, 1 }, - [PO_CHAINMAIL] = { "chainmail", "suits of chainmail", "A suit of interlocking metal rings, providing better\nprotection than leather.", POCLASS_ARMOUR, 30, '[', 6, 1, 3 }, - [PO_PLATE_ARMOUR] = { "plate armour", "suits of plate armour", "A suit of steel plates, providing better protection than\nchainmail.", POCLASS_ARMOUR, 40, '[', 10, 1, 6 }, - [PO_MAGE_ARMOUR] = { "mage armour", "suits of mage armour", "A suit of glowing steel plates bearing enchantments of\ndefence.", POCLASS_ARMOUR, 70, '[', 15, 1, 12 }, - [PO_ROBE] = { "mundane robe", "mundane robes", "A simple woolen robe. It's better protection than your\nskin, but not by much.", POCLASS_ARMOUR, 50, '[', 2, 1, 1 }, - [PO_ROBE_SWIFTNESS] = { "robe of swiftness", "robes of swiftness", "A simple woolen robe that bears a potent enchantment,\nprotecting the wearer and making him unnaturally swift.", POCLASS_ARMOUR, 70, '[', 8, 1, 8 }, - [PO_ROBE_SHADOWS] = { "robe of shadows", "robes of shadows", "A simple woolen robe that bears an awesome enchantment,\nprotecting the wearer better than steel plate.", POCLASS_ARMOUR, 90, '[', 14, 1, 18 }, - [PO_DRAGON_ARMOUR] = { "dragonhide armour", "suits of dragonhide armour", "The skin of a dragon, formed into a jerkin and breeches;\nit turns blows like steel plate and turns away\nflames.", POCLASS_ARMOUR, 90, '[', 12, 1, 21 }, - [PO_METEOR_ARMOUR] = { "meteoric plate armour", "suits of meteoric plate armour", "This plate armour has been forged out of metal taken from\na fallen star.", POCLASS_ARMOUR, 90, '[', 18, 1, 27 }, - [PO_SACRED_MAIL] = { "sacred chainmail", "suits of sacred chainmail", "This suit of interlocking rings has been consecrated to\nthe gods of the Light.", POCLASS_ARMOUR, 90, '[', 15, 1, 24 }, - [PO_RAGGED_SHIFT] = { "ragged shift", "ragged shifts", "This sorry-looking collection of rags is all that remains\nof a battle ballgown.", POCLASS_ARMOUR, 100, '[', 1, 0, 1 }, - [PO_BATTLE_BALLGOWN] = { "battle ballgown", "battle ballgowns", "Partially armoured dresses such as this are a\ntraditional part of a princess's wardrobe.", POCLASS_ARMOUR, 95, '[', 3, 1, 1 }, - [PO_IMPERATRIX_GOWN] = { "imperatrix gown", "imperatrix gowns", "This armoured, enchanted, and elaborately decorated dress\nwould be worthy of an empress regnant.", POCLASS_ARMOUR, 95, '[', 15, 1, 24 }, - [PO_RIBBONS] = { /* inspired by DoomRL's Necroarmor and my own creepiness. */ "set of ribbons", "sets of ribbons", "These ribbons, arranged as if to form an alleged\ngarment, make your fingers tingle with magic.", POCLASS_ARMOUR, 90, '[', 15, 1, 30 }, - [PO_RING_REGEN] = { "regeneration ring", "regeneration rings", "This magical ring increases the wearer's healing rate,\nbut also increases the rate at which they must consume\nfood.", POCLASS_RING, 70, '=', 0, 1, 1 }, - [PO_RING_FIRE] = { "fire ring", "fire rings", "This magical ring protects the wearer from mundane and\nmagical fire, and imbues their blows in combat with the\npower of fire.", POCLASS_RING, 50, '=', 0, 1, 1 }, - [PO_RING_VAMPIRE] = { "vampire ring", "vampire rings", "This magical ring protects the wearer from necromantic\nenergies, and imbues their blows in combat with such\nenergies as well.", POCLASS_RING, 90, '=', 0, 1, 12 }, - [PO_RING_FROST] = { "frost ring", "frost rings", "This magical ring protects the wearer from mundane and\nmagical cold, and imbues their blows in combat with the\npower of cold. Rumour suggests it might also allow walking\non water.\n", POCLASS_RING, 40, '=', 0, 1, 1 }, - [PO_RING_TELEPORT] = { "teleport ring", "teleport rings", "This magical ring allows the wearer to teleport for a\nmodest cost in nutrition.", POCLASS_RING, 70, '=', 0, 1, 1 }, - [PO_IRON_RATION] = { "iron ration", "iron rations", "A parcel of hardtack and beef jerky. Dull but nutritious.", POCLASS_FOOD, 75, '%', 0, 1, 1 }, - [PO_DRIED_FRUIT] = { "parcel of dried fruit", "parcels of dried fruit", "A parcel of mixed dried fruit. It sure beats hardtack\nand beef jerky.", POCLASS_FOOD, 75, '%', 0, 1, 1 }, - [PO_ELVEN_BREAD] = { "round of elven waybread", "rounds of elven waybread", "A tasty, filling, nutritious piece of elven waybread.", POCLASS_FOOD, 85, '%', 0, 1, 1 }, - [PO_DEVIL_SPLEEN] = { "devil spleen", "devil spleens", "A weirdly pulsing organ ripped from the torso of a devil.", POCLASS_FOOD, 100, '%', 0, 1, 1 } diff --git a/permons.cc b/permons.cc index c6df017..59f33d3 100644 --- a/permons.cc +++ b/permons.cc @@ -1,4 +1,4 @@ -/*! \file permons.c +/*! \file permons.cc * \brief monster database for Victrix Abyssi */ @@ -26,132 +26,105 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define PERMONS_C -#include "victrix-abyssi.h" +#define PERMONS_CC +#include "victrix-abyssi.hh" /*! \brief Array housing the monster database. */ struct permon permons[NUM_OF_PERMONS] = { - [PM_NEWT] = { "newt", "newts", 'n', DBCLR_RED, 20, 1, 3, 0, -1, 2, -1, DT_PHYS, "", 1, 1, 0, PMF_STUPID }, - [PM_RAT] = { "rat", "rats", 'r', DBCLR_BROWN, 15, 1, 4, 0, -1, 2, -1, DT_PHYS, "", 4, 2, 2, PMF_STUPID }, - [PM_WOLF] = { "wolf", "wolves", 'c', DBCLR_BROWN, 30, 6, 20, 8, -1, 10, -1, DT_PHYS, "", 6, 15, 2, 0 }, - [PM_SNAKE] = { /* Saps one Body on a really good hit */ "snake", "snakes", 's', DBCLR_RED, 20, 6, 15, 10, -1, 3, -1, DT_PHYS, "", 9, 40, 2, PMF_STUPID }, - [PM_THUG] = { /* may drop a mace or leather armour */ "thug", "thugs", 't', DBCLR_BROWN, 30, 1, 8, 5, -1, 5, -1, DT_PHYS, "", 4, 5, 1, 0 }, - [PM_GOON] = { "goon", "goons", 't', DBCLR_YELLOW, 20, 3, 15, 6, -1, 7, -1, DT_PHYS, "", 8, 10, 1, 0 }, - [PM_HUNTER] = { /* Has a ranged attack - arrows */ "hunter", "hunters", 'h', DBCLR_GREEN, 30, 9, 40, 6, 20, 6, 10, DT_PHYS, "shoots an arrow", 10, 50, 1, PMF_ARCHER }, - [PM_DUELLIST] = { "duellist", "duellists", 'f', DBCLR_RED, 40, 12, 60, 30, -1, 15, -1, DT_PHYS, "", 15, 130, 1, PMF_SMART }, - [PM_WARLORD] = { "warlord", "warlords", 'f', DBCLR_L_RED, 30, 15, 80, 25, -1, 20, -1, DT_PHYS, "", 20, 400, 2, PMF_SMART }, - [PM_GOBLIN] = { /* may drop a dagger */ "goblin", "goblins", 'g', DBCLR_BROWN, 20, 1, 6, 1, -1, 3, -1, DT_PHYS, "", 3, 3, 1, 0 }, - [PM_BAD_ELF] = { "bad elf", "bad elves", 'e', DBCLR_L_GREY, 40, 3, 15, 10, -1, 6, -1, DT_PHYS, "", 8, 15, 2, PMF_SMART }, - [PM_TROLL] = { "troll", "trolls", 'T', DBCLR_GREEN, 20, 12, 80, 15, -1, 15, -1, DT_PHYS, "", 13, 150, 1, PMF_STUPID }, - [PM_GIANT] = { "giant", "giants", 'H', DBCLR_BROWN, 20, 21, 80, 15, -1, 25, -1, DT_PHYS, "", 20, 500, 1, PMF_STUPID }, - [PM_GIANT_JARL] = { "giant jarl", "giant jarls", 'H', DBCLR_L_GREY, 80, 25, 160, 20, -1, 30, -1, DT_PHYS, "", 22, 1000, 1, 0 }, - [PM_WIZARD] = { /* Uses sorcery against you; see sorcery.c for details. */ "wizard", "wizards", 'w', DBCLR_BLUE, 80, 12, 40, 10, 20, 10, 10, DT_ELEC, "casts", 15, 200, 1, PMF_SMART | PMF_MAGICIAN }, - [PM_ARCHMAGE] = { /* Uses sorcery against you; see sorcery.c for details. */ "archmage", "archmagi", 'w', DBCLR_L_BLUE, 80, 24, 80, 15, 30, 15, 15, DT_ELEC, "casts", 15, 1500, 1, PMF_SMART | PMF_MAGICIAN | PMF_RESIST_ELEC }, - [PM_ZOMBIE] = { "zombie", "zombies", 'z', DBCLR_L_GREY, 25, 3, 30, 2, -1, 20, -1, DT_PHYS, "", 1, 7, 0, PMF_STUPID | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR }, - [PM_WRAITH] = { "wraith", "wraiths", 'W', DBCLR_WHITE, 25, 12, 40, 25, -1, 5, -1, DT_PHYS, "", 5, 100, 0, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR }, - [PM_LICH] = { /* Uses sorcery against you; see sorcery.c for details. */ "lich", "liches", 'L', DBCLR_L_GREY, 70, 15, 70, 15, 25, 15, 15, DT_NECRO, "casts", 15, 250, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_MAGICIAN | PMF_RESIST_POIS | PMF_RESIST_NECR }, - [PM_MASTER_LICH] = { /* Master liches use sorcery against you, more powerfully * than lesser practitioners. */ "master lich", "master liches", 'L', DBCLR_PURPLE, 60, 30, 150, 30, 30, 20, 30, DT_NECRO, "", 30, 3000, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_MAGICIAN | PMF_RESIST_POIS | PMF_RESIST_NECR }, - [PM_VAMPIRE] = { /* Vampires heal by hitting you. */ "vampire", "vampires", 'V', DBCLR_RED, 55, 18, 70, 25, -1, 15, -1, DT_PHYS, "", 22, 750, 1, PMF_SMART | PMF_UNDEAD | PMF_RESIST_COLD | PMF_RESIST_POIS | PMF_RESIST_NECR }, - [PM_DEMON] = { /* Demons summon more demons if you don't kill them * quickly. */ "demon", "demons", '&', DBCLR_RED, 60, 18, 40, 25, -1, 20, -1, DT_PHYS, "", 15, 500, 1, PMF_SMART | PMF_DEMONIC | PMF_RESIST_FIRE }, - [PM_DEFILER] = { /* Defilers use sorcery (mostly curses) against you. */ "defiler", "defilers", '&', DBCLR_L_GREEN, 65, 27, 120, 30, 30, 20, 30, DT_FIRE, "", 25, 2000, 1, PMF_SMART | PMF_DEMONIC | PMF_RESIST_FIRE | PMF_MAGICIAN | PMF_RESIST_POIS }, - [PM_CENTAUR] = { "centaur", "centaurs", 'C', DBCLR_BROWN, 30, 9, 40, 15, -1, 10, -1, DT_PHYS, "", 10, 50, 2, 0 }, - [PM_ICE_MONSTER] = { /* Fires ice blasts. */ "ice monster", "ice monsters", 'I', DBCLR_WHITE, 50, 6, 40, 10, 20, 15, 15, DT_COLD, "launches a blast of", 10, 35, 0, PMF_RESIST_COLD | PMF_ARCHER }, - [PM_DRAGON] = { /* Breathes fire. */ "dragon", "dragons", 'D', DBCLR_RED, 50, 15, 80, 20, 20, 20, 20, DT_FIRE, "breathes", 18, 300, 1, PMF_RESIST_FIRE | PMF_ARCHER }, - [PM_MOONDRAKE] = { /* Breathes eldritchness represented as cold. I should work on that. */ "moondrake", "moondrakes", 'D', DBCLR_L_CYAN, 50, 15, 80, 20, 20, 20, 20, DT_COLD, "breathes", 24, 500, 1, PMF_RESIST_FIRE | PMF_RESIST_COLD | PMF_RESIST_NECR | PMF_ARCHER diff --git a/pmon2.cc b/pmon2.cc index 7346460..56af796 100644 --- a/pmon2.cc +++ b/pmon2.cc @@ -1,4 +1,4 @@ -/*! \file pmon2.c +/*! \file pmon2.cc * \brief permons flag-check functions */ @@ -26,9 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define PMON2_C -#include "victrix-abyssi.h" -#include "monsters.h" +#define PMON2_CC +#include "victrix-abyssi.hh" +#include "monsters.hh" bool pmon_resists_fire(int pm) { diff --git a/rng.cc b/rng.cc index 97fff9c..2f5777f 100644 --- a/rng.cc +++ b/rng.cc @@ -1,6 +1,8 @@ -/* rng.c - * - * Copyright 2005-2012 Martin Read +/* \file rng.cc + * \brief xorshift PRNG + */ + +/* Copyright 2005-2012 Martin Read * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,7 +27,7 @@ */ -#include "victrix-abyssi.h" +#include "victrix-abyssi.hh" #include #include #include diff --git a/sorcery.cc b/sorcery.cc index db81633..80ad9fa 100644 --- a/sorcery.cc +++ b/sorcery.cc @@ -1,4 +1,4 @@ -/*! \file sorcery.c +/*! \file sorcery.cc * \brief evil magic used by monsters */ @@ -25,10 +25,10 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "victrix-abyssi.h" -#include "sorcery.h" -#include "monsters.h" -#include "combat.h" +#include "victrix-abyssi.hh" +#include "sorcery.hh" +#include "monsters.hh" +#include "combat.hh" /* SORCERY * diff --git a/sorcery.hh b/sorcery.hh index a083c45..5178f4e 100644 --- a/sorcery.hh +++ b/sorcery.hh @@ -1,5 +1,5 @@ -/*! \file sorcery.h - * \brief Monster sorcery rules +/*! \file sorcery.hh + * \brief Monster sorcery header */ /* Copyright 2005-2013 Martin Read @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SORCERY_H -#define SORCERY_H +#ifndef SORCERY_HH +#define SORCERY_HH /* XXX DATA TYPES XXX */ diff --git a/u.cc b/u.cc index 496026c..6c4359e 100644 --- a/u.cc +++ b/u.cc @@ -1,4 +1,4 @@ -/*! \file u.c +/*! \file u.cc * \brief player-character */ /* @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "victrix-abyssi.h" -#include "combat.h" +#include "victrix-abyssi.hh" +#include "combat.hh" #include #include #include diff --git a/vector.cc b/vector.cc index 319d785..f2da191 100644 --- a/vector.cc +++ b/vector.cc @@ -1,4 +1,4 @@ -/*! \file vector.c +/*! \file vector.cc * \brief direction-handling code */ @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "victrix-abyssi.h" +#include "victrix-abyssi.hh" void compute_directions(int y1, int x1, int y2, int x2, int *pdy, int *pdx, int *psy, int *psx, int *pmelee, int *pcardinal) { diff --git a/victrix-abyssi.hh b/victrix-abyssi.hh index 59f4be1..4575293 100644 --- a/victrix-abyssi.hh +++ b/victrix-abyssi.hh @@ -1,4 +1,4 @@ -/*! \file victrix-abyssi.h +/*! \file victrix-abyssi.hh * \brief Main header for Victrix Abyssi */ @@ -26,10 +26,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef VICTRIX_ABYSSI_H -#define VICTRIX_ABYSSI_H +#ifndef VICTRIX_ABYSSI_HH +#define VICTRIX_ABYSSI_HH +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include @@ -102,24 +104,24 @@ struct player { int ring; /* For now, you can only wear one magic ring. */ }; -#ifndef MONSTERS_H -#include "monsters.h" +#ifndef MONSTERS_HH +#include "monsters.hh" #endif -#ifndef OBJECTS_H -#include "objects.h" +#ifndef OBJECTS_HH +#include "objects.hh" #endif -#ifndef DISPLAY_H -#include "display.h" +#ifndef DISPLAY_HH +#include "display.hh" #endif -#ifndef MAP_H -#include "map.h" +#ifndef MAP_HH +#include "map.hh" #endif -#ifndef FOV_H -#include "fov.h" +#ifndef FOV_HH +#include "fov.hh" #endif /* XXX main.c data and funcs */ @@ -179,5 +181,5 @@ extern int player_resists_dtype(enum damtyp dtype); extern struct player u; #endif -/* victrix-abyssi.h */ +/* victrix-abyssi.hh */ // vim:cindent:ts=8:sw=4:expandtab