light: remove alloc argument to LightStyleForTargetname()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
92ff448966
commit
22ca3262f0
|
|
@ -56,21 +56,19 @@ SetKeyValue(entity_t *ent, const char *key, const char *value)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
LightStyleForTargetname(const char *targetname, qboolean alloc)
|
LightStyleForTargetname(const char *targetname)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < numlighttargets; i++)
|
for (i = 0; i < numlighttargets; i++)
|
||||||
if (!strcmp(lighttargets[i], targetname))
|
if (!strcmp(lighttargets[i], targetname))
|
||||||
return 32 + i;
|
return 32 + i;
|
||||||
if (!alloc)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (i == MAX_LIGHT_TARGETS)
|
if (i == MAX_LIGHT_TARGETS)
|
||||||
Error("%s: Too many unique light targetnames\n", __func__);
|
Error("%s: Too many unique light targetnames\n", __func__);
|
||||||
|
|
||||||
strcpy(lighttargets[i], targetname);
|
strcpy(lighttargets[i], targetname);
|
||||||
numlighttargets++;
|
numlighttargets++;
|
||||||
|
|
||||||
return numlighttargets - 1 + 32;
|
return numlighttargets - 1 + 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,12 +263,10 @@ LoadEntities(void)
|
||||||
|
|
||||||
if (!strcmp(entity->classname, "light")) {
|
if (!strcmp(entity->classname, "light")) {
|
||||||
if (entity->targetname[0] && !entity->style) {
|
if (entity->targetname[0] && !entity->style) {
|
||||||
char s[16];
|
char style[16];
|
||||||
|
entity->style = LightStyleForTargetname(entity->targetname);
|
||||||
entity->style =
|
snprintf(style, sizeof(style), "%i", entity->style);
|
||||||
LightStyleForTargetname(entity->targetname, true);
|
SetKeyValue(entity, "style", style);
|
||||||
sprintf(s, "%i", entity->style);
|
|
||||||
SetKeyValue(entity, "style", s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue