Skip to content

Commit 073b001

Browse files
committed
Successfully link odagtest against odamex-common
1 parent 69a746f commit 073b001

19 files changed

+357
-150
lines changed

client/sdl/i_video.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@
5757
#include "resource.h"
5858
#endif // _WIN32
5959

60-
// Declared in doomtype.h as part of argb_t
61-
uint8_t argb_t::a_num, argb_t::r_num, argb_t::g_num, argb_t::b_num;
62-
6360
// Global IVideoSubsystem instance for video startup and shutdown
6461
static IVideoSubsystem* video_subsystem = NULL;
6562

client/src/cl_game.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ bool noblit; // for comparative timing purposes
126126
bool network_game;
127127
// Describes if this is a multiplayer game or not
128128
bool multiplayer;
129-
// The player vector, contains all player information
130-
Players players;
131129

132130
byte consoleplayer_id; // player taking events and displaying
133131
byte displayplayer_id; // view being displayed

client/src/d_main.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ EXTERN_CVAR (vid_vsync)
150150
EXTERN_CVAR (g_resetinvonexit)
151151
EXTERN_CVAR (i_skipbootwin)
152152

153-
std::string LOG_FILE;
154-
155153
void M_RestoreVideoMode();
156154
void M_ModeFlashTestText();
157155

common/c_doc.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333

3434
#ifdef CLIENT_APP
3535
#define CS_STRING "Odamex Client"
36-
#else
36+
#elif defined(SERVER_APP)
3737
#define CS_STRING "Odamex Server"
38+
#elif defined(TEST_APP)
39+
#define CS_STRING "Odamex Unit Tests"
3840
#endif
3941

4042
// A view to a list of Cvars.
@@ -242,8 +244,10 @@ BEGIN_COMMAND(cvardoc)
242244

243245
#ifdef CLIENT_APP
244246
path += "odamex_cvardoc.html";
245-
#else
247+
#elif defined(SERVER_APP)
246248
path += "odasrv_cvardoc.html";
249+
#elif defined(TEST_APP)
250+
path += "odagtest_cvardoc.html";
247251
#endif
248252

249253
// Try and open a file in our write directory.

common/com_misc.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#if defined(SERVER_APP)
3434
#include "svc_message.h"
35-
#else
35+
#elif defined(CLIENT_APP)
3636
#include "st_stuff.h"
3737
#endif
3838

@@ -43,7 +43,7 @@ void COM_PushToast(const toast_t& toast)
4343
{
4444
MSG_WriteSVC(&player.client.reliablebuf, SVC_Toast(toast));
4545
}
46-
#else
46+
#elif defined(CLIENT_APP)
4747
hud::PushToast(toast);
4848
#endif
4949
}

common/d_main.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "d_event.h"
2727
#include "m_resfile.h"
2828

29-
extern std::string LOG_FILE;
29+
inline std::string LOG_FILE;
3030

3131
//
3232
// D_DoomMain()

common/d_player.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ typedef player_t::client_t client_t;
408408

409409
// Bookkeeping on players - state.
410410
typedef std::list<player_t> Players;
411-
extern Players players;
411+
inline Players players;
412412

413413
// Player taking events, and displaying.
414414
player_t &consoleplayer();

common/doomtype.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ class argb_t
311311
{ a_num = _a; r_num = _r; g_num = _g; b_num = _b; }
312312

313313
private:
314-
static uint8_t a_num, r_num, g_num, b_num;
314+
static inline uint8_t a_num, r_num, g_num, b_num;
315315

316316
union
317317
{

common/m_wdlstats.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333

3434
#define WDLSTATS_VERSION 6
3535

36-
extern Players players;
37-
3836
EXTERN_CVAR(sv_gametype)
3937
EXTERN_CVAR(sv_hostname)
4038
EXTERN_CVAR(sv_teamspawns)

common/p_spec.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2210,7 +2210,7 @@ void P_CollectSecretCommon(sector_t* sector, player_t* player)
22102210
#ifdef SERVER_APP
22112211
SV_UpdateSecret(*sector, *player); // Update the sector to all clients so that they
22122212
// don't discover an already found secret.
2213-
#else
2213+
#elif defined(CLIENT_APP)
22142214
if (player->mo == consoleplayer().camera)
22152215
C_RevealSecret(); // Display the secret revealed message
22162216
#endif

common/s_sound.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ inline static void S_NetSound(AActor* mo, byte channel, const char* name, const
187187
{
188188
#if SERVER_APP
189189
SV_Sound(mo, channel, name, attenuation);
190-
#else
190+
#elif defined(CLIENT_APP)
191191
S_Sound(mo, channel, name, 1, attenuation);
192192
#endif
193193
}
@@ -197,7 +197,7 @@ inline static void S_PlayerSound(player_t* pl, AActor* mo, const byte channel, c
197197
{
198198
#if SERVER_APP
199199
SV_Sound(*pl, mo, channel, name, attenuation);
200-
#else
200+
#elif defined(CLIENT_APP)
201201
S_Sound(mo, channel, name, 1, attenuation);
202202
#endif
203203
}

common/tarray.h

+5-10
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,12 @@ template <class T>
3131
class TArray
3232
{
3333
public:
34-
TArray ()
35-
{
36-
Most = 0;
37-
Count = 0;
38-
Array = NULL;
39-
}
34+
TArray () {}
4035
TArray (int max)
4136
{
4237
Most = max;
4338
Count = 0;
44-
Array = (T *)Malloc (sizeof(T)*max);
39+
Array = (T *)M_Malloc (sizeof(T)*max);
4540
}
4641
~TArray ()
4742
{
@@ -122,7 +117,7 @@ class TArray
122117
}
123118

124119
private:
125-
T *Array;
126-
size_t Most;
127-
size_t Count;
120+
T* Array = nullptr;
121+
size_t Most = 0;
122+
size_t Count = 0;
128123
};

server/src/d_main.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ OLumpName startmap;
9595
event_t events[MAXEVENTS];
9696
gamestate_t wipegamestate = GS_DEMOSCREEN; // can be -1 to force a wipe
9797

98-
std::string LOG_FILE;
99-
10098
//
10199
// D_DoomLoop
102100
//

server/src/sv_game.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ bool timingdemo; // FIXME : delete this variable for odasrv ?
6767
bool network_game; // Describes if a network game is being played
6868
bool multiplayer; // Describes if this is a multiplayer game or not
6969

70-
Players players; // The player vector, contains all player information
7170
player_t nullplayer; // The null player
7271

7372
byte consoleplayer_id; // player taking events and displaying

server/src/v_palette.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
#include "z_zone.h"
3232
#include "st_stuff.h"
3333

34-
// Declared in doomtype.h as part of argb_t
35-
uint8_t argb_t::a_num, argb_t::r_num, argb_t::g_num, argb_t::b_num;
36-
3734
dyncolormap_t NormalLight;
3835

3936
/****************************/

tests/unit-tests/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,11 @@ else()
3232
pkg_check_modules(JSONCPP jsoncpp REQUIRED IMPORTED_TARGET)
3333
target_link_libraries(odagtest PkgConfig::JSONCPP)
3434
endif()
35+
36+
if(WIN32)
37+
target_link_libraries(odagtest winmm wsock32 shlwapi)
38+
elseif(UNIX AND NOT APPLE)
39+
target_link_libraries(odagtest rt)
40+
endif()
41+
3542
odamex_target_settings(odagtest)

0 commit comments

Comments
 (0)