Move fuelcen_activate special assignment up

One caller uses fuelcen_activate when segp->special != station_type.
Every other caller passes the type that was already on the segment.
Move the assignment into the one caller that needs it, then remove the
argument.
This commit is contained in:
Kp 2016-10-29 23:16:17 +00:00
parent 65f9fd54f8
commit 5a69c09ec2
6 changed files with 11 additions and 13 deletions

View file

@ -62,7 +62,7 @@ void fuelcen_reset();
void fuelcen_create( vsegptridx_t segp);
// Makes a fuel center active... needs to be called when
// a segment is loaded from disk.
void fuelcen_activate( vsegptridx_t segp, int station_type );
void fuelcen_activate(vsegptridx_t segp);
// Deletes a segment as a fuel center.
void fuelcen_delete(vsegptr_t segp);

View file

@ -206,7 +206,8 @@ window_event_result centers_dialog_handler(UI_DIALOG *dlg,const d_event &event,
{
fuelcen_delete(Cursegp);
Update_flags |= UF_WORLD_CHANGED;
fuelcen_activate( Cursegp, i );
Cursegp->special = i;
fuelcen_activate(Cursegp);
}
rval = window_event_result::handled;
}

View file

@ -1238,7 +1238,7 @@ static int med_load_group( const char *filename, group::vertex_array_type_t &ver
*segp = tseg;
segp->objects = object_none;
fuelcen_activate(segp, segp->special);
fuelcen_activate(segp);
}
range_for (const auto &gs, segment_ids)

View file

@ -438,7 +438,7 @@ int SetPlayerFromCurseg()
int fuelcen_create_from_curseg()
{
Cursegp->special = SEGMENT_IS_FUELCEN;
fuelcen_activate(Cursegp, Cursegp->special);
fuelcen_activate(Cursegp);
return 1;
}
@ -453,14 +453,14 @@ int repaircen_create_from_curseg()
int controlcen_create_from_curseg()
{
Cursegp->special = SEGMENT_IS_CONTROLCEN;
fuelcen_activate(Cursegp, Cursegp->special);
fuelcen_activate(Cursegp);
return 1;
}
int robotmaker_create_from_curseg()
{
Cursegp->special = SEGMENT_IS_ROBOTMAKER;
fuelcen_activate(Cursegp, Cursegp->special);
fuelcen_activate(Cursegp);
return 1;
}

View file

@ -188,15 +188,12 @@ static void matcen_create(const vsegptridx_t segp)
//------------------------------------------------------------
// Adds a segment that already is a special type into the Station array.
void fuelcen_activate(const vsegptridx_t segp, int station_type )
void fuelcen_activate(const vsegptridx_t segp)
{
segp->special = station_type;
if (segp->special == SEGMENT_IS_ROBOTMAKER)
matcen_create( segp);
else
fuelcen_create( segp);
}
// The lower this number is, the more quickly the center can be re-triggered.

View file

@ -668,7 +668,7 @@ int load_mine_data(PHYSFS_File *LoadFile)
i->matcen_num = v16_seg.matcen_num;
i->static_light = v16_seg.static_light;
#endif
fuelcen_activate(i, i->special);
fuelcen_activate(i);
}
else
Error("Invalid mine version");
@ -709,7 +709,7 @@ int load_mine_data(PHYSFS_File *LoadFile)
range_for (const auto &&segp, vsegptridx)
{
segment2_read(segp, LoadFile);
fuelcen_activate(segp, segp->special);
fuelcen_activate(segp);
}
#endif
}
@ -1020,7 +1020,7 @@ int load_mine_data_compiled(PHYSFS_File *LoadFile)
const auto &&pi = vsegptridx(&i);
if (Gamesave_current_version > 5)
segment2_read(pi, LoadFile);
fuelcen_activate(pi, i.special );
fuelcen_activate(pi);
}
reset_objects(1); //one object, the player