mirror of
https://github.com/UberGames/RPG-X2-rpgxEF.git
synced 2024-11-15 00:51:42 +00:00
Sync with rpgxef-repo
This commit is contained in:
parent
c351237659
commit
b0e877559f
12 changed files with 190 additions and 270 deletions
|
@ -900,12 +900,6 @@ static void CG_ServerCommand( void ) {
|
|||
return;
|
||||
}
|
||||
|
||||
/* TODO remove me? */
|
||||
if(!strcmp(cmd, "sqlkey")) {
|
||||
trap_SendClientCommand(va("sqlkey %s", CG_Argv(1)));
|
||||
return;
|
||||
}
|
||||
|
||||
CG_Printf( "Unknown client game command: %s\n", cmd );
|
||||
}
|
||||
|
||||
|
|
149
game/g_active.c
149
game/g_active.c
|
@ -531,149 +531,28 @@ currently in it....
|
|||
==================
|
||||
*/
|
||||
|
||||
//First off let's store the CVAR data in a local array.
|
||||
//This'll let us perform for loop operations on it.
|
||||
//Sigh, I wish I knew a quick way to convert variable names
|
||||
//to strings. Then this wouldn't be necessary O_o
|
||||
static char *rpg_message[] = { rpg_message1.string,
|
||||
rpg_message2.string,
|
||||
rpg_message3.string,
|
||||
rpg_message4.string,
|
||||
rpg_message5.string,
|
||||
rpg_message6.string,
|
||||
rpg_message7.string,
|
||||
rpg_message8.string,
|
||||
rpg_message9.string,
|
||||
rpg_message10.string };
|
||||
list_iter_p iterTimedMessages;
|
||||
|
||||
/**
|
||||
* \author Ubergames
|
||||
*/
|
||||
char *TimedMessage( void ){
|
||||
int i = lastTimedMessage;
|
||||
char* message;
|
||||
|
||||
while ( 1 ) { //Okay, start from the number we want, and loop thru all of them
|
||||
if ( i >= 11 ) { //reset loop
|
||||
i = 1;
|
||||
}
|
||||
|
||||
if ( strlen( rpg_message[i-1] ) >= 1 ) { //i-1 coz arrays start @ 0, but we started @ 1
|
||||
lastTimedMessage = i;
|
||||
|
||||
return rpg_message[i-1]; //return the string
|
||||
}
|
||||
|
||||
if ( i == lastTimedMessage - 1 ) { //okay, we've obviously gone thru the whole loop and come up with nothing. So screw it.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//TiM: Cheap hack to stop it freezing if string0 is empty. THe above condition don't work here
|
||||
if ( ((i == 1 && lastTimedMessage == 1) && !strlen( rpg_message[i-1] )) ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i++;
|
||||
if(!level.timedMessages->length) {
|
||||
return "^1RPG-X ERROR: No messages to display";
|
||||
}
|
||||
|
||||
//TiM: Hopefully it'll never reach here, but we have this anyway to shut the compiler up
|
||||
return "^1RPG-X ERROR: No messages to display";
|
||||
|
||||
|
||||
/*
|
||||
switch( Msg ){
|
||||
case 1:
|
||||
if(strlen(rpg_message1.string) >= 1){
|
||||
lastTimedMessage = 1;
|
||||
return rpg_message1.string;
|
||||
}else{
|
||||
return TimedMessage( 2 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if(strlen(rpg_message2.string) >= 1){
|
||||
lastTimedMessage = 2;
|
||||
return rpg_message2.string;
|
||||
}else{
|
||||
return TimedMessage( 3 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if(strlen(rpg_message3.string) >= 1){
|
||||
lastTimedMessage = 3;
|
||||
return rpg_message3.string;
|
||||
}else{
|
||||
return TimedMessage( 4 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if(strlen(rpg_message4.string) >= 1){
|
||||
lastTimedMessage = 4;
|
||||
return rpg_message4.string;
|
||||
}else{
|
||||
return TimedMessage( 5 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if(strlen(rpg_message5.string) >= 1){
|
||||
lastTimedMessage = 5;
|
||||
return rpg_message5.string;
|
||||
}else{
|
||||
return TimedMessage( 6 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if(strlen(rpg_message6.string) >= 1){
|
||||
lastTimedMessage = 6;
|
||||
return rpg_message6.string;
|
||||
}else{
|
||||
return TimedMessage( 7 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 7:
|
||||
if(strlen(rpg_message7.string) >= 1){
|
||||
lastTimedMessage = 7;
|
||||
return rpg_message7.string;
|
||||
}else{
|
||||
return TimedMessage( 8 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if(strlen(rpg_message8.string) >= 1){
|
||||
lastTimedMessage = 8;
|
||||
return rpg_message8.string;
|
||||
}else{
|
||||
return TimedMessage( 9 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
if(strlen(rpg_message9.string) >= 1){
|
||||
lastTimedMessage = 9;
|
||||
return rpg_message9.string;
|
||||
}else{
|
||||
return TimedMessage( 10 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
if(strlen(rpg_message10.string) >= 1){
|
||||
lastTimedMessage = 0; //Start over again
|
||||
return rpg_message10.string;
|
||||
}else{
|
||||
return TimedMessage( 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if(iterTimedMessages == NULL) {
|
||||
iterTimedMessages = list_iterator(level.timedMessages, FRONT);
|
||||
if(iterTimedMessages == NULL) { // something went wrong
|
||||
return "^1RPG-X ERROR: No messages to display";
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
message = (char *)list_cycl_next(iterTimedMessages);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1833,13 +1833,6 @@ void ClientBegin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qbool
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/* TODO remove me? */
|
||||
if(sql_use.integer) {
|
||||
int key = (byte)irandom(4096, 65535);
|
||||
ent->client->sqlkey = (byte)key;
|
||||
trap_SendServerCommand(ent-g_entities, va("sqlkey \"%i\"", key));
|
||||
}
|
||||
}
|
||||
|
||||
// WEAPONS - PHENIX1
|
||||
|
|
|
@ -594,7 +594,6 @@ struct gclient_s {
|
|||
// for sql
|
||||
char *userName; //!< username (not player name) in the sql database
|
||||
int uid; //!< uiser id of the player in the sql database
|
||||
byte sqlkey; //!< random key used to make transmission of the username and password from the ui at least a bit safer TODO remove me?
|
||||
|
||||
// CCAM
|
||||
vec3_t origViewAngles;
|
||||
|
@ -697,7 +696,7 @@ typedef struct {
|
|||
// selft destruct safezones
|
||||
list_p selfdestructSafeZones;
|
||||
list_p locations;
|
||||
|
||||
list_p timedMessages;
|
||||
} level_locals_t;
|
||||
|
||||
|
||||
|
@ -1391,16 +1390,6 @@ extern vmCvar_t rpg_timedmessagetime;
|
|||
/*
|
||||
* TODO: save cvars by storing timed messages in a list?
|
||||
*/
|
||||
extern vmCvar_t rpg_message1;
|
||||
extern vmCvar_t rpg_message2;
|
||||
extern vmCvar_t rpg_message3;
|
||||
extern vmCvar_t rpg_message4;
|
||||
extern vmCvar_t rpg_message5;
|
||||
extern vmCvar_t rpg_message6;
|
||||
extern vmCvar_t rpg_message7;
|
||||
extern vmCvar_t rpg_message8;
|
||||
extern vmCvar_t rpg_message9;
|
||||
extern vmCvar_t rpg_message10;
|
||||
extern vmCvar_t rpg_forcekillradius;
|
||||
extern vmCvar_t rpg_forcekillradiuswaittime;
|
||||
|
||||
|
@ -1520,16 +1509,6 @@ extern vmCvar_t rpg_adminVoteOverride;
|
|||
|
||||
// server change entity
|
||||
extern vmCvar_t rpg_serverchange;
|
||||
/*
|
||||
* TODO: move serverchange configuration to external
|
||||
* config nad store info in a list rather than cvars
|
||||
*/
|
||||
extern vmCvar_t rpg_server1;
|
||||
extern vmCvar_t rpg_server2;
|
||||
extern vmCvar_t rpg_server3;
|
||||
extern vmCvar_t rpg_server4;
|
||||
extern vmCvar_t rpg_server5;
|
||||
extern vmCvar_t rpg_server6;
|
||||
|
||||
// SP level change
|
||||
extern vmCvar_t rpg_allowSPLevelChange;
|
||||
|
|
|
@ -112,16 +112,6 @@ vmCvar_t rpg_imoddmg;
|
|||
vmCvar_t rpg_noweapons; //!< Can be used to disable all weapons.
|
||||
vmCvar_t rpg_welcomemessage; //!< Welcome message displayed when a player joins the server.
|
||||
vmCvar_t rpg_timedmessagetime; //!< Delay between timed mesagges
|
||||
vmCvar_t rpg_message1; //!< Timed message
|
||||
vmCvar_t rpg_message2; //!< Timed message
|
||||
vmCvar_t rpg_message3; //!< Timed message
|
||||
vmCvar_t rpg_message4; //!< Timed message
|
||||
vmCvar_t rpg_message5; //!< Timed message
|
||||
vmCvar_t rpg_message6; //!< Timed message
|
||||
vmCvar_t rpg_message7; //!< Timed message
|
||||
vmCvar_t rpg_message8; //!< Timed message
|
||||
vmCvar_t rpg_message9; //!< Timed message
|
||||
vmCvar_t rpg_message10; //!< Timed message
|
||||
vmCvar_t rpg_forcekillradius; //!< Specifies whether the forcekillradius command is avaible.
|
||||
vmCvar_t rpg_forcekillradiuswaittime; //!< forcekillradius delay
|
||||
vmCvar_t rpg_noclipspectating; //!< Specifies whether spectators uses clipping.
|
||||
|
@ -295,12 +285,6 @@ vmCvar_t rpg_adminVoteOverride;
|
|||
// server change
|
||||
//! Enables/disables target_serverchange
|
||||
vmCvar_t rpg_serverchange;
|
||||
vmCvar_t rpg_server1;
|
||||
vmCvar_t rpg_server2;
|
||||
vmCvar_t rpg_server3;
|
||||
vmCvar_t rpg_server4;
|
||||
vmCvar_t rpg_server5;
|
||||
vmCvar_t rpg_server6;
|
||||
|
||||
// SP level change
|
||||
//! Allow target_levelchange to change the current level?
|
||||
|
@ -428,16 +412,6 @@ static cvarTable_t gameCvarTable[] = {
|
|||
{ &rpg_noweapons, "rpg_noWeapons", "0", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse},
|
||||
{ &rpg_welcomemessage, "rpg_welcomeMessage", "Welcome to the RPG-X Mod", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_timedmessagetime, "rpg_timedMessageTime", "5", CVAR_ARCHIVE, 0, qfalse }, //TiM : LATCH Not necessary here.
|
||||
{ &rpg_message1, "rpg_message1", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_message2, "rpg_message2", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_message3, "rpg_message3", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_message4, "rpg_message4", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_message5, "rpg_message5", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_message6, "rpg_message6", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_message7, "rpg_message7", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_message8, "rpg_message8", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_message9, "rpg_message9", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_message10, "rpg_message10", "", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_forcekillradius, "rpg_forceKillRadius", "0", CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue},
|
||||
{ &rpg_forcekillradiuswaittime, "rpg_forceKillRadiusWaitTime", "45000", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse},
|
||||
{ &rpg_chatarearange, "rpg_chatAreaRange", "200", CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue}, //Not latched (ie doesnt need server restart)
|
||||
|
@ -529,12 +503,6 @@ static cvarTable_t gameCvarTable[] = {
|
|||
{ &rpg_RemodulationDelay, "rpg_RemodulationDelay", "5000", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_adminVoteOverride, "rpg_adminVoteOverride", "1", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_serverchange, "rpg_serverchange", "0", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_server1, "rpg_server1", "0", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_server2, "rpg_server2", "0", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_server3, "rpg_server3", "0", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_server4, "rpg_server4", "0", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_server5, "rpg_server5", "0", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_server6, "rpg_server6", "0", CVAR_ARCHIVE, 0, qfalse },
|
||||
{ &rpg_allowSPLevelChange, "rpg_allowSPLevelChange", "1", CVAR_ARCHIVE | CVAR_LATCH, 0, qfalse },
|
||||
|
||||
{ &rpg_spEasterEggs, "rpg_spEasterEggs", "0", CVAR_ARCHIVE, 0, qfalse },
|
||||
|
@ -978,9 +946,61 @@ static qboolean G_LoadClassData( char* fileName )
|
|||
void BG_LanguageFilename(char *baseName,char *baseExtension,char *finalName);
|
||||
void SP_target_location (gentity_t *ent);
|
||||
|
||||
holoData_t holoData;
|
||||
static void G_LoadTimedMessages(void) {
|
||||
fileHandle_t f;
|
||||
char* buffer;
|
||||
char* ptr;
|
||||
char* message;
|
||||
int len;
|
||||
int i, n;
|
||||
|
||||
void G_LoadHolodeckFile(void) {
|
||||
len = trap_FS_FOpenFile("timedmessages.cfg", &f, FS_READ);
|
||||
if(!len) return;
|
||||
|
||||
buffer = (char *)malloc(sizeof(char) * (len+1));
|
||||
if(!buffer) {
|
||||
G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i byte.\n", (len+1) * sizeof(char) );
|
||||
trap_FS_FCloseFile(f);
|
||||
return;
|
||||
}
|
||||
memset(buffer, 0, len+1);
|
||||
|
||||
level.timedMessages = create_list();
|
||||
if(!level.timedMessages) {
|
||||
trap_FS_FCloseFile(f);
|
||||
free(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
trap_FS_Read(buffer, len, f);
|
||||
ptr = buffer;
|
||||
for(i = 0; i < 10; i++) {
|
||||
for(n = 0; ptr[n] != ';' && ptr[n] != 0; n++);
|
||||
if(ptr[n] == 0) break;
|
||||
message = (char *)malloc(sizeof(char)*(n+1));
|
||||
if(!message) {
|
||||
G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i byte.\n", (n+1) * sizeof(char) );
|
||||
trap_FS_FCloseFile(f);
|
||||
free(buffer);
|
||||
if(level.timedMessages != NULL) {
|
||||
destroy_list(level.timedMessages);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
memset(message, 0, sizeof(message));
|
||||
strncpy(message, ptr, n);
|
||||
list_add(level.timedMessages, message, strlen(message));
|
||||
|
||||
ptr += strlen(message)+1;
|
||||
}
|
||||
|
||||
trap_FS_FCloseFile(f);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
holoData_t holoData;
|
||||
static void G_LoadHolodeckFile(void) {
|
||||
char fileRoute[MAX_QPATH];
|
||||
char mapRoute[MAX_QPATH];
|
||||
char *info;
|
||||
|
@ -1872,6 +1892,9 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
|
|||
//GSIO: load holodeck file if avaible
|
||||
G_LoadHolodeckFile();
|
||||
|
||||
//GSIO: load timed message
|
||||
G_LoadTimedMessages();
|
||||
|
||||
// general initialization
|
||||
G_FindTeams();
|
||||
|
||||
|
@ -1989,6 +2012,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
|
|||
|
||||
}
|
||||
|
||||
extern list_iter_p iterTimedMessages; /* list iterator for timed messages */
|
||||
/*
|
||||
=================
|
||||
G_ShutdownGame
|
||||
|
@ -2023,6 +2047,12 @@ void G_ShutdownGame( int restart ) {
|
|||
destroy_list(level.selfdestructSafeZones);
|
||||
}
|
||||
|
||||
if(level.timedMessages != NULL) {
|
||||
destroy_list(level.timedMessages);
|
||||
}
|
||||
|
||||
destroy_iterator(iterTimedMessages);
|
||||
|
||||
#ifdef SQL
|
||||
G_Sql_Shutdown();
|
||||
#endif
|
||||
|
|
|
@ -2411,6 +2411,8 @@ Can be toggled by an usable if the usable has NO_ACTIVATOR spawnflag.
|
|||
|
||||
"serverNum" server to connect to (rpg_server<serverNum> cvar)
|
||||
*/
|
||||
extern srvChangeData_t srvChangeData;
|
||||
|
||||
void target_serverchange_think(gentity_t *ent) {
|
||||
if(!ent->touched || !ent->touched->client) return;
|
||||
trap_SendServerCommand(ent->touched->client->ps.clientNum, va("cg_connect \"%s\"\n", ent->targetname2));
|
||||
|
@ -2418,8 +2420,6 @@ void target_serverchange_think(gentity_t *ent) {
|
|||
}
|
||||
|
||||
void target_serverchange_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
|
||||
char *server;
|
||||
|
||||
if(!activator || !activator->client) {
|
||||
ent->s.time2 = !ent->s.time2;
|
||||
return;
|
||||
|
@ -2431,33 +2431,12 @@ void target_serverchange_use(gentity_t *ent, gentity_t *other, gentity_t *activa
|
|||
activator->flags ^= FL_LOCKED;
|
||||
|
||||
if(rpg_serverchange.integer && ent->s.time2) {
|
||||
switch(ent->count) {
|
||||
default:
|
||||
case 1:
|
||||
server = rpg_server1.string;
|
||||
break;
|
||||
case 2:
|
||||
server = rpg_server2.string;
|
||||
break;
|
||||
case 3:
|
||||
server = rpg_server3.string;
|
||||
break;
|
||||
case 4:
|
||||
server = rpg_server4.string;
|
||||
break;
|
||||
case 5:
|
||||
server = rpg_server5.string;
|
||||
break;
|
||||
case 6:
|
||||
server = rpg_server6.string;
|
||||
break;
|
||||
}
|
||||
ent->think = target_serverchange_think;
|
||||
ent->nextthink = level.time + 3000;
|
||||
TransDat[ent->client->ps.clientNum].beamTime = level.time + 8000;
|
||||
activator->client->ps.powerups[PW_BEAM_OUT] = level.time + 8000;
|
||||
ent->touched = activator;
|
||||
ent->targetname2 = server;
|
||||
ent->targetname2 = srvChangeData.ip[ent->count];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2636,9 +2615,7 @@ static int target_selfdestruct_get_unsafe_players(gentity_t *ents[MAX_GENTITIES]
|
|||
}
|
||||
}
|
||||
|
||||
if(iter != NULL) {
|
||||
free(iter);
|
||||
}
|
||||
destroy_iterator(iter);
|
||||
return cur2;
|
||||
}
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ gentity_t *G_PickTarget (char *targetname)
|
|||
*/
|
||||
void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) {
|
||||
gentity_t *t;
|
||||
list_iter_p szIter;
|
||||
list_iter_p szIter = NULL;
|
||||
safeZone_t *sz;
|
||||
|
||||
if ( !ent ) {
|
||||
|
@ -517,6 +517,8 @@ void G_UseTargets2( gentity_t *ent, gentity_t *activator, char *target ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
destroy_iterator(szIter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
37
game/list.c
37
game/list.c
|
@ -42,6 +42,7 @@ list_iter_p list_iterator(list_p list, char init){
|
|||
iter->current = list->last;
|
||||
}
|
||||
else return NULL;
|
||||
iter->list = list;
|
||||
iter->started = 0;
|
||||
return iter;
|
||||
}
|
||||
|
@ -84,6 +85,21 @@ void* list_next(list_iter_p iter){
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void* list_cycl_next(list_iter_p iter){
|
||||
if(!iter->started&&iter->current!=NULL){
|
||||
iter->started=1;
|
||||
return iter->current->data;
|
||||
}
|
||||
if(iter->current!=NULL){
|
||||
iter->current = iter->current->next;
|
||||
if(iter->current == NULL) {
|
||||
iter->current = iter->list->first;
|
||||
}
|
||||
return list_current(iter);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* list_prev(list_iter_p iter){
|
||||
if(!iter->started&&iter->current!=NULL){
|
||||
iter->started=1;
|
||||
|
@ -96,6 +112,21 @@ void* list_prev(list_iter_p iter){
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void* list_cycl_prev(list_iter_p iter){
|
||||
if(!iter->started&&iter->current!=NULL){
|
||||
iter->started=1;
|
||||
return iter->current->data;
|
||||
}
|
||||
if(iter->current!=NULL){
|
||||
iter->current = iter->current->prev;
|
||||
if(iter->current == NULL) {
|
||||
iter->current = iter->list->last;
|
||||
}
|
||||
return list_current(iter);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* list_first(list_p list){
|
||||
return list->first->data;
|
||||
}
|
||||
|
@ -144,4 +175,10 @@ void destroy_list(list_p list){
|
|||
cur = next;
|
||||
}
|
||||
free(list);
|
||||
}
|
||||
|
||||
void destroy_iterator(list_iter_p iter) {
|
||||
if(iter == NULL) return;
|
||||
|
||||
free(iter);
|
||||
}
|
90
game/list.h
90
game/list.h
|
@ -46,53 +46,95 @@ struct list{
|
|||
typedef struct list * list_p;
|
||||
|
||||
struct list_iter{
|
||||
list_p list;
|
||||
lnode_p current;
|
||||
char started;
|
||||
};
|
||||
|
||||
typedef struct list_iter * list_iter_p;
|
||||
|
||||
/* Create a linked_list object. This pointer is created on the heap and must be
|
||||
cleared with a call to destroy_list to avoid memory leaks */
|
||||
/**
|
||||
* Create a linked_list object. This pointer is created on the heap and must be
|
||||
* cleared with a call to destroy_list to avoid memory leaks
|
||||
*/
|
||||
list_p create_list(void);
|
||||
|
||||
/* Create a list_iter object for the linked_list list. The flag init can be
|
||||
either FRONT or BACK and indicates whether to start the iterator from the first
|
||||
or last item in the list */
|
||||
/**
|
||||
* Create a list_iter object for the linked_list list. The flag init can be
|
||||
* either FRONT or BACK and indicates whether to start the iterator from the first
|
||||
* or last item in the list
|
||||
*/
|
||||
list_iter_p list_iterator(list_p list, char init);
|
||||
|
||||
/* Add an item with the given value and size to the back of the list.
|
||||
The data is copied by value, so the original pointer must be freed if it
|
||||
was allocated on the heap. */
|
||||
/**
|
||||
* Add an item with the given value and size to the back of the list.
|
||||
* The data is copied by value, so the original pointer must be freed if it
|
||||
* was allocated on the heap.
|
||||
*/
|
||||
void list_add(list_p list, void* data, int size);
|
||||
|
||||
/* Gets the data stored in the first item of the list or NULL if the list is empty */
|
||||
/**
|
||||
* Gets the data stored in the first item of the list or NULL if the list is empty
|
||||
*/
|
||||
void* list_first(list_p list);
|
||||
/* Gets the data stored in the last item of the list or NULL if the list is empty */
|
||||
/**
|
||||
* Gets the data stored in the last item of the list or NULL if the list is empty
|
||||
*/
|
||||
void* list_last(list_p list);
|
||||
|
||||
/* Removes the last item in the list (LIFO order) and returns the data stored
|
||||
there. The data returned must be freed later in order to remain memory safe. */
|
||||
/**
|
||||
* Removes the last item in the list (LIFO order) and returns the data stored
|
||||
* there. The data returned must be freed later in order to remain memory safe.
|
||||
*/
|
||||
void* list_pop(list_p list);
|
||||
/* Removes the first item in the list (FIFO order) and returns the data stored
|
||||
there. The data return must be freed later in order to remain memory safe. */
|
||||
/**
|
||||
* Removes the first item in the list (FIFO order) and returns the data stored
|
||||
* there. The data return must be freed later in order to remain memory safe.
|
||||
*/
|
||||
void* list_poll(list_p list);
|
||||
/* Convenience function for completely destroying an item in the list. If the end
|
||||
flag is FRONT, an item will be polled from the front of the list and its data
|
||||
freed. If the end flag is set to BACK, an item will be popped off the end of
|
||||
the list and the data freed. */
|
||||
/**
|
||||
* Convenience function for completely destroying an item in the list. If the end
|
||||
* flag is FRONT, an item will be polled from the front of the list and its data
|
||||
* freed. If the end flag is set to BACK, an item will be popped off the end of
|
||||
* the list and the data freed.
|
||||
*/
|
||||
void list_remove(list_p list, char end);
|
||||
|
||||
/* Completely free the data associated with the list. */
|
||||
/**
|
||||
* Completely free the data associated with the list.
|
||||
*/
|
||||
void destroy_list(list_p list);
|
||||
|
||||
/* Return the data held by the current item pointed to by the iterator */
|
||||
/**
|
||||
* Destroy a list iterator if allocated.
|
||||
*/
|
||||
void destroy_iterator(list_iter_p iter);
|
||||
|
||||
/**
|
||||
* Return the data held by the current item pointed to by the iterator
|
||||
*/
|
||||
void* list_current(list_iter_p list);
|
||||
/* Advances the iterator to the next item in the list and returns the data
|
||||
stored there. */
|
||||
/**
|
||||
* Advances the iterator to the next item in the list and returns the data
|
||||
* stored there.
|
||||
*/
|
||||
void* list_next(list_iter_p list);
|
||||
/* Advances the iterator to the previous item in the list and returns the data
|
||||
stored there. */
|
||||
/**
|
||||
* Advances the iterator to the previous item in the list and returns the data
|
||||
* stored there.
|
||||
*/
|
||||
void* list_prev(list_iter_p list);
|
||||
/**
|
||||
* Advances the iterator to the next item in the list and returns the data
|
||||
* stored there. If the end of the list is reached it continues with the first
|
||||
* element of the list.
|
||||
*/
|
||||
void* list_cycl_next(list_iter_p list);
|
||||
/**
|
||||
* Advances the iterator to the previous item in the list and returns the data
|
||||
* stored there. If the start of the list is reached it continues with the last
|
||||
* element of the list.
|
||||
*/
|
||||
void* list_cycl_prev(list_iter_p list);
|
||||
|
||||
#endif
|
|
@ -58,12 +58,7 @@ static int Entity_MMBRefit(lua_State * L)
|
|||
MMB->splashRadius = 9999;
|
||||
MMB->s.powerups = 1;//metal
|
||||
MMB->spawnflags = 2;
|
||||
MMB->health = 1;
|
||||
G_CallSpawn(MMB);
|
||||
}else if( !Q_stricmp( MMB->model, "models/mapobjects/dn/sleep_chamber.md3" )){ //no description needed ^^
|
||||
MMB->splashDamage = 75;
|
||||
MMB->splashRadius = 75;
|
||||
MMB->s.powerups = 3;//metal
|
||||
}else continue;//we are not looking for this kind of MMB
|
||||
}
|
||||
|
||||
|
|
|
@ -1318,13 +1318,6 @@ qboolean UI_ConsoleCommand( void ) {
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
/* TODO remove me? */
|
||||
if ( Q_stricmp( cmd, "sqlkey" ) == 0) {
|
||||
/*UI_LoginSetSqlkey((int)UI_Argv(1));*/
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
|
|
@ -1859,8 +1859,7 @@ extern void TransDataReceived(const char *data);
|
|||
//
|
||||
// ui_login.c
|
||||
//
|
||||
/* TODO remove me ? */
|
||||
extern void UI_LoginSetSqlkey(int key);
|
||||
/* nothing for now */
|
||||
|
||||
//
|
||||
// ui_demo2.c
|
||||
|
|
Loading…
Reference in a new issue