Changeset - r12513:4e8212c376c5
[Not reviewed]
master
0 3 0
alberth - 15 years ago 2009-07-26 12:49:26
alberth@openttd.org
(svn r16960) -Doc: Added some viewport and vehicle type doxygen strings.
3 files changed with 31 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/vehicle_type.h
Show inline comments
 
@@ -6,21 +6,22 @@
 
#define VEHICLE_TYPE_H
 

	
 
#include "core/enum_type.hpp"
 

	
 
typedef uint16 VehicleID;
 

	
 
/** Available vehicle types. */
 
enum VehicleType {
 
	VEH_TRAIN,
 
	VEH_ROAD,
 
	VEH_SHIP,
 
	VEH_AIRCRAFT,
 
	VEH_EFFECT,
 
	VEH_DISASTER,
 
	VEH_TRAIN,          ///< %Train vehicle type.
 
	VEH_ROAD,           ///< Road vehicle type.
 
	VEH_SHIP,           ///< %Ship vehicle type.
 
	VEH_AIRCRAFT,       ///< %Aircraft vehicle type.
 
	VEH_EFFECT,         ///< Effect vehicle type (smoke, explosions, sparks, bubbles)
 
	VEH_DISASTER,       ///< Disaster vehicle type.
 
	VEH_END,
 
	VEH_INVALID = 0xFF,
 
	VEH_INVALID = 0xFF, ///< Non-existing type of vehicle.
 
};
 
DECLARE_POSTFIX_INCREMENT(VehicleType);
 
/** It needs to be 8bits, because we save and load it as such */
 
typedef SimpleTinyEnumT<VehicleType, byte> VehicleTypeByte;
 

	
 
struct Vehicle;
 
@@ -33,13 +34,13 @@ struct DisasterVehicle;
 

	
 
struct BaseVehicle
 
{
 
	VehicleTypeByte type;    ///< Type of vehicle
 
};
 

	
 
static const VehicleID INVALID_VEHICLE = 0xFFFF;
 
static const VehicleID INVALID_VEHICLE = 0xFFFF; ///< Constant representing a non-existing vehicle.
 

	
 
/** Pathfinding option states */
 
enum {
 
	VPF_OPF  = 0, ///< The Original PathFinder
 
	VPF_NTP  = 0, ///< New Train Pathfinder, replacing OPF for trains
 
	VPF_NPF  = 1, ///< New PathFinder
src/viewport.cpp
Show inline comments
 
@@ -1575,12 +1575,16 @@ static inline void ClampViewportToMap(co
 

	
 
	/* Remove centreing */
 
	x -= vp->virtual_width / 2;
 
	y -= vp->virtual_height / 2;
 
}
 

	
 
/**
 
 * Update the viewport position being displayed.
 
 * @param w %Window owning the viewport.
 
 */
 
void UpdateViewportPosition(Window *w)
 
{
 
	const ViewPort *vp = w->viewport;
 

	
 
	if (w->viewport->follow_vehicle != INVALID_VEHICLE) {
 
		const Vehicle *veh = Vehicle::Get(w->viewport->follow_vehicle);
 
@@ -2034,13 +2038,20 @@ void PlaceObject()
 

	
 
	w = GetCallbackWnd();
 
	if (w != NULL) w->OnPlaceObject(pt, TileVirtXY(pt.x, pt.y));
 
}
 

	
 

	
 
/* scrolls the viewport in a window to a given location */
 
/** Scrolls the viewport in a window to a given location.
 
 * @param x       Desired x location of the map to scroll to (world coordinate).
 
 * @param y       Desired y location of the map to scroll to (world coordinate).
 
 * @param z       Desired z location of the map to scroll to (world coordinate). Use \c -1 to scroll to the height of the map at the \a x, \a y location.
 
 * @param w       %Window containing the viewport.
 
 * @param instant Jump to the location instead of slowly moving to it.
 
 * @return Destination of the viewport was changed (to activate other actions when the viewport is already at the desired position).
 
 */
 
bool ScrollWindowTo(int x, int y, int z, Window *w, bool instant)
 
{
 
	/* The slope cannot be acquired outside of the map, so make sure we are always within the map. */
 
	if (z == -1) z = GetSlopeZ(Clamp(x, 0, MapSizeX() * TILE_SIZE - 1), Clamp(y, 0, MapSizeY() * TILE_SIZE - 1));
 

	
 
	Point pt = MapXYZToViewport(w->viewport, x, y, z);
src/window_gui.h
Show inline comments
 
@@ -186,20 +186,24 @@ enum SortButtonState {
 
	SBS_OFF,
 
	SBS_DOWN,
 
	SBS_UP,
 
};
 

	
 
/**
 
 * Data structure for a window viewport
 
 * Data structure for a window viewport.
 
 * A viewport is either following a vehicle (its id in then in #follow_vehicle), or it aims to display a specific
 
 * location #dest_scrollpos_x, #dest_scrollpos_y (#follow_vehicle is then #INVALID_VEHICLE).
 
 * The actual location being shown is #scrollpos_x, #scrollpos_y.
 
 * @see InitializeViewport(), UpdateViewportPosition().
 
 */
 
struct ViewportData : ViewPort {
 
	VehicleID follow_vehicle;
 
	int32 scrollpos_x;
 
	int32 scrollpos_y;
 
	int32 dest_scrollpos_x;
 
	int32 dest_scrollpos_y;
 
	VehicleID follow_vehicle; ///< VehicleID to follow if following a vehicle, #INVALID_VEHICLE otherwise.
 
	int32 scrollpos_x;        ///< Currently shown x coordinate (virtual screen coordinate of topleft corner of the viewport).
 
	int32 scrollpos_y;        ///< Currently shown y coordinate (virtual screen coordinate of topleft corner of the viewport).
 
	int32 dest_scrollpos_x;   ///< Current destination x coordinate to display (virtual screen coordinate of topleft corner of the viewport).
 
	int32 dest_scrollpos_y;   ///< Current destination y coordinate to display (virtual screen coordinate of topleft corner of the viewport).
 
};
 

	
 
/**
 
 * Data structure for an opened window
 
 */
 
struct Window : ZeroedMemoryAllocator {
0 comments (0 inline, 0 general)