diff --git a/sc2/ChangeLog b/sc2/ChangeLog index a0a854569..38317e566 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.8: +- Preparing for linking with C++ code, from Scott A. Colcord - Fixed player's phrase leading to Tanaka's response about a solitary vigil (bug #859) - Alex - Added the Ur-Quan to the list of starfaring races on which Commander diff --git a/sc2/src/endian_uqm.h b/sc2/src/endian_uqm.h index 76f64cd90..3958431aa 100644 --- a/sc2/src/endian_uqm.h +++ b/sc2/src/endian_uqm.h @@ -61,6 +61,11 @@ #define UQM_Swap32 __arch__swab32 #endif #endif /* linux */ + +#if defined(__cplusplus) +extern "C" { +#endif + /* Use inline functions for compilers that support them, and static functions for those that do not. Because these functions become static for compilers that do not support inline functions, this @@ -124,4 +129,8 @@ static __inline__ uint64 UQM_Swap64(uint64 val) #define UQM_SwapBE64(X) (X) #endif +#if defined(__cplusplus) +} +#endif + #endif /* _ENDIAN_H */ diff --git a/sc2/src/libs/alarm.h b/sc2/src/libs/alarm.h index 7cd33d2ca..b4a72cacb 100644 --- a/sc2/src/libs/alarm.h +++ b/sc2/src/libs/alarm.h @@ -1,2 +1,9 @@ +#if defined(__cplusplus) +extern "C" { +#endif + #include "callback/alarm.h" +#if defined(__cplusplus) +} +#endif diff --git a/sc2/src/libs/callback.h b/sc2/src/libs/callback.h index d2d959b95..025160a5b 100644 --- a/sc2/src/libs/callback.h +++ b/sc2/src/libs/callback.h @@ -1,2 +1,10 @@ +#if defined(__cplusplus) +extern "C" { +#endif + #include "callback/callback.h" +#if defined(__cplusplus) +} +#endif + diff --git a/sc2/src/libs/cdplib.h b/sc2/src/libs/cdplib.h index 51405fea3..9ba42f3aa 100644 --- a/sc2/src/libs/cdplib.h +++ b/sc2/src/libs/cdplib.h @@ -19,6 +19,14 @@ #ifndef _CDPLIB_H #define _CDPLIB_H +#if defined(__cplusplus) +extern "C" { +#endif + #include "cdp/cdp.h" +#if defined(__cplusplus) +} +#endif + #endif /* _CDPLIB_H */ diff --git a/sc2/src/libs/compiler.h b/sc2/src/libs/compiler.h index 0b2970928..6e795aa66 100644 --- a/sc2/src/libs/compiler.h +++ b/sc2/src/libs/compiler.h @@ -21,6 +21,10 @@ #include "types.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef uint8 BYTE; typedef uint8 UBYTE; typedef sint8 SBYTE; @@ -85,5 +89,9 @@ typedef DWORD (*PDWORDFUNC) (void); # define _ALIGNED_ON(bytes) #endif +#if defined(__cplusplus) +} +#endif + #endif /* _COMPILER_H */ diff --git a/sc2/src/libs/declib.h b/sc2/src/libs/declib.h index dc2f922a5..63840cc7d 100644 --- a/sc2/src/libs/declib.h +++ b/sc2/src/libs/declib.h @@ -20,6 +20,11 @@ #define _DECLIB_H #include "libs/compiler.h" + +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct _LZHCODE_DESC* DECODE_REF; enum @@ -45,4 +50,8 @@ extern COUNT cread (void *pStr, COUNT size, COUNT count, extern COUNT cwrite (const void *pStr, COUNT size, COUNT count, DECODE_REF DecodeRef); +#if defined(__cplusplus) +} +#endif + #endif /* _DECLIB_H */ diff --git a/sc2/src/libs/file.h b/sc2/src/libs/file.h index 83c06dbf4..eb1883108 100644 --- a/sc2/src/libs/file.h +++ b/sc2/src/libs/file.h @@ -25,6 +25,10 @@ // for bool #include "types.h" +#if defined(__cplusplus) +extern "C" { +#endif + #if 0 // from temp.h void initTempDir (void); @@ -83,5 +87,9 @@ static inline int isDriveLetter(int c) } #endif /* HAVE_DRIVE_LETTERS */ +#if defined(__cplusplus) +} +#endif + #endif /* _FILE_H */ diff --git a/sc2/src/libs/gfxlib.h b/sc2/src/libs/gfxlib.h index 346030357..19ac8f810 100644 --- a/sc2/src/libs/gfxlib.h +++ b/sc2/src/libs/gfxlib.h @@ -32,6 +32,10 @@ struct Color { #include "libs/reslib.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct context_desc CONTEXT_DESC; typedef struct frame_desc FRAME_DESC; typedef struct font_desc FONT_DESC; @@ -227,8 +231,16 @@ typedef struct text COUNT CharCount; } TEXT; +#if defined(__cplusplus) +} +#endif + #include "libs/strlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef STRING_TABLE COLORMAP_REF; typedef STRING COLORMAP; // COLORMAPPTR is really a pointer to colortable entry structure @@ -237,6 +249,7 @@ typedef void *COLORMAPPTR; #include "graphics/prim.h" + typedef BYTE BATCH_FLAGS; // This flag is currently unused but it might make sense to restore it #define BATCH_BUILD_PAGE (BATCH_FLAGS)(1 << 0) @@ -454,4 +467,8 @@ extern COLORMAPPTR GetColorMapAddress (COLORMAP); void SetSystemRect (const RECT *pRect); void ClearSystemRect (void); +#if defined(__cplusplus) +} +#endif + #endif /* _GFXLIB_H */ diff --git a/sc2/src/libs/heap.h b/sc2/src/libs/heap.h index a6cce5838..674649bab 100644 --- a/sc2/src/libs/heap.h +++ b/sc2/src/libs/heap.h @@ -1,2 +1,9 @@ +#if defined(__cplusplus) +extern "C" { +#endif + #include "heap/heap.h" +#if defined(__cplusplus) +} +#endif diff --git a/sc2/src/libs/inplib.h b/sc2/src/libs/inplib.h index 08bb0d1a2..27a69079e 100644 --- a/sc2/src/libs/inplib.h +++ b/sc2/src/libs/inplib.h @@ -24,6 +24,10 @@ #include "libs/uio.h" #include "libs/unicode.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern BOOLEAN AnyButtonPress (BOOLEAN DetectSpecial); @@ -59,5 +63,9 @@ void SaveKeyConfiguration (uio_DirHandle *path, const char *fname); void BeginInputFrame (void); +#if defined(__cplusplus) +} +#endif + #endif /* _INPLIB_H */ diff --git a/sc2/src/libs/list.h b/sc2/src/libs/list.h index a7a507b03..42a28d4a9 100644 --- a/sc2/src/libs/list.h +++ b/sc2/src/libs/list.h @@ -16,5 +16,14 @@ * */ +#if defined(__cplusplus) +extern "C" { +#endif + #include "list/list.h" +#if defined(__cplusplus) +} +#endif + + diff --git a/sc2/src/libs/log.h b/sc2/src/libs/log.h index 79b1fd8d7..11537c734 100644 --- a/sc2/src/libs/log.h +++ b/sc2/src/libs/log.h @@ -14,4 +14,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#if defined(__cplusplus) +extern "C" { +#endif + #include "log/uqmlog.h" + +#if defined(__cplusplus) +} +#endif diff --git a/sc2/src/libs/mathlib.h b/sc2/src/libs/mathlib.h index fca48fdd4..430e87961 100644 --- a/sc2/src/libs/mathlib.h +++ b/sc2/src/libs/mathlib.h @@ -20,10 +20,19 @@ #define _MATHLIB_H #include "libs/compiler.h" + +#if defined(__cplusplus) +extern "C" { +#endif + #include "math/random.h" extern COUNT square_root (DWORD value); +#if defined(__cplusplus) +} +#endif + #endif /* _MATHLIB_H */ diff --git a/sc2/src/libs/md5.h b/sc2/src/libs/md5.h index 3f24cc9b5..17414db82 100644 --- a/sc2/src/libs/md5.h +++ b/sc2/src/libs/md5.h @@ -19,7 +19,15 @@ #ifndef _LIB_MD5_H #define _LIB_MD5_H +#if defined(__cplusplus) +extern "C" { +#endif + #include "md5/md5.h" +#if defined(__cplusplus) +} +#endif + #endif /* _LIB_MD5_H */ diff --git a/sc2/src/libs/memlib.h b/sc2/src/libs/memlib.h index 291b62429..52234f37c 100644 --- a/sc2/src/libs/memlib.h +++ b/sc2/src/libs/memlib.h @@ -21,6 +21,10 @@ #include "types.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern bool mem_init (void); extern bool mem_uninit (void); @@ -29,5 +33,9 @@ extern void HFree (void *p); extern void *HCalloc (int size); extern void *HRealloc (void *p, int size); +#if defined(__cplusplus) +} +#endif + #endif /* _MEMLIB_H */ diff --git a/sc2/src/libs/misc.h b/sc2/src/libs/misc.h index a080f064c..56fbc222f 100644 --- a/sc2/src/libs/misc.h +++ b/sc2/src/libs/misc.h @@ -26,6 +26,10 @@ #include #include "port.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern int TFB_DEBUG_HALT; @@ -54,5 +58,9 @@ unconst(const void *arg) { return u.c; } +#if defined(__cplusplus) +} +#endif + #endif diff --git a/sc2/src/libs/net.h b/sc2/src/libs/net.h index 50ce7e1bd..b1e3377eb 100644 --- a/sc2/src/libs/net.h +++ b/sc2/src/libs/net.h @@ -19,11 +19,19 @@ #ifndef _NET_H #define _NET_H +#if defined(__cplusplus) +extern "C" { +#endif + #include "network/network.h" #include "network/netmanager/netmanager.h" #include "network/connect/connect.h" #include "network/connect/listen.h" #include "network/connect/resolve.h" +#if defined(__cplusplus) +} +#endif + #endif /* _NET_H */ diff --git a/sc2/src/libs/platform.h b/sc2/src/libs/platform.h index 8ab6919cc..f17674d60 100644 --- a/sc2/src/libs/platform.h +++ b/sc2/src/libs/platform.h @@ -17,6 +17,10 @@ #ifndef PLATFORM_H_ #define PLATFORM_H_ +#if defined(__cplusplus) +extern "C" { +#endif + #if defined(USE_PLATFORM_ACCEL) # if defined(__GNUC__) && (defined(i386) || defined(__x86_64__)) # define MMX_ASM @@ -46,4 +50,8 @@ typedef enum extern PLATFORM_TYPE force_platform; +#if defined(__cplusplus) +} +#endif + #endif /* PLATFORM_H_ */ diff --git a/sc2/src/libs/reslib.h b/sc2/src/libs/reslib.h index c7486e8d0..20f01f422 100644 --- a/sc2/src/libs/reslib.h +++ b/sc2/src/libs/reslib.h @@ -25,6 +25,10 @@ #include "libs/memlib.h" #include "libs/uio.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct resource_index_desc RESOURCE_INDEX_DESC; typedef RESOURCE_INDEX_DESC *RESOURCE_INDEX; @@ -78,8 +82,16 @@ void *GetResourceData (uio_Stream *fp, DWORD length); #define AllocResourceData HMalloc BOOLEAN FreeResourceData (void *); +#if defined(__cplusplus) +} +#endif + #include "libs/strlib.h" #include "libs/gfxlib.h" + +#if defined(__cplusplus) +extern "C" { +#endif // For Color typedef STRING_TABLE DIRENTRY_REF; @@ -120,4 +132,8 @@ void res_PutColor (const char *key, Color value); BOOLEAN res_Remove (const char *key); +#if defined(__cplusplus) +} +#endif + #endif /* _RESLIB_H */ diff --git a/sc2/src/libs/sndlib.h b/sc2/src/libs/sndlib.h index cc8c38895..61ca210db 100644 --- a/sc2/src/libs/sndlib.h +++ b/sc2/src/libs/sndlib.h @@ -22,6 +22,10 @@ #include "port.h" #include "libs/strlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef STRING_TABLE SOUND_REF; typedef STRING SOUND; // SOUNDPTR is really a TFB_SoundSample** @@ -95,5 +99,9 @@ extern void WaitForSoundEnd (COUNT Channel); extern DWORD FadeMusic (BYTE end_vol, SIZE TimeInterval); +#if defined(__cplusplus) +} +#endif + #endif /* _SNDLIB_H */ diff --git a/sc2/src/libs/strlib.h b/sc2/src/libs/strlib.h index 7f4ba0245..3195c6966 100644 --- a/sc2/src/libs/strlib.h +++ b/sc2/src/libs/strlib.h @@ -36,6 +36,10 @@ typedef char *STRINGPTR; /* This has to go here because reslib requires the above typedefs. */ #include "libs/reslib.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern BOOLEAN InstallStringTableResType (void); extern STRING_TABLE LoadStringTableInstance (RESOURCE res); extern STRING_TABLE LoadStringTableFile (uio_DirHandle *dir, @@ -67,5 +71,9 @@ extern STRINGPTR GetStringTimeStamp (STRING String); #define UNICHAR_BULLET 0x2022 #define STR_BULLET "\xE2\x80\xA2" +#if defined(__cplusplus) +} +#endif + #endif /* _STRLIB_H */ diff --git a/sc2/src/libs/tasklib.h b/sc2/src/libs/tasklib.h index fea7510cf..82981c44d 100644 --- a/sc2/src/libs/tasklib.h +++ b/sc2/src/libs/tasklib.h @@ -26,6 +26,10 @@ #include "libs/threadlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + /* Bitmasks for setting task state. */ #define TASK_INUSE 1 #define TASK_EXIT 2 @@ -50,5 +54,9 @@ extern DWORD Task_ReadState (Task task, DWORD state_mask); extern void FinishTask (Task task); extern void ConcludeTask (Task task); +#if defined(__cplusplus) +} +#endif + #endif diff --git a/sc2/src/libs/threadlib.h b/sc2/src/libs/threadlib.h index fe9070e91..80db0a533 100644 --- a/sc2/src/libs/threadlib.h +++ b/sc2/src/libs/threadlib.h @@ -45,6 +45,10 @@ #include #include "libs/timelib.h" +#if defined(__cplusplus) +extern "C" { +#endif + #if defined (PROFILE_THREADS) || defined (DEBUG_THREADS) #define THREAD_NAMES #endif @@ -173,5 +177,9 @@ void WaitCondVar (CondVar); void SignalCondVar (CondVar); void BroadcastCondVar (CondVar); +#if defined(__cplusplus) +} +#endif + #endif /* _THREADLIB_H */ diff --git a/sc2/src/libs/timelib.h b/sc2/src/libs/timelib.h index c48b2fe6c..bfb3e37d5 100644 --- a/sc2/src/libs/timelib.h +++ b/sc2/src/libs/timelib.h @@ -21,6 +21,10 @@ #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + /* ONE_SECOND is the LCM of all the fractions of a second the game uses. * Battle is 24 FPS, Landers are 35 FPS, most UI-level things are 15 FPS, * The Interplanetary flight is 30 FPS, Comm ambient animation is 40 FPS, @@ -38,5 +42,9 @@ extern void InitTimeSystem (void); extern void UnInitTimeSystem (void); extern TimeCount GetTimeCounter (void); +#if defined(__cplusplus) +} +#endif + #endif /* _TIMLIB_H */ diff --git a/sc2/src/libs/uio.h b/sc2/src/libs/uio.h index 15acfc467..e73d1ed82 100644 --- a/sc2/src/libs/uio.h +++ b/sc2/src/libs/uio.h @@ -21,7 +21,15 @@ #ifndef _UIO_H #define _UIO_H +#if defined(__cplusplus) +extern "C" { +#endif + #include "uio/io.h" +#if defined(__cplusplus) +} +#endif + #endif /* _UIO_H */ diff --git a/sc2/src/libs/uioutils.h b/sc2/src/libs/uioutils.h index 6748dd144..377fd84f7 100644 --- a/sc2/src/libs/uioutils.h +++ b/sc2/src/libs/uioutils.h @@ -21,7 +21,15 @@ #ifndef _UIOUTILS_H #define _UIOUTILS_H +#if defined(__cplusplus) +extern "C" { +#endif + #include "uio/utils.h" +#if defined(__cplusplus) +} +#endif + #endif /* _UIOUTILS_H */ diff --git a/sc2/src/libs/unicode.h b/sc2/src/libs/unicode.h index 428de6f5c..922a3cc4e 100644 --- a/sc2/src/libs/unicode.h +++ b/sc2/src/libs/unicode.h @@ -23,6 +23,10 @@ #include // For size_t +#if defined(__cplusplus) +extern "C" { +#endif + typedef uint32 UniChar; #ifdef UNICODE_INTERNAL @@ -60,5 +64,9 @@ UniChar UniChar_toLower(UniChar ch); #undef UNICODE_CHAR +#if defined(__cplusplus) +} +#endif + #endif /* UNICODE_H */ diff --git a/sc2/src/libs/vidlib.h b/sc2/src/libs/vidlib.h index 786470814..d1a25877b 100644 --- a/sc2/src/libs/vidlib.h +++ b/sc2/src/libs/vidlib.h @@ -23,6 +23,10 @@ #include "libs/sndlib.h" #include "libs/reslib.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef enum { NO_FMV = 0, @@ -57,4 +61,8 @@ extern LEGACY_VIDEO_REF PlayLegacyVideo (LEGACY_VIDEO vid); extern void StopLegacyVideo (LEGACY_VIDEO_REF ref); extern BOOLEAN PlayingLegacyVideo (LEGACY_VIDEO_REF ref); +#if defined(__cplusplus) +} +#endif + #endif /* _VIDLIB_H */ diff --git a/sc2/src/options.h b/sc2/src/options.h index 9fd33b1f4..aa673efe2 100644 --- a/sc2/src/options.h +++ b/sc2/src/options.h @@ -26,6 +26,10 @@ #include "libs/compiler.h" #include "libs/uio.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define OPT_3DO 0x01 #define OPT_PC 0x02 #define OPT_ALL 0xFF @@ -81,5 +85,9 @@ int loadIndices (uio_DirHandle *baseDir); bool setGammaCorrection (float gamma); +#if defined(__cplusplus) +} +#endif + #endif diff --git a/sc2/src/port.h b/sc2/src/port.h index f6581db9c..bfa3f0e99 100644 --- a/sc2/src/port.h +++ b/sc2/src/port.h @@ -79,12 +79,24 @@ #ifndef HAVE_STRUPR +#if defined(__cplusplus) +extern "C" { +#endif char *strupr (char *str); +#if defined(__cplusplus) +} +#endif #endif #if !defined (_MSC_VER) && !defined (HAVE_READDIR_R) # include +#if defined(__cplusplus) +extern "C" { +#endif int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); +#if defined(__cplusplus) +} +#endif #endif // Directories @@ -161,10 +173,21 @@ typedef unsigned short mode_t; #ifdef _MSC_VER # include // Defined in port.c +#if defined(__cplusplus) +extern "C" { +#endif int snprintf(char *str, size_t size, const char *format, ...); int vsnprintf(char *str, size_t size, const char *format, va_list args); +#if defined(__cplusplus) +} +#endif + #endif /* _MSC_VER */ +#if defined(__cplusplus) +extern "C" { +#endif + // setenv() #ifndef HAVE_SETENV int setenv (const char *name, const char *value, int overwrite); @@ -178,6 +201,10 @@ typedef unsigned short wchar_t; typedef unsigned int wint_t; #endif +#if defined(__cplusplus) +} +#endif + #if defined (_MSC_VER) || defined(__MINGW32__) # define USE_WINSOCK #endif diff --git a/sc2/src/types.h b/sc2/src/types.h index 8489d2bce..e49c1450e 100644 --- a/sc2/src/types.h +++ b/sc2/src/types.h @@ -50,6 +50,10 @@ # endif /* defined(PRIxPTR) */ #endif +#if defined(__cplusplus) +extern "C" { +#endif + #if defined(__arch64__) || defined(__alpha) || defined(__x86_64) \ || defined(_M_IA64) || defined(_M_AMD64) /* 64-bit platforms */ @@ -177,4 +181,8 @@ UQM_COMPILE_TIME_ASSERT(uint64, sizeof(uint64) == 8); #define UINT16_MAX 0xffff /* 65535U */ #define UINT32_MAX 0xffffffff /* 4294967295U */ +#if defined(__cplusplus) +} +#endif + #endif /* _TYPES_H */ diff --git a/sc2/src/uqm/battle.h b/sc2/src/uqm/battle.h index ea4fc9492..067165d2c 100644 --- a/sc2/src/uqm/battle.h +++ b/sc2/src/uqm/battle.h @@ -26,6 +26,10 @@ typedef DWORD BattleFrameCounter; #include "init.h" // For NUM_SIDES +#if defined(__cplusplus) +extern "C" { +#endif + // The callback function is called on every battle frame // with GraphicsLock held, just before the display queue // is drawn @@ -56,4 +60,8 @@ BOOLEAN Battle (BattleFrameCallback *); extern void BattleSong (BOOLEAN DoPlay); extern void FreeBattleSong (void); +#if defined(__cplusplus) +} +#endif + #endif /* _BATTLE_H */ diff --git a/sc2/src/uqm/battlecontrols.h b/sc2/src/uqm/battlecontrols.h index f368eee46..9f4ad8ed1 100644 --- a/sc2/src/uqm/battlecontrols.h +++ b/sc2/src/uqm/battlecontrols.h @@ -30,6 +30,10 @@ typedef struct NetworkInputContext NetworkInputContext; #include "races.h" #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef BATTLE_INPUT_STATE (*BattleFrameInputFunction) ( InputContext *context, STARSHIP *StarShipPtr); typedef BOOLEAN (*SelectShipFunction) (InputContext *context, @@ -88,6 +92,10 @@ void InputContext_delete (InputContext *context); // Call InputContext->handlers->freeContext() to release an // InputContext. +#if defined(__cplusplus) +} +#endif + #endif /* _BATTLECONTROLS_H */ diff --git a/sc2/src/uqm/build.h b/sc2/src/uqm/build.h index b94aa8296..e45c835c3 100644 --- a/sc2/src/uqm/build.h +++ b/sc2/src/uqm/build.h @@ -23,6 +23,10 @@ #include "displist.h" #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define NAME_OFFSET 5 #define NUM_CAPTAINS_NAMES 16 @@ -60,5 +64,9 @@ extern RACE_DESC *load_ship (SPECIES_ID SpeciesID, BOOLEAN LoadBattleData); extern void free_ship (RACE_DESC *RaceDescPtr, BOOLEAN FreeIconData, BOOLEAN FreeBattleData); +#if defined(__cplusplus) +} +#endif + #endif /* _BUILD_H */ diff --git a/sc2/src/uqm/clock.h b/sc2/src/uqm/clock.h index 41692709f..26d872f96 100644 --- a/sc2/src/uqm/clock.h +++ b/sc2/src/uqm/clock.h @@ -22,6 +22,10 @@ #include "libs/tasklib.h" #include "displist.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define START_YEAR 2155 @@ -100,5 +104,9 @@ extern void UnlockGameClock (void); // but not much else extern BOOLEAN GameClockRunning (void); +#if defined(__cplusplus) +} +#endif + #endif /* _CLOCK_H */ diff --git a/sc2/src/uqm/cnctdlg.h b/sc2/src/uqm/cnctdlg.h index 5492601b5..0329baa1c 100644 --- a/sc2/src/uqm/cnctdlg.h +++ b/sc2/src/uqm/cnctdlg.h @@ -16,16 +16,23 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifdef NETPLAY - #ifndef _CNCTDLG_H #define _CNCTDLG_H +#ifdef NETPLAY + #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + BOOLEAN MeleeConnectDialog (int side); -#endif /* _CNCTDLG_H */ +#if defined(__cplusplus) +} +#endif #endif /* NETPLAY */ +#endif /* _CNCTDLG_H */ diff --git a/sc2/src/uqm/coderes.h b/sc2/src/uqm/coderes.h index b23f99d69..99c05d3bf 100644 --- a/sc2/src/uqm/coderes.h +++ b/sc2/src/uqm/coderes.h @@ -21,6 +21,10 @@ #include "libs/reslib.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern BOOLEAN InstallCodeResType (void); extern void *LoadCodeResInstance (RESOURCE res); extern void *CaptureCodeRes (void *hCode, void *pData, void **ppLocData); @@ -32,5 +36,9 @@ typedef struct UWORD size; } CODE_REF; +#if defined(__cplusplus) +} +#endif + #endif /* _CODERES_H */ diff --git a/sc2/src/uqm/collide.h b/sc2/src/uqm/collide.h index 85bdb2019..35a7052ba 100644 --- a/sc2/src/uqm/collide.h +++ b/sc2/src/uqm/collide.h @@ -21,6 +21,10 @@ #include "element.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define COLLISION_TURN_WAIT 1 #define COLLISION_THRUST_WAIT 3 @@ -59,5 +63,9 @@ extern void collide (ELEMENT *ElementPtr0, ELEMENT *ElementPtr1); +#if defined(__cplusplus) +} +#endif + #endif /* _COLLIDE_H */ diff --git a/sc2/src/uqm/comm.h b/sc2/src/uqm/comm.h index d3fe8708d..79167fa7c 100644 --- a/sc2/src/uqm/comm.h +++ b/sc2/src/uqm/comm.h @@ -31,6 +31,10 @@ #include "commanim.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern LOCDATA CommData; static inline BOOLEAN @@ -131,6 +135,10 @@ extern void SetCommIntroMode (CommIntroMode, TimeCount howLong); extern void EnableTalkingAnim (BOOLEAN enable); +#if defined(__cplusplus) +} +#endif + #endif /* _COMM_H */ diff --git a/sc2/src/uqm/commanim.h b/sc2/src/uqm/commanim.h index 43cf18f7d..641325966 100644 --- a/sc2/src/uqm/commanim.h +++ b/sc2/src/uqm/commanim.h @@ -20,6 +20,10 @@ #include "libs/compiler.h" #include "libs/gfxlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + // Some background: every animation has a neutral frame which returns // the image to the state it was in before the animation began. Which // frame is neutral depends on the animation type. @@ -130,6 +134,10 @@ extern BOOLEAN DrawAlienFrame (SEQUENCE *pSeq, COUNT Num, BOOLEAN fullRedraw); extern void InitCommAnimations (void); extern BOOLEAN ProcessCommAnimations (BOOLEAN fullRedraw, BOOLEAN paused); +#if defined(__cplusplus) +} +#endif + #endif /* _COMMANIM_H */ diff --git a/sc2/src/uqm/commglue.h b/sc2/src/uqm/commglue.h index 06f13f987..f9ebe6f93 100644 --- a/sc2/src/uqm/commglue.h +++ b/sc2/src/uqm/commglue.h @@ -23,6 +23,10 @@ #include "resinst.h" #include "libs/sound/trackplayer.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef enum { ARILOU_CONVERSATION, CHMMR_CONVERSATION, @@ -154,5 +158,9 @@ extern LOCDATA* init_zoqfot_comm (void); extern LOCDATA* init_umgah_comm (void); +#if defined(__cplusplus) +} +#endif + #endif /* _COMMGLUE_H */ diff --git a/sc2/src/uqm/cons_res.h b/sc2/src/uqm/cons_res.h index 6ed5bd456..2325e1657 100644 --- a/sc2/src/uqm/cons_res.h +++ b/sc2/src/uqm/cons_res.h @@ -20,6 +20,10 @@ #include "libs/gfxlib.h" #include "libs/sndlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + void load_gravity_well (BYTE selector); void free_gravity_well (void); @@ -27,4 +31,8 @@ FRAME load_life_form (BYTE selector); MUSIC_REF load_orbit_theme (BYTE selector); +#if defined(__cplusplus) +} +#endif + #endif /* CONS_RES_H_ */ diff --git a/sc2/src/uqm/controls.h b/sc2/src/uqm/controls.h index a3b6f982b..6a568f1f6 100644 --- a/sc2/src/uqm/controls.h +++ b/sc2/src/uqm/controls.h @@ -23,6 +23,10 @@ #include "libs/strlib.h" #include "libs/timelib.h" +#if defined(__cplusplus) +extern "C" { +#endif + // Enumerated type for controls enum { KEY_UP, @@ -162,6 +166,10 @@ typedef struct textentry_state extern BOOLEAN DoTextEntry (TEXTENTRY_STATE *pTES); +#if defined(__cplusplus) +} +#endif + #endif diff --git a/sc2/src/uqm/credits.h b/sc2/src/uqm/credits.h index 24fafa935..dd4ddbe68 100644 --- a/sc2/src/uqm/credits.h +++ b/sc2/src/uqm/credits.h @@ -19,7 +19,15 @@ #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern void Credits (BOOLEAN WithOuttakes); +#if defined(__cplusplus) +} +#endif + #endif /* _CREDITS_H */ diff --git a/sc2/src/uqm/demo.h b/sc2/src/uqm/demo.h index 338261e59..06e4512a0 100644 --- a/sc2/src/uqm/demo.h +++ b/sc2/src/uqm/demo.h @@ -19,6 +19,10 @@ #ifndef _DEMO_H #define _DEMO_H +#if defined(__cplusplus) +extern "C" { +#endif + #ifndef DEMO_MODE #define DEMO_MODE 0 #endif /* DEMO_MODE */ @@ -44,5 +48,9 @@ extern void JournalInput (INPUT_STATE InputState); #endif +#if defined(__cplusplus) +} +#endif + #endif /* _DEMO_H */ diff --git a/sc2/src/uqm/displist.h b/sc2/src/uqm/displist.h index 30b3caeed..b45dec969 100644 --- a/sc2/src/uqm/displist.h +++ b/sc2/src/uqm/displist.h @@ -24,6 +24,10 @@ #include "libs/compiler.h" #include "libs/memlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + // Note that we MUST use the QUEUE_TABLE variant at this time, because // certain gameplay elements depend on it. Namely, the maximum number // of HyperSpace encounter globes chasing the player is defined by the @@ -120,5 +124,9 @@ extern void RemoveQueue (QUEUE *pq, HLINK hLink); extern COUNT CountLinks (QUEUE *pq); void ForAllLinks(QUEUE *pq, void (*callback)(LINK *, void *), void *arg); +#if defined(__cplusplus) +} +#endif + #endif /* _DISPLIST_H */ diff --git a/sc2/src/uqm/element.h b/sc2/src/uqm/element.h index fab58d126..4f302e437 100644 --- a/sc2/src/uqm/element.h +++ b/sc2/src/uqm/element.h @@ -24,6 +24,10 @@ #include "velocity.h" #include "libs/gfxlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define NORMAL_LIFE 1 @@ -230,5 +234,9 @@ extern void MoveGalaxy (VIEW_STATE view_state, SIZE dx, SIZE dy); extern BOOLEAN CalculateGravity (ELEMENT *ElementPtr); +#if defined(__cplusplus) +} +#endif + #endif /* _ELEMENT_H */ diff --git a/sc2/src/uqm/encount.h b/sc2/src/uqm/encount.h index aed519e61..5344dcaf4 100644 --- a/sc2/src/uqm/encount.h +++ b/sc2/src/uqm/encount.h @@ -30,6 +30,10 @@ typedef struct encounter ENCOUNTER; #include "element.h" #include "races.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef HLINK HENCOUNTER; @@ -190,5 +194,9 @@ extern void GenerateIlwrath (BYTE control); extern SIZE EncounterRace; extern BYTE EncounterGroup; +#if defined(__cplusplus) +} +#endif + #endif /* _ENCOUNT_H */ diff --git a/sc2/src/uqm/flash.h b/sc2/src/uqm/flash.h index d3c7bb568..905d1473a 100644 --- a/sc2/src/uqm/flash.h +++ b/sc2/src/uqm/flash.h @@ -90,6 +90,10 @@ #include "libs/gfxlib.h" #include "libs/timelib.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef enum { FlashState_fadeIn = 0, // Someway between on and off, going towards on. @@ -211,5 +215,9 @@ void Flash_setCacheSize (FlashContext *context, COUNT size); COUNT Flash_getCacheSize (const FlashContext *context); +#if defined(__cplusplus) +} +#endif + #endif /* _FLASH_H */ diff --git a/sc2/src/uqm/fmv.h b/sc2/src/uqm/fmv.h index cb820f7ea..0490c75d3 100644 --- a/sc2/src/uqm/fmv.h +++ b/sc2/src/uqm/fmv.h @@ -20,6 +20,11 @@ #include "libs/compiler.h" #include "libs/sndlib.h" #include "libs/gfxlib.h" + +#if defined(__cplusplus) +extern "C" { +#endif + #define WANT_SHIP_SPINS extern void SplashScreen (void (* DoProcessing)(DWORD TimeOut)); @@ -29,5 +34,9 @@ extern void DoShipSpin (COUNT index, MUSIC_REF hMusic); extern BOOLEAN ShowPresentation (RESOURCE presentation); +#if defined(__cplusplus) +} +#endif + #endif /* _FMV_H */ diff --git a/sc2/src/uqm/gameev.h b/sc2/src/uqm/gameev.h index d7bb9b0e2..2bec47634 100644 --- a/sc2/src/uqm/gameev.h +++ b/sc2/src/uqm/gameev.h @@ -20,6 +20,10 @@ #include "libs/compiler.h" #include "libs/gfxlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + enum { @@ -57,5 +61,9 @@ extern void SetRaceDest (BYTE which_race, COORD x, COORD y, BYTE days_left, BYTE func_index); +#if defined(__cplusplus) +} +#endif + #endif /* _GAMEEV_H */ diff --git a/sc2/src/uqm/gameopt.h b/sc2/src/uqm/gameopt.h index c08fa55b8..3ef3e81ba 100644 --- a/sc2/src/uqm/gameopt.h +++ b/sc2/src/uqm/gameopt.h @@ -19,11 +19,19 @@ #include "libs/compiler.h" #include "libs/gfxlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern void ConfirmSaveLoad (STAMP *MsgStamp); extern BOOLEAN GameOptions (void); typedef void (NamingCallback) (void); extern void SetNamingCallback (NamingCallback *); +#if defined(__cplusplus) +} +#endif + #endif /* _GAMEOPT_H */ diff --git a/sc2/src/uqm/gamestr.h b/sc2/src/uqm/gamestr.h index 48a811ba0..f87bfa5ee 100644 --- a/sc2/src/uqm/gamestr.h +++ b/sc2/src/uqm/gamestr.h @@ -25,6 +25,10 @@ #include "libs/strlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define STAR_STRING_COUNT 133 #define DEVICE_STRING_COUNT 29 #define CARGO_STRING_COUNT 10 @@ -82,5 +86,9 @@ extern STRING GameStrings; +#if defined(__cplusplus) +} +#endif + #endif /* _GAMESTR_H */ diff --git a/sc2/src/uqm/gendef.h b/sc2/src/uqm/gendef.h index c763130c8..576749074 100644 --- a/sc2/src/uqm/gendef.h +++ b/sc2/src/uqm/gendef.h @@ -4,7 +4,15 @@ #include "planets/generate.h" #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + const GenerateFunctions *getGenerateFunctions (BYTE Index); +#if defined(__cplusplus) +} +#endif + #endif /* GENDEF_H */ diff --git a/sc2/src/uqm/globdata.h b/sc2/src/uqm/globdata.h index afb46e0d5..c69cc53b1 100644 --- a/sc2/src/uqm/globdata.h +++ b/sc2/src/uqm/globdata.h @@ -27,6 +27,10 @@ #include "velocity.h" #include "commanim.h" +#if defined(__cplusplus) +extern "C" { +#endif + // general numbers-speech generator info // should accomodate most common base-10 languages @@ -1010,5 +1014,9 @@ extern void InitGlobData (void); extern BOOLEAN InitGameStructures (void); extern void UninitGameStructures (void); +#if defined(__cplusplus) +} +#endif + #endif /* _GLOBDATA_H */ diff --git a/sc2/src/uqm/grpinfo.h b/sc2/src/uqm/grpinfo.h index 867525377..7ab777106 100644 --- a/sc2/src/uqm/grpinfo.h +++ b/sc2/src/uqm/grpinfo.h @@ -24,6 +24,10 @@ // for POINT #include +#if defined(__cplusplus) +extern "C" { +#endif + // XXX: Needed to maintain savegame compatibility #define NUM_SAVED_BATTLE_GROUPS 64 @@ -82,4 +86,8 @@ LockIpGroup (const QUEUE *pq, HIPGROUP h) extern HIPGROUP BuildGroup (QUEUE *pDstQueue, BYTE race_id); +#if defined(__cplusplus) +} +#endif + #endif /* _GRPINFO_H */ diff --git a/sc2/src/uqm/hyper.h b/sc2/src/uqm/hyper.h index 6176e77f5..4d0292279 100644 --- a/sc2/src/uqm/hyper.h +++ b/sc2/src/uqm/hyper.h @@ -23,6 +23,10 @@ #include "units.h" // for UNIT_SCREEN_WIDTH/HEIGHT +#if defined(__cplusplus) +extern "C" { +#endif + #define NUM_RADAR_SCREENS 12 #define RADAR_SCAN_WIDTH (UNIT_SCREEN_WIDTH * NUM_RADAR_SCREENS) @@ -79,5 +83,9 @@ extern BOOLEAN hyper_transition (ELEMENT *ElementPtr); extern void HyperspaceMenu (void); extern void SaveSisHyperState (void); +#if defined(__cplusplus) +} +#endif + #endif /* _HYPER_H */ diff --git a/sc2/src/uqm/init.h b/sc2/src/uqm/init.h index f9dba517e..e58d50bc2 100644 --- a/sc2/src/uqm/init.h +++ b/sc2/src/uqm/init.h @@ -20,6 +20,10 @@ #include "libs/gfxlib.h" #include "libs/reslib.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define NUM_PLAYERS 2 #define NUM_SIDES 2 @@ -35,5 +39,9 @@ extern BOOLEAN load_animation (FRAME *pixarray, RESOURCE big_res, RESOURCE med_res, RESOURCE sml_res); extern BOOLEAN free_image (FRAME *pixarray); +#if defined(__cplusplus) +} +#endif + #endif /* _INIT_H */ diff --git a/sc2/src/uqm/intel.h b/sc2/src/uqm/intel.h index b5381acaa..503d01239 100644 --- a/sc2/src/uqm/intel.h +++ b/sc2/src/uqm/intel.h @@ -24,6 +24,10 @@ #include "element.h" #include "races.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define MANEUVERABILITY(pi) ((pi)->ManeuverabilityIndex) #define WEAPON_RANGE(pi) ((pi)->WeaponRange) @@ -74,6 +78,10 @@ extern BOOLEAN ThrustShip (ELEMENT *ShipPtr, COUNT angle); #define AWESOME_RATING (BYTE)(1 << 6) +#if defined(__cplusplus) +} +#endif + #endif /* _INTEL_H */ diff --git a/sc2/src/uqm/ipdisp.h b/sc2/src/uqm/ipdisp.h index 1321e2fa6..6b910cadb 100644 --- a/sc2/src/uqm/ipdisp.h +++ b/sc2/src/uqm/ipdisp.h @@ -19,6 +19,10 @@ #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern void NotifyOthers (COUNT which_race, BYTE target_loc); // Special target locations for NotifyOthers() #define IPNL_INTERCEPT_PLAYER 0 @@ -26,4 +30,8 @@ extern void NotifyOthers (COUNT which_race, BYTE target_loc); extern void DoMissions (void); +#if defined(__cplusplus) +} +#endif + #endif /* UQM_IPDISP_H_INCL_ */ diff --git a/sc2/src/uqm/load.h b/sc2/src/uqm/load.h index c3859db5d..175e38c80 100644 --- a/sc2/src/uqm/load.h +++ b/sc2/src/uqm/load.h @@ -22,10 +22,18 @@ #include "libs/compiler.h" #include "globdata.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern ACTIVITY NextActivity; extern BOOLEAN LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc); +#if defined(__cplusplus) +} +#endif + #endif /* _LOAD_H */ diff --git a/sc2/src/uqm/master.h b/sc2/src/uqm/master.h index 50160c0f1..2c8276e6e 100644 --- a/sc2/src/uqm/master.h +++ b/sc2/src/uqm/master.h @@ -20,6 +20,10 @@ #include "races.h" #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef HLINK HMASTERSHIP; typedef struct @@ -58,5 +62,9 @@ COUNT GetShipCostFromIndex (unsigned Index); FRAME GetShipIconsFromIndex (unsigned Index); FRAME GetShipMeleeIconsFromIndex (unsigned Index); +#if defined(__cplusplus) +} +#endif + #endif /* _MASTER_H */ diff --git a/sc2/src/uqm/menustat.h b/sc2/src/uqm/menustat.h index 008a40eec..03e54dd8e 100644 --- a/sc2/src/uqm/menustat.h +++ b/sc2/src/uqm/menustat.h @@ -23,6 +23,10 @@ #include "libs/sndlib.h" #include "flash.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct menu_state { // Standard field required by DoInput() @@ -120,5 +124,9 @@ enum extern BOOLEAN DoMenuChooser (MENU_STATE *pMS, BYTE BaseState); extern void DrawMenuStateStrings (BYTE beg_index, SWORD NewState); +#if defined(__cplusplus) +} +#endif + #endif /* _MENUSTAT_H */ diff --git a/sc2/src/uqm/oscill.h b/sc2/src/uqm/oscill.h index 34e3f2a94..84f76901b 100644 --- a/sc2/src/uqm/oscill.h +++ b/sc2/src/uqm/oscill.h @@ -20,6 +20,10 @@ #include "libs/compiler.h" #include "libs/gfxlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern BOOLEAN sliderDisabled; extern BOOLEAN oscillDisabled; @@ -32,5 +36,9 @@ extern void InitSlider (int x, int y, int width, FRAME sliderFrame, extern void SetSliderImage (FRAME f); void DrawSlider (void); +#if defined(__cplusplus) +} +#endif + #endif /* _OSCILL_H */ diff --git a/sc2/src/uqm/pickship.h b/sc2/src/uqm/pickship.h index b52540187..f5a55b365 100644 --- a/sc2/src/uqm/pickship.h +++ b/sc2/src/uqm/pickship.h @@ -20,8 +20,16 @@ #include "libs/compiler.h" #include "races.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern HSTARSHIP GetEncounterStarShip (STARSHIP *LastStarShipPtr, COUNT which_player); extern void DrawArmadaPickShip (BOOLEAN draw_salvage_frame, RECT *pPickRect); +#if defined(__cplusplus) +} +#endif + #endif /* UQM_PICKSHIP_H_INCL_ */ diff --git a/sc2/src/uqm/planets/elemdata.h b/sc2/src/uqm/planets/elemdata.h index f37dfa386..dcadfc65b 100644 --- a/sc2/src/uqm/planets/elemdata.h +++ b/sc2/src/uqm/planets/elemdata.h @@ -21,6 +21,9 @@ #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif /*------------------------------ Type Defines ----------------------------- */ enum @@ -205,5 +208,9 @@ enum extern const BYTE *Elements; +#if defined(__cplusplus) +} +#endif + #endif /* _ELEMDATA_H */ diff --git a/sc2/src/uqm/planets/generate.h b/sc2/src/uqm/planets/generate.h index 57d9603d5..16f3ee220 100644 --- a/sc2/src/uqm/planets/generate.h +++ b/sc2/src/uqm/planets/generate.h @@ -23,6 +23,10 @@ typedef struct GenerateFunctions GenerateFunctions; #include "planets.h" #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + /* * To do (for further cleanups): * - split off generateOrbital in a calculation and an activation @@ -98,6 +102,9 @@ struct GenerateFunctions { PickupLifeFunction pickupLife; }; +#if defined(__cplusplus) +} +#endif #endif /* GENERATE_H */ diff --git a/sc2/src/uqm/planets/generate/gendefault.h b/sc2/src/uqm/planets/generate/gendefault.h index f0a49e314..3cf0935b0 100644 --- a/sc2/src/uqm/planets/generate/gendefault.h +++ b/sc2/src/uqm/planets/generate/gendefault.h @@ -21,6 +21,10 @@ #include "../planets.h" #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + bool GenerateDefault_initNpcs (SOLARSYS_STATE *solarSys); bool GenerateDefault_reinitNpcs (SOLARSYS_STATE *solarSys); bool GenerateDefault_uninitNpcs (SOLARSYS_STATE *solarSys); @@ -52,5 +56,9 @@ bool GenerateDefault_landerReportCycle (SOLARSYS_STATE *); extern const GenerateFunctions generateDefaultFunctions; +#if defined(__cplusplus) +} +#endif + #endif /* GENDEFAULT_H */ diff --git a/sc2/src/uqm/planets/lander.h b/sc2/src/uqm/planets/lander.h index f5d7aaeb3..b1cb3af0a 100644 --- a/sc2/src/uqm/planets/lander.h +++ b/sc2/src/uqm/planets/lander.h @@ -26,6 +26,9 @@ #include "libs/timelib.h" #include "../element.h" +#if defined(__cplusplus) +extern "C" { +#endif // Surface magnification shift (x4) #define MAG_SHIFT 2 @@ -76,5 +79,9 @@ enum PS_NON_PLAYER, }; +#if defined(__cplusplus) +} +#endif + #endif /* _LANDER_H */ diff --git a/sc2/src/uqm/planets/lifeform.h b/sc2/src/uqm/planets/lifeform.h index f260a79a5..72fa58a44 100644 --- a/sc2/src/uqm/planets/lifeform.h +++ b/sc2/src/uqm/planets/lifeform.h @@ -21,6 +21,9 @@ #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif #define BEHAVIOR_HUNT (0 << 0) #define BEHAVIOR_FLEE (1 << 0) @@ -65,5 +68,9 @@ typedef struct extern const LIFEFORM_DESC CreatureData[]; +#if defined(__cplusplus) +} +#endif + #endif /* _LIFEFORM_H */ diff --git a/sc2/src/uqm/planets/plandata.h b/sc2/src/uqm/planets/plandata.h index 7cf240bac..57308bf8f 100644 --- a/sc2/src/uqm/planets/plandata.h +++ b/sc2/src/uqm/planets/plandata.h @@ -21,6 +21,9 @@ #include "libs/reslib.h" +#if defined(__cplusplus) +extern "C" { +#endif /*------------------------------ Type Defines ----------------------------- */ #define NUMBER_OF_ORBITS 16 @@ -328,5 +331,9 @@ enum extern const PlanetFrame *PlanData; +#if defined(__cplusplus) +} +#endif + #endif /* _PLANDATA_H */ diff --git a/sc2/src/uqm/planets/planets.h b/sc2/src/uqm/planets/planets.h index 84370087a..451dedeb1 100644 --- a/sc2/src/uqm/planets/planets.h +++ b/sc2/src/uqm/planets/planets.h @@ -99,6 +99,9 @@ typedef struct solarsys_state SOLARSYS_STATE; #include "plandata.h" #include "sundata.h" +#if defined(__cplusplus) +extern "C" { +#endif struct planet_desc { @@ -286,5 +289,9 @@ extern void GetPlanetOrMoonName (UNICODE *buf, COUNT bufsize); extern void PlanetOrbitMenu (void); extern void SaveSolarSysLocation (void); +#if defined(__cplusplus) +} +#endif + #endif /* _PLANETS_H */ diff --git a/sc2/src/uqm/planets/scan.h b/sc2/src/uqm/planets/scan.h index 76b9b702b..ba53e9c0a 100644 --- a/sc2/src/uqm/planets/scan.h +++ b/sc2/src/uqm/planets/scan.h @@ -26,6 +26,9 @@ typedef struct scan_block SCAN_BLOCK; #include "libs/gfxlib.h" #include "planets.h" +#if defined(__cplusplus) +extern "C" { +#endif struct scan_desc { @@ -62,5 +65,9 @@ COUNT countNodesRetrieved (PLANET_INFO *planetInfo, BYTE scanType); void setNodeRetrieved (PLANET_INFO *planetInfo, BYTE scanType, BYTE nodeNr); void setNodeNotRetrieved (PLANET_INFO *planetInfo, BYTE scanType, BYTE nodeNr); +#if defined(__cplusplus) +} +#endif + #endif /* _SCAN_H */ diff --git a/sc2/src/uqm/planets/sundata.h b/sc2/src/uqm/planets/sundata.h index b55a53681..eb7eeb9f8 100644 --- a/sc2/src/uqm/planets/sundata.h +++ b/sc2/src/uqm/planets/sundata.h @@ -22,6 +22,9 @@ #include "plandata.h" #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif /*------------------------------ Global Data ------------------------------ */ @@ -58,5 +61,9 @@ extern DWORD DoPlanetaryAnalysis (SYSTEM_INFO *SysInfoPtr, extern SYSTEM_INFO CurSysInfo; +#if defined(__cplusplus) +} +#endif + #endif /* _SUNDATA_H */ diff --git a/sc2/src/uqm/process.h b/sc2/src/uqm/process.h index 80618749d..d794a2e60 100644 --- a/sc2/src/uqm/process.h +++ b/sc2/src/uqm/process.h @@ -21,9 +21,17 @@ #include "libs/gfxlib.h" #include "element.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern void RedrawQueue (BOOLEAN clear); extern void InitDisplayList (void); extern void SetUpElement (ELEMENT *ElementPtr); extern void InsertPrim (PRIM_LINKS *pLinks, COUNT primIndex, COUNT iPI); +#if defined(__cplusplus) +} +#endif + #endif /* UQM_PROCESS_H_INCL_ */ diff --git a/sc2/src/uqm/races.h b/sc2/src/uqm/races.h index 33033d9a1..ef5baaed7 100644 --- a/sc2/src/uqm/races.h +++ b/sc2/src/uqm/races.h @@ -31,6 +31,10 @@ typedef HLINK HSTARSHIP; #include "libs/sndlib.h" #include "libs/reslib.h" +#if defined(__cplusplus) +extern "C" { +#endif + // TODO: remove RACES_PER_PLAYER remnant of SC1 #define RACES_PER_PLAYER 7 @@ -664,5 +668,9 @@ enum BUILD_COLOR (MAKE_RGB15_INIT (0x06, 0x06, 0x06), 0x20), /* BLACK_URQUAN_SHIP */ \ BUILD_COLOR (MAKE_RGB15_INIT (0x14, 0x07, 0x1F), 0x39), /* YEHAT_REBEL_SHIP */ +#if defined(__cplusplus) +} +#endif + #endif /* _RACES_H */ diff --git a/sc2/src/uqm/restart.h b/sc2/src/uqm/restart.h index 0d4de735b..e985fc831 100644 --- a/sc2/src/uqm/restart.h +++ b/sc2/src/uqm/restart.h @@ -19,8 +19,16 @@ #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern BOOLEAN StartGame (void); +#if defined(__cplusplus) +} +#endif + #endif /* _RESTART_H */ diff --git a/sc2/src/uqm/save.h b/sc2/src/uqm/save.h index 020fdb68e..bb7084b18 100644 --- a/sc2/src/uqm/save.h +++ b/sc2/src/uqm/save.h @@ -21,8 +21,16 @@ // for SUMMARY_DESC #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern void SaveProblem (void); extern BOOLEAN SaveGame (COUNT which_game, SUMMARY_DESC *summary_desc); +#if defined(__cplusplus) +} +#endif + #endif /* _SAVE_H */ diff --git a/sc2/src/uqm/settings.h b/sc2/src/uqm/settings.h index 4641fb658..12449dc60 100644 --- a/sc2/src/uqm/settings.h +++ b/sc2/src/uqm/settings.h @@ -19,6 +19,10 @@ #include "libs/sndlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern void ToggleMusic (void); extern void StopMusic (void); extern void ResumeMusic (void); @@ -30,5 +34,9 @@ extern void PlaySoundEffect (SOUND S, COUNT Channel, SoundPosition Pos, void *PositionalObject, BYTE Priority); +#if defined(__cplusplus) +} +#endif + #endif /* _SETTINGS_H */ diff --git a/sc2/src/uqm/setup.h b/sc2/src/uqm/setup.h index 0f8e151d0..0cade7646 100644 --- a/sc2/src/uqm/setup.h +++ b/sc2/src/uqm/setup.h @@ -24,6 +24,10 @@ #include "libs/gfxlib.h" #include "libs/threadlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern RESOURCE_INDEX hResIndex; extern FRAME Screen; @@ -79,6 +83,10 @@ void ClearPlayerInput (COUNT playerI); void ClearPlayerInputAll (void); +#if defined(__cplusplus) +} +#endif + #endif /* _SETUP_H */ diff --git a/sc2/src/uqm/setupmenu.h b/sc2/src/uqm/setupmenu.h index 3a4619224..658f8a2ad 100644 --- a/sc2/src/uqm/setupmenu.h +++ b/sc2/src/uqm/setupmenu.h @@ -21,6 +21,10 @@ #include "controls.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef enum { OPTVAL_DISABLED, OPTVAL_ENABLED @@ -88,4 +92,8 @@ void SetupMenu (void); void GetGlobalOptions (GLOBALOPTS *opts); void SetGlobalOptions (GLOBALOPTS *opts); +#if defined(__cplusplus) +} +#endif + #endif // _SETUPMENU_H diff --git a/sc2/src/uqm/ship.h b/sc2/src/uqm/ship.h index 5cfc31889..8f0c72c62 100644 --- a/sc2/src/uqm/ship.h +++ b/sc2/src/uqm/ship.h @@ -21,6 +21,10 @@ #include "races.h" #include "element.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern BOOLEAN GetNextStarShip (STARSHIP *LastStarShipPtr, COUNT which_side); extern BOOLEAN GetInitialStarShips (void); @@ -32,4 +36,8 @@ extern void collision (ELEMENT *ElementPtr0, POINT *pPt0, extern STATUS_FLAGS inertial_thrust (ELEMENT *ElementPtr); +#if defined(__cplusplus) +} +#endif + #endif /* UQM_SHIP_H_INCL_ */ diff --git a/sc2/src/uqm/shipcont.h b/sc2/src/uqm/shipcont.h index 5352afb42..0533ded2c 100644 --- a/sc2/src/uqm/shipcont.h +++ b/sc2/src/uqm/shipcont.h @@ -21,6 +21,10 @@ #include "menustat.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define FIELD_WIDTH (STATUS_WIDTH - 5) extern void CargoMenu (void); @@ -33,5 +37,9 @@ extern void ShowRemainingCapacity (void); extern SIZE InventoryDevices (BYTE *pDeviceMap, COUNT Size); +#if defined(__cplusplus) +} +#endif + #endif /* _SHIPCONT_H */ diff --git a/sc2/src/uqm/ships/androsyn/androsyn.h b/sc2/src/uqm/ships/androsyn/androsyn.h index 4e891e3db..43fe88d5b 100644 --- a/sc2/src/uqm/ships/androsyn/androsyn.h +++ b/sc2/src/uqm/ships/androsyn/androsyn.h @@ -17,7 +17,15 @@ #ifndef ANDROSYN_H #define ANDROSYN_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_androsynth (void); +#if defined(__cplusplus) +} +#endif + #endif /* ANDROSYN_H */ diff --git a/sc2/src/uqm/ships/arilou/arilou.h b/sc2/src/uqm/ships/arilou/arilou.h index 606dd9608..8e65d5892 100644 --- a/sc2/src/uqm/ships/arilou/arilou.h +++ b/sc2/src/uqm/ships/arilou/arilou.h @@ -17,7 +17,15 @@ #ifndef ARILOU_H #define ARILOU_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_arilou (void); +#if defined(__cplusplus) +} +#endif + #endif /* ARILOU_H */ diff --git a/sc2/src/uqm/ships/blackurq/blackurq.h b/sc2/src/uqm/ships/blackurq/blackurq.h index 3a1b9404b..4b2b5d987 100644 --- a/sc2/src/uqm/ships/blackurq/blackurq.h +++ b/sc2/src/uqm/ships/blackurq/blackurq.h @@ -17,7 +17,15 @@ #ifndef BLACKURQ_H #define BLACKURQ_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_black_urquan (void); +#if defined(__cplusplus) +} +#endif + #endif /* BLACKURQ_H */ diff --git a/sc2/src/uqm/ships/chenjesu/chenjesu.h b/sc2/src/uqm/ships/chenjesu/chenjesu.h index 8cd17a515..37ac9d68a 100644 --- a/sc2/src/uqm/ships/chenjesu/chenjesu.h +++ b/sc2/src/uqm/ships/chenjesu/chenjesu.h @@ -17,7 +17,15 @@ #ifndef CHENJESU_H #define CHENJESU_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_chenjesu (void); +#if defined(__cplusplus) +} +#endif + #endif /* CHENJESU_H */ diff --git a/sc2/src/uqm/ships/chmmr/chmmr.h b/sc2/src/uqm/ships/chmmr/chmmr.h index 5499fe797..88dd9b852 100644 --- a/sc2/src/uqm/ships/chmmr/chmmr.h +++ b/sc2/src/uqm/ships/chmmr/chmmr.h @@ -17,7 +17,15 @@ #ifndef CHMMR_H #define CHMMR_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_chmmr (void); +#if defined(__cplusplus) +} +#endif + #endif /* CHMMR_H */ diff --git a/sc2/src/uqm/ships/druuge/druuge.h b/sc2/src/uqm/ships/druuge/druuge.h index ec25d7752..f332bc328 100644 --- a/sc2/src/uqm/ships/druuge/druuge.h +++ b/sc2/src/uqm/ships/druuge/druuge.h @@ -17,7 +17,15 @@ #ifndef DRUUGE_H #define DRUUGE_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_druuge (void); +#if defined(__cplusplus) +} +#endif + #endif /* DRUUGE_H */ diff --git a/sc2/src/uqm/ships/human/human.h b/sc2/src/uqm/ships/human/human.h index 7a1f18c85..6f7314d20 100644 --- a/sc2/src/uqm/ships/human/human.h +++ b/sc2/src/uqm/ships/human/human.h @@ -17,7 +17,15 @@ #ifndef HUMAN_H #define HUMAN_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_human (void); +#if defined(__cplusplus) +} +#endif + #endif /* HUMAN_H */ diff --git a/sc2/src/uqm/ships/ilwrath/ilwrath.h b/sc2/src/uqm/ships/ilwrath/ilwrath.h index e5914767d..a442b9d5c 100644 --- a/sc2/src/uqm/ships/ilwrath/ilwrath.h +++ b/sc2/src/uqm/ships/ilwrath/ilwrath.h @@ -17,7 +17,15 @@ #ifndef ILWRATH_H #define ILWRATH_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_ilwrath (void); +#if defined(__cplusplus) +} +#endif + #endif /* ILWRATH_H */ diff --git a/sc2/src/uqm/ships/lastbat/lastbat.h b/sc2/src/uqm/ships/lastbat/lastbat.h index abd7658e8..ccda7f164 100644 --- a/sc2/src/uqm/ships/lastbat/lastbat.h +++ b/sc2/src/uqm/ships/lastbat/lastbat.h @@ -17,7 +17,15 @@ #ifndef LASTBAT_H #define LASTBAT_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_samatra (void); +#if defined(__cplusplus) +} +#endif + #endif /* LASTBAT_H */ diff --git a/sc2/src/uqm/ships/melnorme/melnorme.h b/sc2/src/uqm/ships/melnorme/melnorme.h index 4fb6254bc..287ec76d1 100644 --- a/sc2/src/uqm/ships/melnorme/melnorme.h +++ b/sc2/src/uqm/ships/melnorme/melnorme.h @@ -17,7 +17,15 @@ #ifndef MELNORME_H #define MELNORME_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_melnorme (void); +#if defined(__cplusplus) +} +#endif + #endif /* MELNORME_H */ diff --git a/sc2/src/uqm/ships/mmrnmhrm/mmrnmhrm.h b/sc2/src/uqm/ships/mmrnmhrm/mmrnmhrm.h index a942f9ac4..c2c851267 100644 --- a/sc2/src/uqm/ships/mmrnmhrm/mmrnmhrm.h +++ b/sc2/src/uqm/ships/mmrnmhrm/mmrnmhrm.h @@ -17,7 +17,15 @@ #ifndef MMRNMHRM_H #define MMRNMHRM_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_mmrnmhrm (void); +#if defined(__cplusplus) +} +#endif + #endif /* MMRNMHRM_H */ diff --git a/sc2/src/uqm/ships/mycon/mycon.h b/sc2/src/uqm/ships/mycon/mycon.h index f536532af..8051b7ccc 100644 --- a/sc2/src/uqm/ships/mycon/mycon.h +++ b/sc2/src/uqm/ships/mycon/mycon.h @@ -17,7 +17,15 @@ #ifndef MYCON_H #define MYCON_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_mycon (void); +#if defined(__cplusplus) +} +#endif + #endif /* MYCON_H */ diff --git a/sc2/src/uqm/ships/orz/orz.h b/sc2/src/uqm/ships/orz/orz.h index 28693a9a4..a62caacef 100644 --- a/sc2/src/uqm/ships/orz/orz.h +++ b/sc2/src/uqm/ships/orz/orz.h @@ -17,11 +17,19 @@ #ifndef ORZ_H #define ORZ_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_orz (void); void intruder_preprocess (ELEMENT *ElementPtr); void marine_collision (ELEMENT *ElementPtr0, POINT *pPt0, ELEMENT *ElementPtr1, POINT *pPt1); +#if defined(__cplusplus) +} +#endif + #endif /* ORZ_H */ diff --git a/sc2/src/uqm/ships/pkunk/pkunk.h b/sc2/src/uqm/ships/pkunk/pkunk.h index aa1dd7104..91681b863 100644 --- a/sc2/src/uqm/ships/pkunk/pkunk.h +++ b/sc2/src/uqm/ships/pkunk/pkunk.h @@ -17,7 +17,15 @@ #ifndef PKUNK_H #define PKUNK_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_pkunk (void); +#if defined(__cplusplus) +} +#endif + #endif /* PKUNK_H */ diff --git a/sc2/src/uqm/ships/probe/probe.h b/sc2/src/uqm/ships/probe/probe.h index 4af7e9826..c5889700b 100644 --- a/sc2/src/uqm/ships/probe/probe.h +++ b/sc2/src/uqm/ships/probe/probe.h @@ -17,7 +17,15 @@ #ifndef PROBE_H #define PROBE_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_probe (void); +#if defined(__cplusplus) +} +#endif + #endif /* PROBE_H */ diff --git a/sc2/src/uqm/ships/shofixti/shofixti.h b/sc2/src/uqm/ships/shofixti/shofixti.h index 1151ea4af..e4fdd0c83 100644 --- a/sc2/src/uqm/ships/shofixti/shofixti.h +++ b/sc2/src/uqm/ships/shofixti/shofixti.h @@ -17,7 +17,15 @@ #ifndef SHOFIXTI_H #define SHOFIXTI_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_shofixti (void); +#if defined(__cplusplus) +} +#endif + #endif /* SHOFIXTI_H */ diff --git a/sc2/src/uqm/ships/sis_ship/sis_ship.h b/sc2/src/uqm/ships/sis_ship/sis_ship.h index 79dda24e3..ffe077692 100644 --- a/sc2/src/uqm/ships/sis_ship/sis_ship.h +++ b/sc2/src/uqm/ships/sis_ship/sis_ship.h @@ -17,7 +17,15 @@ #ifndef SIS_SHIP_H #define SIS_SHIP_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_sis (void); +#if defined(__cplusplus) +} +#endif + #endif /* SIS_SHIP_H */ diff --git a/sc2/src/uqm/ships/slylandr/slylandr.h b/sc2/src/uqm/ships/slylandr/slylandr.h index 72843395d..a55362d2d 100644 --- a/sc2/src/uqm/ships/slylandr/slylandr.h +++ b/sc2/src/uqm/ships/slylandr/slylandr.h @@ -17,7 +17,15 @@ #ifndef SLYLANDR_H #define SLYLANDR_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_slylandro (void); +#if defined(__cplusplus) +} +#endif + #endif /* SLYLANDR_H */ diff --git a/sc2/src/uqm/ships/spathi/spathi.h b/sc2/src/uqm/ships/spathi/spathi.h index 4a4d58cb4..900d05cd2 100644 --- a/sc2/src/uqm/ships/spathi/spathi.h +++ b/sc2/src/uqm/ships/spathi/spathi.h @@ -17,7 +17,15 @@ #ifndef SPATHI_H #define SPATHI_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_spathi (void); +#if defined(__cplusplus) +} +#endif + #endif /* SPATHI_H */ diff --git a/sc2/src/uqm/ships/supox/supox.h b/sc2/src/uqm/ships/supox/supox.h index ce3721379..b06632034 100644 --- a/sc2/src/uqm/ships/supox/supox.h +++ b/sc2/src/uqm/ships/supox/supox.h @@ -17,7 +17,15 @@ #ifndef SUPOX_H #define SUPOX_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_supox (void); +#if defined(__cplusplus) +} +#endif + #endif /* SUPOX_H */ diff --git a/sc2/src/uqm/ships/syreen/syreen.h b/sc2/src/uqm/ships/syreen/syreen.h index 713f87f09..1930a1a66 100644 --- a/sc2/src/uqm/ships/syreen/syreen.h +++ b/sc2/src/uqm/ships/syreen/syreen.h @@ -17,7 +17,15 @@ #ifndef SYREEN_H #define SYREEN_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_syreen (void); +#if defined(__cplusplus) +} +#endif + #endif /* SYREEN_H */ diff --git a/sc2/src/uqm/ships/thradd/thradd.h b/sc2/src/uqm/ships/thradd/thradd.h index 193248cd1..fb2a54203 100644 --- a/sc2/src/uqm/ships/thradd/thradd.h +++ b/sc2/src/uqm/ships/thradd/thradd.h @@ -17,7 +17,15 @@ #ifndef THRADD_H #define THRADD_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_thraddash (void); +#if defined(__cplusplus) +} +#endif + #endif /* THRADD_H */ diff --git a/sc2/src/uqm/ships/umgah/umgah.h b/sc2/src/uqm/ships/umgah/umgah.h index 5da749230..8c706bba0 100644 --- a/sc2/src/uqm/ships/umgah/umgah.h +++ b/sc2/src/uqm/ships/umgah/umgah.h @@ -17,7 +17,15 @@ #ifndef UMGAH_H #define UMGAH_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_umgah (void); +#if defined(__cplusplus) +} +#endif + #endif /* UMGAH_H */ diff --git a/sc2/src/uqm/ships/urquan/urquan.h b/sc2/src/uqm/ships/urquan/urquan.h index d1a4161df..937d93ffa 100644 --- a/sc2/src/uqm/ships/urquan/urquan.h +++ b/sc2/src/uqm/ships/urquan/urquan.h @@ -17,7 +17,15 @@ #ifndef URQUAN_H #define URQUAN_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_urquan (void); +#if defined(__cplusplus) +} +#endif + #endif /* URQUAN_H */ diff --git a/sc2/src/uqm/ships/utwig/utwig.h b/sc2/src/uqm/ships/utwig/utwig.h index 903625a45..83ab97e47 100644 --- a/sc2/src/uqm/ships/utwig/utwig.h +++ b/sc2/src/uqm/ships/utwig/utwig.h @@ -17,7 +17,15 @@ #ifndef UTWIG_H #define UTWIG_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_utwig (void); +#if defined(__cplusplus) +} +#endif + #endif /* UTWIG_H */ diff --git a/sc2/src/uqm/ships/vux/vux.h b/sc2/src/uqm/ships/vux/vux.h index e1a6ee2a1..3fa2f3f64 100644 --- a/sc2/src/uqm/ships/vux/vux.h +++ b/sc2/src/uqm/ships/vux/vux.h @@ -17,7 +17,15 @@ #ifndef VUX_H #define VUX_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_vux (void); +#if defined(__cplusplus) +} +#endif + #endif /* VUX_H */ diff --git a/sc2/src/uqm/ships/yehat/yehat.h b/sc2/src/uqm/ships/yehat/yehat.h index ae8a0bb55..8b3dd5a48 100644 --- a/sc2/src/uqm/ships/yehat/yehat.h +++ b/sc2/src/uqm/ships/yehat/yehat.h @@ -17,7 +17,15 @@ #ifndef YEHAT_H #define YEHAT_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_yehat (void); +#if defined(__cplusplus) +} +#endif + #endif /* YEHAT_H */ diff --git a/sc2/src/uqm/ships/zoqfot/zoqfot.h b/sc2/src/uqm/ships/zoqfot/zoqfot.h index 83a16f67c..1bdcc8589 100644 --- a/sc2/src/uqm/ships/zoqfot/zoqfot.h +++ b/sc2/src/uqm/ships/zoqfot/zoqfot.h @@ -17,7 +17,15 @@ #ifndef ZOQFOT_H #define ZOQFOT_H +#if defined(__cplusplus) +extern "C" { +#endif + RACE_DESC *init_zoqfotpik (void); +#if defined(__cplusplus) +} +#endif + #endif /* ZOQFOT_H */ diff --git a/sc2/src/uqm/sis.h b/sc2/src/uqm/sis.h index b717b5b6d..e97c7c8a7 100644 --- a/sc2/src/uqm/sis.h +++ b/sc2/src/uqm/sis.h @@ -22,6 +22,10 @@ #include "planets/elemdata.h" // for NUM_ELEMENT_CATEGORIES +#if defined(__cplusplus) +extern "C" { +#endif + #define CLEAR_SIS_RADAR (1 << 2) #define DRAW_SIS_DISPLAY (1 << 3) @@ -244,5 +248,9 @@ extern COUNT CountSISPieces (BYTE piece_type); extern void DrawFlagshipName (BOOLEAN InStatusArea); extern void DrawCaptainsName (void); +#if defined(__cplusplus) +} +#endif + #endif /* SIS_H_INCL__ */ diff --git a/sc2/src/uqm/sounds.h b/sc2/src/uqm/sounds.h index 74750b203..bea1a0b89 100644 --- a/sc2/src/uqm/sounds.h +++ b/sc2/src/uqm/sounds.h @@ -23,6 +23,10 @@ #include "libs/compiler.h" #include "libs/sndlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef enum { GRAB_CREW = 0, @@ -74,6 +78,10 @@ extern void UpdateSoundPositions (void); extern void FlushSounds (void); extern void RemoveSoundsForObject (ELEMENT *PosObj); +#if defined(__cplusplus) +} +#endif + #endif /* _SOUNDS_H */ diff --git a/sc2/src/uqm/starbase.h b/sc2/src/uqm/starbase.h index ef6f0fe45..64ce19769 100644 --- a/sc2/src/uqm/starbase.h +++ b/sc2/src/uqm/starbase.h @@ -21,6 +21,10 @@ #include "menustat.h" +#if defined(__cplusplus) +extern "C" { +#endif + enum { TALK_COMMANDER = 0, @@ -44,5 +48,9 @@ extern COUNT WrapText (const UNICODE *pStr, COUNT len, TEXT *tarray, SIZE field_width); // XXX: Doesn't really belong in this file. +#if defined(__cplusplus) +} +#endif + #endif /* _STARBASE_H */ diff --git a/sc2/src/uqm/starcon.h b/sc2/src/uqm/starcon.h index e357a0650..edc81236e 100644 --- a/sc2/src/uqm/starcon.h +++ b/sc2/src/uqm/starcon.h @@ -17,6 +17,10 @@ #ifndef _STARCON_H #define _STARCON_H +#if defined(__cplusplus) +extern "C" { +#endif + extern volatile int MainExited; extern void SignalStopMainThread (void); extern void ProcessUtilityKeys (void); @@ -24,5 +28,9 @@ extern void ProcessUtilityKeys (void); extern int Starcon2Main (void *threadArg); extern void FreeGameData (void); +#if defined(__cplusplus) +} +#endif + #endif /* _STARCON_H */ diff --git a/sc2/src/uqm/state.h b/sc2/src/uqm/state.h index 560d531e8..4c7dbe7f8 100644 --- a/sc2/src/uqm/state.h +++ b/sc2/src/uqm/state.h @@ -23,6 +23,10 @@ #include "libs/compiler.h" #include +#if defined(__cplusplus) +extern "C" { +#endif + extern void InitPlanetInfo (void); extern void UninitPlanetInfo (void); extern void GetPlanetInfo (void); @@ -155,5 +159,9 @@ swrite_a32 (void *fp, const DWORD *ar, COUNT count) return 1; } +#if defined(__cplusplus) +} +#endif + #endif /* _STATE_H */ diff --git a/sc2/src/uqm/status.h b/sc2/src/uqm/status.h index b119d48a3..f27965ee8 100644 --- a/sc2/src/uqm/status.h +++ b/sc2/src/uqm/status.h @@ -22,6 +22,10 @@ #include "races.h" #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define CREW_XOFFS 4 #define ENERGY_XOFFS 52 #define GAUGE_YOFFS (SHIP_INFO_HEIGHT - 10) @@ -64,4 +68,8 @@ extern BOOLEAN DeltaCrew (ELEMENT *ElementPtr, SIZE crew_delta); extern void PreProcessStatus (ELEMENT *ShipPtr); extern void PostProcessStatus (ELEMENT *ShipPtr); +#if defined(__cplusplus) +} +#endif + #endif /* UQM_STATUS_H_INCL_ */ diff --git a/sc2/src/uqm/supermelee/buildpick.h b/sc2/src/uqm/supermelee/buildpick.h index dc609c627..43608e725 100644 --- a/sc2/src/uqm/supermelee/buildpick.h +++ b/sc2/src/uqm/supermelee/buildpick.h @@ -4,6 +4,10 @@ #include "types.h" #include "melee.h" +#if defined(__cplusplus) +extern "C" { +#endif + void BuildBuildPickFrame (void); void DestroyBuildPickFrame (void); bool BuildPickShip (MELEE_STATE *pMS); @@ -13,5 +17,9 @@ void DrawPickFrame (MELEE_STATE *pMS); void DrawPickIcon (MeleeShip ship, bool DrawErase); +#if defined(__cplusplus) +} +#endif + #endif /* BUILDPICK_H */ diff --git a/sc2/src/uqm/supermelee/loadmele.h b/sc2/src/uqm/supermelee/loadmele.h index 993c56940..b002b5432 100644 --- a/sc2/src/uqm/supermelee/loadmele.h +++ b/sc2/src/uqm/supermelee/loadmele.h @@ -26,6 +26,10 @@ struct melee_load_state; #include "melee.h" #include "meleesetup.h" +#if defined(__cplusplus) +extern "C" { +#endif + struct melee_load_state { MeleeTeam **preBuiltList; @@ -56,6 +60,10 @@ bool ReadTeamImage (MeleeTeam *pTI, uio_Stream *load_fp); int WriteTeamImage (const MeleeTeam *pTI, uio_Stream *save_fp); void LoadTeamList (MELEE_STATE *pMS); +#if defined(__cplusplus) +} +#endif + #endif /* _LOADMELE_H */ diff --git a/sc2/src/uqm/supermelee/melee.h b/sc2/src/uqm/supermelee/melee.h index a0a9e4abf..21830263f 100644 --- a/sc2/src/uqm/supermelee/melee.h +++ b/sc2/src/uqm/supermelee/melee.h @@ -28,6 +28,10 @@ #include "netplay/packet.h" // for NetplayAbortReason and NetplayResetReason. +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct melee_state MELEE_STATE; #define NUM_MELEE_ROWS 2 @@ -50,10 +54,18 @@ extern FRAME PickMeleeFrame; typedef BYTE MELEE_OPTIONS; +#if defined(__cplusplus) +} +#endif + #include "loadmele.h" #include "meleesetup.h" #include "meleeship.h" +#if defined(__cplusplus) +extern "C" { +#endif + struct melee_state { BOOLEAN (*InputFunc) (struct melee_state *pInputState); @@ -125,5 +137,9 @@ void Melee_RemoteChange_ship (MELEE_STATE *pMS, NetConnection *conn, void Melee_RemoteChange_teamName (MELEE_STATE *pMS, NetConnection *conn, COUNT side, const char *name); +#if defined(__cplusplus) +} +#endif + #endif /* _MELEE_H */ diff --git a/sc2/src/uqm/supermelee/meleesetup.h b/sc2/src/uqm/supermelee/meleesetup.h index d6ff9eda9..0097d920b 100644 --- a/sc2/src/uqm/supermelee/meleesetup.h +++ b/sc2/src/uqm/supermelee/meleesetup.h @@ -32,6 +32,10 @@ typedef COUNT FleetShipIndex; #include "melee.h" #include "meleeship.h" +#if defined(__cplusplus) +extern "C" { +#endif + #ifdef MELEETEAM_INTERNAL struct MeleeTeam { @@ -131,5 +135,9 @@ void MeleeState_setTeamName (MELEE_STATE *pMS, size_t teamNr, void MeleeState_setTeam (MELEE_STATE *pMS, size_t teamNr, const MeleeTeam *team); +#if defined(__cplusplus) +} +#endif + #endif /* MELEESETUP_H */ diff --git a/sc2/src/uqm/supermelee/meleeship.h b/sc2/src/uqm/supermelee/meleeship.h index b58c5b26c..e917b7561 100644 --- a/sc2/src/uqm/supermelee/meleeship.h +++ b/sc2/src/uqm/supermelee/meleeship.h @@ -3,6 +3,10 @@ #include "types.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef enum MeleeShip { MELEE_ANDROSYNTH, MELEE_ARILOU, @@ -43,5 +47,9 @@ MeleeShip_valid (MeleeShip ship) return (ship < NUM_MELEE_SHIPS) || (ship == MELEE_NONE); } +#if defined(__cplusplus) +} +#endif + #endif /* MELEESHIP_H */ diff --git a/sc2/src/uqm/supermelee/netplay/checkbuf.h b/sc2/src/uqm/supermelee/netplay/checkbuf.h index cb7637b17..f209bd508 100644 --- a/sc2/src/uqm/supermelee/netplay/checkbuf.h +++ b/sc2/src/uqm/supermelee/netplay/checkbuf.h @@ -19,13 +19,25 @@ #ifndef _CHECKBUF_H #define _CHECKBUF_H +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct ChecksumEntry ChecksumEntry; typedef struct ChecksumBuffer ChecksumBuffer; +#if defined(__cplusplus) +} +#endif + #include "../../battle.h" // for BattleFrameCounter #include "checksum.h" +#if defined(__cplusplus) +extern "C" { +#endif + struct ChecksumEntry { #ifdef NETPLAY_DEBUG @@ -58,5 +70,9 @@ bool ChecksumBuffer_addChecksum(ChecksumBuffer *cb, bool ChecksumBuffer_getChecksum(ChecksumBuffer *cb, BattleFrameCounter frameNr, Checksum *result); +#if defined(__cplusplus) +} +#endif + #endif /* _CHECKBUF_H */ diff --git a/sc2/src/uqm/supermelee/netplay/checksum.h b/sc2/src/uqm/supermelee/netplay/checksum.h index 95f84bf6b..2a5948fa8 100644 --- a/sc2/src/uqm/supermelee/netplay/checksum.h +++ b/sc2/src/uqm/supermelee/netplay/checksum.h @@ -33,6 +33,10 @@ typedef uint32 Checksum; #include "netconnection.h" +#if defined(__cplusplus) +extern "C" { +#endif + static inline void crc_processELEMENT_FLAGS(crc_State *state, ELEMENT_FLAGS val) { @@ -88,6 +92,10 @@ void addRemoteChecksum(NetConnection *conn, BattleFrameCounter frameNr, Checksum checksum); bool verifyChecksums(BattleFrameCounter frameNr); +#if defined(__cplusplus) +} +#endif + #endif /* _CHECKSUM_H */ diff --git a/sc2/src/uqm/supermelee/netplay/crc.h b/sc2/src/uqm/supermelee/netplay/crc.h index c1847cf19..b6f1e248b 100644 --- a/sc2/src/uqm/supermelee/netplay/crc.h +++ b/sc2/src/uqm/supermelee/netplay/crc.h @@ -25,6 +25,10 @@ typedef struct crc_State crc_State; #include +#if defined(__cplusplus) +extern "C" { +#endif + struct crc_State { uint32 crc; }; @@ -36,6 +40,9 @@ void crc_processUint16(crc_State *state, uint16 val); void crc_processUint32(crc_State *state, uint32 val); uint32 crc_finish(const crc_State *state); +#if defined(__cplusplus) +} +#endif #ifdef DUMP_CRC_OPS #include "netconnection.h" diff --git a/sc2/src/uqm/supermelee/netplay/netconnection.h b/sc2/src/uqm/supermelee/netplay/netconnection.h index 32c034fad..396c59e4c 100644 --- a/sc2/src/uqm/supermelee/netplay/netconnection.h +++ b/sc2/src/uqm/supermelee/netplay/netconnection.h @@ -22,6 +22,10 @@ #include "netplay.h" // for NETPLAY_STATISTICS +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct NetConnection NetConnection; typedef struct NetConnectionError NetConnectionError; typedef struct ConnectStateData ConnectStateData; @@ -38,6 +42,10 @@ typedef void (*NetConnection_DeleteCallback)(NetConnection *nd); typedef void (*NetConnection_ReadyCallback)(NetConnection *conn, void *arg); typedef void (*NetConnection_ResetCallback)(NetConnection *conn, void *arg); +#if defined(__cplusplus) +} +#endif + #include "netstate.h" #include "netoptions.h" #ifdef NETPLAY_CHECKSUM @@ -50,6 +58,10 @@ typedef void (*NetConnection_ResetCallback)(NetConnection *conn, void *arg); # include "libs/uio.h" #endif +#if defined(__cplusplus) +extern "C" { +#endif + struct NetConnectionError { NetState state; int err; @@ -68,11 +80,18 @@ struct NetStatistics { }; #endif +#if defined(__cplusplus) +} +#endif #ifdef NETCONNECTION_INTERNAL #include "libs/net.h" #include "packetq.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct { // For actions that require agreement by both parties. bool localOk : 1; /* Action confirmed by us */ @@ -232,6 +251,9 @@ void *NetConnection_getResetCallbackArg(const NetConnection *conn); extern uio_Stream *netplayDebugFile; #endif +#if defined(__cplusplus) +} +#endif #endif /* _NETCONNECTION_H */ diff --git a/sc2/src/uqm/supermelee/netplay/netinput.h b/sc2/src/uqm/supermelee/netplay/netinput.h index ff1f42f7f..7d6eef9e6 100644 --- a/sc2/src/uqm/supermelee/netplay/netinput.h +++ b/sc2/src/uqm/supermelee/netplay/netinput.h @@ -22,6 +22,10 @@ #include "../../controls.h" // for BATTLE_INPUT_STATE #include "../../init.h" + +#if defined(__cplusplus) +extern "C" { +#endif // for NUM_PLAYERS typedef struct BattleInputBuffer { @@ -46,5 +50,9 @@ bool BattleInputBuffer_pop(BattleInputBuffer *bib, BattleInputBuffer *getBattleInputBuffer(size_t player); +#if defined(__cplusplus) +} +#endif + #endif /* _NETINPUT_H */ diff --git a/sc2/src/uqm/supermelee/netplay/netmelee.h b/sc2/src/uqm/supermelee/netplay/netmelee.h index 6bed21961..44503accd 100644 --- a/sc2/src/uqm/supermelee/netplay/netmelee.h +++ b/sc2/src/uqm/supermelee/netplay/netmelee.h @@ -31,6 +31,9 @@ #include "../../races.h" // for STARSHIP +#if defined(__cplusplus) +extern "C" { +#endif extern struct NetConnection *netConnections[]; @@ -80,6 +83,10 @@ bool waitReady(NetConnection *conn); bool waitReset(NetConnection *conn, NetState nextState); bool waitResetConnections(NetState nextState); +#if defined(__cplusplus) +} +#endif + #endif /* _NETMELEE_H */ diff --git a/sc2/src/uqm/supermelee/netplay/netmisc.h b/sc2/src/uqm/supermelee/netplay/netmisc.h index e97f2961a..c2cef1290 100644 --- a/sc2/src/uqm/supermelee/netplay/netmisc.h +++ b/sc2/src/uqm/supermelee/netplay/netmisc.h @@ -28,6 +28,10 @@ typedef struct BattleStateData BattleStateData; #include "../../battle.h" // for BattleFrameCounter, BATTLE_FRAME_RATE +#if defined(__cplusplus) +extern "C" { +#endif + struct BattleStateData { NETCONNECTION_STATE_DATA_COMMON @@ -66,6 +70,10 @@ readyFlagsMeaningful(NetState state) { } +#if defined(__cplusplus) +} +#endif + #endif /* _NETMISC_H */ diff --git a/sc2/src/uqm/supermelee/netplay/netoptions.h b/sc2/src/uqm/supermelee/netplay/netoptions.h index cdefe21ad..88005b187 100644 --- a/sc2/src/uqm/supermelee/netplay/netoptions.h +++ b/sc2/src/uqm/supermelee/netplay/netoptions.h @@ -23,6 +23,10 @@ #include +#if defined(__cplusplus) +extern "C" { +#endif + #define NETPLAY_NUM_PLAYERS 2 // Not using NUM_PLAYERS because that would mean we'd have // to include init.h, and all that comes with it. @@ -45,6 +49,10 @@ typedef struct { extern NetplayOptions netplayOptions; +#if defined(__cplusplus) +} +#endif + #endif /* _NETOPTIONS_H */ diff --git a/sc2/src/uqm/supermelee/netplay/netrcv.h b/sc2/src/uqm/supermelee/netplay/netrcv.h index 9db577635..bf409befd 100644 --- a/sc2/src/uqm/supermelee/netplay/netrcv.h +++ b/sc2/src/uqm/supermelee/netplay/netrcv.h @@ -21,7 +21,15 @@ #include "libs/net.h" +#if defined(__cplusplus) +extern "C" { +#endif + void dataReadyCallback(NetDescriptor *nd); +#if defined(__cplusplus) +} +#endif + #endif /* _NETRCV_H */ diff --git a/sc2/src/uqm/supermelee/netplay/netsend.h b/sc2/src/uqm/supermelee/netplay/netsend.h index 1a2199379..22c73459d 100644 --- a/sc2/src/uqm/supermelee/netplay/netsend.h +++ b/sc2/src/uqm/supermelee/netplay/netsend.h @@ -21,8 +21,16 @@ #include "packet.h" +#if defined(__cplusplus) +extern "C" { +#endif + int sendPacket(NetConnection *conn, Packet *packet); +#if defined(__cplusplus) +} +#endif + #endif /* _NETSEND_H */ diff --git a/sc2/src/uqm/supermelee/netplay/netstate.h b/sc2/src/uqm/supermelee/netplay/netstate.h index f9708b015..1408eced2 100644 --- a/sc2/src/uqm/supermelee/netplay/netstate.h +++ b/sc2/src/uqm/supermelee/netplay/netstate.h @@ -21,6 +21,9 @@ #include "port.h" +#if defined(__cplusplus) +extern "C" { +#endif typedef struct NetConnectionStateData NetConnectionStateData; @@ -38,8 +41,16 @@ typedef enum { NetState_endingBattle2, /* Waiting for the final synchronisation */ } NetState; +#if defined(__cplusplus) +} +#endif + #include "types.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct { const char *name; } NetStateData; @@ -65,5 +76,9 @@ NetState_battleActive(NetState state) { } +#if defined(__cplusplus) +} +#endif + #endif /* _NETSTATE_H */ diff --git a/sc2/src/uqm/supermelee/netplay/notify.h b/sc2/src/uqm/supermelee/netplay/notify.h index a492c51e8..e17e3c93f 100644 --- a/sc2/src/uqm/supermelee/netplay/notify.h +++ b/sc2/src/uqm/supermelee/netplay/notify.h @@ -32,6 +32,10 @@ #include "../meleesetup.h" // for FleetShipIndex +#if defined(__cplusplus) +extern "C" { +#endif + void Netplay_Notify_shipSelected(NetConnection *conn, FleetShipIndex index); void Netplay_Notify_battleInput(NetConnection *conn, BATTLE_INPUT_STATE input); @@ -51,5 +55,9 @@ void Netplay_Notify_checksum(NetConnection *conn, #endif +#if defined(__cplusplus) +} +#endif + #endif /* _NOTIFY_H */ diff --git a/sc2/src/uqm/supermelee/netplay/notifyall.h b/sc2/src/uqm/supermelee/netplay/notifyall.h index 55f413f07..d20ca8117 100644 --- a/sc2/src/uqm/supermelee/netplay/notifyall.h +++ b/sc2/src/uqm/supermelee/netplay/notifyall.h @@ -24,6 +24,10 @@ # include "checksum.h" #endif /* NETPLAY_CHECKSUM */ +#if defined(__cplusplus) +extern "C" { +#endif + void Netplay_NotifyAll_setTeamName (MELEE_STATE *pMS, size_t playerNr); void Netplay_NotifyAll_setFleet (MELEE_STATE *pMS, size_t playerNr); void Netplay_NotifyAll_setShip (MELEE_STATE *pMS, size_t playerNr, @@ -37,5 +41,9 @@ void Netplay_NotifyAll_checksum(BattleFrameCounter frameNr, void Netplay_NotifyAll_battleInput(BATTLE_INPUT_STATE input); +#if defined(__cplusplus) +} +#endif + #endif /* NOTIFYALL_H */ diff --git a/sc2/src/uqm/supermelee/netplay/packet.h b/sc2/src/uqm/supermelee/netplay/packet.h index c9980fde6..c5e2f5efb 100644 --- a/sc2/src/uqm/supermelee/netplay/packet.h +++ b/sc2/src/uqm/supermelee/netplay/packet.h @@ -19,6 +19,10 @@ #ifndef _PACKET_H #define _PACKET_H +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct Packet Packet; typedef enum PacketType { @@ -60,12 +64,19 @@ typedef enum NetplayResetReason { ResetReason_manualReset, } NetplayResetReason; +#if defined(__cplusplus) +} +#endif + #ifndef PACKET_H_STANDALONE #include "netconnection.h" #include "types.h" #include "libs/network/bytesex.h" +#if defined(__cplusplus) +extern "C" { +#endif /* NB: These handlers are expected not to modify the state if an * error occurs. @@ -81,8 +92,16 @@ typedef struct { } PacketTypeData; extern PacketTypeData packetTypeData[]; + +#if defined(__cplusplus) +} #endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif // When adding new packets, be sure to have all the fields properly aligned, // and that the size of a packet is a multiple of 4 bytes in length. @@ -272,6 +291,9 @@ Packet_Abort *Packet_Abort_create(uint16 reason); Packet_Reset *Packet_Reset_create(uint16 reason); #endif +#if defined(__cplusplus) +} +#endif #endif /* _PACKET_H */ diff --git a/sc2/src/uqm/supermelee/netplay/packethandlers.h b/sc2/src/uqm/supermelee/netplay/packethandlers.h index 5f4a6025b..ff63f6ef7 100644 --- a/sc2/src/uqm/supermelee/netplay/packethandlers.h +++ b/sc2/src/uqm/supermelee/netplay/packethandlers.h @@ -21,6 +21,10 @@ #include "packet.h" +#if defined(__cplusplus) +extern "C" { +#endif + #define DECLARE_PACKETHANDLER(type) \ int PacketHandler_##type(NetConnection *conn, \ const Packet_##type *packet); @@ -45,4 +49,8 @@ DECLARE_PACKETHANDLER(Abort); DECLARE_PACKETHANDLER(Reset); +#if defined(__cplusplus) +} +#endif + #endif /* _PACKETHANDLERS_H */ diff --git a/sc2/src/uqm/supermelee/netplay/packetq.h b/sc2/src/uqm/supermelee/netplay/packetq.h index 494c61969..15150c65b 100644 --- a/sc2/src/uqm/supermelee/netplay/packetq.h +++ b/sc2/src/uqm/supermelee/netplay/packetq.h @@ -26,6 +26,10 @@ typedef struct PacketQueue PacketQueue; #include +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct PacketQueueLink PacketQueueLink; struct PacketQueueLink { PacketQueueLink *next; @@ -47,5 +51,9 @@ void queuePacket(NetConnection *conn, Packet *packet); int flushPacketQueue(NetConnection *conn); +#if defined(__cplusplus) +} +#endif + #endif diff --git a/sc2/src/uqm/supermelee/netplay/packetsenders.h b/sc2/src/uqm/supermelee/netplay/packetsenders.h index 407db4b61..ab6e125a9 100644 --- a/sc2/src/uqm/supermelee/netplay/packetsenders.h +++ b/sc2/src/uqm/supermelee/netplay/packetsenders.h @@ -31,6 +31,10 @@ #include "../meleesetup.h" // for FleetShipIndex +#if defined(__cplusplus) +extern "C" { +#endif + void sendInit(NetConnection *conn); void sendPing(NetConnection *conn, uint32 id); void sendAck(NetConnection *conn, uint32 id); @@ -56,6 +60,10 @@ void sendAbort(NetConnection *conn, NetplayAbortReason reason); void sendReset(NetConnection *conn, NetplayResetReason reason); +#if defined(__cplusplus) +} +#endif + #endif /* _PACKETSENDERS_H */ diff --git a/sc2/src/uqm/supermelee/netplay/proto/npconfirm.h b/sc2/src/uqm/supermelee/netplay/proto/npconfirm.h index 432e7d5b1..d28ba2f75 100644 --- a/sc2/src/uqm/supermelee/netplay/proto/npconfirm.h +++ b/sc2/src/uqm/supermelee/netplay/proto/npconfirm.h @@ -22,9 +22,17 @@ #include "../netplay.h" #include "../netconnection.h" +#if defined(__cplusplus) +extern "C" { +#endif + int Netplay_confirm(NetConnection *conn); int Netplay_cancelConfirmation(NetConnection *conn); +#if defined(__cplusplus) +} +#endif + #endif /* _NPCONFIRM_H */ diff --git a/sc2/src/uqm/supermelee/netplay/proto/ready.h b/sc2/src/uqm/supermelee/netplay/proto/ready.h index 296bbf7a6..1c30184e1 100644 --- a/sc2/src/uqm/supermelee/netplay/proto/ready.h +++ b/sc2/src/uqm/supermelee/netplay/proto/ready.h @@ -21,11 +21,19 @@ #include "../netconnection.h" +#if defined(__cplusplus) +extern "C" { +#endif + bool Netplay_localReady(NetConnection *conn, NetConnection_ReadyCallback callback, void *arg, bool notifyRemote); bool Netplay_remoteReady(NetConnection *conn); bool Netplay_isLocalReady(const NetConnection *conn); bool Netplay_isRemoteReady(const NetConnection *conn); +#if defined(__cplusplus) +} +#endif + #endif /* _READY_H */ diff --git a/sc2/src/uqm/supermelee/netplay/proto/reset.h b/sc2/src/uqm/supermelee/netplay/proto/reset.h index d07a3c4d7..a4473a437 100644 --- a/sc2/src/uqm/supermelee/netplay/proto/reset.h +++ b/sc2/src/uqm/supermelee/netplay/proto/reset.h @@ -22,6 +22,10 @@ #include "../netconnection.h" #include "../packet.h" +#if defined(__cplusplus) +extern "C" { +#endif + void Netplay_setResetCallback(NetConnection *conn, NetConnection_ResetCallback callback, void *resetArg); void Netplay_localReset(NetConnection *conn, NetplayResetReason reason); @@ -29,6 +33,9 @@ void Netplay_remoteReset(NetConnection *conn, NetplayResetReason reason); bool Netplay_isLocalReset(const NetConnection *conn); bool Netplay_isRemoteReset(const NetConnection *conn); +#if defined(__cplusplus) +} +#endif #endif /* _RESET_H */ diff --git a/sc2/src/uqm/supermelee/pickmele.h b/sc2/src/uqm/supermelee/pickmele.h index a214dfba9..7fadc449e 100644 --- a/sc2/src/uqm/supermelee/pickmele.h +++ b/sc2/src/uqm/supermelee/pickmele.h @@ -24,6 +24,10 @@ typedef struct getmelee_struct GETMELEE_STATE; #include "meleesetup.h" #include "libs/compiler.h" +#if defined(__cplusplus) +extern "C" { +#endif + void MeleeShipDeath (STARSHIP *); void BuildPickMeleeFrame (void); void DestroyPickMeleeFrame (void); @@ -41,12 +45,20 @@ BOOLEAN selectShipComputer (ComputerInputContext *context, BOOLEAN selectShipNetwork (NetworkInputContext *context, GETMELEE_STATE *gms); #endif /* NETPLAY */ +#if defined(__cplusplus) +} +#endif + #ifdef PICKMELE_INTERNAL #include "../flash.h" #include "libs/timelib.h" #include "../init.h" +#if defined(__cplusplus) +extern "C" { +#endif + struct getmelee_struct { BOOLEAN (*InputFunc) (struct getmelee_struct *pInputState); @@ -80,6 +92,10 @@ struct getmelee_struct { bool setShipSelected(GETMELEE_STATE *gms, COUNT playerI, COUNT choice, bool reportNetwork); +#if defined(__cplusplus) +} +#endif + #endif /* PICKMELE_INTERNAL */ #endif /* _PICKMELE_H */ diff --git a/sc2/src/uqm/tactrans.h b/sc2/src/uqm/tactrans.h index dd51808e3..11b345ee9 100644 --- a/sc2/src/uqm/tactrans.h +++ b/sc2/src/uqm/tactrans.h @@ -24,6 +24,10 @@ #include "element.h" #include "battlecontrols.h" +#if defined(__cplusplus) +extern "C" { +#endif + bool battleEndReadyHuman (HumanInputContext *context); bool battleEndReadyComputer (ComputerInputContext *context); #ifdef NETPLAY @@ -40,6 +44,10 @@ extern void flee_preprocess (ELEMENT *ElementPtr); extern void StopDitty (void); extern void ResetWinnerStarShip (void); +#if defined(__cplusplus) +} +#endif + #endif /* _TACTRANS_H */ diff --git a/sc2/src/uqm/units.h b/sc2/src/uqm/units.h index 303e50558..8b04b6056 100644 --- a/sc2/src/uqm/units.h +++ b/sc2/src/uqm/units.h @@ -21,6 +21,10 @@ #include "libs/gfxlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern int ScreenWidth; extern int ScreenHeight; @@ -216,5 +220,10 @@ extern COUNT ARCTAN (SIZE delta_x, SIZE delta_y); #define WRAP_DELTA_Y(dy) ((dy)<0 ? \ ((-(dy)<=LOG_SPACE_HEIGHT>>1)?(dy):(LOG_SPACE_HEIGHT+(dy))) : \ (((dy)<=LOG_SPACE_HEIGHT>>1)?(dy):((dy)-LOG_SPACE_HEIGHT))) + +#if defined(__cplusplus) +} +#endif + #endif /* _UNITS_H */ diff --git a/sc2/src/uqm/util.h b/sc2/src/uqm/util.h index 2add76ec3..8549cf1aa 100644 --- a/sc2/src/uqm/util.h +++ b/sc2/src/uqm/util.h @@ -20,6 +20,10 @@ #include "libs/compiler.h" #include "libs/gfxlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + extern void DrawStarConBox (RECT *pRect, SIZE BorderWidth, Color TopLeftColor, Color BottomRightColor, BOOLEAN FillInterior, Color InteriorColor); @@ -28,5 +32,9 @@ extern DWORD SeedRandomNumbers (void); // saveRect can be NULL to save the entire context frame extern STAMP SaveContextFrame (const RECT *saveRect); +#if defined(__cplusplus) +} +#endif + #endif /* _UTIL_H */ diff --git a/sc2/src/uqm/velocity.h b/sc2/src/uqm/velocity.h index eb2585b17..23bea030f 100644 --- a/sc2/src/uqm/velocity.h +++ b/sc2/src/uqm/velocity.h @@ -22,6 +22,10 @@ #include /* for memset */ #include "libs/gfxlib.h" +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct velocity_desc { COUNT TravelAngle; @@ -65,5 +69,9 @@ VelocitySquared (SIZE dx, SIZE dy) #define VELOCITY_TO_WORLD(v) ((v)>>VELOCITY_SHIFT) #define WORLD_TO_VELOCITY(l) ((l)<