(svn r11003) -Codechange: replace Vehicle->next to Vehicle->Next() and Vehicle->SetNext() so we can trap instances that change a next pointer and (in the future) update the first/previous pointers based on that.

This commit is contained in:
rubidium
2007-08-30 13:03:56 +00:00
parent 6edf2d3a1b
commit 235ad4ab6b
21 changed files with 164 additions and 147 deletions

View File

@@ -371,7 +371,7 @@ void SetTrainGroupID(Vehicle *v, GroupID new_g)
assert(v->IsValid() && v->type == VEH_TRAIN && IsFrontEngine(v));
for (Vehicle *u = v; u != NULL; u = u->next) {
for (Vehicle *u = v; u != NULL; u = u->Next()) {
if (IsEngineCountable(u)) UpdateNumEngineGroup(u->engine_type, u->group_id, new_g);
u->group_id = new_g;
@@ -394,7 +394,7 @@ void UpdateTrainGroupID(Vehicle *v)
assert(v->IsValid() && v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v)));
GroupID new_g = IsFrontEngine(v) ? v->group_id : (GroupID)DEFAULT_GROUP;
for (Vehicle *u = v; u != NULL; u = u->next) {
for (Vehicle *u = v; u != NULL; u = u->Next()) {
if (IsEngineCountable(u)) UpdateNumEngineGroup(u->engine_type, u->group_id, new_g);
u->group_id = new_g;