mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
Make def_visit_all return the actual result of visit.
This way, def_visit_all is a little more useful (though I think I might redo the one case that's using this feature).
This commit is contained in:
parent
028b19888f
commit
204a0b3f72
2 changed files with 9 additions and 7 deletions
|
@ -300,7 +300,8 @@ int def_size (def_t *def);
|
|||
parameter is \a data passed on. If non-zero is returned,
|
||||
the pass through the alias cluster will terminate.
|
||||
\param data Pointer to the data needed by \a visit.
|
||||
\return 1 if \a visit returned non-zero, otherwise 0.
|
||||
\return The value returned by \a visit returned non-zero,
|
||||
otherwise 0.
|
||||
*/
|
||||
int def_visit_all (def_t *def, int overlap,
|
||||
int (*visit) (def_t *, void *), void *data);
|
||||
|
|
|
@ -640,21 +640,22 @@ def_visit_all (def_t *def, int overlap,
|
|||
int (*visit) (def_t *, void *), void *data)
|
||||
{
|
||||
def_t *start_def = def;
|
||||
int ret;
|
||||
|
||||
if (visit (def, data))
|
||||
return 1;
|
||||
if ((ret = visit (def, data)))
|
||||
return ret;
|
||||
if (def->alias) {
|
||||
def = def->alias;
|
||||
if (visit (def, data))
|
||||
return 1;
|
||||
if ((ret = visit (def, data)))
|
||||
return ret;
|
||||
}
|
||||
for (def = def->alias_defs; def; def = def->next) {
|
||||
if (def == start_def)
|
||||
continue;
|
||||
if (overlap && !def_overlap (def, start_def))
|
||||
continue;
|
||||
if (visit (def, data))
|
||||
return 1;
|
||||
if ((ret = visit (def, data)))
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue