Skip to content

Commit

Permalink
server: fix build on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed May 22, 2024
1 parent cf1701a commit 4ba42ef
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 16 deletions.
4 changes: 2 additions & 2 deletions dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ void UpdateClientData( edict_t *pEntity )

if (pev->health != pcache->health)
{
int iHealth = max( pev->health, 0 ); // make sure that no negative health values are sent
int iHealth = Q_max( pev->health, 0 ); // make sure that no negative health values are sent

MESSAGE_BEGIN( MSG_ONE, gmsgStats, pEntity );
WRITE_BYTE( STAT_HEALTH );
Expand Down Expand Up @@ -1600,4 +1600,4 @@ int ShouldCollide( edict_t *pentTouched, edict_t *pentOther )
// ED_UpdateEdictFields( pentOther );

return 1;
}
}
4 changes: 3 additions & 1 deletion dlls/dll_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,13 @@ void OnFreeEntPrivateData( edict_s *pEdict )
{
}

#ifdef _WIN32
// Required DLL entry point
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
return TRUE;
}
#endif // _WIN32

void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
{
Expand All @@ -204,4 +206,4 @@ void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t
g_iXashEngineBuildNumber = CVAR_GET_FLOAT( "build" ); // 0 for old builds or GoldSrc
if( g_iXashEngineBuildNumber <= 0 )
g_iXashEngineBuildNumber = (int)CVAR_GET_FLOAT( "buildnum" );
}
}
6 changes: 3 additions & 3 deletions dlls/pr_cmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1597,11 +1597,11 @@ void PF_changepitch( void )
ent = G_EDICT( OFS_PARM0 );
pr_entvars_t *pev = (pr_entvars_t *)GET_PRIVATE( ent );

if( val = GETEDICTFIELDVALUE( ent, pr.eval_idealpitch ))
if(( val = GETEDICTFIELDVALUE( ent, pr.eval_idealpitch )))
ideal_pitch = val->value;
else PR_RunError( "PF_changepitch: .float idealpitch and .float pitch_speed must be defined to use changepitch" );

if( val = GETEDICTFIELDVALUE( ent, pr.eval_pitch_speed ))
if(( val = GETEDICTFIELDVALUE( ent, pr.eval_pitch_speed )))
pitch_speed = val->value;
else PR_RunError( "PF_changepitch: .float idealpitch and .float pitch_speed must be defined to use changepitch" );

Expand Down Expand Up @@ -2084,4 +2084,4 @@ void PR_InstallBuiltins( void )
{
pr.numbuiltins = ARRAYSIZE( prog_builtin );
pr.builtins = prog_builtin;
}
}
13 changes: 7 additions & 6 deletions dlls/pr_edict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,24 +515,25 @@ void ED_Print( edict_t *ed )

if( name[Q_strlen( name ) - 2] == '_' )
continue; // skip _x, _y, _z vars

int *v = (int *)((char *)ed->pvPrivateData + d->ofs * 4);

// if the value is still all 0, skip the field
int type = d->type & ~DEF_SAVEGLOBAL;

for( int j = 0; j < gProgSizes[type]; j++ )

int j;
for( j = 0; j < gProgSizes[type]; j++ )
if( v[j] ) break;

if( j == gProgSizes[type] )
continue;

ALERT( at_console, "%s", name );
int l = Q_strlen( name );
while( l++ < 15 )
ALERT( at_console, " " );

ALERT( at_console, "%s\n", PR_ValueString( d->type, (eval_t *)v ));
ALERT( at_console, "%s\n", PR_ValueString( d->type, (eval_t *)v ));
}
}

Expand Down Expand Up @@ -1107,4 +1108,4 @@ void PR_UnloadProgs( void )
free( pr.source_globals );
free( pr.temp_entvars );
memset( &pr, 0, sizeof( prog_state_t ));
}
}
5 changes: 3 additions & 2 deletions dlls/pr_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ void PR_SendMessage( void )
return;
}

for( int msg_num = 0; msg_num < pr.num_messages; )
int msg_num;
for( msg_num = 0; msg_num < pr.num_messages; )
{
pr_message_t *msg = &pr.messages[msg_num];

Expand Down Expand Up @@ -478,4 +479,4 @@ void PR_SendMessage( void )

// clear the queue
pr.num_messages = 0;
}
}
6 changes: 5 additions & 1 deletion game_shared/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/

#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#endif
#include <stdio.h>
#include <stringlib.h>

typedef unsigned char byte;

/*
============
COM_FileBase
Expand Down Expand Up @@ -312,4 +316,4 @@ unsigned int COM_HashKey( const char *string, unsigned int hashSize )
hashKey = (hashKey + i) * 37 + Q_tolower( string[i] );

return (hashKey % hashSize);
}
}
6 changes: 5 additions & 1 deletion game_shared/stringlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
// stringlib.cpp - safety string routines
//=======================================================================

#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#endif // _WIN32
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include <stringlib.h>

Expand Down Expand Up @@ -578,4 +582,4 @@ char *Q_pretifymem( float value, int digitsafterdecimal )
*o = 0; // terminate

return out;
}
}

0 comments on commit 4ba42ef

Please sign in to comment.