Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6b5f516
[ZH] Basic preprocessor fixes
zzambers Apr 1, 2025
176f1ce
[ZH] Replacements of _int64 with __int64
zzambers Apr 1, 2025
5ec2ac7
[ZH] Introdution of CPP_11 macro for code requiring c++11 or higher
zzambers Mar 30, 2025
43c49b2
[ZH] Forward enum declacrations portability fix
zzambers Apr 1, 2025
d89f254
[ZH] Fix of missing forward declarations
zzambers Apr 1, 2025
3c05bd8
[ZH] Fix of missing includes
zzambers Apr 1, 2025
1a37f94
[ZH] Fix of accesses to parent class members
zzambers Mar 29, 2025
3d4c893
[ZH] Fixes of template specializations
zzambers Apr 1, 2025
32c2234
[ZH] Removal of static keyword for enums
zzambers Apr 1, 2025
eaf937e
[ZH] Fixed boolean redefinition
zzambers Mar 29, 2025
f5e72d9
[ZH] Fix of non-static declarations with static definitions
zzambers Apr 1, 2025
862b45d
[ZH] Fix of function pointer catsts to void*
zzambers Apr 1, 2025
337a01d
[ZH] Fix of direct constructor calls
zzambers Apr 1, 2025
d8fb831
[ZH] Fix of unsigned values in signed arrays
zzambers Apr 1, 2025
be8d67b
[ZH] COM related fixes
zzambers Apr 1, 2025
11928ee
[ZH] Fixes of test main methods
zzambers Apr 1, 2025
95e8064
[ZH] Fix to do stack trace only when support is enabled
zzambers Apr 1, 2025
ed1a5dd
[ZH] Fix of unsigned short casts
zzambers Mar 29, 2025
6e6fad4
[ZH] typename fixes
zzambers Mar 29, 2025
81f4234
[ZH] Fix of virtual method declarations
zzambers Mar 29, 2025
4cb8d7c
[ZH] Fix of sizeof operators
zzambers Mar 29, 2025
1073855
[ZH] Fix of forgotten BitTest macro usage
zzambers Mar 29, 2025
ef1d840
[ZH] Fix making use of proper MouseButtonState constants
zzambers Mar 29, 2025
cd6be77
[ZH] Fix to avoid unsupported __try and __except on GCC
zzambers Mar 29, 2025
9edf0f4
[ZH] Fix to avoid VS specific new operators on GCC
zzambers Apr 1, 2025
63ec6dd
[ZH] Fix of loop counter scope
zzambers Mar 29, 2025
aa30755
[ZH] Fix of calls with excess argument
zzambers Mar 29, 2025
23a34a9
[ZH] Removal of duplicit strtrim
zzambers Mar 30, 2025
b117146
[ZH] Fix of strtok_r redefinition on mingw
zzambers Mar 29, 2025
feba1d3
[ZH] Use feature testing macros for std::atomic_flag::{wait,notify_one}
zzambers Apr 1, 2025
c5cc49c
[ZH] Fixes to intrin_compat.h
zzambers Apr 2, 2025
ff2197f
[ZH] Rest of asm code made VC only
zzambers Apr 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@ WindowMsgHandledType GameSpyPlayerInfoOverlaySystem( GameWindow *window, Unsigne
return MSG_HANDLED;
}// GameSpyPlayerInfoOverlaySystem

static void messageBoxYes( void )
void messageBoxYes( void )
{
BuddyRequest breq;
breq.buddyRequestType = BuddyRequest::BUDDYREQUEST_DELETEACCT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg,
}


static void insertChat( BuddyMessage msg )
void insertChat( BuddyMessage msg )
{
if (buddyControls.listboxChat)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ static const char* getMessageString(Int t)
/** refreshGameList
The Bool is used to force refresh if the refresh button was hit.*/
//-------------------------------------------------------------------------------------------------
static void refreshGameList( Bool forceRefresh )
void refreshGameList( Bool forceRefresh )
{
Int refreshInterval = gameListRefreshInterval;

Expand All @@ -888,7 +888,7 @@ static void refreshGameList( Bool forceRefresh )
/** refreshPlayerList
The Bool is used to force refresh if the refresh button was hit.*/
//-------------------------------------------------------------------------------------------------
static void refreshPlayerList( Bool forceRefresh )
void refreshPlayerList( Bool forceRefresh )
{
Int refreshInterval = playerListRefreshInterval;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2174,7 +2174,7 @@ void PushButtonImageDrawThree(GameWindow *window, Int alpha )

}

static void drawTypeText( GameWindow *window, DisplayString *str)
void drawTypeText( GameWindow *window, DisplayString *str)
{
TextData *tData = (TextData *)window->winGetUserData();
Int textColor = window->winGetEnabledTextColor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,14 @@ inline Real maxReal(Real a, Real b)
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid);
static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid);
static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid);
static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid);
static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms);
static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms);
static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms);
static void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms);
void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid);
void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid);
void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid);
void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid);
void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms);
void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms);
void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms);
void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms);

static void projectCoord3D(Coord3D *coord, const Coord3D *unitDir, Real dist);
static void flipCoord3D(Coord3D *coord);
Expand Down Expand Up @@ -5606,7 +5606,7 @@ static int cellValueProc(PartitionCell* cell, void* userData)
}

// -----------------------------------------------------------------------------
static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid)
void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised that this is a problem. What is the error? static function in cpp should be legal, no?

Copy link
Author

@zzambers zzambers Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem here (and in other cases) was not function being static. But rather function being declared non-static and then defined (or re-declared) as static. In this particular case, problem was inconsistency with friend declarations in PartitionManager.h, if I remember correctly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiler error:

CnC_Generals_Zero_Hour/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp:340:13: error: ‘void hLineAddLooker(Int, Int, Int, void*)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
  340 | static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid);
      |             ^~~~~~~~~~~~~~
In file included from CnC_Generals_Zero_Hour/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp:74:
CnC_Generals_Zero_Hour/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h:1300:21: note: previous declaration of ‘void hLineAddLooker(Int, Int, Int, void*)’
 1300 |         friend void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndex);
      |                     ^~~~~~~~~~~~~~

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to make a static friend here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making static fried results in error:

CnC_Generals_Zero_Hour/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h:1300:16: error: storage class specifiers invalid in friend function declarations
 1300 |         friend static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndex);
      |                ^~~~~~

{
if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0)
return;
Expand All @@ -5623,7 +5623,7 @@ static void hLineAddLooker(Int x1, Int x2, Int y, void *playerIndexVoid)
}

// -----------------------------------------------------------------------------
static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid)
void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid)
{
if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0)
return;
Expand All @@ -5640,7 +5640,7 @@ static void hLineRemoveLooker(Int x1, Int x2, Int y, void *playerIndexVoid)
}

// -----------------------------------------------------------------------------
static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid)
void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid)
{
if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0)
return;
Expand All @@ -5657,7 +5657,7 @@ static void hLineAddShrouder(Int x1, Int x2, Int y, void *playerIndexVoid)
}

// -----------------------------------------------------------------------------
static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid)
void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid)
{
if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0)
return;
Expand All @@ -5674,7 +5674,7 @@ static void hLineRemoveShrouder(Int x1, Int x2, Int y, void *playerIndexVoid)
}

// -----------------------------------------------------------------------------
static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms)
void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms)
{
if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0)
return;
Expand Down Expand Up @@ -5702,7 +5702,7 @@ static void hLineAddThreat(Int x1, Int x2, Int y, void *threatValueParms)
}

// -----------------------------------------------------------------------------
static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms)
void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms)
{
if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0)
return;
Expand Down Expand Up @@ -5730,7 +5730,7 @@ static void hLineRemoveThreat(Int x1, Int x2, Int y, void *threatValueParms)
}

// -----------------------------------------------------------------------------
static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms)
void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms)
{
if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0)
return;
Expand Down Expand Up @@ -5758,7 +5758,7 @@ static void hLineAddValue(Int x1, Int x2, Int y, void *threatValueParms)
}

// -----------------------------------------------------------------------------
static void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms)
void hLineRemoveValue(Int x1, Int x2, Int y, void *threatValueParms)
{
if (y < 0 || y >= ThePartitionManager->m_cellCountY || x1 >= ThePartitionManager->m_cellCountX || x2 < 0)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ void W3DMainMenuButtonDropShadowDraw( GameWindow *window,
// drawButtonText =============================================================
/** Draw button text to the screen */
//=============================================================================
static void drawText( GameWindow *window, WinInstanceData *instData )
void drawText( GameWindow *window, WinInstanceData *instData )
{
ICoord2D origin, size, textPos;
Int width, height;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ static void drawContainedDrawable( Object *obj, void *userData )

//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
static void drawDrawableExtents( Drawable *draw, void *userData )
void drawDrawableExtents( Drawable *draw, void *userData )
{
UnsignedInt color = GameMakeColor( 0, 255, 0, 255 );

Expand Down Expand Up @@ -886,7 +886,7 @@ static void drawContainedAudioLocations( Object *obj, void *userData )
//-------------------------------------------------------------------------------------------------
// Draw the location of audio objects in the world
//-------------------------------------------------------------------------------------------------
static void drawAudioLocations( Drawable *draw, void *userData )
void drawAudioLocations( Drawable *draw, void *userData )
{
// draw audio for things that are contained by this
Object *obj = draw->getObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ extern HWND ApplicationHWnd;
//TODO: Fix editor so it actually draws the wave segment instead of line while editing
//Could freeze all the water while editing? Or keep setting elapsed time on current segment.
//Have to make it so seamless merge of segments at final position.
static void TestWaterUpdate(void)
void TestWaterUpdate(void)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestWaterUpdate isn't called in any other translation units, correct fix would be to specify static on its forward declaration rather than remove it here.

Copy link
Author

@zzambers zzambers Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I changed definition to match declaration, but in this case declaration could have been static. I can fix that.

{
static Int doInit=1;
static WaterTracksObj *track=NULL,*track2=NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void MissingTexture::_Deinit()
_MissingTexture=0;
}

static unsigned int missing_image_palette[]={
unsigned int missing_image_palette[]={
0x7F040204,0x7F048AC4,0x7F84829C,0x7FFC0204,0x7F0442AB,0x7FFCFE04,0x7F444244,0x7F0462FC,
0x7F84CEE4,0x7FC4C6CF,0x7F9CA6B2,0x7FC4E6F4,0x7F04FE04,0x7F4C82D4,0x7F2452A1,0x7F0442D4,
0x7F446AB0,0x7FA4A6B6,0x7F2C62C2,0x7FE4E6E9,0x7F646264,0x7F0402FC,0x7FC4D6E1,0x7F44B6DC,
Expand Down Expand Up @@ -196,7 +196,7 @@ static unsigned int missing_image_palette[]={
0x7FACDEEC,0x7F2CA6D4,0x7F0452E4,0x7FD4D6E4,0x7F849ED4,0x7FB4B6CC,0x7F4C7ACC,0x7FACC6FC,
0x7F9496B4,0x7F042AA4,0x7F1C62E4,0x7F74A6EC,0x7FE4EEFC,0x7F1C72FC,0x7FD4DEEC,0x7F2C5ABC};

static unsigned int missing_image_pixels[]={
unsigned int missing_image_pixels[]={
0x03030303,0x03030303,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,
0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,
0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,0xA7A7A7A7,
Expand Down