mirror of
https://github.com/UberGames/rpgxEF.git
synced 2024-11-10 07:11:34 +00:00
Modified some code due to use of container ...
The list now can store C types and and strings directly (without the need of them to be in a struct).
This commit is contained in:
parent
c35fbf170f
commit
4fc5e3489a
8 changed files with 26 additions and 35 deletions
|
@ -18,10 +18,12 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -512,7 +512,6 @@ list_iter_p iterTimedMessages;
|
|||
*/
|
||||
static char *TimedMessage( void ){
|
||||
char* message;
|
||||
timedMessage_t *msg;
|
||||
container_p c;
|
||||
|
||||
if(!level.timedMessages->length) {
|
||||
|
@ -527,8 +526,7 @@ static char *TimedMessage( void ){
|
|||
}
|
||||
|
||||
c = list_cycl_next(iterTimedMessages);
|
||||
msg = c->data;
|
||||
message = msg->message;
|
||||
message = c->data;
|
||||
|
||||
return message;
|
||||
}
|
||||
|
|
|
@ -7432,40 +7432,33 @@ void Cmd_CamtestEnd_f(gentity_t *ent) {
|
|||
}
|
||||
// END CCAM
|
||||
|
||||
typedef struct rShader_s {
|
||||
char *s;
|
||||
} rShader_s;
|
||||
void addShaderToList(list_p list, char *shader) {
|
||||
rShader_s* s = (rShader_s *)malloc(sizeof(rShader_s));
|
||||
rShader_s* t;
|
||||
char* s;
|
||||
char* t;
|
||||
container_p c;
|
||||
list_iter_p i;
|
||||
|
||||
if(s == NULL) return;
|
||||
if(shader[0] == 0) return;
|
||||
if(list == NULL) return;
|
||||
|
||||
s->s = strdup(shader);
|
||||
if(s->s == NULL) {
|
||||
free(s);
|
||||
s = strdup(shader);
|
||||
if(s == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
i = list_iterator(list, LIST_FRONT);
|
||||
if(i == NULL) {
|
||||
free(s->s);
|
||||
free(s);
|
||||
return;
|
||||
}
|
||||
|
||||
for(c = list_next(i)->data; c != NULL; c = list_next(i)->data) {
|
||||
t = c->data;
|
||||
if(!strcmp(shader, t->s)) {
|
||||
if(!strcmp(shader, t)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
list_append(list, s, LT_DATA, sizeof(rShader_s));
|
||||
list_append(list, s, LT_DATA, strlen(s)+1);
|
||||
}
|
||||
|
||||
extern target_alert_Shaders_s alertShaders;
|
||||
|
@ -7477,7 +7470,7 @@ void Cmd_GeneratePrecacheFile(gentity_t *ent) {
|
|||
list_iter_p iter;
|
||||
qboolean first = qtrue;
|
||||
fileHandle_t f;
|
||||
rShader_s* s;
|
||||
char* s;
|
||||
container_p c;
|
||||
|
||||
trap_GetServerinfo(info, MAX_INFO_STRING);
|
||||
|
@ -7531,15 +7524,15 @@ void Cmd_GeneratePrecacheFile(gentity_t *ent) {
|
|||
|
||||
for(c = list_next(iter)->data; c != NULL; c = list_next(iter)->data) {
|
||||
s = c->data;
|
||||
G_Printf("\t%s\n", s->s);
|
||||
G_Printf("\t%s\n", s);
|
||||
if(first) {
|
||||
trap_FS_Write("\"", 1, f);
|
||||
trap_FS_Write(s->s, strlen(s->s), f);
|
||||
trap_FS_Write(s, strlen(s), f);
|
||||
trap_FS_Write("\"", 1, f);
|
||||
first = qfalse;
|
||||
} else {
|
||||
trap_FS_Write("\n\"", 2, f);
|
||||
trap_FS_Write(s->s, strlen(s->s), f);
|
||||
trap_FS_Write(s, strlen(s), f);
|
||||
trap_FS_Write("\"", 1, f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2092,12 +2092,6 @@ struct luaAlertState_s {
|
|||
|
||||
luaAlertState_t* luaAlertState;
|
||||
|
||||
// timed messages
|
||||
typedef struct timedMessage_s timedMessage_t;
|
||||
struct timedMessage_s {
|
||||
char* message;
|
||||
} timedMessage_s;
|
||||
|
||||
/* alert shaders */
|
||||
typedef struct {
|
||||
char* greenShaders[10];
|
||||
|
|
|
@ -915,7 +915,6 @@ static void G_LoadTimedMessages(void) {
|
|||
char* token;
|
||||
int len;
|
||||
int i;
|
||||
timedMessage_t *msg;
|
||||
|
||||
len = trap_FS_FOpenFile("timedmessages.cfg", &f, FS_READ);
|
||||
if(!len) return;
|
||||
|
@ -961,14 +960,7 @@ static void G_LoadTimedMessages(void) {
|
|||
continue;
|
||||
}
|
||||
|
||||
msg = (timedMessage_t *)malloc(sizeof(timedMessage_s));
|
||||
if(msg == NULL) {
|
||||
G_Printf("G_LoadTimedMessages - was unable to allocate timed message storage\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
msg->message = strdup(token);
|
||||
list_append(level.timedMessages, msg, LT_DATA, sizeof(timedMessage_s));
|
||||
list_append(level.timedMessages, token, LT_DATA, strlen(token)+1);
|
||||
} else {
|
||||
if(token[0] == '}') {
|
||||
break;
|
||||
|
|
|
@ -18,10 +18,12 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -19,11 +19,13 @@
|
|||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -41,34 +41,42 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release TA|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
Loading…
Reference in a new issue