restored original stats, moved modded ones to separate file (rename to common.h use), fixed text overflow bug caused by extending company names

This commit is contained in:
jan6 2020-02-12 22:56:08 +00:00
parent fb969f2ac7
commit 832d07921c
3 changed files with 80 additions and 16 deletions

View File

@ -20,14 +20,13 @@
#define BLACKHOLE '@' /* black hole character */ #define BLACKHOLE '@' /* black hole character */
#define NUMCO 5 /* number of companies (don't change) */ #define NUMCO 5 /* number of companies (don't change) */
#define INIT_CO_COST 90 /* initial company start cost */ #define INIT_CO_COST 100 /* initial company start cost */
#define FOUNDER_BONUS 10 /* founder gets this much stock */ #define FOUNDER_BONUS 5 /* founder gets this much stock */
#define NUMMOVES 6 /* number of moves options a player gets */ #define NUMMOVES 5 /* number of moves options a player gets */
#define MAXPLAYERS 4 /* total number of players a game can have */ #define MAXPLAYERS 4 /* total number of players a game can have */
#define STARCOST 251 /* company's price increase near star */ #define STARCOST 500 /* company's price increase near star */
#define BLACKHOLECOST -250 /* price increase near black hole */ #define BLACKHOLECOST -500 /* price increase near black hole */
#define NEWCOCOST 101 /* company's price increase near new co */ #define NEWCOCOST 100 /* company's price increase near new co */
#define Mx 12 /* x dimension of map */ #define Mx 12 /* x dimension of map */
#define My 10 /* y dimension of map */ #define My 10 /* y dimension of map */

64
common.h.modded Normal file
View File

@ -0,0 +1,64 @@
/*
** 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;

View File

@ -1,5 +1,5 @@
/* /*
** 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 ** Copyright (C) 1997 Brian "Beej" Hall
** with modifications by David Barnsdale 2004 and by ~jan6 2020 ** with modifications by David Barnsdale 2004 and by ~jan6 2020
@ -315,10 +315,10 @@ void initialize(void)
for(i=0;i<NUMCO;i++) { for(i=0;i<NUMCO;i++) {
switch(i) { switch(i) {
case 0: strcpy(co[i].name, "Altar & Stairway, Ltd.");break; case 0: strcpy(co[i].name, "Altar & Stairway, Ltd.");break;
case 1: strcpy(co[i].name, "Beatles & Juice Co.");break; case 1: strcpy(co[i].name, "Beatles & Juice Co. ");break;
case 2: strcpy(co[i].name, "Capella Fright, Ltd.");break; case 2: strcpy(co[i].name, "Capella Fright, Ltd. ");break;
case 3: strcpy(co[i].name, "Denebola Dice Shippers");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; co[i].size = co[i].price = 0;
} }
@ -418,7 +418,7 @@ void get_num_players(void)
sologame=1; sologame=1;
sprintf(s,"Please enter level (1 easiest,3 hardest)"); sprintf(s,"Please enter level (1 easiest,3 hardest)");
center(stdscr,COLUMNS ,11,s); center(stdscr,COLUMNS ,11,s);
refresh(); refresh();
noecho();raw(); noecho();raw();
do { do {
Difficulty = getch()-'0'; Difficulty = getch()-'0';
@ -426,7 +426,7 @@ void get_num_players(void)
addch(Difficulty+'0'); addch(Difficulty+'0');
} }
else */ sologame=0; else */ sologame=0;
srand(getpid()); /* reseed the dumb random number generator */ srand(getpid()); /* reseed the dumb random number generator */
turn = rand()%numplayers; turn = rand()%numplayers;
@ -522,7 +522,7 @@ void show_coinfo(void)
werase(coinfo); werase(coinfo);
wattron(coinfo,COINFO_TITLE); 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); wattroff(coinfo,COINFO_TITLE);
wmove(coinfo,2,0); wmove(coinfo,2,0);
@ -537,10 +537,11 @@ void show_coinfo(void)
} }
wattron(coinfo,attrs); wattron(coinfo,attrs);
// wprintw(coinfo," %-19s ",co[i].name); // wprintw(coinfo," %-19s ",co[i].name);
wprintw(coinfo," %-22s ",co[i].name); wprintw(coinfo," %-22s ",co[i].name);
wattroff(coinfo,attrs); 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);*/ /*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]); wprintw(coinfo,"%-5d\n\n\r",pl[turn].holdings[i]);
/*if (pl[turn].holdings[i] == 0) wattroff(coinfo,A_BLINK);*/ /*if (pl[turn].holdings[i] == 0) wattroff(coinfo,A_BLINK);*/
gotco = 1; gotco = 1;