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:
Barra Ó Catháin 2023-04-11 14:41:44 +01:00
parent 3419ef1804
commit 701335c236
9 changed files with 21 additions and 17 deletions

4
.gitignore vendored
View File

@ -9,3 +9,7 @@ SilverMUDServerDebug
# Profiling Artifacts:
gmon.out
# LSP whatnot:
.cache
compile_commands.json

View File

@ -11,13 +11,14 @@ serversrc = $(wildcard src/*.c) src/server/SilverMUDServer.c
serverobj = $(serversrc:.c=.o)
# 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: SilverMUDClient SilverMUDServer
# Debug target: Compile the client and server with profiling, debug information, debug optimization, and the
# preprocessor flag "debug" set.
debug: CFLAGS += -Wall -Wextra -pg -ggdb -Og -D debug
debug: clean SilverMUDClientDebug SilverMUDServerDebug
debug: SilverMUDClientDebug SilverMUDServerDebug
SilverMUDClient: $(clientobj)
cc $^ $(LDFLAGS) -o $@
@ -29,7 +30,7 @@ SilverMUDClientDebug: $(clientobj)
cc -pg $^ $(LDFLAGS) -o $@
SilverMUDServerDebug: $(serverobj)
cc -pg $^ $(LDFLAGS) -o $@
cc -pg $^ $(LDFLAGS) -o @$
# Start from a clean slate:
.PHONY: clean

View File

@ -3,7 +3,6 @@
#ifndef AREADATA_H
#define AREADATA_H
#include "constants.h"
#include "linkedlist.h"
// ====================
// -=[ Area/Paths: ]=-:

View File

@ -54,10 +54,10 @@ void * messageSender(void * parameters)
{
usleep(200000);
// Clear the window:
wprintw(window, "\n\n\n");
waddstr(window, "\n\n\n");
// Print the prompt:
wprintw(window, prompt);
waddstr(window, prompt);
if (wgetnstr(window, sendBuffer.messageContent, MAX) == ERR)
{

View File

@ -2,11 +2,13 @@
// Barry Kane, 2022.
#ifndef GAMELOGIC_H
#define GAMELOGIC_H
#include "queue.h"
#include "areadata.h"
#include "constants.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 ]=-:

View File

@ -7,12 +7,10 @@
#include <stdlib.h>
#include <stdbool.h>
#include <gnutls/gnutls.h>
#include "queue.h"
#include "constants.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;
// ========================

View File

@ -3,7 +3,6 @@
#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include "areadata.h"
#include "playerdata.h"
// Let the compiler know there will be structs defined elsewhere:
typedef struct playerPath playerPath;

View File

@ -5,13 +5,13 @@
#include "gamelogic.h"
#include "inputoutput.h"
// Forward-declare some data structures to prevent cyclic dependencies:
typedef struct queue queue;
// ========================
// -=[ 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:
typedef enum queueDataType
{

View File

@ -64,7 +64,8 @@ int main(int argc, char ** argv)
}
case 'm':
{
strncpy(motd, optarg, strlen(optarg) + 1);
strncpy(motd, optarg, 2047);
motd[2047] = '\0';
break;
}
}