diff --git a/src/cc/rogue/Makefile.in b/src/cc/rogue/Makefile.in index c2f4e551a..e276584a9 100644 --- a/src/cc/rogue/Makefile.in +++ b/src/cc/rogue/Makefile.in @@ -101,7 +101,7 @@ HDRS = rogue.h extern.h score.h OBJS1 = vers.$(O) extern.$(O) armor.$(O) chase.$(O) command.$(O) \ daemon.$(O) daemons.$(O) fight.$(O) init.$(O) io.$(O) list.$(O) \ mach_dep.$(O) rogue.$(O) mdport.$(O) misc.$(O) monsters.$(O) \ - move.$(O) new_level.$(O) + move.$(O) new_level.$(O) cursesd.$(O) OBJS2 = options.$(O) pack.$(O) passages.$(O) potions.$(O) rings.$(O) \ rip.$(O) rooms.$(O) save.$(O) scrolls.$(O) state.$(O) sticks.$(O) \ things.$(O) weapons.$(O) wizard.$(O) xcrypt.$(O) diff --git a/src/cc/rogue/cursesd.c b/src/cc/rogue/cursesd.c new file mode 100644 index 000000000..71843d36d --- /dev/null +++ b/src/cc/rogue/cursesd.c @@ -0,0 +1,22 @@ +/****************************************************************************** + * Copyright © 2014-2019 The SuperNET Developers. * + * * + * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * + * the top-level directory of this distribution for the individual copyright * + * holder information and the developer policies on copyright and licensing. * + * * + * Unless otherwise agreed in a custom licensing agreement, no part of the * + * SuperNET software, including this file may be copied, modified, propagated * + * or distributed except according to the terms contained in the LICENSE file * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + +#include "cursesd.h" + +WINDOW *initscr() +{ + if ( stdscr == 0 ) + stdscr = (WINDOW)calloc(1,sizeof(*stdscr)); +} diff --git a/src/cc/rogue/cursesd.h b/src/cc/rogue/cursesd.h index 76e9b878e..54c368220 100644 --- a/src/cc/rogue/cursesd.h +++ b/src/cc/rogue/cursesd.h @@ -1,17 +1,30 @@ -/* - * Score file structure - * - * @(#)score.h 4.6 (Berkeley) 02/05/99 - * - * Rogue: Exploring the Dungeons of Doom - * Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman - * All rights reserved. - * - * See the file LICENSE.TXT for full copyright and licensing information. - */ +/****************************************************************************** + * Copyright © 2014-2019 The SuperNET Developers. * + * * + * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * + * the top-level directory of this distribution for the individual copyright * + * holder information and the developer policies on copyright and licensing. * + * * + * Unless otherwise agreed in a custom licensing agreement, no part of the * + * SuperNET software, including this file may be copied, modified, propagated * + * or distributed except according to the terms contained in the LICENSE file * + * * + * Removal or modification of this copyright notice is prohibited. * + * * + ******************************************************************************/ + #ifndef H_CURSESD_H #define H_CURSESD_H +#define LINES 24 +#define COLS 80 + +struct cursesd_info +{ + uint8_t screen[LINES][COLS]; +} *stdscr; +typedef struct cursesd_info WINDOW; + #ifndef TRUE #define TRUE 1 #endif @@ -19,8 +32,6 @@ #define FALSE 0 #endif -typedef void *WINDOW; -WINDOW stdscr; #define standout() #define standend() @@ -28,7 +39,6 @@ WINDOW stdscr; #define raw() #define noecho() #define flushinp() -#define initscr() #define clear() #define clrtoeol() diff --git a/src/cc/rogue/pack.c b/src/cc/rogue/pack.c index 1984a87a8..1e308892e 100644 --- a/src/cc/rogue/pack.c +++ b/src/cc/rogue/pack.c @@ -165,6 +165,7 @@ out: bool pack_room(struct rogue_state *rs,bool from_floor, THING *obj) { + inpack = num_packitems(); if (++inpack > MAXPACK) { if (!terse) @@ -245,6 +246,16 @@ pack_char() * List what is in the pack. Return TRUE if there is something of * the given type. */ + +int32_t num_packitems() +{ + THING *list = pack; + int32_t type = 0,n = 0; + for (; list != NULL; list = next(list)) + n++; + return(n); +} + bool inventory(struct rogue_state *rs,THING *list, int type) { diff --git a/src/cc/rogue/rogue.h b/src/cc/rogue/rogue.h index b83b1a3f5..7d00bd8cf 100644 --- a/src/cc/rogue/rogue.h +++ b/src/cc/rogue/rogue.h @@ -816,6 +816,7 @@ THING *leave_pack(struct rogue_state *rs,THING *obj, bool newobj, bool all); THING *new_item(void); THING *new_thing(struct rogue_state *rs); void end_line(struct rogue_state *rs); +int32_t num_packitems(); void runners(struct rogue_state *rs,int); void land(struct rogue_state *rs,int);