Skip to content
Snippets Groups Projects
Commit 4e861b43 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Resolve warnings from GCC 10.2

Include some constification of xsdk functions

Added some comments (observed concerns) in TBD about the object[] definition
not matching (struct/type and contents) between objects.h and tbd2.c.
parent 3a76a067
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4012 passed
......@@ -50,19 +50,20 @@ char compiler[32];
typedef struct { char value, suit; } card_t;
card_t newdeck[52]={
2,H, 2,D, 2,C, 2,S,
3,H, 3,D, 3,C, 3,S,
4,H, 4,D, 4,C, 4,S,
5,H, 5,D, 5,C, 5,S,
6,H, 6,D, 6,C, 6,S,
7,H, 7,D, 7,C, 7,S,
8,H, 8,D, 8,C, 8,S,
9,H, 9,D, 9,C, 9,S,
10,H,10,D,10,C,10,S,
J,H, J,D, J,C, J,S,
Q,H, Q,D, Q,C, Q,S,
K,H, K,D, K,C, K,S,
A,H, A,D, A,C, A,S };
{ 2,H }, { 2,D }, { 2,C }, { 2,S },
{ 3,H }, { 3,D }, { 3,C }, { 3,S },
{ 4,H }, { 4,D }, { 4,C }, { 4,S },
{ 5,H }, { 5,D }, { 5,C }, { 5,S },
{ 6,H }, { 6,D }, { 6,C }, { 6,S },
{ 7,H }, { 7,D }, { 7,C }, { 7,S },
{ 8,H }, { 8,D }, { 8,C }, { 8,S },
{ 9,H }, { 9,D }, { 9,C }, { 9,S },
{10,H }, {10,D }, {10,C }, {10,S },
{ J,H }, { J,D }, { J,C }, { J,S },
{ Q,H }, { Q,D }, { Q,C }, { Q,S },
{ K,H }, { K,D }, { K,C }, { K,S },
{ A,H }, { A,D }, { A,C }, { A,S }
};
card_t deck[52], card[52];
card_t hand[MAX_NODES+1][10];
......@@ -147,7 +148,7 @@ enum { OPEN, DEAL, BET, DISCARD, BET2, GET_WINNER };
#pragma pack(1)
#endif
#ifdef __GNUC__
#ifdef __GNUC__
#define _PACK __attribute__ ((packed))
#else
#define _PACK
......@@ -205,7 +206,7 @@ int main(int argc, char **argv)
printf("\tL = Create daily log of computer vs player "
"wins/losses\n");
printf("\tCLEAN = Clean-up player/node data (replaces 'dpclean')\n");
return(0);
return(0);
}
}
initdata();
......@@ -471,7 +472,7 @@ void discard()
bprintf("\x1b[6A");
do {
strcpy(dishand,handstr(node_num)); if(!symbols) strip_symbols(dishand);
sprintf(str,"\r\n\t\t\t\1b\1h%s - \1b\1h(\1c%s\1b)\1n",dishand,
snprintf(str, sizeof(str), "\r\n\t\t\t\1b\1h%s - \1b\1h(\1c%s\1b)\1n",dishand,
ranking(rank));
bprintf("%s\r\n\t\t\t\1b\1h(\1c1\1b) (\1c2\1b) (\1c3\1b) (\1c4\1b) "
"(\1c5\1b)\r\n",str);
......@@ -1031,7 +1032,7 @@ void play_menu()
*waitcmd="\1y\1hCommand \1b\1h(\1c\1hL,S,Y,Q,^P,^U,?\1b\1h):\1n ",
*dealcmd="\1m\1hDealer \1n\1b\1h(\1c\1hD,L,S,Y,Q,^P,^U,?\1b\1h):\1n ";
int warn,tt;
time_t timeout,timeout2,now;
time_t timeout, now;
sprintf(fname,"message.%d",node_num);
get_game_status(cur_table);
......@@ -1044,7 +1045,6 @@ void play_menu()
else
bprintf(waitcmd); /* Show the command prompt */
timeout=time(NULL); /* Set entry time here */
timeout2=time(NULL); /* for the demo game timer only */
do {
now=time(NULL); /* Start the timer here */
......@@ -1119,7 +1119,7 @@ void play_menu()
get_player(node_num);
if (flength(fname)>0) { /* Checks for new player */
bprintf("\r\n"); /* Messages and reads them */
do {
do {
read_player_message();
mswait(100);
} while (flength(fname)>0);
......@@ -1164,7 +1164,7 @@ void play_menu()
}
if (!cur_node && dealer==node_num) { /* Computer is cur_node */
if (stage==BET && comp_bet!=current_bet || !current_bet) {
if ((stage==BET && comp_bet!=current_bet) || !current_bet) {
bprintf("\r\n");
computer_bet(); timeout=time(NULL); warn=0;
bprintf("\r\n"); nodesync();
......@@ -1211,9 +1211,7 @@ void play_menu()
time_played+=time(NULL)-now;
if (time_played>time_allowed) time_played=time_allowed;
}
if (timeout2);
if((now-timeout)>=240 && !warn) /* Warning Beep */
if((now-timeout)>=240 && !warn) /* Warning Beep */
for(warn=0;warn<5;warn++) {
putchar(7);
}
......@@ -1435,7 +1433,8 @@ void dealer_ctrl()
declare_winner();
return; /* All but 1 has folded */
}
if (firstbid) firstbid=0; put_game_status(-1); x=0;
if (firstbid) firstbid=0;
put_game_status(-1); x=0;
for (num=1;num<=sys_nodes;num++) {
if (node[num-1]==WAITING) {
get_player(num);
......@@ -1709,7 +1708,9 @@ void gethandtype(int player)
highest_card=hand[player][i].value;
if (temphand[0].suit==hand[player][i].suit) x++;
for (j=0;j<5;j++) {
if (m==j) j++; if (m1==j) j++; if (m2==j) j++;
if (m==j) j++;
if (m1==j) j++;
if (m2==j) j++;
if (temphand[i].value==hand[player][j].value) {
same++;
if (same==2 && i<5 && m>-1 && m1==-1) {
......@@ -1907,7 +1908,7 @@ void send_message()
do {
if (!getstr(str1,45,K_CHAT|K_WRAP))
break;
sprintf(str,"\r\n\1g\1hFrom %s: \1n\1g%s\r\n",user_name
snprintf(str, sizeof(str), "\r\n\1g\1hFrom %s: \1n\1g%s\r\n",user_name
,str1);
if (num=='A') {
send_all_message(str,0);
......
/* SBJ.C */
/* $Id: sbj.c,v 1.14 2003/08/29 21:51:52 rswindell Exp $ */
/************************/
/* Synchronet Blackjack */
/************************/
......@@ -111,19 +107,20 @@ enum { /* values for status bytes */
typedef struct { char value, suit; } card_t;
card_t newdeck[52]={
2,H, 2,D, 2,C, 2,S,
3,H, 3,D, 3,C, 3,S,
4,H, 4,D, 4,C, 4,S,
5,H, 5,D, 5,C, 5,S,
6,H, 6,D, 6,C, 6,S,
7,H, 7,D, 7,C, 7,S,
8,H, 8,D, 8,C, 8,S,
9,H, 9,D, 9,C, 9,S,
10,H,10,D,10,C,10,S,
J,H, J,D, J,C, J,S,
Q,H, Q,D, Q,C, Q,S,
K,H, K,D, K,C, K,S,
A,H, A,D, A,C, A,S };
{ 2,H }, { 2,D }, { 2,C }, { 2,S },
{ 3,H }, { 3,D }, { 3,C }, { 3,S },
{ 4,H }, { 4,D }, { 4,C }, { 4,S },
{ 5,H }, { 5,D }, { 5,C }, { 5,S },
{ 6,H }, { 6,D }, { 6,C }, { 6,S },
{ 7,H }, { 7,D }, { 7,C }, { 7,S },
{ 8,H }, { 8,D }, { 8,C }, { 8,S },
{ 9,H }, { 9,D }, { 9,C }, { 9,S },
{10,H }, {10,D }, {10,C }, {10,S },
{ J,H }, { J,D }, { J,C }, { J,S },
{ Q,H }, { Q,D }, { Q,C }, { Q,S },
{ K,H }, { K,D }, { K,C }, { K,S },
{ A,H }, { A,D }, { A,C }, { A,S }
};
uchar misc;
uchar curplayer;
......@@ -201,7 +198,7 @@ int my_random(int n)
/****************************************************************************/
int main(int argc, char **argv)
{
char str[81],compiler[32],*p;
char str[128],compiler[32],*p;
int i,file;
FILE *stream;
......@@ -330,7 +327,7 @@ int main(int argc, char **argv)
mnelow=CYAN|HIGH;
/* Override default inactivity timeout values */
sec_warn=120;
sec_warn=120;
sec_timeout=180;
COMPILER_DESC(compiler);
......@@ -391,8 +388,8 @@ int main(int argc, char **argv)
play();
sec_warn=120;
sec_timeout=180;
break;
}
break;
}
}
}
......@@ -576,7 +573,7 @@ while(1) {
max=max_bet;
else
max=credits/1024L;
sprintf(str,"\r\nBet amount (in kilobytes) or ~Quit [%u]: "
sprintf(str,"\r\nBet amount (in kilobytes) or ~Quit [%lu]: "
,ibet<credits/1024L ? ibet : credits/1024L);
chat();
mnemonics(str);
......@@ -637,7 +634,7 @@ while(1) {
bputs(str);
sprintf(str,UserWasDealt,user_name,cardstr(card[cur_card-1]));
putallnodemsg(str);
if(lastplayer()) {
getcarddat();
dealer[0]=card[cur_card++];
......@@ -659,7 +656,7 @@ while(1) {
bputs(str);
sprintf(str,UserWasDealt,user_name,cardstr(card[cur_card-1]));
putallnodemsg(str);
if(lastplayer()) {
getcarddat();
dealer[1]=card[cur_card++];
......@@ -1417,7 +1414,7 @@ while(node[node_num-1] && status[node_num-1]==SYNC_P) {
/****************************************************************************/
void moduserdat()
{
char str[128];
char str[MAX_PATH + 1];
FILE *stream;
sprintf(str,"%sMODUSER.DAT",node_dir);
......
This diff is collapsed.
......@@ -93,25 +93,25 @@ void get_term(void);
/* BBS Print String
- Displays a string locally and remotely (with Ctrl-A codes) */
void bputs(char *str);
void bputs(const char *str);
/* Raw Print String
- Oututs a string locally and remotely (verbatim) */
void rputs(char *str);
void rputs(const char *str);
/* BBS Print Formatted
- Displays a formatted string locally and remotely (with Ctrl-A codes)
- printf() equivalent */
int bprintf(char *fmt, ...);
int bprintf(const char *fmt, ...);
/* Raw Print Formated
- Displays a formatted string locally and remotely (verbatim)
- printf() equivalent */
int rprintf(char *fmt, ...);
int rprintf(const char *fmt, ...);
/* BBS String Length
- Returns length of string, excluding Ctrl-A codes */
int bstrlen(char *str);
int bstrlen(const char *str);
/* Output character
- Displays a single character */
......@@ -121,7 +121,7 @@ void outchar(char ch);
- Display a string expanding ~letter combinations to command keys
- Automatically colorizes mnemonic letters or places them in parenthesis
for non-ANSI users */
void mnemonics(char *str);
void mnemonics(const char *str);
/* Pause prompt
- Displays [Hit a key] and waits for the user to hit a key */
......@@ -132,13 +132,13 @@ void bpause(void);
'Y', 'N' or enter
- Returns 1 if the user hit 'Y' or enter
- Automatic colorization */
char yesno(char *str);
char yesno(const char *str);
/* No/yes Question
- Displays a string with (y/N) ? appended and waits for the user to hit
'Y', 'N' or enter
- Returns 1 if the user hit 'N' or enter */
char noyes(char *str);
char noyes(const char *str);
/* Inbound Keystroke
- If the local or remote user has struck a key, this function returns the
......@@ -162,7 +162,7 @@ char getkey(long mode);
followed by CRLF
- If the user entered a number, the number is ORed with 0x8000 and returned
you must XOR (or not) this bit to get the correct number */
int getkeys(char *str, int max);
int getkeys(const char *str, int max);
/* Get a Number
- Waits for the user to enter a number from 0 to max, 'Q' or ENTER
......@@ -212,7 +212,7 @@ void checktimeleft(void);
/* Print File
- Displays contents of file (expanding Ctrl-A characters if appropriate) */
void printfile(char *str);
void printfile(const char *str);
/* Get String
- Waits for the user to enter a string
......@@ -222,7 +222,7 @@ int getstr(char *str, size_t maxlen, long mode);
/* Redraw String
- Redisplays a string, mainly called by getstr() */
void redrwstr(char *strin, int i, int l, long mode);
void redrwstr(const char *strin, int i, int l, long mode);
/* Strip Invalid Ctrl-A codes */
char stripattr(char *strin);
......@@ -232,13 +232,13 @@ char *xsdk_username(uint usernumber);
#define username(x) xsdk_username(x)
/* Returns the number of the user name passed */
uint usernumber(char *username);
uint usernumber(const char *username);
/* Convert unsigned long to an ASCII string with commas */
char *ultoac(ulong l, char *string);
/* Convert an ASCII string of hex digits into an unsigned long */
ulong ahtoul(char *str);
ulong ahtoul(const char *str);
/* Display status of node */
void xsdk_printnodedat(int number, node_t node);
......@@ -256,7 +256,7 @@ void xsdk_getnodedat(int number, node_t *node, char lockit);
#define getnodedat(a,b,c) xsdk_getnodedat(a,b,c)
/* Writes a short message (telegram) for specified user number */
void xsdk_putsmsg(int usernumber, char *strin);
void xsdk_putsmsg(int usernumber, const char *strin);
#define putsmsg(a,b) xsdk_putsmsg(a,b)
/* Reads and displays short message for specified user number */
......@@ -264,7 +264,7 @@ void xsdk_getsmsg(int usernumber);
#define getsmsg(a) xsdk_getsmsg(a)
/* Writes a node message for specified node */
void xsdk_putnmsg(int num, char *strin);
void xsdk_putnmsg(int num, const char *strin);
#define putnmsg(a,b) xsdk_putnmsg(a,b)
/* Reads and displays node message for current node */
......@@ -285,7 +285,7 @@ int isconnected(void);
void checkline(void);
/* Display a line (with ctrl-A codes) centered on the screen */
void center(char *str);
void center(const char *str);
#ifdef _MSC_VER
int lock(int file, long offset, long size);
......
......@@ -19,69 +19,69 @@
typedef struct {
char type,color,symbol,name[50];
int value,misc;
int value,misc; // NOTE (TODO): these members are short ints in tbd2.c
} object_t;
object_t object[62]={
0,0,' '," ",0,0,
1,(BLUE),'',"Dagger",0,4,
1,(LIGHTBLUE),'',"Long Dagger",1250,5, /* is the damage */
1,(LIGHTGREEN),'',"Short Sword",2500,6, /* that they do */
1,(LIGHTCYAN),'',"Long Sword",3740,7,
1,(LIGHTRED),'',"Broad Sword",4360,8,
1,(LIGHTMAGENTA),'',"Bastard Sword",4680,9,
1,(YELLOW),'',"2-Handed Sword",4840,10,
2,(LIGHTBLUE),'',"Leather Armor",1250,1, /* Misc for Armor */
2,(LIGHTGREEN),'',"Studded Armor",2500,2, /* is their A.C. */
2,(LIGHTCYAN),'',"Scale Armor",3740,3,
2,(LIGHTRED),'',"Chain Armor",4360,4,
2,(LIGHTMAGENTA),'',"Banded Armor",4680,5,
2,(YELLOW),'',"Plate Armor",4840,6,
3,(YELLOW),'$',"",0,0,
4,(LIGHTBLUE),'',"Warp 2 Other Scroll",100,1,
4,(LIGHTBLUE),'',"Invisibilty Potion",2500,2, /* 30 seconds */
4,(LIGHTGREEN),'',"Healing Potion",500,3, /* 1-5 points */
4,(LIGHTGREEN),'',"Scroll of Xtra Heal",1000,4, /* 2-10 points */
4,(LIGHTMAGENTA),'',"Mystery Scroll",200,7,
4,(LIGHTMAGENTA),'',"Mystery Potion",200,8,
4,(LIGHTRED),'', "Ring of Resurrect",2500,0,
4,(LIGHTCYAN),'',"Potion of Full Heal",2500,5,
4,(YELLOW),'',"Potion of Strength",1500,6,
4,(BLINK|YELLOW),'',"Magical Key",0,0,
4,(BLINK|LIGHTRED),'',"Staff of Power",0,0,
4,(WHITE),'@',"Magical Compass",0,0,
4,(BROWN),'F',"Food",0,0,
5,(YELLOW),'',"Stairs Going Up (+ to climb up)",0,0,
5,(LIGHTGREEN),'',"Stairs Going Down (+ to climb down)",0,1,
6,(LIGHTCYAN),'',"Weapons Shop Shopkeeper",0,1,
6,(LIGHTGREEN),'',"Armor Shop Shopkeeper",0,2,
6,(LIGHTRED),'',"Specialty Store Shopkeeper",0,3,
7,(LIGHTBLUE),'',"a Giant Caterpillar",1,1, /* Gold first - */
7,(LIGHTGREEN),'',"a Frag",1,1, /* then level */
7,(BROWN),'',"a Giant Snail",1,2,
7,(LIGHTRED),'',"a Deadly Crab",2,2,
7,(LIGHTCYAN),'',"a Rattlesnake",2,3,
7,(LIGHTBLUE),'',"a Giant",3,3,
7,(YELLOW),'',"a Brainsucker",3,4,
7,(LIGHTMAGENTA),'',"a Bonecrusher",4,4,
7,(BLUE),'',"a Thraxion Stabber",4,5,
7,(GREEN),'',"a Conehead",5,5,
7,(RED),'',"a Snubber",5,6,
7,(MAGENTA),'',"a Little Bojay",6,6,
7,(LIGHTMAGENTA),'',"a Big Bojay",6,7,
7,(BLUE),'',"a Little Flerp",7,7,
7,(LIGHTBLUE),'',"a Big Flerp",7,8,
7,(LIGHTRED),'',"a Neck Puller",8,8,
7,(LIGHTCYAN),'',"an Inhaler",8,9,
7,(YELLOW),'',"a Hunchback",9,9,
7,(GREEN),'',"a Creeping Moss",9,10,
7,(YELLOW),'',"a Killer Hornet",10,10,
7,(WHITE),'',"a Zombie",10,10,
7,(LIGHTBLUE),'',"a Killer Mantis",0,15,
7,(LIGHTRED),'',"The Beast",0,20,
8,(GREEN),'',"Tree",0,0,
8,(YELLOW),'',"Quicksand",0,0,
8,(MAGENTA),'',"Pillar",0,0,
8,(WHITE),'',"Pillar",0,0,
8,(BLUE),'',"Water",0,0,
8,(WHITE),'',"Rock",0,0
{ 0,0,' '," ",0,0 },
{ 1,(BLUE),'',"Dagger",0,4 },
{ 1,(LIGHTBLUE),'',"Long Dagger",1250,5 }, /* is the damage */
{ 1,(LIGHTGREEN),'',"Short Sword",2500,6 }, /* that they do */
{ 1,(LIGHTCYAN),'',"Long Sword",3740,7 },
{ 1,(LIGHTRED),'',"Broad Sword",4360,8 },
{ 1,(LIGHTMAGENTA),'',"Bastard Sword",4680,9 },
{ 1,(YELLOW),'',"2-Handed Sword",4840,10 },
{ 2,(LIGHTBLUE),'',"Leather Armor",1250,1 }, /* Misc for Armor */
{ 2,(LIGHTGREEN),'',"Studded Armor",2500,2 }, /* is their A.C. */
{ 2,(LIGHTCYAN),'',"Scale Armor",3740,3 },
{ 2,(LIGHTRED),'',"Chain Armor",4360,4 },
{ 2,(LIGHTMAGENTA),'',"Banded Armor",4680,5 },
{ 2,(YELLOW),'',"Plate Armor",4840,6 },
{ 3,(YELLOW),'$',"",0,0 },
{ 4,(LIGHTBLUE),'',"Warp 2 Other Scroll",100,1 },
{ 4,(LIGHTBLUE),'',"Invisibilty Potion",2500,2 }, /* 30 seconds */
{ 4,(LIGHTGREEN),'',"Healing Potion",500,3 }, /* 1-5 points */
{ 4,(LIGHTGREEN),'',"Scroll of Xtra Heal",1000,4 }, /* 2-10 points */
{ 4,(LIGHTMAGENTA),'',"Mystery Scroll",200,7 },
{ 4,(LIGHTMAGENTA),'',"Mystery Potion",200,8 },
{ 4,(LIGHTRED),'', "Ring of Resurrect",2500,0 },
{ 4,(LIGHTCYAN),'',"Potion of Full Heal",2500,5 },
{ 4,(YELLOW),'',"Potion of Strength",1500,6 },
{ 4,(BLINK|YELLOW),'',"Magical Key",0,0 },
{ 4,(BLINK|LIGHTRED),'',"Staff of Power",0,0 },
{ 4,(WHITE),'@',"Magical Compass",0,0 },
{ 4,(BROWN),'F',"Food",0,0 },
{ 5,(YELLOW),'',"Stairs Going Up (+ to climb up)",0,0 },
{ 5,(LIGHTGREEN),'',"Stairs Going Down (+ to climb down)",0,1 },
{ 6,(LIGHTCYAN),'',"Weapons Shop Shopkeeper",0,1 },
{ 6,(LIGHTGREEN),'',"Armor Shop Shopkeeper",0,2 },
{ 6,(LIGHTRED),'',"Specialty Store Shopkeeper",0,3 },
{ 7,(LIGHTBLUE),'',"a Giant Caterpillar",1,1 }, /* Gold first - */
{ 7,(LIGHTGREEN),'',"a Frag",1,1 }, /* then level */
{ 7,(BROWN),'',"a Giant Snail",1,2 },
{ 7,(LIGHTRED),'',"a Deadly Crab",2,2 },
{ 7,(LIGHTCYAN),'',"a Rattlesnake",2,3 },
{ 7,(LIGHTBLUE),'',"a Giant",3,3 },
{ 7,(YELLOW),'',"a Brainsucker",3,4 },
{ 7,(LIGHTMAGENTA),'',"a Bonecrusher",4,4 },
{ 7,(BLUE),'',"a Thraxion Stabber",4,5 },
{ 7,(GREEN),'',"a Conehead",5,5 },
{ 7,(RED),'',"a Snubber",5,6 },
{ 7,(MAGENTA),'',"a Little Bojay",6,6 },
{ 7,(LIGHTMAGENTA),'',"a Big Bojay",6,7 },
{ 7,(BLUE),'',"a Little Flerp",7,7 },
{ 7,(LIGHTBLUE),'',"a Big Flerp",7,8 },
{ 7,(LIGHTRED),'',"a Neck Puller",8,8 },
{ 7,(LIGHTCYAN),'',"an Inhaler",8,9 },
{ 7,(YELLOW),'',"a Hunchback",9,9 },
{ 7,(GREEN),'',"a Creeping Moss",9,10 },
{ 7,(YELLOW),'',"a Killer Hornet",10,10 },
{ 7,(WHITE),'',"a Zombie",10,10 },
{ 7,(LIGHTBLUE),'',"a Killer Mantis",0,15 },
{ 7,(LIGHTRED),'',"The Beast",0,20 },
{ 8,(GREEN),'',"Tree",0,0 },
{ 8,(YELLOW),'',"Quicksand",0,0 },
{ 8,(MAGENTA),'',"Pillar",0,0 },
{ 8,(WHITE),'',"Pillar",0,0 },
{ 8,(BLUE),'',"Water",0,0 },
{ 8,(WHITE),'',"Rock",0,0 }
};
......@@ -64,7 +64,7 @@
int main(int argc, char **argv)
{
FILE *stream;
char door=0,room[SQUARE][SQUARE],str[128];
char door=0,room[SQUARE][SQUARE];
unsigned char ch,val;
int file,v=0,w=0,x=0,y=0,z=1,weapons[10],weapons2[10],armor[10],armor2[10],
magic[10],magic2[10],num_monster,num_gold,fountain[10],stairs,staff,
......@@ -325,7 +325,7 @@ for (w=0;w<LEVELS;w++) {
if(object[ch].type==STAIRS) {
if(w<5 && w>1) ch=NUM_MONSTER+rand()%7;
else if(w==1 || w==5) ch=NUM_MONSTER+7+rand()%7;
else ch=NUM_MONSTER+14+rand()%8;
else ch=NUM_MONSTER+14+rand()%8;
}
if(object[ch].type==GOLD) {
++num_gold;
......
......@@ -88,7 +88,7 @@ int main(int argc, char **argv)
if (!strchr(argv[x],'/')) {
strcpy(node_dir,argv[x]);
backslash(node_dir); }
if(strstr(strupr(argv[x]),"/COST=")) {
p=strchr(argv[x],'=');
if(p!=NULL) cost_per_min=atoi(p+1); }
......@@ -122,7 +122,7 @@ int main(int argc, char **argv)
return(0);
}
if((file=nopen("tbd.mnt",O_RDWR))==-1) {
cls();
cls();
bprintf("\r\nPLEASE WAIT: Daily maintenance is running.");
for(x=0;x<(SQUARE/2);x++) { mswait(1000); bprintf("."); }
} else {
......@@ -728,7 +728,8 @@ void movement(int sx,int sy,int sz,int sgx,int sgy)
}
if(invisible) write_movement(32,x,y,z,gx,gy);
else write_movement(tpic,x,y,z,gx,gy);
if(user.mapx!=x) user.mapx=x; if(user.mapy!=y) user.mapy=y;
if(user.mapx!=x) user.mapx=x;
if(user.mapy!=y) user.mapy=y;
if(in_shop && weapon_ready) { /* put weapon away if drawn */
status_message(0,"\1r\1hAll weapons must be put away while you"
" are within shops!");
......@@ -965,7 +966,7 @@ void movement(int sx,int sy,int sz,int sgx,int sgy)
&& oz[n][0]==z) {
attr((n+1)&0x1f);
bprintf("\x1b[%d;%dH%c",ogy[n][0]+7,ogx[n][0]+35,
active[n][0]);
active[n][0]);
attr((n+1)); }
/********************************************/
/* Erase the other guy if he left the room! */
......@@ -1080,8 +1081,8 @@ void read_player_message()
******************************************************************************/
void send_message(int nodes)
{
int file,num,n;
char ch,fname[81],str[256],str1[256],count=0,chbuf[8];
int num,n;
char str[256],str1[256],count=0,chbuf[8];
if(!nodes) {
bprintf("\x1b[18;0H\x1b[K\1r\1hYou are the only player!\1n");
......@@ -1198,7 +1199,8 @@ void perform_daily_maintenance(int maint_only)
for (y=0;y<3;y++) {
for(z=0;z<18;z++) {
if(level<5 && level>1) ch=y+NUM_WEAPON+1;
else ch=y+4+NUM_WEAPON; val=0;
else ch=y+4+NUM_WEAPON;
val=0;
fwrite(&ch,1,1,stream);
fwrite(&val,1,1,stream);
}
......@@ -1207,7 +1209,8 @@ void perform_daily_maintenance(int maint_only)
for (y=0;y<3;y++) {
for(z=0;z<18;z++) {
if(level<5 && level>1) ch=y+NUM_ARMOR;
else ch=y+3+NUM_ARMOR; val=0;
else ch=y+3+NUM_ARMOR;
val=0;
fwrite(&ch,1,1,stream);
fwrite(&val,1,1,stream);
}
......
......@@ -3,76 +3,87 @@
******************************************************************************/
#include "tbd_pack.h"
int in_shop=0;
long cost_per_min=0L,total_cost=0L,times_per_day=0L;
user_t user;
rmobj_t rmobj[55];
rmobj_t rmcmp[55];
// NOTE (TODO): This list of object does not match objects.h, diff:
/*
* < 4,(BLINK|YELLOW),'.',"Magical Key",0,0,
* < 4,(BLINK|LIGHTRED),'.',"Staff of Power",0,0,
*
* > 4,(YELLOW),'.',"Magical Key",0,0,
* > 4,(LIGHTRED),'.',"Staff of Power",0,0,
*
* < 4,(BROWN),'F',"Food",0,0,
* > 4,(BROWN),'F',"Food",0,9,
*/
object_t object[62]={
0,0,' '," ",0,0,
1,(BLUE),'',"Dagger",0,4,
1,(LIGHTBLUE),'',"Long Dagger",1250,5, /* is the damage */
1,(LIGHTGREEN),'',"Short Sword",2500,6, /* that they do */
1,(LIGHTCYAN),'',"Long Sword",3740,7,
1,(LIGHTRED),'',"Broad Sword",4360,8,
1,(LIGHTMAGENTA),'',"Bastard Sword",4680,9,
1,(YELLOW),'',"2-Handed Sword",4840,10,
2,(LIGHTBLUE),'',"Leather Armor",1250,1, /* Misc for Armor */
2,(LIGHTGREEN),'',"Studded Armor",2500,2, /* is their A.C. */
2,(LIGHTCYAN),'',"Scale Armor",3740,3,
2,(LIGHTRED),'',"Chain Armor",4360,4,
2,(LIGHTMAGENTA),'',"Banded Armor",4680,5,
2,(YELLOW),'',"Plate Armor",4840,6,
3,(YELLOW),'$',"",0,0,
4,(LIGHTBLUE),'',"Warp 2 Other Scroll",100,1,
4,(LIGHTBLUE),'',"Invisibilty Potion",2500,2, /* 30 seconds */
4,(LIGHTGREEN),'',"Healing Potion",500,3, /* 1-5 points */
4,(LIGHTGREEN),'',"Scroll of Xtra Heal",1000,4, /* 2-10 points */
4,(LIGHTMAGENTA),'',"Mystery Scroll",200,7,
4,(LIGHTMAGENTA),'',"Mystery Potion",200,8,
4,(LIGHTRED),'', "Ring of Resurrect",2500,0,
4,(LIGHTCYAN),'',"Potion of Full Heal",2500,5,
4,(YELLOW),'',"Potion of Strength",1500,6,
4,(YELLOW),'',"Magical Key",0,0,
4,(LIGHTRED),'',"Staff of Power",0,0,
4,(WHITE),'@',"Magical Compass",0,0,
4,(BROWN),'F',"Food",0,9,
5,(YELLOW),'',"Stairs Going Up (+ to climb up)",0,0,
5,(LIGHTGREEN),'',"Stairs Going Down (+ to climb down)",0,1,
6,(LIGHTCYAN),'',"Weapons Shop Shopkeeper",0,1,
6,(LIGHTGREEN),'',"Armor Shop Shopkeeper",0,2,
6,(LIGHTRED),'',"Specialty Store Shopkeeper",0,3,
7,(LIGHTBLUE),'',"a Giant Caterpillar",1,1, /* Gold first - */
7,(LIGHTGREEN),'',"a Frag",1,1, /* then level */
7,(BROWN),'',"a Giant Snail",1,2,
7,(LIGHTRED),'',"a Deadly Crab",2,2,
7,(LIGHTCYAN),'',"a Rattlesnake",2,3,
7,(LIGHTBLUE),'',"a Giant",3,3,
7,(YELLOW),'',"a Brainsucker",3,4,
7,(LIGHTMAGENTA),'',"a Bonecrusher",4,4,
7,(BLUE),'',"a Thraxion Stabber",4,5,
7,(GREEN),'',"a Conehead",5,5,
7,(RED),'',"a Snubber",5,6,
7,(MAGENTA),'',"a Little Bojay",6,6,
7,(LIGHTMAGENTA),'',"a Big Bojay",6,7,
7,(BLUE),'',"a Little Flerp",7,7,
7,(LIGHTBLUE),'',"a Big Flerp",7,8,
7,(LIGHTRED),'',"a Neck Puller",8,8,
7,(LIGHTCYAN),'',"an Inhaler",8,9,
7,(YELLOW),'',"a Hunchback",9,9,
7,(GREEN),'',"a Creeping Moss",9,10,
7,(YELLOW),'',"a Killer Hornet",10,10,
7,(WHITE),'',"a Zombie",10,10,
7,(LIGHTBLUE),'',"a Killer Mantis",0,15,
7,(LIGHTRED),'',"The Beast",0,20,
8,(GREEN),'',"Tree",0,0,
8,(YELLOW),'',"Quicksand",0,0,
8,(MAGENTA),'',"Pillar",0,0,
8,(WHITE),'',"Pillar",0,0,
8,(BLUE),'',"Water",0,0,
8,(WHITE),'',"Rock",0,0
{ 0,0,' '," ",0,0 },
{ 1,(BLUE),'',"Dagger",0,4 },
{ 1,(LIGHTBLUE),'',"Long Dagger",1250,5 }, /* is the damage */
{ 1,(LIGHTGREEN),'',"Short Sword",2500,6 }, /* that they do */
{ 1,(LIGHTCYAN),'',"Long Sword",3740,7 },
{ 1,(LIGHTRED),'',"Broad Sword",4360,8 },
{ 1,(LIGHTMAGENTA),'',"Bastard Sword",4680,9 },
{ 1,(YELLOW),'',"2-Handed Sword",4840,10 },
{ 2,(LIGHTBLUE),'',"Leather Armor",1250,1 }, /* Misc for Armor */
{ 2,(LIGHTGREEN),'',"Studded Armor",2500,2 }, /* is their A.C. */
{ 2,(LIGHTCYAN),'',"Scale Armor",3740,3 },
{ 2,(LIGHTRED),'',"Chain Armor",4360,4 },
{ 2,(LIGHTMAGENTA),'',"Banded Armor",4680,5 },
{ 2,(YELLOW),'',"Plate Armor",4840,6 },
{ 3,(YELLOW),'$',"",0,0 },
{ 4,(LIGHTBLUE),'',"Warp 2 Other Scroll",100,1 },
{ 4,(LIGHTBLUE),'',"Invisibilty Potion",2500,2 }, /* 30 seconds */
{ 4,(LIGHTGREEN),'',"Healing Potion",500,3 }, /* 1-5 points */
{ 4,(LIGHTGREEN),'',"Scroll of Xtra Heal",1000,4 }, /* 2-10 points */
{ 4,(LIGHTMAGENTA),'',"Mystery Scroll",200,7 },
{ 4,(LIGHTMAGENTA),'',"Mystery Potion",200,8 },
{ 4,(LIGHTRED),'', "Ring of Resurrect",2500,0 },
{ 4,(LIGHTCYAN),'',"Potion of Full Heal",2500,5 },
{ 4,(YELLOW),'',"Potion of Strength",1500,6 },
{ 4,(YELLOW),'',"Magical Key",0,0 },
{ 4,(LIGHTRED),'',"Staff of Power",0,0 },
{ 4,(WHITE),'@',"Magical Compass",0,0 },
{ 4,(BROWN),'F',"Food",0,9 },
{ 5,(YELLOW),'',"Stairs Going Up (+ to climb up)",0,0 },
{ 5,(LIGHTGREEN),'',"Stairs Going Down (+ to climb down)",0,1 },
{ 6,(LIGHTCYAN),'',"Weapons Shop Shopkeeper",0,1 },
{ 6,(LIGHTGREEN),'',"Armor Shop Shopkeeper",0,2 },
{ 6,(LIGHTRED),'',"Specialty Store Shopkeeper",0,3 },
{ 7,(LIGHTBLUE),'',"a Giant Caterpillar",1,1 }, /* Gold first - */
{ 7,(LIGHTGREEN),'',"a Frag",1,1 }, /* then level */
{ 7,(BROWN),'',"a Giant Snail",1,2 },
{ 7,(LIGHTRED),'',"a Deadly Crab",2,2 },
{ 7,(LIGHTCYAN),'',"a Rattlesnake",2,3 },
{ 7,(LIGHTBLUE),'',"a Giant",3,3 },
{ 7,(YELLOW),'',"a Brainsucker",3,4 },
{ 7,(LIGHTMAGENTA),'',"a Bonecrusher",4,4 },
{ 7,(BLUE),'',"a Thraxion Stabber",4,5 },
{ 7,(GREEN),'',"a Conehead",5,5 },
{ 7,(RED),'',"a Snubber",5,6 },
{ 7,(MAGENTA),'',"a Little Bojay",6,6 },
{ 7,(LIGHTMAGENTA),'',"a Big Bojay",6,7 },
{ 7,(BLUE),'',"a Little Flerp",7,7 },
{ 7,(LIGHTBLUE),'',"a Big Flerp",7,8 },
{ 7,(LIGHTRED),'',"a Neck Puller",8,8 },
{ 7,(LIGHTCYAN),'',"an Inhaler",8,9 },
{ 7,(YELLOW),'',"a Hunchback",9,9 },
{ 7,(GREEN),'',"a Creeping Moss",9,10 },
{ 7,(YELLOW),'',"a Killer Hornet",10,10 },
{ 7,(WHITE),'',"a Zombie",10,10 },
{ 7,(LIGHTBLUE),'',"a Killer Mantis",0,15 },
{ 7,(LIGHTRED),'',"The Beast",0,20 },
{ 8,(GREEN),'',"Tree",0,0 },
{ 8,(YELLOW),'',"Quicksand",0,0 },
{ 8,(MAGENTA),'',"Pillar",0,0 },
{ 8,(WHITE),'',"Pillar",0,0 },
{ 8,(BLUE),'',"Water",0,0 },
{ 8,(WHITE),'',"Rock",0,0 }
};
/******************************************************************************
This function draws the room you are currently in (it also automatically
calls the 'draw_others' routine to draw any other people in the room.
......@@ -489,7 +500,7 @@ void game_commands(int menu,int line)
******************************************************************************/
long read_user(int get_empty)
{
int file,x,count;
int file,count;
char buf[USER_T_SIZE];
record_number=0L;
......@@ -502,7 +513,8 @@ long read_user(int get_empty)
while(!ateof) {
count=0;
while(lock(file,record_number*(long)(USER_T_SIZE),
(long)(USER_T_SIZE)) && count++<500);
(long)(USER_T_SIZE)) && count++<500)
;
if(!read(file,buf,USER_T_SIZE))
ateof=1;
unpack_user_t_struct(&user, buf);
......@@ -618,7 +630,7 @@ void get_room_objects(int level,int room,int display)
}
}
if(!z) in_shop=0;
}
}
}
/******************************************************************************
This function compares room objects from the last read
......@@ -1022,7 +1034,7 @@ int player_attack(int player,uchar level,int ac,int symbol)
char str[256];
uchar x;
int hitchance=70,file;
if(user.level>level)
hitchance+=(user.level-level)*2;
else if(user.level<level)
......@@ -1052,9 +1064,8 @@ int player_attack(int player,uchar level,int ac,int symbol)
******************************************************************************/
int attack_monster(uchar level)
{
char str[256];
int hitchance=70,x;
if(user.level>level)
hitchance+=(user.level-level)*2;
else if(user.level<level)
......@@ -1076,7 +1087,7 @@ void monster_attack(uchar level)
char str[256];
uchar x=0,temp;
int hitchance=70,file;
if(user.level<level)
hitchance+=(level-user.level)*2;
else if(user.level>level)
......@@ -1221,8 +1232,12 @@ void monster_check(int gx,int gy)
if(object[rmobj[((gy+y)*11)+(gx+x)].item].type==MONSTER &&
count<100 && (clock_tick>=18 || (object[rmobj[((gy+y)*11)+
(gx+x)].item].misc>9 && clock_tick>=9))) {
if(y<0) my=1; if(x<0) mx=1; if(y==0) my=0;
if(x==0) mx=0; if(y>0) my=-1; if(x>0) mx=-1;
if(y<0) my=1;
if(x<0) mx=1;
if(y==0) my=0;
if(x==0) mx=0;
if(y>0) my=-1;
if(x>0) mx=-1;
if(!(rmobj[((gy+(y+my))*11)+(gx+(x+mx))].item) &&
!(initial_inway(user.mapx,user.mapy,user.mapz,
(x+mx+gx),(y+my+gy)))) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment