Compare commits

...

5 Commits

5 changed files with 238 additions and 151 deletions

View File

@ -1,3 +1,19 @@
Version 1.4.2 by ~jan6, 2020
added a terminal bell on the start of each turn, to notify players
Version 1.4.1 by ~jan6, 2020
restored original stats,
moved modded stats to separate file (rename to common.h use)
fixed text overflow bug caused by extending company names in 1.4.0,
the bug pushed 5th company (Eridani) off-screen,
because of too long lines wrapping around
Version 1.4.0 released 2020 by ~jan6
jan6@tilde.ninja and jan6@envs.net

View File

@ -1,64 +0,0 @@
/*
** 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 v2 for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program;
*/
#define OFFMAP '-' /* space character */
#define SPACE '.' /* space character */
#define NEWCO '+' /* new company character */
#define STAR '*' /* star character */
#define BLACKHOLE '@' /* black hole character */
#define NUMCO 5 /* number of companies (don't change) */
#define INIT_CO_COST 90 /* initial company start cost */
#define FOUNDER_BONUS 10 /* founder gets this much stock */
#define NUMMOVES 6 /* number of moves options a player gets */
#define MAXPLAYERS 4 /* total number of players a game can have */
#define STARCOST 251 /* company's price increase near star */
#define BLACKHOLECOST -250 /* price increase near black hole */
#define NEWCOCOST 101 /* company's price increase near new co */
#define Mx 12 /* x dimension of map */
#define My 10 /* y dimension of map */
/* macros to look at surrounding spaces on the map: */
#define iscompany(c) ((c)>='A'&&(c)<='Z')
#define ripe(c) ((c)==STAR||(c)==NEWCO)
#define co_near(move) (iscompany(up_obj(move))||iscompany(down_obj(move))||iscompany(left_obj(move))||iscompany(right_obj(move)))
#define s_or_bh(c) ((c)==SPACE||(c)==BLACKHOLE)
/* player and company structures: */
typedef struct {
char name[100];
int holdings[NUMCO];
long int svalue; /* stock value -- not always accurate!! */
long int cash;
int ishuman;
} PLAYER;
typedef struct {
char name[100];
int price;
int size;
int potential;
int risk; /* value related to chance of being swallowed by Black Hole */
int netpot; /* potential - risk */
} COMPANY;

1
common.h Symbolic link
View File

@ -0,0 +1 @@
common.h.modded

67
common.h.modded Normal file
View File

@ -0,0 +1,67 @@
/*
** 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 v2 for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program;
*/
#define OFFMAP '?' /* space character */
#define SPACE '`' /* space character */
#define NEWCO '+' /* new company character */
#define STAR '*' /* star character */
#define BLACKHOLE '@' /* black hole character */
#define END_PERCENT 45 /* end when this much of the map is full */
#define INIT_CASH 600 /* initial player cash */
#define SPLIT_PRICE 300 /* when stocks split 2-1 */
#define NUMCO 5 /* number of companies (don't change) */
#define INIT_CO_COST 9 /* initial company start cost */
#define FOUNDER_BONUS 5 /* founder gets this much stock */
#define NUMMOVES 6 /* number of moves options a player gets */
#define MAXPLAYERS 4 /* total number of players a game can have */
#define STARCOST 26 /* company's price increase near star */
#define BLACKHOLECOST -25 /* price increase near black hole */
#define NEWCOCOST 10 /* company's price increase near new co */
#define Mx 12 /* x dimension of map */
#define My 10 /* y dimension of map */
/* macros to look at surrounding spaces on the map: */
#define iscompany(c) ((c)>='A'&&(c)<='Z')
#define ripe(c) ((c)==STAR||(c)==NEWCO)
#define co_near(move) (iscompany(up_obj(move))||iscompany(down_obj(move))||iscompany(left_obj(move))||iscompany(right_obj(move)))
#define s_or_bh(c) ((c)==SPACE||(c)==BLACKHOLE)
/* player and company structures: */
typedef struct {
char name[100];
int holdings[NUMCO];
long int svalue; /* stock value -- not always accurate!! */
long int cash;
int ishuman;
} PLAYER;
typedef struct {
char name[100];
int price;
int size;
int potential;
int risk; /* value related to chance of being swallowed by Black Hole */
int netpot; /* potential - risk */
} COMPANY;

66
common.h.orig Normal file
View File

@ -0,0 +1,66 @@
/*
** 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 v2 for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program;
*/
#define OFFMAP '-' /* space character */
#define SPACE '.' /* space character */
#define NEWCO '+' /* new company character */
#define STAR '*' /* star character */
#define BLACKHOLE '@' /* black hole character */
#define END_PERCENT 55 /* end when this much of the map is full */
#define INIT_CASH 6000 /* initial player cash */
#define SPLIT_PRICE 3000 /* when stocks split 2-1 */
#define NUMCO 5 /* number of companies (don't change) */
#define INIT_CO_COST 100 /* initial company start cost */
#define FOUNDER_BONUS 5 /* founder gets this much stock */
#define NUMMOVES 5 /* number of moves options a player gets */
#define MAXPLAYERS 4 /* total number of players a game can have */
#define STARCOST 500 /* company's price increase near star */
#define BLACKHOLECOST -500 /* price increase near black hole */
#define NEWCOCOST 100 /* company's price increase near new co */
#define Mx 12 /* x dimension of map */
#define My 10 /* y dimension of map */
/* macros to look at surrounding spaces on the map: */
#define iscompany(c) ((c)>='A'&&(c)<='Z')
#define ripe(c) ((c)==STAR||(c)==NEWCO)
#define co_near(move) (iscompany(up_obj(move))||iscompany(down_obj(move))||iscompany(left_obj(move))||iscompany(right_obj(move)))
#define s_or_bh(c) ((c)==SPACE||(c)==BLACKHOLE)
/* player and company structures: */
typedef struct {
char name[100];
int holdings[NUMCO];
long int svalue; /* stock value -- not always accurate!! */
long int cash;
int ishuman;
} PLAYER;
typedef struct {
char name[100];
int price;
int size;
int potential;
int risk; /* value related to chance of being swallowed by Black Hole */
int netpot; /* potential - risk */
} COMPANY;

View File

@ -1,19 +1,19 @@
/*
** starlanes v1.3.0 (29-Mar-1997) -- a space-age stock trading game
** starlanes v1.4.0 (29-Mar-1997) -- a space-age stock trading game
**
** Copyright (C) 1997 Brian "Beej" Hall
** with modifications by David Barnsdale 2004 and by ~jan6 2020
**
**
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -94,14 +94,14 @@
/* misc stuff: */
#define INIT_CO_COST 100 /* initial company start cost */
#define INIT_CASH 6000 /* initial player cash */
#define SPLIT_PRICE 3000 /* when stocks split 2-1 */
//#define INIT_CO_COST 100 /* initial company start cost */
//#define INIT_CASH 6000 /* initial player cash */
//#define SPLIT_PRICE 3000 /* when stocks split 2-1 */
/* #define NUMMOVES 5 number of different moves a player gets */
//#define NUMMOVES 5 /* number of different moves a player gets */
#define END_PERCENT 55 /* end when this much of the map is full */
//#define END_PERCENT 55 /* end when this much of the map is full */
#define DEF_LINES 25 /* default number of lines on screen */
#define DEF_COLUMNS 80 /* default number of columns on screen */
@ -128,7 +128,7 @@ void color_setup(void);
void get_num_players(void);
void showmap(void);
void drawmap(int loc, char c);
int get_move(void); /*called by main */
int get_move(void); /*called by main */
void show_coinfo(void);
void more_coinfo(void);
void do_move(int move);
@ -136,22 +136,22 @@ void do_merge(int *c1, int *c2, int *o1, int *o2);
void holding_bonus(void);
void holding_bonus(void);
void buy_sell(void);
int check_endgame(void);
int count_used_sectors(void);
int check_endgame(void);
int count_used_sectors(void);
void calc_cost(int cnum, int move, int n, int s, int w, int e);
void new_co_announce(int newc);
void suck_announce(int conum, int grown);
void merge_announce(int c1, int c2);
void xaction_announce(int c1, int c2);
void split_announce(int conum);
int co_avail(void);
int co_avail(void);
void clear_general(char *s,int blink);
void center(WINDOW *win, int width, int row, char *s);
int my_mvwgetstr(WINDOW *win, int y, int x, int max, int restricted, char *s);
int my_mvwgetstr(WINDOW *win, int y, int x, int max, int restricted, char *s);
void redraw(void);
void show_standings(char *title);
void show_company_holdings(char *title);
int order_compare(const void *v1, const void *v2);
int order_compare(const void *v1, const void *v2);
void quit_yn(void);
void shutdown(void);
void usage(void);
@ -161,36 +161,36 @@ void usage(void);
char placemove(); */
/* global variables */
char *VERSION = "1.3.0";
char *VERSION_DATE = "1-June-2004";
char *VERSION = "1.4.1";
char *VERSION_DATE = "13-February-2020";
char *ident = "$Id: starlanes.c 1.2.2 29-Mar-1997 beej@ecst.csuchico.edu $";
/* These two varibles must be cordinated with ai.c */
/* These probably could be constants but untill I'm
sure they stay as variables. */
int MAPX = Mx; /* x dimension of map */
int MAPY = My; /* y dimension of map */
int MAPX = Mx; /* x dimension of map */
int MAPY = My; /* y dimension of map */
int LINES; /* lines in screen */
int COLUMNS; /* columns in screen */
char *map; /* pointer to the map data */
//char *mapc; /* copy of map for ai */
PLAYER *pl; /* pointer to array of players */
COMPANY *co; /* pointer to array of companies */
int numplayers,turn; /* number of players, whose turn it is */
WINDOW *mapwin,*general,*coinfo; /* pointers to the windows */
int color; /* true if we want color */
int sologame=0; /* set to true if nmr of playes is 0*/
int Difficulty;
int LINES; /* lines in screen */
int COLUMNS; /* columns in screen */
char *map; /* pointer to the map data *//*
char *mapc; /* copy of map for ai */
PLAYER *pl; /* pointer to array of players */
COMPANY *co; /* pointer to array of companies */
int numplayers,turn; /* number of players, whose turn it is */
WINDOW *mapwin,*general,*coinfo; /* pointers to the windows */
int color; /* true if we want color */
int sologame=0; /* set to true if nmr of playes is 0*/
int Difficulty;
int main(int argc, char *argv[])
{
int done = 0,move, colorforce=0, monoforce=0;
switch(argc)
{
case 1: break;
case 2: if (argv[1][1] == 'v') {
case 1: break;
case 2: if (argv[1][1] == 'v') {
fprintf(stderr,"Starlanes for ncurses v%s Copyright (C) by Brian \"Beej\" Hall %s\n",VERSION,VERSION_DATE);
fprintf(stderr,"\nStarlanes comes with ABSOLUTELY NO WARRANTY. This is free\n");
fprintf(stderr,"software, and you are welcome to redistribute it under\n");
@ -204,13 +204,13 @@ int main(int argc, char *argv[])
else
usage();
break;
default:usage();
default: usage();
}
/* initscr */
initscr();
start_color();
if (colorforce)
color = 1;
else if (monoforce)
@ -228,7 +228,7 @@ int main(int argc, char *argv[])
/* num players */
get_num_players();
clear();
attron(color?(YELLOW_ON_BLUE|A_BOLD):A_REVERSE);
mvprintw(0,0," StarLanes ");
@ -251,6 +251,7 @@ int main(int argc, char *argv[])
//ai_buy_sell(pl,co,turn,map,Difficulty);
//}
turn = (++turn)%numplayers;
fprintf(stderr,"\x07");
}
} while (!done);
@ -315,10 +316,10 @@ void initialize(void)
for(i=0;i<NUMCO;i++) {
switch(i) {
case 0: strcpy(co[i].name, "Altar & Stairway, Ltd.");break;
case 1: strcpy(co[i].name, "Beatles & Juice Co.");break;
case 2: strcpy(co[i].name, "Capella Fright, Ltd.");break;
case 1: strcpy(co[i].name, "Beatles & Juice Co. ");break;
case 2: strcpy(co[i].name, "Capella Fright, Ltd. ");break;
case 3: strcpy(co[i].name, "Denebola Dice Shippers");break;
case 4: strcpy(co[i].name, "Eridani Expert Export");break;
case 4: strcpy(co[i].name, "Eridani Expert Export ");break;
}
co[i].size = co[i].price = 0;
}
@ -327,10 +328,9 @@ void initialize(void)
for(i=0;i<MAXPLAYERS;i++) {
pl[i].name[0] = '\0';
pl[i].ishuman=1;
pl[i].ishuman=1;
pl[i].cash = INIT_CASH;
for(j=0;j<NUMCO;j++)
pl[i].holdings[j] = 0;
for(j=0;j<NUMCO;j++) pl[i].holdings[j] = 0;
}
/* create the windows: */
@ -362,20 +362,20 @@ void initialize(void)
void color_setup(void)
{
init_pair(1, COLOR_BLUE, COLOR_BLACK);
init_pair(2, COLOR_RED, COLOR_BLACK);
init_pair(3, COLOR_GREEN, COLOR_BLACK);
init_pair(4, COLOR_YELLOW, COLOR_BLACK);
init_pair(1, COLOR_BLUE, COLOR_BLACK);
init_pair(2, COLOR_RED, COLOR_BLACK);
init_pair(3, COLOR_GREEN, COLOR_BLACK);
init_pair(4, COLOR_YELLOW, COLOR_BLACK);
init_pair(5, COLOR_MAGENTA, COLOR_BLACK);
init_pair(6, COLOR_CYAN, COLOR_BLACK);
init_pair(7, COLOR_WHITE, COLOR_BLACK);
init_pair(8, COLOR_YELLOW, COLOR_BLUE);
init_pair(9, COLOR_WHITE, COLOR_BLUE);
init_pair(10, COLOR_BLACK, COLOR_YELLOW);
init_pair(11, COLOR_BLACK, COLOR_WHITE);
init_pair(12, COLOR_BLACK, COLOR_RED);
init_pair(13, COLOR_BLACK, COLOR_BLUE);
init_pair(14, COLOR_BLACK, COLOR_GREEN);
init_pair(6, COLOR_CYAN, COLOR_BLACK);
init_pair(7, COLOR_WHITE, COLOR_BLACK);
init_pair(8, COLOR_YELLOW, COLOR_BLUE);
init_pair(9, COLOR_WHITE, COLOR_BLUE);
init_pair(10, COLOR_BLACK, COLOR_YELLOW);
init_pair(11, COLOR_BLACK, COLOR_WHITE);
init_pair(12, COLOR_BLACK, COLOR_RED);
init_pair(13, COLOR_BLACK, COLOR_BLUE);
init_pair(14, COLOR_BLACK, COLOR_GREEN);
}
/*
@ -418,7 +418,7 @@ void get_num_players(void)
sologame=1;
sprintf(s,"Please enter level (1 easiest,3 hardest)");
center(stdscr,COLUMNS ,11,s);
refresh();
refresh();
noecho();raw();
do {
Difficulty = getch()-'0';
@ -426,7 +426,7 @@ void get_num_players(void)
addch(Difficulty+'0');
}
else */ sologame=0;
srand(getpid()); /* reseed the dumb random number generator */
turn = rand()%numplayers;
@ -468,16 +468,16 @@ void showmap(void)
for(i=0;i<MAPY;i++)
for(j=0;j<MAPX;j++) {
switch(map[j+i*MAPX]) {
case SPACE: attrs = MAP_SPACE;break;
case STAR: attrs = MAP_STAR;break;
case NEWCO: attrs = MAP_NEWCO;break;
case SPACE : attrs = MAP_SPACE;break;
case STAR : attrs = MAP_STAR;break;
case NEWCO : attrs = MAP_NEWCO;break;
case BLACKHOLE: attrs = MAP_BLACKHOLE;break;
case 'A': attrs = CO_A;break;
case 'B': attrs = CO_B;break;
case 'C': attrs = CO_C;break;
case 'D': attrs = CO_D;break;
case 'E': attrs = CO_E;break;
default: attrs = A_NORMAL;
default : attrs = A_NORMAL;
}
wattron(mapwin,attrs);
mvwaddch(mapwin,i+1,j*3+2,map[j+i*MAPX]);
@ -496,16 +496,16 @@ void drawmap(int loc, char c)
int attrs;
switch(c) {
case SPACE: attrs = MAP_SPACE;break;
case STAR: attrs = MAP_STAR;break;
case NEWCO: attrs = MAP_NEWCO;break;
case SPACE : attrs = MAP_SPACE;break;
case STAR : attrs = MAP_STAR;break;
case NEWCO : attrs = MAP_NEWCO;break;
case BLACKHOLE: attrs = MAP_BLACKHOLE;break;
case 'A': attrs = CO_A;break;
case 'B': attrs = CO_B;break;
case 'C': attrs = CO_C;break;
case 'D': attrs = CO_D;break;
case 'E': attrs = CO_E;break;
default: attrs = A_NORMAL;
default : attrs = A_NORMAL;
}
wattron(mapwin,attrs);
mvwaddch(mapwin,loc/MAPX+1,(loc%MAPX)*3+2,c);
@ -522,7 +522,7 @@ void show_coinfo(void)
werase(coinfo);
wattron(coinfo,COINFO_TITLE);
mvwprintw(coinfo,0,0," %-19s %5s %8s ","Company","Price","Holdings");
mvwprintw(coinfo,0,0," %-22s %5s %8s","Company","Price","Holdings");
wattroff(coinfo,COINFO_TITLE);
wmove(coinfo,2,0);
@ -537,10 +537,11 @@ void show_coinfo(void)
}
wattron(coinfo,attrs);
// wprintw(coinfo," %-19s ",co[i].name);
wprintw(coinfo," %-22s ",co[i].name);
wprintw(coinfo," %-22s ",co[i].name);
wattroff(coinfo,attrs);
wprintw(coinfo,"$%-4d ",co[i].price);
wprintw(coinfo,"$%-4d ",co[i].price);
/*if (pl[turn].holdings[i] == 0) wattron(coinfo,A_BLINK);*/
// wprintw(coinfo,"%-5d\n\n\r",pl[turn].holdings[i]);
wprintw(coinfo,"%-5d\n\n\r",pl[turn].holdings[i]);
/*if (pl[turn].holdings[i] == 0) wattroff(coinfo,A_BLINK);*/
gotco = 1;
@ -562,10 +563,10 @@ void show_coinfo(void)
int get_move(void)
{
char s[80],c;
int move[NUMMOVES],i,j,ok,splat;
int move[NUMMOVES],i,j,ok,splat;
/* move[] is the numbered options that are shown on the screen
i represents each of the random place points while j
represents the already chosen points which must be
represents the already chosen points which must be
checked to avoid duplicates. */
wattron(mapwin,A_REVERSE);
@ -628,8 +629,7 @@ int get_move(void)
} while(c<1 || c>NUMMOVES);
echo();
for(i=0;i<NUMMOVES;i++)
mvwaddch(mapwin,move[i]/MAPX+1,(move[i]%MAPX)*3+2,SPACE);
for(i=0;i<NUMMOVES;i++) mvwaddch(mapwin,move[i]/MAPX+1,(move[i]%MAPX)*3+2,SPACE);
wnoutrefresh(mapwin);
return move[c-1];
@ -725,7 +725,7 @@ void do_move(int move)
calc_cost(newc_type-'A',move,north,south,west,east);
if (co[newc_type-'A'].price <= 0) /* black holed */
suck_announce(newc_type-'A',1);
else {
else {
if (co[newc_type-'A'].price > SPLIT_PRICE)
split_announce(newc_type-'A');
else
@ -764,7 +764,7 @@ void do_merge(int *c1, int *c2, int *o1, int *o2)
cb = t;
}
for(i=0;i<MAPX*MAPY;i++)
for(i=0;i<MAPX*MAPY;i++)
if (map[i] == cs+'A') {
map[i] = cb+'A';
drawmap(i,cb+'A');
@ -777,11 +777,11 @@ void do_merge(int *c1, int *c2, int *o1, int *o2)
co[cb].size += co[cs].size;
co[cb].price += co[cs].price;
co[cs].size = 0;
wnoutrefresh(mapwin); /* show the players what's up */
wnoutrefresh(mapwin); /* show the players what's up */
merge_announce(cb,cs);
xaction_announce(cb,cs); /*annouces and executes the transactions */
xaction_announce(cb,cs); /* annouces and executes the transactions */
if (co[cb].price > SPLIT_PRICE)
split_announce(cb);
}
@ -802,8 +802,8 @@ void calc_cost(int cnum, int move, int n, int s, int w, int e)
if (s == BLACKHOLE) co[cnum].price += BLACKHOLECOST;
if (w == BLACKHOLE) co[cnum].price += BLACKHOLECOST;
if (e == BLACKHOLE) co[cnum].price += BLACKHOLECOST;
if (n == NEWCO) { /* starter companies */
if (n == NEWCO) { /* starter companies */
map[move-MAPX] = cnum + 'A'; /*company represented by A is 0 and so on */
drawmap(move-MAPX,cnum+'A');
co[cnum].size++;
@ -867,7 +867,7 @@ void suck_announce(int conum, int grown)
}
}
wnoutrefresh(mapwin);
for(i=0;i<numplayers;i++) /* ditch all player holdings */
pl[i].holdings[conum] = 0;
@ -950,7 +950,7 @@ void xaction_announce(int c1, int c2)
mvwprintw(general,3+i,4," %-20s ", pl[i].name);
wattroff(general,A_BOLD);
wprintw(general,"%-5d %-5d %5d ",
pl[i].holdings[c2],newshares,totalholdings);
pl[i].holdings[c2],newshares,totalholdings); //continues previous line
wattron(general,A_BOLD);
wprintw(general,"$%-5d",bonus);
wattroff(general,A_BOLD);
@ -985,7 +985,7 @@ void split_announce(int conum)
center(general,COLUMNS-2,6,"Press any key to continue...");
co[conum].price = (int)(((float)(co[conum].price)/2.0) + 0.5);
for(i=0;i<numplayers;i++)
for(i=0;i<numplayers;i++)
pl[i].holdings[conum] *= 2;
show_coinfo();
@ -1026,8 +1026,7 @@ void buy_sell(void)
if (cocount == 0) return; /* no companies yet */
sprintf(s," %s (Cash: $%ld) ",pl[turn].name,pl[turn].cash);
clear_general(s,0);
sprintf(s," %s (Cash: $%ld) ",pl[turn].name,pl[turn].cash); clear_general(s,0);
center(general,COLUMNS-2,1,"Arrow keys to select a company, return to trade, escape when done:");
@ -1071,22 +1070,24 @@ void buy_sell(void)
break;
case 'q':
case 'Q':
case CTRL_C:quit_yn();
case CTRL_C :
quit_yn();
wmove(general,cursor+3,strlen(co[cos[cursor]].name)+20);
wnoutrefresh(general);
break;
case KEY_UP:
case KEY_UP :
case '8':
case 'k':
case 'K': newcur = cursor?cursor-1:cocount-1;break;
case KEY_DOWN:
case KEY_DOWN :
case '5':
case 'j':
case 'J': newcur = cursor<cocount-1?cursor+1:0;break;
case KEY_RIGHT:
case 6:
case CR :
case LF : max = pl[turn].cash / co[cos[cursor]].price;
case LF :
max = pl[turn].cash / co[cos[cursor]].price;
min = -pl[turn].holdings[cos[cursor]];
sprintf(s,"Amount (%d to %d): ",min,max);
mvwprintw(general,cursor+3,40,s);