Files
@ r11815:174e81d06883
Branch filter:
Location: cpp/openttd-patchpack/source/src/waypoint.cpp - annotation
r11815:174e81d06883
2.0 KiB
text/x-c
(svn r16210) -Codechange: Make panels non-overlapping in company stations window.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | r5584:545d748cc681 r5584:545d748cc681 r9111:983de9c5a848 r6432:3f618c3647c2 r5584:545d748cc681 r5584:545d748cc681 r11349:d10cdef1879d r8138:f851b4cbdad1 r8785:8312063c5ee4 r5584:545d748cc681 r5584:545d748cc681 r8131:7a50db7be0ff r8787:4e60a460f8ef r8847:d0a2cc468a55 r11349:d10cdef1879d r5584:545d748cc681 r7381:7ca8ddb92031 r5584:545d748cc681 r6432:3f618c3647c2 r6432:3f618c3647c2 r6432:3f618c3647c2 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6432:3f618c3647c2 r6432:3f618c3647c2 r6432:3f618c3647c2 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10089:c08af04d24d0 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6432:3f618c3647c2 r6432:3f618c3647c2 r6432:3f618c3647c2 r6432:3f618c3647c2 r6432:3f618c3647c2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5734:df644aea31d5 r5734:df644aea31d5 r5734:df644aea31d5 r5739:85c6eccb968b r5734:df644aea31d5 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6432:3f618c3647c2 r6432:3f618c3647c2 r6432:3f618c3647c2 r6432:3f618c3647c2 r6432:3f618c3647c2 r6432:3f618c3647c2 r6432:3f618c3647c2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r7381:7ca8ddb92031 r7381:7ca8ddb92031 r7381:7ca8ddb92031 r7381:7ca8ddb92031 r7381:7ca8ddb92031 r7381:7ca8ddb92031 r7381:7ca8ddb92031 r8258:08100da56269 r7413:3ccdde9800e0 r7413:3ccdde9800e0 r9964:c2a3e9be6d4b r7381:7ca8ddb92031 r7381:7ca8ddb92031 r7381:7ca8ddb92031 r10550:fdff38307dad r7381:7ca8ddb92031 r7381:7ca8ddb92031 r6247:96e840dbefcc r5584:545d748cc681 r7381:7ca8ddb92031 r7381:7ca8ddb92031 r5584:545d748cc681 | /* $Id$ */
/** @file waypoint.cpp Handling of waypoints. */
#include "stdafx.h"
#include "strings_type.h"
#include "rail.h"
#include "station_base.h"
#include "town.h"
#include "waypoint.h"
#include "window_func.h"
#include "newgrf_station.h"
#include "oldpool_func.h"
#include "order_func.h"
DEFINE_OLD_POOL_GENERIC(Waypoint, Waypoint)
/**
* Update all signs
*/
void UpdateAllWaypointSigns()
{
Waypoint *wp;
FOR_ALL_WAYPOINTS(wp) {
UpdateWaypointSign(wp);
}
}
/**
* Daily loop for waypoints
*/
void WaypointsDailyLoop()
{
Waypoint *wp;
/* Check if we need to delete a waypoint */
FOR_ALL_WAYPOINTS(wp) {
if (wp->deleted != 0 && --wp->deleted == 0) delete wp;
}
}
/**
* This hacks together some dummy one-shot Station structure for a waypoint.
* @param tile on which to work
* @return pointer to a Station
*/
Station *ComposeWaypointStation(TileIndex tile)
{
Waypoint *wp = GetWaypointByTile(tile);
/* instead of 'static Station stat' use byte array to avoid Station's destructor call upon exit. As
* a side effect, the station is not constructed now. */
static byte stat_raw[sizeof(Station)];
static Station &stat = *(Station*)stat_raw;
stat.train_tile = stat.xy = wp->xy;
stat.town = GetTown(wp->town_index);
stat.build_date = wp->build_date;
return &stat;
}
/**
* Draw a waypoint
* @param x coordinate
* @param y coordinate
* @param stat_id station id
* @param railtype RailType to use for
*/
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
{
x += 33;
y += 17;
if (!DrawStationTile(x, y, railtype, AXIS_X, STAT_CLASS_WAYP, stat_id)) {
DrawDefaultWaypointSprite(x, y, railtype);
}
}
Waypoint::Waypoint(TileIndex tile)
{
this->xy = tile;
}
Waypoint::~Waypoint()
{
free(this->name);
if (CleaningPool()) return;
DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);
RedrawWaypointSign(this);
this->xy = INVALID_TILE;
}
void InitializeWaypoints()
{
_Waypoint_pool.CleanPool();
_Waypoint_pool.AddBlockToPool();
}
|