Tremulous Forum
Mods => Modding Center => Topic started by: |MoT|Erfe555 on July 03, 2009, 10:30:22 am
-
I use this forcespec patch: forcespec_svn966.patch on a SVN revision 966.
I patched the SVN, some hunks failed so i use the .rej file to complete the patch.
I copy the C source code of the .rej file in g_admin.c file and when i compile i have this error in msys:
SHLIB_CC src/game/g_admin.c
src/game/g_admin.c:138: `G_admin_forcespec' undeclared here (not in a function)
src/game/g_admin.c:138: initializer element is not constant
src/game/g_admin.c:138: (near initialization for `g_admin_cmds[18].handler')
src/game/g_admin.c:141: initializer element is not constant
src/game/g_admin.c:141: (near initialization for `g_admin_cmds[18]')
src/game/g_admin.c:143: `G_admin_unforcespec' undeclared here (not in a function)
src/game/g_admin.c:143: initializer element is not constant
src/game/g_admin.c:143: (near initialization for `g_admin_cmds[19].handler')
src/game/g_admin.c:146: initializer element is not constant
src/game/g_admin.c:146: (near initialization for `g_admin_cmds[19]')
src/game/g_admin.c:151: initializer element is not constant
src/game/g_admin.c:151: (near initialization for `g_admin_cmds[20]')
src/game/g_admin.c:156: initializer element is not constant
src/game/g_admin.c:156: (near initialization for `g_admin_cmds[21]')
src/game/g_admin.c:162: initializer element is not constant
src/game/g_admin.c:162: (near initialization for `g_admin_cmds[22]')
src/game/g_admin.c:167: initializer element is not constant
src/game/g_admin.c:167: (near initialization for `g_admin_cmds[23]')
src/game/g_admin.c:172: initializer element is not constant
src/game/g_admin.c:172: (near initialization for `g_admin_cmds[24]')
src/game/g_admin.c:177: initializer element is not constant
src/game/g_admin.c:177: (near initialization for `g_admin_cmds[25]')
src/game/g_admin.c:182: initializer element is not constant
src/game/g_admin.c:182: (near initialization for `g_admin_cmds[26]')
src/game/g_admin.c:187: initializer element is not constant
src/game/g_admin.c:187: (near initialization for `g_admin_cmds[27]')
src/game/g_admin.c:192: initializer element is not constant
src/game/g_admin.c:192: (near initialization for `g_admin_cmds[28]')
src/game/g_admin.c:197: initializer element is not constant
src/game/g_admin.c:197: (near initialization for `g_admin_cmds[29]')
src/game/g_admin.c:202: initializer element is not constant
src/game/g_admin.c:202: (near initialization for `g_admin_cmds[30]')
src/game/g_admin.c:207: initializer element is not constant
src/game/g_admin.c:207: (near initialization for `g_admin_cmds[31]')
src/game/g_admin.c:212: initializer element is not constant
src/game/g_admin.c:212: (near initialization for `g_admin_cmds[32]')
src/game/g_admin.c:217: initializer element is not constant
src/game/g_admin.c:217: (near initialization for `g_admin_cmds[33]')
src/game/g_admin.c:222: initializer element is not constant
src/game/g_admin.c:222: (near initialization for `g_admin_cmds[34]')
src/game/g_admin.c:227: initializer element is not constant
src/game/g_admin.c:227: (near initialization for `g_admin_cmds[35]')
src/game/g_admin.c:232: initializer element is not constant
src/game/g_admin.c:232: (near initialization for `g_admin_cmds[36]')
src/game/g_admin.c:237: initializer element is not constant
src/game/g_admin.c:237: (near initialization for `g_admin_cmds[37]')
src/game/g_admin.c:242: initializer element is not constant
src/game/g_admin.c:242: (near initialization for `g_admin_cmds[38]')
src/game/g_admin.c:247: initializer element is not constant
src/game/g_admin.c:247: (near initialization for `g_admin_cmds[39]')
src/game/g_admin.c:252: initializer element is not constant
src/game/g_admin.c:252: (near initialization for `g_admin_cmds[40]')
src/game/g_admin.c:258: initializer element is not constant
src/game/g_admin.c:258: (near initialization for `g_admin_cmds[41]')
src/game/g_admin.c:263: initializer element is not constant
src/game/g_admin.c:263: (near initialization for `g_admin_cmds[42]')
src/game/g_admin.c:268: initializer element is not constant
src/game/g_admin.c:268: (near initialization for `g_admin_cmds[43]')
src/game/g_admin.c:273: initializer element is not constant
src/game/g_admin.c:273: (near initialization for `g_admin_cmds[44]')
src/game/g_admin.c:278: initializer element is not constant
src/game/g_admin.c:278: (near initialization for `g_admin_cmds[45]')
src/game/g_admin.c:284: initializer element is not constant
src/game/g_admin.c:284: (near initialization for `g_admin_cmds[46]')
src/game/g_admin.c:289: initializer element is not constant
src/game/g_admin.c:289: (near initialization for `g_admin_cmds[47]')
src/game/g_admin.c:294: initializer element is not constant
src/game/g_admin.c:294: (near initialization for `g_admin_cmds[48]')
src/game/g_admin.c:299: initializer element is not constant
src/game/g_admin.c:299: (near initialization for `g_admin_cmds[49]')
src/game/g_admin.c:304: initializer element is not constant
src/game/g_admin.c:304: (near initialization for `g_admin_cmds[50]')
src/game/g_admin.c:308: initializer element is not constant
src/game/g_admin.c:308: (near initialization for `g_admin_cmds[51]')
src/game/g_admin.c:315: initializer element is not constant
src/game/g_admin.c:315: (near initialization for `g_admin_cmds[52]')
src/game/g_admin.c:324: initializer element is not constant
src/game/g_admin.c:324: (near initialization for `g_admin_cmds[53]')
src/game/g_admin.c:328: initializer element is not constant
src/game/g_admin.c:328: (near initialization for `g_admin_cmds[54]')
src/game/g_admin.c:333: initializer element is not constant
src/game/g_admin.c:333: (near initialization for `g_admin_cmds[55]')
src/game/g_admin.c:338: initializer element is not constant
src/game/g_admin.c:338: (near initialization for `g_admin_cmds[56]')
src/game/g_admin.c:343: initializer element is not constant
src/game/g_admin.c:343: (near initialization for `g_admin_cmds[57]')
src/game/g_admin.c:348: initializer element is not constant
src/game/g_admin.c:348: (near initialization for `g_admin_cmds[58]')
src/game/g_admin.c:354: initializer element is not constant
src/game/g_admin.c:354: (near initialization for `g_admin_cmds[59]')
src/game/g_admin.c: In function `G_admin_bubble':
src/game/g_admin.c:6018: warning: unused variable `command'
make[2]: *** [build/release-mingw32-x86/base/game/g_admin.o] Error 1
make[2]: Leaving directory `/c/msys/1.0/home/mot_qvm_rej/trunk'
make[1]: *** [targets] Error 2
make[1]: Leaving directory `/c/msys/1.0/home/mot_qvm_rej/trunk'
make: *** [release] Error 2
Where is the error? And what can i do to resolve it?
I tried to found it, but losing.
Pls a little help... :'(
-
I think that the error is the qboolean variable, maybe is a syntax error:
qboolean G_admin_forcespec( gentity_t *ent, int skiparg )
{
int pids[ MAX_CLIENTS ];
char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ];
int minargc;
gentity_t *vic;
minargc = 2 + skiparg;
if( G_SayArgc() < minargc )
{
ADMP( "^3!forcespec: ^7usage: !forcespec [name|slot#]\n" );
return qfalse;
}
G_SayArgv( 1 + skiparg, name, sizeof( name ) );
if( G_ClientNumbersFromString( name, pids ) != 1 )
{
G_MatchOnePlayer( pids, err, sizeof( err ) );
ADMP( va( "^3!forcespec: ^7%s\n", err ) );
return qfalse;
}
vic = &g_entities[ pids[ 0 ] ];
if ( vic->client->pers.specd == qtrue )
{
ADMP( "^3!forcespec: ^7player already forcespeced\n" );
return qfalse;
}
//push them to the spec team
G_ChangeTeam( vic, PTE_NONE );
//tell g_cmds that they cannot join teams
vic->client->pers.specd = qtrue;
//tell the person they cant join teams
CPx( pids[ 0 ], "cp \"^1you can no longer join teams\"" );
//tell everyone that you cant join teams
AP( va( "print \"^3!forcespec: ^7%s^7 has disallowed joining of teams for ^7%s\n\"", ( ent ) ? ent->client->pers.netname : "console", vic->client->pers.netname ) );
//tell g_cmds to save their creds
vic->client->pers.saved = qtrue;
return qtrue;
}
qboolean G_admin_unforcespec( gentity_t *ent, int skiparg )
{
int pids[ MAX_CLIENTS ];
char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ];
int minargc;
gentity_t *vic;
minargc = 2 + skiparg;
if( G_SayArgc() < minargc )
{
ADMP( "^3!unforcespec: ^7usage: !unforcespec [name|slot#]\n" );
return qfalse;
}
G_SayArgv( 1 + skiparg, name, sizeof( name ) );
if( G_ClientNumbersFromString( name, pids ) != 1 )
{
G_MatchOnePlayer( pids, err, sizeof( err ) );
ADMP( va( "^3!unforcespec: ^7%s\n", err ) );
return qfalse;
}
vic = &g_entities[ pids[ 0 ] ];
if ( vic->client->pers.specd == qfalse )
{
ADMP( "^3!unforcespec: ^7player is not forcespeced\n" );
return qfalse;
}
//remove the limitation
vic->client->pers.specd = qfalse;
//tell them it was removed
CPx( pids[ 0 ], "cp \"^1you can now join teams\"" );
//tell everyone that it was removed
AP( va( "print \"^3!unforcespec: ^7%s^7 has allowed joining of teams for ^7%s\n\"", ( ent ) ? ent->client->pers.netname : "console", vic->client->pers.netname ) );
return qtrue;
}
These are the two qboolean variables of the forcespac and unforcespec.
I think that the error is here but i don't know where...
Because the
src/game/g_admin.c:138: `G_admin_forcespec' undeclared here (not in a function)
src/game/g_admin.c:138: initializer element is not constant
src/game/g_admin.c:138: (near initialization for `g_admin_cmds[18].handler')
src/game/g_admin.c:141: initializer element is not constant
src/game/g_admin.c:141: (near initialization for `g_admin_cmds[18]')
src/game/g_admin.c:143: `G_admin_unforcespec' undeclared here (not in a function)
src/game/g_admin.c:143: initializer element is not constant
G_admin_forcespec and G_admin_unforcespec are not declared (for the compiler).
Tell me if i say bullshit.
Help requested! ???
-
Probably your patch is missing the prototypes for these functions. In the patch tracker there is a comment by spidey that explains how to fix it:
i don't know if he updated the patch
but the one i have is missing 2 lines
in g_admin.h, here they are
qboolean G_admin_forcespec( gentity_t *ent, int skiparg );
qboolean G_admin_unforcespec( gentity_t *ent, int skiparg );
put them under // ! command functions
-
Gimhael FOR PRESIDENT!
;D ;D ;D
-
Another problem i patched the SVN 966 with the votelog_svn35.patch i take some .rej i copy the source code into various files but when i compiled i had an error:
src/game/g_main.c: In function `CheckVote':
src/game/g_main.c:2475: `result' undeclared (first use in this function)
src/game/g_main.c:2475: (Each undeclared identifier is reported only once
src/game/g_main.c:2475: for each function it appears in.)
src/game/g_main.c: In function `CheckTeamVote':
src/game/g_main.c:2542: `result' undeclared (first use in this function)
src/game/g_main.c:2542: `voteYesPercent' undeclared (first use in this function)
Can someone help me?
Or the SUPER GIMHAEL is still here to help me? lol
-
Could you post that piece of the code ?
-
Here is it:
/*
==================
CheckTeamVote
==================
*/
void CheckTeamVote( int team )
{
int cs_offset;
if ( team == PTE_HUMANS )
cs_offset = 0;
else if ( team == PTE_ALIENS )
cs_offset = 1;
else
return;
if( !level.teamVoteTime[ cs_offset ] )
return;
if( level.time - level.teamVoteTime[ cs_offset ] >= VOTE_TIME )
{
if( level.teamVoteYes[ cs_offset ] > level.teamVoteNo[ cs_offset ] && level.teamVoteYes[ cs_offset ] >= 2 )
{
// execute the command, then remove the vote
trap_SendServerCommand( -1, va("print \"Team vote passed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) );
trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.teamVoteString[ cs_offset ] ) );
}
else
{
trap_SendServerCommand( -1, va("print \"Team vote failed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) );
G_LogPrintf( "Teamvote: Team vote failed (%d - %d)\n", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] );
}
}
else
{
if( level.teamVoteYes[ cs_offset ] > level.numteamVotingClients[ cs_offset ] / 2 )
{
// execute the command, then remove the vote
trap_SendServerCommand( -1, va("print \"Team vote passed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) );
G_LogPrintf( "Teamvote: Team vote passed (%d - %d)\n", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] );
//
trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.teamVoteString[ cs_offset ] ) );
}
else if( level.teamVoteNo[ cs_offset ] >= level.numteamVotingClients[ cs_offset ] / 2 )
{
// same behavior as a timeout
trap_SendServerCommand( -1, va("print \"Team vote failed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) );
G_LogPrintf( "Teamvote: Team vote failed (%d - %d)\n", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] );
}
else
{
// still waiting for a majority
return;
}
}
G_admin_adminlog_log( NULL, "teamvote",
va( "%s^7 (^2Y:%d^7-^1N:%d^7, %d percent)",
result, level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ], voteYesPercent ),
0, ( strstr( result, "pass" ) != NULL ) );
level.teamVoteTime[ cs_offset ] = 0;
trap_SetConfigstring( CS_TEAMVOTE_TIME + cs_offset, "" );
trap_SetConfigstring( CS_TEAMVOTE_STRING + cs_offset, "" );
}
Or maybe is this the right string but i don't know...
/*
==================
CheckMsgTimer
==================
*/
void CheckMsgTimer( void )
{
if( !g_msgTime.integer )
return;
if( level.time - level.lastMsgTime < abs( g_msgTime.integer ) * 60000 )
return;
// negative settings only print once per map
if( ( level.lastMsgTime ) && g_msgTime.integer < 0 )
return;
level.lastMsgTime = level.time;
if( g_msg.string[0] )
{
char buffer[ MAX_STRING_CHARS ];
Q_strncpyz( buffer, g_msg.string, sizeof( buffer ) );
G_ParseEscapedString( buffer );
trap_SendServerCommand( -1, va( "cp \"%s\"", buffer ) );
trap_SendServerCommand( -1, va( "print \"%s\n\"", buffer ) );
}
}
/*
==================
CheckCountdown
==================
If you want i can post all g_main.c in pastebin or somthing.
-
That patch seems to be based on the p-g-qvm, which is a bit different here than the default qvm. Try the following (untested):
/*
==================
CheckTeamVote
==================
*/
void CheckTeamVote( int team )
{
int cs_offset;
char *result;
if ( team == PTE_HUMANS )
cs_offset = 0;
else if ( team == PTE_ALIENS )
cs_offset = 1;
else
return;
if( !level.teamVoteTime[ cs_offset ] )
return;
if( level.time - level.teamVoteTime[ cs_offset ] >= VOTE_TIME )
{
if( level.teamVoteYes[ cs_offset ] > level.teamVoteNo[ cs_offset ] && level.teamVoteYes[ cs_offset ] >= 2 )
{
// execute the command, then remove the vote
trap_SendServerCommand( -1, va("print \"Team vote passed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) );
trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.teamVoteString[ cs_offset ] ) );
result = "passed";
}
else
{
trap_SendServerCommand( -1, va("print \"Team vote failed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) );
G_LogPrintf( "Teamvote: Team vote failed (%d - %d)\n", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] );
result = "failed";
}
}
else
{
if( level.teamVoteYes[ cs_offset ] > level.numteamVotingClients[ cs_offset ] / 2 )
{
// execute the command, then remove the vote
trap_SendServerCommand( -1, va("print \"Team vote passed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) );
G_LogPrintf( "Teamvote: Team vote passed (%d - %d)\n", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] );
//
trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.teamVoteString[ cs_offset ] ) );
result = "passed";
}
else if( level.teamVoteNo[ cs_offset ] >= level.numteamVotingClients[ cs_offset ] / 2 )
{
// same behavior as a timeout
trap_SendServerCommand( -1, va("print \"Team vote failed (%d - %d)\n\"", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] ) );
G_LogPrintf( "Teamvote: Team vote failed (%d - %d)\n", level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ] );
result = "failed";
}
else
{
// still waiting for a majority
return;
}
}
G_admin_adminlog_log( NULL, "teamvote",
va( "%s^7 (^2Y:%d^7-^1N:%d^7, %d percent)",
result, level.teamVoteYes[ cs_offset ], level.teamVoteNo[ cs_offset ], voteYesPercent ),
0, ( strstr( result, "pass" ) != NULL ) );
level.teamVoteTime[ cs_offset ] = 0;
trap_SetConfigstring( CS_TEAMVOTE_TIME + cs_offset, "" );
trap_SetConfigstring( CS_TEAMVOTE_STRING + cs_offset, "" );
}
-
The error now is partially resolved but i still have an error, this:
SHLIB_CC src/game/g_main.c
src/game/g_main.c: In function `CheckVote':
src/game/g_main.c:2475: `result' undeclared (first use in this function)
src/game/g_main.c:2475: (Each undeclared identifier is reported only once
src/game/g_main.c:2475: for each function it appears in.)
src/game/g_main.c: In function `CheckTeamVote':
src/game/g_main.c:2546: `voteYesPercent' undeclared (first use in this function)
make[2]: *** [build/release-mingw32-x86/base/game/g_main.o] Error 1
make[2]: Leaving directory `/c/msys/1.0/home/mot_qvm_rej/trunk'
make[1]: *** [targets] Error 2
make[1]: Leaving directory `/c/msys/1.0/home/mot_qvm_rej/trunk'
make: *** [release] Error 2
How can i resolve this last part?
-
You could try to take the CheckVote and CheckTeamVote functions directly from p-g-qvm (http://code.google.com/p/p-g-qvm/source/browse/trunk/src/game/g_main.c#2452).
But this may fail because other variables are missing.
-
And so what can i do? I do a fusion of Invasion2.1-L5.5 with p-g qvm...is really difficult...
-
I try to apply the code of p-g qvm but fail for a little!
The error is very short, here it is:
SHLIB_CC src/game/g_main.c
src/game/g_main.c: In function `CheckVote':
src/game/g_main.c:2383: structure has no member named `votePercentToPass'
src/game/g_main.c: In function `CheckTeamVote':
src/game/g_main.c:2491: structure has no member named `teamVotePercentToPass'
make[2]: *** [build/release-mingw32-x86/base/game/g_main.o] Error 1
make[2]: Leaving directory `/c/msys/1.0/home/mot_qvm_rej/trunk'
make[1]: *** [targets] Error 2
make[1]: Leaving directory `/c/msys/1.0/home/mot_qvm_rej/trunk'
make: *** [release] Error 2
Maybe you can correct it...
-
A quick fix would be to replace
int votePercentToPass=level.votePercentToPass;
by
int votePercentToPass=50;
and
votePercentToPass = level.teamVotePercentToPass[ cs_offset ];
by
votePercentToPass = 50;
-
Now is perfect problem solved!!!!
Gimhael when this qvm will be release i put you into credits.
Thx! ;D
-
Ah...gim i need u another time.
An error occured in immunity patch:
src/game/g_admin.c: In function `G_admin_immunity':
src/game/g_admin.c:6858: `ADMF_BANIMMUNITY' undeclared (first use in this function)
src/game/g_admin.c:6858: (Each undeclared identifier is reported only once
src/game/g_admin.c:6858: for each function it appears in.)
make[2]: *** [build/release-mingw32-x86/base/game/g_admin.o] Error 1
make[2]: Leaving directory `/c/msys/1.0/home/mot_qvm_rej/trunk'
make[1]: *** [targets] Error 2
make[1]: Leaving directory `/c/msys/1.0/home/mot_qvm_rej/trunk'
make: *** [release] Error 2
I think that the error is here:
if( *action != '+' && *action != '-' )
{
ADMP( va( "^3immunity:^7 ban immunity for %s^7 is %s, prepend + or - to the slot number to change.\n",
adminname,
( strchr( g_admin_admins[ id ]->flags, ADMF_BANIMMUNITY ) != NULL ) ? "on" : "off" ) );
return qfalse;
}
result = G_admin_user_flag( id, ADMF_BANIMMUNITY, qtrue, ( *action != '+' ) );
if( result )
{
ADMP( va( "^3!immunity: ^7an error occured setting flag, %s\n", result ) );
return qfalse;
}
But i don't know (as usual ::) )how to resolve it.
Thx for help.
-
Check that you have the line
#define ADMF_BANIMMUNITY '&'
in your src/game/g_admin.h file, it is probably missing.
-
Thx as usual gim! :D
Listen maybe is better if u give me your msn/skype contact on PM...
-
Another error with tklog patch! I become crazy now...
Fusing two qvms is an hard work...
src/game/g_admin.c: In function `G_admin_tklog':
src/game/g_admin.c:3322: warning: implicit declaration of function `G_SanitiseName'
The error is probably here:
G_SanitiseName( g_admin_tklog[ index ]->name, n1 );
if( strstr( n1, search_name ) )
match = qtrue;
And listen gim, i don't want to use too much for these problem the forum, maybe isn't the better think...if u want contact me with PM and tell me your MSN/skype contect, or answer here if u like.