Changeset - r7014:5a0a16e3673b
[Not reviewed]
master
0 6 0
truelight - 17 years ago 2007-06-22 18:28:44
truelight@openttd.org
(svn r10270) -Add: prefixed the loading indicator with an arrow, up meaning vehicle is loading, down meaning vehicle is unloading
6 files changed with 35 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/economy.cpp
Show inline comments
 
@@ -1666,17 +1666,18 @@ static void LoadUnloadVehicle(Vehicle *v
 
			unloading_time += (overhang * unloading_time) / 8;
 
		}
 
	}
 

	
 
	/* Calculate the loading indicator fill percent and display */
 
	if (_patches.loading_indicators && _game_mode != GM_MENU && v->owner == _local_player) {
 
		int percent = CalcPercentVehicleFilled(v);
 
		StringID percent_up_down = STR_NULL;
 
		int percent = CalcPercentVehicleFilled(v, &percent_up_down);
 
		if (v->fill_percent_te_id == INVALID_TE_ID) {
 
			v->fill_percent_te_id = ShowFillingPercent(v->x_pos, v->y_pos, v->z_pos + 20, percent);
 
			v->fill_percent_te_id = ShowFillingPercent(v->x_pos, v->y_pos, v->z_pos + 20, percent, percent_up_down);
 
		} else {
 
			UpdateFillingPercent(v->fill_percent_te_id, percent);
 
			UpdateFillingPercent(v->fill_percent_te_id, percent, percent_up_down);
 
		}
 
	}
 

	
 
	v->load_unload_time_rem = unloading_time;
 

	
 
	if (completely_empty) {
src/lang/english.txt
Show inline comments
 
@@ -3289,14 +3289,18 @@ STR_TRANSPARENT_HOUSES_DESC             
 
STR_TRANSPARENT_INDUSTRIES_DESC                                 :{BLACK}Toggle transparency for industries
 
STR_TRANSPARENT_BUILDINGS_DESC                                  :{BLACK}Toggle transparency for buildables like stations, depots, waypoints and catenary
 
STR_TRANSPARENT_BRIDGES_DESC                                    :{BLACK}Toggle transparency for bridges
 
STR_TRANSPARENT_STRUCTURES_DESC                                 :{BLACK}Toggle transparency for structures like lighthouses and antennas, maybe in future for eyecandy
 
STR_TRANSPARENT_LOADING_DESC                                    :{BLACK}Toggle transparency for loading indicators
 

	
 
STR_PERCENT_FULL_SMALL                                          :{TINYFONT}{WHITE}{NUM}%
 
STR_PERCENT_FULL                                                :{WHITE}{NUM}%
 
STR_PERCENT_UP_SMALL                                            :{TINYFONT}{WHITE}{NUM}%{UPARROW}
 
STR_PERCENT_UP                                                  :{WHITE}{NUM}%{UPARROW}
 
STR_PERCENT_DOWN_SMALL                                          :{TINYFONT}{WHITE}{NUM}%{DOWNARROW}
 
STR_PERCENT_DOWN                                                :{WHITE}{NUM}%{DOWNARROW}
 
STR_PERCENT_UP_DOWN_SMALL                                       :{TINYFONT}{WHITE}{NUM}%{UPARROW}{DOWNARROW}
 
STR_PERCENT_UP_DOWN                                             :{WHITE}{NUM}%{UPARROW}{DOWNARROW}
 

	
 
##### Mass Order
 
STR_GROUP_NAME_FORMAT                                           :Group {COMMA}
 
STR_GROUP_TINY_NAME                                             :{TINYFONT}{GROUP}
 
STR_GROUP_ALL_TRAINS                                            :All trains
 
STR_GROUP_ALL_ROADS                                             :All road vehicles
src/misc_gui.cpp
Show inline comments
 
@@ -641,24 +641,28 @@ void ShowFeederIncomeAnimation(int x, in
 
	Point pt = RemapCoords(x,y,z);
 

	
 
	SetDParam(0, cost);
 
	AddTextEffect(STR_FEEDER, pt.x, pt.y, 0x250, TE_RISING);
 
}
 

	
 
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent)
 
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent, StringID string)
 
{
 
	Point pt = RemapCoords(x, y, z);
 

	
 
	assert(string != STR_NULL);
 

	
 
	SetDParam(0, percent);
 
	return AddTextEffect(STR_PERCENT_FULL, pt.x, pt.y, 0xFFFF, TE_STATIC);
 
	return AddTextEffect(string, pt.x, pt.y, 0xFFFF, TE_STATIC);
 
}
 

	
 
void UpdateFillingPercent(TextEffectID te_id, uint8 percent)
 
void UpdateFillingPercent(TextEffectID te_id, uint8 percent, StringID string)
 
{
 
	assert(string != STR_NULL);
 

	
 
	SetDParam(0, percent);
 
	UpdateTextEffect(te_id, STR_PERCENT_FULL);
 
	UpdateTextEffect(te_id, string);
 
}
 

	
 
void HideFillingPercent(TextEffectID te_id)
 
{
 
	if (te_id != INVALID_TE_ID) RemoveTextEffect(te_id);
 
}
src/texteff.hpp
Show inline comments
 
@@ -25,11 +25,11 @@ void RemoveTextEffect(TextEffectID effec
 
void InitTextMessage();
 
void DrawTextMessage();
 
void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...);
 
void UndrawTextMessage();
 

	
 
/* misc_gui.cpp */
 
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent);
 
void UpdateFillingPercent(TextEffectID te_id, uint8 percent);
 
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent, StringID color);
 
void UpdateFillingPercent(TextEffectID te_id, uint8 percent, StringID color);
 
void HideFillingPercent(TextEffectID te_id);
 

	
 
#endif /* TEXTEFF_HPP */
src/vehicle.cpp
Show inline comments
 
@@ -2268,25 +2268,38 @@ bool IsVehicleInDepot(const Vehicle *v)
 
	return false;
 
}
 

	
 
/**
 
 * Calculates how full a vehicle is.
 
 * @param v The Vehicle to check. For trains, use the first engine.
 
 * @param color The string to show depending on if we are unloading or loading
 
 * @return A percentage of how full the Vehicle is.
 
 */
 
uint8 CalcPercentVehicleFilled(Vehicle *v)
 
uint8 CalcPercentVehicleFilled(Vehicle *v, StringID *color)
 
{
 
	int count = 0;
 
	int max = 0;
 
	int cars = 0;
 
	int unloading = 0;
 

	
 
	assert(color != NULL);
 

	
 
	/* Count up max and used */
 
	for (; v != NULL; v = v->next) {
 
		count += v->cargo.Count();
 
		max += v->cargo_cap;
 
		if (v->cargo_cap != 0) {
 
			unloading += HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING) ? 1 : 0;
 
			cars++;
 
		}
 
	}
 

	
 
	if (unloading == 0)         *color = STR_PERCENT_UP;
 
	else if (cars == unloading) *color = STR_PERCENT_DOWN;
 
	else                        *color = STR_PERCENT_UP_DOWN;
 

	
 
	/* Train without capacity */
 
	if (max == 0) return 100;
 

	
 
	/* Return the percentage */
 
	return (count * 100) / max;
 
}
src/vehicle.h
Show inline comments
 
@@ -502,13 +502,13 @@ uint CountVehiclesInChain(const Vehicle*
 
bool IsEngineCountable(const Vehicle *v);
 
void DeleteVehicleChain(Vehicle *v);
 
void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc);
 
void *VehicleFromPosXY(int x, int y, void *data, VehicleFromPosProc *proc);
 
void CallVehicleTicks();
 
Vehicle *FindVehicleOnTileZ(TileIndex tile, byte z);
 
uint8 CalcPercentVehicleFilled(Vehicle *v);
 
uint8 CalcPercentVehicleFilled(Vehicle *v, StringID *color);
 

	
 
void InitializeTrains();
 
byte VehicleRandomBits();
 
void ResetVehiclePosHash();
 

	
 
bool CanRefitTo(EngineID engine_type, CargoID cid_to);
0 comments (0 inline, 0 general)