Calculate unpack
This commit is contained 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)
|
||||
|
||||
22
src/cc/rogue/cursesd.c
Normal file
22
src/cc/rogue/cursesd.c
Normal file
@@ -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));
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user