Changeset - r9395:5facaa348a52
[Not reviewed]
master
0 2 0
peter1138 - 16 years ago 2008-05-28 10:29:48
peter1138@openttd.org
(svn r13306) -Fix (r8362): Pass engine list by pointer instead of making a copy of it.
2 files changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_gui.cpp
Show inline comments
 
@@ -27,7 +27,7 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group);
 
void DrawEngineList(VehicleType type, int x, int y, const EngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group);
 

	
 
static const StringID _rail_types_list[] = {
 
	STR_RAIL_VEHICLES,
 
@@ -386,7 +386,7 @@ public:
 
			EngineID end    = min((i == 0 ? this->vscroll.cap : this->vscroll2.cap) + start, list.size());
 

	
 
			/* Do the actual drawing */
 
			DrawEngineList((VehicleType)this->window_number, this->widget[widget].left + 2, this->widget[widget].top + 1, list, start, end, this->sel_engine[i], i == 0 ? this->widget[RVW_WIDGET_LEFT_MATRIX].right - 2 : 0, selected_group);
 
			DrawEngineList((VehicleType)this->window_number, this->widget[widget].left + 2, this->widget[widget].top + 1, &list, start, end, this->sel_engine[i], i == 0 ? this->widget[RVW_WIDGET_LEFT_MATRIX].right - 2 : 0, selected_group);
 

	
 
			/* Also draw the details if an engine is selected */
 
			if (this->sel_engine[i] != INVALID_ENGINE) {
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -745,13 +745,13 @@ static void DrawVehicleEngine(VehicleTyp
 
 * @param selected_id what engine to highlight as selected, if any
 
 * @param count_location Offset to print the engine count (used by autoreplace). 0 means it's off
 
 */
 
void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group)
 
void DrawEngineList(VehicleType type, int x, int y, const EngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group)
 
{
 
	byte step_size = GetVehicleListHeight(type);
 
	byte x_offset = 0;
 
	byte y_offset = 0;
 

	
 
	assert(max <= eng_list.size());
 
	assert(max <= eng_list->size());
 

	
 
	switch (type) {
 
		case VEH_TRAIN:
 
@@ -779,7 +779,7 @@ void DrawEngineList(VehicleType type, in
 
	}
 

	
 
	for (; min < max; min++, y += step_size) {
 
		const EngineID engine = eng_list[min];
 
		const EngineID engine = (*eng_list)[min];
 
		/* Note: num_engines is only used in the autoreplace GUI, so it is correct to use _local_player here. */
 
		const uint num_engines = GetGroupNumEngines(_local_player, selected_group, engine);
 

	
 
@@ -1117,7 +1117,7 @@ struct BuildVehicleWindow : Window {
 

	
 
		this->DrawWidgets();
 

	
 
		DrawEngineList(this->vehicle_type, this->widget[BUILD_VEHICLE_WIDGET_LIST].left + 2, this->widget[BUILD_VEHICLE_WIDGET_LIST].top + 1, this->eng_list, this->vscroll.pos, max, this->sel_engine, 0, DEFAULT_GROUP);
 
		DrawEngineList(this->vehicle_type, this->widget[BUILD_VEHICLE_WIDGET_LIST].left + 2, this->widget[BUILD_VEHICLE_WIDGET_LIST].top + 1, &this->eng_list, this->vscroll.pos, max, this->sel_engine, 0, DEFAULT_GROUP);
 

	
 
		if (this->sel_engine != INVALID_ENGINE) {
 
			const Widget *wi = &this->widget[BUILD_VEHICLE_WIDGET_PANEL];
0 comments (0 inline, 0 general)