Skip to content

Commit

Permalink
Fixed a couple of loop invariants in Def_Get
Browse files Browse the repository at this point in the history
  • Loading branch information
danij committed May 31, 2008
1 parent 690c9f7 commit 615e582
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions doomsday/engine/portable/src/def_main.c
Expand Up @@ -1504,23 +1504,31 @@ int Def_Get(int type, char *id, void *out)
return false;

case DD_DEF_LINE_TYPE:
{
int typeId = strtol(id, (char **)NULL, 10);

for(i = defs.count.lineTypes.num - 1; i >= 0; i--)
if(defs.lineTypes[i].id == strtol(id, (char **)NULL, 10))
if(defs.lineTypes[i].id == typeId)
{
if(out)
Def_CopyLineType(out, &defs.lineTypes[i]);
return true;
}
}
return false;

case DD_DEF_SECTOR_TYPE:
{
int typeId = strtol(id, (char **)NULL, 10);

for(i = defs.count.sectorTypes.num - 1; i >= 0; i--)
if(defs.sectorTypes[i].id == strtol(id, (char **)NULL, 10))
if(defs.sectorTypes[i].id == typeId)
{
if(out)
Def_CopySectorType(out, &defs.sectorTypes[i]);
return true;
}
}
return false;

default:
Expand Down

0 comments on commit 615e582

Please sign in to comment.