Squashed version of:
Altered some header files to prevent cycles confusing LSP Switched to correct ncurses function for just printing a string. Make cleaning manual in the makefile. It's getting bigger. Squash the warning about strncpy. Added LSP shtuff to the gitignore
This commit is contained in:
parent
3419ef1804
commit
701335c236
|
@ -9,3 +9,7 @@ SilverMUDServerDebug
|
||||||
|
|
||||||
# Profiling Artifacts:
|
# Profiling Artifacts:
|
||||||
gmon.out
|
gmon.out
|
||||||
|
|
||||||
|
# LSP whatnot:
|
||||||
|
.cache
|
||||||
|
compile_commands.json
|
7
Makefile
7
Makefile
|
@ -11,13 +11,14 @@ serversrc = $(wildcard src/*.c) src/server/SilverMUDServer.c
|
||||||
serverobj = $(serversrc:.c=.o)
|
serverobj = $(serversrc:.c=.o)
|
||||||
|
|
||||||
# Default target: Compile the client and server with aggressive optimizations and a big stack of warnings:
|
# Default target: Compile the client and server with aggressive optimizations and a big stack of warnings:
|
||||||
all: clean SilverMUDClient SilverMUDServer
|
|
||||||
all: CFLAGS += -Wall -Wextra -Ofast
|
all: CFLAGS += -Wall -Wextra -Ofast
|
||||||
|
all: SilverMUDClient SilverMUDServer
|
||||||
|
|
||||||
|
|
||||||
# Debug target: Compile the client and server with profiling, debug information, debug optimization, and the
|
# Debug target: Compile the client and server with profiling, debug information, debug optimization, and the
|
||||||
# preprocessor flag "debug" set.
|
# preprocessor flag "debug" set.
|
||||||
debug: CFLAGS += -Wall -Wextra -pg -ggdb -Og -D debug
|
debug: CFLAGS += -Wall -Wextra -pg -ggdb -Og -D debug
|
||||||
debug: clean SilverMUDClientDebug SilverMUDServerDebug
|
debug: SilverMUDClientDebug SilverMUDServerDebug
|
||||||
|
|
||||||
SilverMUDClient: $(clientobj)
|
SilverMUDClient: $(clientobj)
|
||||||
cc $^ $(LDFLAGS) -o $@
|
cc $^ $(LDFLAGS) -o $@
|
||||||
|
@ -29,7 +30,7 @@ SilverMUDClientDebug: $(clientobj)
|
||||||
cc -pg $^ $(LDFLAGS) -o $@
|
cc -pg $^ $(LDFLAGS) -o $@
|
||||||
|
|
||||||
SilverMUDServerDebug: $(serverobj)
|
SilverMUDServerDebug: $(serverobj)
|
||||||
cc -pg $^ $(LDFLAGS) -o $@
|
cc -pg $^ $(LDFLAGS) -o @$
|
||||||
|
|
||||||
# Start from a clean slate:
|
# Start from a clean slate:
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#ifndef AREADATA_H
|
#ifndef AREADATA_H
|
||||||
#define AREADATA_H
|
#define AREADATA_H
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "linkedlist.h"
|
|
||||||
|
|
||||||
// ====================
|
// ====================
|
||||||
// -=[ Area/Paths: ]=-:
|
// -=[ Area/Paths: ]=-:
|
||||||
|
|
|
@ -54,10 +54,10 @@ void * messageSender(void * parameters)
|
||||||
{
|
{
|
||||||
usleep(200000);
|
usleep(200000);
|
||||||
// Clear the window:
|
// Clear the window:
|
||||||
wprintw(window, "\n\n\n");
|
waddstr(window, "\n\n\n");
|
||||||
|
|
||||||
// Print the prompt:
|
// Print the prompt:
|
||||||
wprintw(window, prompt);
|
waddstr(window, prompt);
|
||||||
|
|
||||||
if (wgetnstr(window, sendBuffer.messageContent, MAX) == ERR)
|
if (wgetnstr(window, sendBuffer.messageContent, MAX) == ERR)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
// Barry Kane, 2022.
|
// Barry Kane, 2022.
|
||||||
#ifndef GAMELOGIC_H
|
#ifndef GAMELOGIC_H
|
||||||
#define GAMELOGIC_H
|
#define GAMELOGIC_H
|
||||||
#include "queue.h"
|
|
||||||
#include "areadata.h"
|
#include "areadata.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "playerdata.h"
|
#include "playerdata.h"
|
||||||
#include "inputoutput.h"
|
|
||||||
|
// Forward-declare some data structures to prevent cyclic dependencies:
|
||||||
|
typedef struct queue queue;
|
||||||
|
typedef struct inputMessage inputMessage;
|
||||||
|
|
||||||
// ========================
|
// ========================
|
||||||
// -=[ Data Structures ]=-:
|
// -=[ Data Structures ]=-:
|
||||||
|
|
|
@ -7,12 +7,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <gnutls/gnutls.h>
|
#include <gnutls/gnutls.h>
|
||||||
|
|
||||||
#include "queue.h"
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "playerdata.h"
|
#include "playerdata.h"
|
||||||
|
|
||||||
// Let the compiler know there will be structs defined elsewhere:
|
// Forward-declare some data structures to prevent cyclic dependencies:
|
||||||
typedef struct queue queue;
|
typedef struct queue queue;
|
||||||
|
|
||||||
// ========================
|
// ========================
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#ifndef LINKEDLIST_H
|
#ifndef LINKEDLIST_H
|
||||||
#define LINKEDLIST_H
|
#define LINKEDLIST_H
|
||||||
#include "areadata.h"
|
#include "areadata.h"
|
||||||
#include "playerdata.h"
|
|
||||||
|
|
||||||
// Let the compiler know there will be structs defined elsewhere:
|
// Let the compiler know there will be structs defined elsewhere:
|
||||||
typedef struct playerPath playerPath;
|
typedef struct playerPath playerPath;
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
#include "gamelogic.h"
|
#include "gamelogic.h"
|
||||||
#include "inputoutput.h"
|
#include "inputoutput.h"
|
||||||
|
|
||||||
|
// Forward-declare some data structures to prevent cyclic dependencies:
|
||||||
|
typedef struct queue queue;
|
||||||
|
|
||||||
// ========================
|
// ========================
|
||||||
// -=[ Data Structures ]=-:
|
// -=[ Data Structures ]=-:
|
||||||
// ========================
|
// ========================
|
||||||
|
|
||||||
// Let the compiler know there will be structs defined elsewhere:
|
|
||||||
typedef struct queue queue;
|
|
||||||
|
|
||||||
// An enum which is used to state what type of data is being stored in a queueNode:
|
// An enum which is used to state what type of data is being stored in a queueNode:
|
||||||
typedef enum queueDataType
|
typedef enum queueDataType
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,8 @@ int main(int argc, char ** argv)
|
||||||
}
|
}
|
||||||
case 'm':
|
case 'm':
|
||||||
{
|
{
|
||||||
strncpy(motd, optarg, strlen(optarg) + 1);
|
strncpy(motd, optarg, 2047);
|
||||||
|
motd[2047] = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue