diff options
author | truelight <truelight@openttd.org> | 2006-08-26 14:22:54 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-26 14:22:54 +0000 |
commit | 602c0d40b38c83e520667ec1585b7745278fbbf8 (patch) | |
tree | 3ffa0a94034a5993e48411c7cb9b2cb765c6b1de /engine.c | |
parent | be737b80d35aebf98a7fb571b1124cd51b371953 (diff) | |
download | openttd-602c0d40b38c83e520667ec1585b7745278fbbf8.tar.xz |
(svn r6137) -Codechange: some very minor cleanups:
- Start using DeleteXXX for every pool item, not manually doing it
- Use some wrapper to improve logic
- Rewrote some pieces to improve logic
Diffstat (limited to 'engine.c')
-rw-r--r-- | engine.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -503,10 +503,12 @@ static EngineRenew *GetEngineReplacement(EngineRenewList erl, EngineID engine) void RemoveAllEngineReplacement(EngineRenewList *erl) { EngineRenew *er = (EngineRenew *)(*erl); + EngineRenew *next; while (er) { - er->from = INVALID_ENGINE; // "Deallocate" elements - er = er->next; + next = er->next; + DeleteEngineRenew(er); + er = next; } *erl = NULL; // Empty list } @@ -559,7 +561,7 @@ int32 RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, uint32 flag /* Cut this element out */ prev->next = er->next; } - er->from = INVALID_ENGINE; // Deallocate + DeleteEngineRenew(er); } return 0; } |