Warning fixes and Makefile edits
- Adjusted the Makefile to create gprof data in the server (currently inactive as the server never terminates.) - Fixed warnings in areadata.c and gamelogic.c. - Added bruteforcePrint for completeness.
This commit is contained in:
parent
60110d3abd
commit
52b4b1e2f0
14
Makefile
14
Makefile
|
@ -8,22 +8,22 @@ serverobj = $(serversrc:.c=.o)
|
||||||
CLIENTLDFLAGS= -lpthread -lncurses -lgnutls
|
CLIENTLDFLAGS= -lpthread -lncurses -lgnutls
|
||||||
SERVERLDFLAGS= -lpthread -lncurses -lgnutls
|
SERVERLDFLAGS= -lpthread -lncurses -lgnutls
|
||||||
SilverMUDClient: $(clientobj)
|
SilverMUDClient: $(clientobj)
|
||||||
gcc -s -O3 -o $@ $^ $(CLIENTLDFLAGS)
|
gcc -o $@ $^ $(CLIENTLDFLAGS)
|
||||||
|
|
||||||
SilverMUDServer: $(serverobj)
|
SilverMUDServer: $(serverobj)
|
||||||
gcc -s -O3 -o $@ $^ $(SERVERLDFLAGS)
|
gcc -o $@ $^ $(SERVERLDFLAGS)
|
||||||
|
|
||||||
SilverMUDClientDebug: $(clientobj)
|
SilverMUDClientDebug: $(clientobj)
|
||||||
gcc -ggdb -Wall $^ $(CLIENTLDFLAGS) -o $@
|
gcc $^ $(CLIENTLDFLAGS) -o $@
|
||||||
|
|
||||||
SilverMUDServerDebug: $(serverobj)
|
SilverMUDServerDebug: $(serverobj)
|
||||||
gcc -ggdb -Wall $^ $(SERVERLDFLAGS) -o $@
|
gcc $^ $(SERVERLDFLAGS) -o $@
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f $(clientobj) $(serverobj) SilverMUDClient SilverMUDServer SilverMUDClientDebug SilverMUDServerDebug
|
rm -f $(clientobj) $(serverobj) SilverMUDClient SilverMUDServer SilverMUDClientDebug SilverMUDServerDebug
|
||||||
|
|
||||||
all: SilverMUDClient SilverMUDServer
|
all: SilverMUDClient SilverMUDServer
|
||||||
|
all: CFLAGS += -Wall -Wextra -Ofast
|
||||||
debug: CFLAGS += -Wall -ggdb -Wextra
|
debug: CFLAGS += -Wall -ggdb -Wextra -Og -pg
|
||||||
debug: SilverMUDClientDebug SilverMUDServerDebug
|
debug: clean SilverMUDClientDebug SilverMUDServerDebug
|
||||||
|
|
|
@ -34,6 +34,7 @@ int addAreaNodeToList(areaNode * toList, playerArea * areaToAdd)
|
||||||
current->next->prev = current;
|
current->next->prev = current;
|
||||||
current->next->data = areaToAdd;
|
current->next->data = areaToAdd;
|
||||||
current->next->next = NULL;
|
current->next->next = NULL;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int deleteAreaNodeFromList(areaNode * fromList, playerArea * areaToDelete)
|
int deleteAreaNodeFromList(areaNode * fromList, playerArea * areaToDelete)
|
||||||
|
@ -53,6 +54,7 @@ int deleteAreaNodeFromList(areaNode * fromList, playerArea * areaToDelete)
|
||||||
current->next->prev = current->prev;
|
current->next->prev = current->prev;
|
||||||
}
|
}
|
||||||
free(current);
|
free(current);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int addPathNodeToList(pathNode * toList, playerPath * pathToAdd)
|
int addPathNodeToList(pathNode * toList, playerPath * pathToAdd)
|
||||||
|
@ -67,6 +69,7 @@ int addPathNodeToList(pathNode * toList, playerPath * pathToAdd)
|
||||||
current->next->prev = current;
|
current->next->prev = current;
|
||||||
current->next->data = pathToAdd;
|
current->next->data = pathToAdd;
|
||||||
current->next->next = NULL;
|
current->next->next = NULL;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int deletePathNodeFromList(pathNode * fromList, playerPath * pathToDelete)
|
int deletePathNodeFromList(pathNode * fromList, playerPath * pathToDelete)
|
||||||
|
@ -86,6 +89,7 @@ int deletePathNodeFromList(pathNode * fromList, playerPath * pathToDelete)
|
||||||
current->next->prev = current->prev;
|
current->next->prev = current->prev;
|
||||||
}
|
}
|
||||||
free(current);
|
free(current);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
areaNode * getAreaNode(areaNode * fromList, int listIndex)
|
areaNode * getAreaNode(areaNode * fromList, int listIndex)
|
||||||
|
|
|
@ -86,4 +86,7 @@ typedef enum outcome
|
||||||
// Run a stat check:
|
// Run a stat check:
|
||||||
outcome statCheck(playerInfo * player, int chance, coreStat statToCheck);
|
outcome statCheck(playerInfo * player, int chance, coreStat statToCheck);
|
||||||
|
|
||||||
|
// Run a skill check:
|
||||||
|
// outcome skillCheck(playerInfo * player, int chance, char * skillToCheck, int skillNameLength);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,7 +40,25 @@ void slowPrintNcurses(char * stringToPrint, int delay, WINDOW * window, bool bol
|
||||||
wrefresh(window);
|
wrefresh(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bruteForcePrintNcurses(char * stringToPrint, int delay, WINDOW * window, bool bolded)
|
void bruteforcePrint(char * stringToPrint, int delay)
|
||||||
|
{
|
||||||
|
unsigned int characterIndex = 0;
|
||||||
|
while(stringToPrint[characterIndex] != '\0')
|
||||||
|
{
|
||||||
|
for(unsigned char currentCharacter = 32; currentCharacter <= stringToPrint[characterIndex]; currentCharacter++)
|
||||||
|
{
|
||||||
|
putchar(stringToPrint[currentCharacter]);
|
||||||
|
fflush(stdout);
|
||||||
|
usleep(delay);
|
||||||
|
putchar(8);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
putchar(stringToPrint[characterIndex]);
|
||||||
|
characterIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void bruteforcePrintNcurses(char * stringToPrint, int delay, WINDOW * window, bool bolded)
|
||||||
{
|
{
|
||||||
int characterIndex = 0;
|
int characterIndex = 0;
|
||||||
if(bolded)
|
if(bolded)
|
||||||
|
|
|
@ -5,14 +5,32 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ncurses.h>
|
#include <ncurses.h>
|
||||||
|
|
||||||
// A fancy, character by character print. Similar to a serial terminal with lower baud rate.
|
// A character by character print, similar to a serial terminal with lower baud rate.
|
||||||
void slowPrint(char * stringToPrint, int delay);
|
void slowPrint(char * stringToPrint, int delay);
|
||||||
|
|
||||||
// The same, altered to work with Ncurses.
|
// The same, altered to work with ncurses.
|
||||||
void slowPrintNcurses(char * stringToPrint, int delay, WINDOW * window, bool bolded);
|
void slowPrintNcurses(char * stringToPrint, int delay, WINDOW * window, bool bolded);
|
||||||
|
|
||||||
|
// A character by character "brute-force" print, similar to Hollywood hacking scenes.
|
||||||
|
void bruteforcePrint(char * stringToPrint, int delay);
|
||||||
|
|
||||||
|
// The same, altered to work with ncurses.
|
||||||
|
void bruteforcePrintNcurses(char * stringToPrint, int delay, WINDOW * window, bool bolded);
|
||||||
|
|
||||||
// A string containing an ASCII art version of the Silverkin Industries logo.
|
// A string containing an ASCII art version of the Silverkin Industries logo.
|
||||||
char * logostring = " ///////\n //////////////////////////////////////////\n ///////////////////////////////////////////////////////////\n ////////// ////////////////////////////\n ### # # # # ##### ### # # # # # /////////////////\n ### # # # # ## # # ## # ## # //////////////\n ## # # # # # ### # # # # # # /////////\n #### # ### # ##### # # # # # # ## ///////\n # ## # ##### # # ### ### ### # ##### ### ////// \n # # # # # # # # ## # # # # ## ## ////\n # # # # # # # # ## # ### # # ## //\n # # ### ##### ##### ### # # # # #### ### //\n";
|
char * logostring =
|
||||||
|
" ///////\n"
|
||||||
|
" //////////////////////////////////////////\n"
|
||||||
|
" ///////////////////////////////////////////////////////////\n"
|
||||||
|
" ////////// ////////////////////////////\n"
|
||||||
|
" ### # # # # ##### ### # # # # # /////////////////\n"
|
||||||
|
" ## # # # # ## # # ### # ## # //////////////\n"
|
||||||
|
" ## # # # # # ### # # # # # # /////////\n"
|
||||||
|
" ### # ### # ##### # # # # # # # ///////\n"
|
||||||
|
" # ## # ##### # # ### ### ### # ##### ### ////// \n"
|
||||||
|
" # # # # # # # # ## # # # # ## ## ////\n"
|
||||||
|
" # # # # # # # # ## # ### # # ## //\n"
|
||||||
|
" # # ### ##### ##### ### # # # # #### ### /\n";
|
||||||
|
|
||||||
void wrapString(char * stringToWrap, int stringLength, int screenWidth);
|
void wrapString(char * stringToWrap, int stringLength, int screenWidth);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue