mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r5609) CodeChange : Apply coding style
This commit is contained in:
parent
fd0305197e
commit
6082507fea
|
@ -32,7 +32,7 @@
|
||||||
void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number)
|
void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number)
|
||||||
{
|
{
|
||||||
const AircraftVehicleInfo *avi = AircraftVehInfo(engine_number);
|
const AircraftVehicleInfo *avi = AircraftVehInfo(engine_number);
|
||||||
const Engine* e = GetEngine(engine_number);
|
const Engine *e = GetEngine(engine_number);
|
||||||
CargoID cargo;
|
CargoID cargo;
|
||||||
YearMonthDay ymd;
|
YearMonthDay ymd;
|
||||||
ConvertDayToYMD(&ymd, e->intro_date);
|
ConvertDayToYMD(&ymd, e->intro_date);
|
||||||
|
@ -93,7 +93,7 @@ static void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selectio
|
||||||
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
if (success) {
|
if (success) {
|
||||||
const Vehicle* v = GetVehicle(_new_vehicle_id);
|
const Vehicle *v = GetVehicle(_new_vehicle_id);
|
||||||
|
|
||||||
if (v->tile == _backup_orders_tile) {
|
if (v->tile == _backup_orders_tile) {
|
||||||
_backup_orders_tile = 0;
|
_backup_orders_tile = 0;
|
||||||
|
@ -127,7 +127,7 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e)
|
||||||
EngineID eid;
|
EngineID eid;
|
||||||
|
|
||||||
for (eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) {
|
for (eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) {
|
||||||
const AircraftVehicleInfo* avi;
|
const AircraftVehicleInfo *avi;
|
||||||
|
|
||||||
if (!HASBIT(GetEngine(eid)->player_avail, _local_player)) continue;
|
if (!HASBIT(GetEngine(eid)->player_avail, _local_player)) continue;
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e)
|
||||||
EngineID eid;
|
EngineID eid;
|
||||||
|
|
||||||
for (eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) {
|
for (eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) {
|
||||||
const AircraftVehicleInfo* avi;
|
const AircraftVehicleInfo *avi;
|
||||||
|
|
||||||
if (!HASBIT(GetEngine(eid)->player_avail, _local_player)) continue;
|
if (!HASBIT(GetEngine(eid)->player_avail, _local_player)) continue;
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ static const WindowDesc _aircraft_refit_desc = {
|
||||||
AircraftRefitWndProc
|
AircraftRefitWndProc
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ShowAircraftRefitWindow(const Vehicle* v)
|
static void ShowAircraftRefitWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ static const WindowDesc _aircraft_details_desc = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void ShowAircraftDetailsWindow(const Vehicle* v)
|
static void ShowAircraftDetailsWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
VehicleID veh = v->index;
|
VehicleID veh = v->index;
|
||||||
|
@ -522,7 +522,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
uint32 disabled = 1 << 8;
|
uint32 disabled = 1 << 8;
|
||||||
StringID str;
|
StringID str;
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
|
|
||||||
switch (e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 5: /* start stop */
|
case 5: /* start stop */
|
||||||
|
@ -618,7 +618,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP: {
|
case WE_MOUSELOOP: {
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
uint32 h = IsAircraftInHangarStopped(v) ? 1 << 7 : 1 << 11;
|
uint32 h = IsAircraftInHangarStopped(v) ? 1 << 7 : 1 << 11;
|
||||||
|
|
||||||
if (h != w->hidden_state) {
|
if (h != w->hidden_state) {
|
||||||
|
@ -639,9 +639,9 @@ static const WindowDesc _aircraft_view_desc = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void ShowAircraftViewWindow(const Vehicle* v)
|
void ShowAircraftViewWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window* w = AllocateWindowDescFront(&_aircraft_view_desc, v->index);
|
Window *w = AllocateWindowDescFront(&_aircraft_view_desc, v->index);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
w->caption_color = v->owner;
|
w->caption_color = v->owner;
|
||||||
|
@ -774,7 +774,7 @@ static void AircraftDepotClickAircraft(Window *w, int x, int y)
|
||||||
* @param *v is the original vehicle to clone
|
* @param *v is the original vehicle to clone
|
||||||
* @param *w is the window of the hangar where the clone is build
|
* @param *w is the window of the hangar where the clone is build
|
||||||
*/
|
*/
|
||||||
static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
static void HandleCloneVehClick(const Vehicle *v, const Window *w)
|
||||||
{
|
{
|
||||||
if (v == NULL || v->type != VEH_Aircraft) return;
|
if (v == NULL || v->type != VEH_Aircraft) return;
|
||||||
|
|
||||||
|
@ -785,9 +785,9 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClonePlaceObj(const Window* w)
|
static void ClonePlaceObj(const Window *w)
|
||||||
{
|
{
|
||||||
const Vehicle* v = CheckMouseOverVehicle();
|
const Vehicle *v = CheckMouseOverVehicle();
|
||||||
|
|
||||||
if (v != NULL) HandleCloneVehClick(v, w);
|
if (v != NULL) HandleCloneVehClick(v, w);
|
||||||
}
|
}
|
||||||
|
@ -841,7 +841,7 @@ static void AircraftDepotWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
// check if a vehicle in a depot was clicked..
|
// check if a vehicle in a depot was clicked..
|
||||||
case WE_MOUSELOOP: {
|
case WE_MOUSELOOP: {
|
||||||
const Vehicle* v = _place_clicked_vehicle;
|
const Vehicle *v = _place_clicked_vehicle;
|
||||||
|
|
||||||
// since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button
|
// since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button
|
||||||
if (v != NULL && HASBIT(w->click_state, 8)) {
|
if (v != NULL && HASBIT(w->click_state, 8)) {
|
||||||
|
@ -943,7 +943,7 @@ void ShowAircraftDepotWindow(TileIndex tile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DrawSmallOrderList(const Vehicle* v, int x, int y)
|
static void DrawSmallOrderList(const Vehicle *v, int x, int y)
|
||||||
{
|
{
|
||||||
const Order *order;
|
const Order *order;
|
||||||
int sel, i = 0;
|
int sel, i = 0;
|
||||||
|
@ -1088,7 +1088,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
case 7: { /* Matrix to show vehicles */
|
case 7: { /* Matrix to show vehicles */
|
||||||
uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG;
|
uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG;
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
|
|
||||||
if (id_v >= w->vscroll.cap) return; // click out of bounds
|
if (id_v >= w->vscroll.cap) return; // click out of bounds
|
||||||
|
|
||||||
|
|
26
airport.c
26
airport.c
|
@ -9,16 +9,16 @@
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
#include "airport_movement.h"
|
#include "airport_movement.h"
|
||||||
|
|
||||||
static AirportFTAClass* CountryAirport;
|
static AirportFTAClass *CountryAirport;
|
||||||
static AirportFTAClass* CityAirport;
|
static AirportFTAClass *CityAirport;
|
||||||
static AirportFTAClass* Oilrig;
|
static AirportFTAClass *Oilrig;
|
||||||
static AirportFTAClass* Heliport;
|
static AirportFTAClass *Heliport;
|
||||||
static AirportFTAClass* MetropolitanAirport;
|
static AirportFTAClass *MetropolitanAirport;
|
||||||
static AirportFTAClass* InternationalAirport;
|
static AirportFTAClass *InternationalAirport;
|
||||||
static AirportFTAClass* CommuterAirport;
|
static AirportFTAClass *CommuterAirport;
|
||||||
static AirportFTAClass* HeliDepot;
|
static AirportFTAClass *HeliDepot;
|
||||||
static AirportFTAClass* IntercontinentalAirport;
|
static AirportFTAClass *IntercontinentalAirport;
|
||||||
static AirportFTAClass* HeliStation;
|
static AirportFTAClass *HeliStation;
|
||||||
|
|
||||||
static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
|
static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
|
||||||
const byte *terminals, const byte *helipads,
|
const byte *terminals, const byte *helipads,
|
||||||
|
@ -201,7 +201,7 @@ static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
|
||||||
byte nofterminals, nofhelipads;
|
byte nofterminals, nofhelipads;
|
||||||
byte nofterminalgroups = 0;
|
byte nofterminalgroups = 0;
|
||||||
byte nofhelipadgroups = 0;
|
byte nofhelipadgroups = 0;
|
||||||
const byte * curr;
|
const byte *curr;
|
||||||
int i;
|
int i;
|
||||||
nofterminals = nofhelipads = 0;
|
nofterminals = nofhelipads = 0;
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ static void AirportBuildAutomata(AirportFTAClass *Airport, const AirportFTAbuild
|
||||||
|
|
||||||
// outgoing nodes from the same position, create linked list
|
// outgoing nodes from the same position, create linked list
|
||||||
while (current->position == FA[internalcounter + 1].position) {
|
while (current->position == FA[internalcounter + 1].position) {
|
||||||
AirportFTA* newNode = malloc(sizeof(AirportFTA));
|
AirportFTA *newNode = malloc(sizeof(AirportFTA));
|
||||||
|
|
||||||
newNode->position = FA[internalcounter + 1].position;
|
newNode->position = FA[internalcounter + 1].position;
|
||||||
newNode->heading = FA[internalcounter + 1].heading;
|
newNode->heading = FA[internalcounter + 1].heading;
|
||||||
|
@ -444,7 +444,7 @@ static void AirportPrintOut(const AirportFTAClass *Airport, const bool full_repo
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const AirportFTAClass* GetAirport(const byte airport_type)
|
const AirportFTAClass *GetAirport(const byte airport_type)
|
||||||
{
|
{
|
||||||
//FIXME -- AircraftNextAirportPos_and_Order -> Needs something nicer, don't like this code
|
//FIXME -- AircraftNextAirportPos_and_Order -> Needs something nicer, don't like this code
|
||||||
// needs constant change if more airports are added
|
// needs constant change if more airports are added
|
||||||
|
|
|
@ -150,7 +150,7 @@ typedef struct AirportFTA {
|
||||||
|
|
||||||
void InitializeAirports(void);
|
void InitializeAirports(void);
|
||||||
void UnInitializeAirports(void);
|
void UnInitializeAirports(void);
|
||||||
const AirportFTAClass* GetAirport(const byte airport_type);
|
const AirportFTAClass *GetAirport(const byte airport_type);
|
||||||
const AirportMovingData *GetAirportMovingData(byte airport_type, byte position);
|
const AirportMovingData *GetAirportMovingData(byte airport_type, byte position);
|
||||||
|
|
||||||
/** Get buildable airport bitmask.
|
/** Get buildable airport bitmask.
|
||||||
|
|
|
@ -146,7 +146,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
|
||||||
int sel;
|
int sel;
|
||||||
int rad = 4; // default catchment radious
|
int rad = 4; // default catchment radious
|
||||||
uint32 avail_airports;
|
uint32 avail_airports;
|
||||||
const AirportFTAClass* airport;
|
const AirportFTAClass *airport;
|
||||||
|
|
||||||
if (WP(w,def_d).close) return;
|
if (WP(w,def_d).close) return;
|
||||||
|
|
||||||
|
|
26
aystar.c
26
aystar.c
|
@ -25,24 +25,24 @@ int _aystar_stats_closed_size;
|
||||||
|
|
||||||
// This looks in the Hash if a node exists in ClosedList
|
// This looks in the Hash if a node exists in ClosedList
|
||||||
// If so, it returns the PathNode, else NULL
|
// If so, it returns the PathNode, else NULL
|
||||||
static PathNode* AyStarMain_ClosedList_IsInList(AyStar* aystar, const AyStarNode* node)
|
static PathNode* AyStarMain_ClosedList_IsInList(AyStar *aystar, const AyStarNode *node)
|
||||||
{
|
{
|
||||||
return (PathNode*)Hash_Get(&aystar->ClosedListHash, node->tile, node->direction);
|
return (PathNode*)Hash_Get(&aystar->ClosedListHash, node->tile, node->direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This adds a node to the ClosedList
|
// This adds a node to the ClosedList
|
||||||
// It makes a copy of the data
|
// It makes a copy of the data
|
||||||
static void AyStarMain_ClosedList_Add(AyStar* aystar, const PathNode* node)
|
static void AyStarMain_ClosedList_Add(AyStar *aystar, const PathNode *node)
|
||||||
{
|
{
|
||||||
// Add a node to the ClosedList
|
// Add a node to the ClosedList
|
||||||
PathNode* new_node = malloc(sizeof(*new_node));
|
PathNode *new_node = malloc(sizeof(*new_node));
|
||||||
*new_node = *node;
|
*new_node = *node;
|
||||||
Hash_Set(&aystar->ClosedListHash, node->node.tile, node->node.direction, new_node);
|
Hash_Set(&aystar->ClosedListHash, node->node.tile, node->node.direction, new_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if a node is in the OpenList
|
// Checks if a node is in the OpenList
|
||||||
// If so, it returns the OpenListNode, else NULL
|
// If so, it returns the OpenListNode, else NULL
|
||||||
static OpenListNode* AyStarMain_OpenList_IsInList(AyStar* aystar, const AyStarNode* node)
|
static OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, const AyStarNode *node)
|
||||||
{
|
{
|
||||||
return (OpenListNode*)Hash_Get(&aystar->OpenListHash, node->tile, node->direction);
|
return (OpenListNode*)Hash_Get(&aystar->OpenListHash, node->tile, node->direction);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ static OpenListNode* AyStarMain_OpenList_IsInList(AyStar* aystar, const AyStarNo
|
||||||
static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar)
|
static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar)
|
||||||
{
|
{
|
||||||
// Return the item the Queue returns.. the best next OpenList item.
|
// Return the item the Queue returns.. the best next OpenList item.
|
||||||
OpenListNode* res = (OpenListNode*)aystar->OpenListQueue.pop(&aystar->OpenListQueue);
|
OpenListNode *res = (OpenListNode*)aystar->OpenListQueue.pop(&aystar->OpenListQueue);
|
||||||
if (res != NULL) {
|
if (res != NULL) {
|
||||||
Hash_Delete(&aystar->OpenListHash, res->path.node.tile, res->path.node.direction);
|
Hash_Delete(&aystar->OpenListHash, res->path.node.tile, res->path.node.direction);
|
||||||
}
|
}
|
||||||
|
@ -63,10 +63,10 @@ static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar)
|
||||||
|
|
||||||
// Adds a node to the OpenList
|
// Adds a node to the OpenList
|
||||||
// It makes a copy of node, and puts the pointer of parent in the struct
|
// It makes a copy of node, and puts the pointer of parent in the struct
|
||||||
static void AyStarMain_OpenList_Add(AyStar* aystar, PathNode* parent, const AyStarNode* node, int f, int g)
|
static void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, const AyStarNode *node, int f, int g)
|
||||||
{
|
{
|
||||||
// Add a new Node to the OpenList
|
// Add a new Node to the OpenList
|
||||||
OpenListNode* new_node = malloc(sizeof(*new_node));
|
OpenListNode *new_node = malloc(sizeof(*new_node));
|
||||||
new_node->g = g;
|
new_node->g = g;
|
||||||
new_node->path.parent = parent;
|
new_node->path.parent = parent;
|
||||||
new_node->path.node = *node;
|
new_node->path.node = *node;
|
||||||
|
@ -81,7 +81,7 @@ static void AyStarMain_OpenList_Add(AyStar* aystar, PathNode* parent, const AySt
|
||||||
* return values:
|
* return values:
|
||||||
* AYSTAR_DONE : indicates we are done
|
* AYSTAR_DONE : indicates we are done
|
||||||
*/
|
*/
|
||||||
int AyStarMain_CheckTile(AyStar* aystar, AyStarNode* current, OpenListNode* parent)
|
int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
|
||||||
{
|
{
|
||||||
int new_f, new_g, new_h;
|
int new_f, new_g, new_h;
|
||||||
PathNode *closedlist_parent;
|
PathNode *closedlist_parent;
|
||||||
|
@ -147,7 +147,7 @@ int AyStarMain_CheckTile(AyStar* aystar, AyStarNode* current, OpenListNode* pare
|
||||||
* AYSTAR_FOUND_END_NODE : indicates we found the end. Path_found now is true, and in path is the path found.
|
* AYSTAR_FOUND_END_NODE : indicates we found the end. Path_found now is true, and in path is the path found.
|
||||||
* AYSTAR_STILL_BUSY : indicates we have done this tile, did not found the path yet, and have items left to try.
|
* AYSTAR_STILL_BUSY : indicates we have done this tile, did not found the path yet, and have items left to try.
|
||||||
*/
|
*/
|
||||||
int AyStarMain_Loop(AyStar* aystar)
|
int AyStarMain_Loop(AyStar *aystar)
|
||||||
{
|
{
|
||||||
int i, r;
|
int i, r;
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ int AyStarMain_Loop(AyStar* aystar)
|
||||||
/*
|
/*
|
||||||
* This function frees the memory it allocated
|
* This function frees the memory it allocated
|
||||||
*/
|
*/
|
||||||
void AyStarMain_Free(AyStar* aystar)
|
void AyStarMain_Free(AyStar *aystar)
|
||||||
{
|
{
|
||||||
aystar->OpenListQueue.free(&aystar->OpenListQueue, false);
|
aystar->OpenListQueue.free(&aystar->OpenListQueue, false);
|
||||||
/* 2nd argument above is false, below is true, to free the values only
|
/* 2nd argument above is false, below is true, to free the values only
|
||||||
|
@ -207,7 +207,7 @@ void AyStarMain_Free(AyStar* aystar)
|
||||||
* This function make the memory go back to zero
|
* This function make the memory go back to zero
|
||||||
* This function should be called when you are using the same instance again.
|
* This function should be called when you are using the same instance again.
|
||||||
*/
|
*/
|
||||||
void AyStarMain_Clear(AyStar* aystar)
|
void AyStarMain_Clear(AyStar *aystar)
|
||||||
{
|
{
|
||||||
// Clean the Queue, but not the elements within. That will be done by
|
// Clean the Queue, but not the elements within. That will be done by
|
||||||
// the hash.
|
// the hash.
|
||||||
|
@ -266,7 +266,7 @@ int AyStarMain_Main(AyStar *aystar) {
|
||||||
* clear() automatically when the algorithm finishes
|
* clear() automatically when the algorithm finishes
|
||||||
* g is the cost for starting with this node.
|
* g is the cost for starting with this node.
|
||||||
*/
|
*/
|
||||||
void AyStarMain_AddStartNode(AyStar* aystar, AyStarNode* start_node, uint g)
|
void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g)
|
||||||
{
|
{
|
||||||
#ifdef AYSTAR_DEBUG
|
#ifdef AYSTAR_DEBUG
|
||||||
printf("[AyStar] Starting A* Algorithm from node (%d, %d, %d)\n",
|
printf("[AyStar] Starting A* Algorithm from node (%d, %d, %d)\n",
|
||||||
|
@ -275,7 +275,7 @@ void AyStarMain_AddStartNode(AyStar* aystar, AyStarNode* start_node, uint g)
|
||||||
AyStarMain_OpenList_Add(aystar, NULL, start_node, 0, g);
|
AyStarMain_OpenList_Add(aystar, NULL, start_node, 0, g);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_AyStar(AyStar* aystar, Hash_HashProc hash, uint num_buckets)
|
void init_AyStar(AyStar *aystar, Hash_HashProc hash, uint num_buckets)
|
||||||
{
|
{
|
||||||
// Allocated the Hash for the OpenList and ClosedList
|
// Allocated the Hash for the OpenList and ClosedList
|
||||||
init_Hash(&aystar->OpenListHash, hash, num_buckets);
|
init_Hash(&aystar->OpenListHash, hash, num_buckets);
|
||||||
|
|
26
aystar.h
26
aystar.h
|
@ -99,7 +99,7 @@ typedef void AyStar_GetNeighbours(AyStar *aystar, OpenListNode *current);
|
||||||
typedef void AyStar_FoundEndNode(AyStar *aystar, OpenListNode *current);
|
typedef void AyStar_FoundEndNode(AyStar *aystar, OpenListNode *current);
|
||||||
|
|
||||||
// For internal use, see aystar.c
|
// For internal use, see aystar.c
|
||||||
typedef void AyStar_AddStartNode(AyStar *aystar, AyStarNode* start_node, uint g);
|
typedef void AyStar_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g);
|
||||||
typedef int AyStar_Main(AyStar *aystar);
|
typedef int AyStar_Main(AyStar *aystar);
|
||||||
typedef int AyStar_Loop(AyStar *aystar);
|
typedef int AyStar_Loop(AyStar *aystar);
|
||||||
typedef int AyStar_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
typedef int AyStar_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||||
|
@ -112,11 +112,11 @@ struct AyStar {
|
||||||
|
|
||||||
/* These should point to the application specific routines that do the
|
/* These should point to the application specific routines that do the
|
||||||
* actual work */
|
* actual work */
|
||||||
AyStar_CalculateG* CalculateG;
|
AyStar_CalculateG *CalculateG;
|
||||||
AyStar_CalculateH* CalculateH;
|
AyStar_CalculateH *CalculateH;
|
||||||
AyStar_GetNeighbours* GetNeighbours;
|
AyStar_GetNeighbours *GetNeighbours;
|
||||||
AyStar_EndNodeCheck* EndNodeCheck;
|
AyStar_EndNodeCheck *EndNodeCheck;
|
||||||
AyStar_FoundEndNode* FoundEndNode;
|
AyStar_FoundEndNode *FoundEndNode;
|
||||||
|
|
||||||
/* These are completely untouched by AyStar, they can be accesed by
|
/* These are completely untouched by AyStar, they can be accesed by
|
||||||
* the application specific routines to input and output data.
|
* the application specific routines to input and output data.
|
||||||
|
@ -144,12 +144,12 @@ struct AyStar {
|
||||||
|
|
||||||
/* These will contain the methods for manipulating the AyStar. Only
|
/* These will contain the methods for manipulating the AyStar. Only
|
||||||
* main() should be called externally */
|
* main() should be called externally */
|
||||||
AyStar_AddStartNode* addstart;
|
AyStar_AddStartNode *addstart;
|
||||||
AyStar_Main* main;
|
AyStar_Main *main;
|
||||||
AyStar_Loop* loop;
|
AyStar_Loop *loop;
|
||||||
AyStar_Free* free;
|
AyStar_Free *free;
|
||||||
AyStar_Clear* clear;
|
AyStar_Clear *clear;
|
||||||
AyStar_CheckTile* checktile;
|
AyStar_CheckTile *checktile;
|
||||||
|
|
||||||
/* These will contain the open and closed lists */
|
/* These will contain the open and closed lists */
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ void AyStarMain_Clear(AyStar *aystar);
|
||||||
/* Initialize an AyStar. You should fill all appropriate fields before
|
/* Initialize an AyStar. You should fill all appropriate fields before
|
||||||
* callling init_AyStar (see the declaration of AyStar for which fields are
|
* callling init_AyStar (see the declaration of AyStar for which fields are
|
||||||
* internal */
|
* internal */
|
||||||
void init_AyStar(AyStar* aystar, Hash_HashProc hash, uint num_buckets);
|
void init_AyStar(AyStar *aystar, Hash_HashProc hash, uint num_buckets);
|
||||||
|
|
||||||
|
|
||||||
#endif /* AYSTAR_H */
|
#endif /* AYSTAR_H */
|
||||||
|
|
20
console.c
20
console.c
|
@ -59,11 +59,11 @@ static void IConsoleClearCommand(void)
|
||||||
static inline void IConsoleResetHistoryPos(void) {_iconsole_historypos = ICON_HISTORY_SIZE - 1;}
|
static inline void IConsoleResetHistoryPos(void) {_iconsole_historypos = ICON_HISTORY_SIZE - 1;}
|
||||||
|
|
||||||
|
|
||||||
static void IConsoleHistoryAdd(const char* cmd);
|
static void IConsoleHistoryAdd(const char *cmd);
|
||||||
static void IConsoleHistoryNavigate(int direction);
|
static void IConsoleHistoryNavigate(int direction);
|
||||||
|
|
||||||
// ** console window ** //
|
// ** console window ** //
|
||||||
static void IConsoleWndProc(Window* w, WindowEvent* e)
|
static void IConsoleWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
|
@ -255,7 +255,7 @@ static void IConsoleClear(void)
|
||||||
IConsoleClearBuffer();
|
IConsoleClearBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void IConsoleWriteToLogFile(const char* string)
|
static void IConsoleWriteToLogFile(const char *string)
|
||||||
{
|
{
|
||||||
if (_iconsole_output_file != NULL) {
|
if (_iconsole_output_file != NULL) {
|
||||||
// if there is an console output file ... also print it there
|
// if there is an console output file ... also print it there
|
||||||
|
@ -331,7 +331,7 @@ void IConsoleOpen(void) {if (_iconsole_mode == ICONSOLE_CLOSED) IConsoleSwitch(
|
||||||
* scroll, etc. Put it to the beginning as it is the latest text
|
* scroll, etc. Put it to the beginning as it is the latest text
|
||||||
* @param cmd Text to be entered into the 'history'
|
* @param cmd Text to be entered into the 'history'
|
||||||
*/
|
*/
|
||||||
static void IConsoleHistoryAdd(const char* cmd)
|
static void IConsoleHistoryAdd(const char *cmd)
|
||||||
{
|
{
|
||||||
free(_iconsole_history[ICON_HISTORY_SIZE - 1]);
|
free(_iconsole_history[ICON_HISTORY_SIZE - 1]);
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ static void IConsoleHistoryNavigate(int direction)
|
||||||
* @param color_code the colour of the command. Red in case of errors, etc.
|
* @param color_code the colour of the command. Red in case of errors, etc.
|
||||||
* @param string the message entered or output on the console (notice, error, etc.)
|
* @param string the message entered or output on the console (notice, error, etc.)
|
||||||
*/
|
*/
|
||||||
void IConsolePrint(uint16 color_code, const char* string)
|
void IConsolePrint(uint16 color_code, const char *string)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NETWORK
|
#ifdef ENABLE_NETWORK
|
||||||
if (_redirect_console_to_client != 0) {
|
if (_redirect_console_to_client != 0) {
|
||||||
|
@ -433,7 +433,7 @@ void CDECL IConsolePrintF(uint16 color_code, const char *s, ...)
|
||||||
* @debug() in debug.c. You need at least a level 2 (developer) for debugging
|
* @debug() in debug.c. You need at least a level 2 (developer) for debugging
|
||||||
* messages to show up
|
* messages to show up
|
||||||
*/
|
*/
|
||||||
void IConsoleDebug(const char* string)
|
void IConsoleDebug(const char *string)
|
||||||
{
|
{
|
||||||
if (_stdlib_developer > 1)
|
if (_stdlib_developer > 1)
|
||||||
IConsolePrintF(_icolour_dbg, "dbg: %s", string);
|
IConsolePrintF(_icolour_dbg, "dbg: %s", string);
|
||||||
|
@ -444,7 +444,7 @@ void IConsoleDebug(const char* string)
|
||||||
* errors or mishaps, but non-fatal. You need at least a level 1 (developer) for
|
* errors or mishaps, but non-fatal. You need at least a level 1 (developer) for
|
||||||
* debugging messages to show up
|
* debugging messages to show up
|
||||||
*/
|
*/
|
||||||
void IConsoleWarning(const char* string)
|
void IConsoleWarning(const char *string)
|
||||||
{
|
{
|
||||||
if (_stdlib_developer > 0)
|
if (_stdlib_developer > 0)
|
||||||
IConsolePrintF(_icolour_warn, "WARNING: %s", string);
|
IConsolePrintF(_icolour_warn, "WARNING: %s", string);
|
||||||
|
@ -454,7 +454,7 @@ void IConsoleWarning(const char* string)
|
||||||
* It is possible to print error information to the console. This can include
|
* It is possible to print error information to the console. This can include
|
||||||
* game errors, or errors in general you would want the user to notice
|
* game errors, or errors in general you would want the user to notice
|
||||||
*/
|
*/
|
||||||
void IConsoleError(const char* string)
|
void IConsoleError(const char *string)
|
||||||
{
|
{
|
||||||
IConsolePrintF(_icolour_err, "ERROR: %s", string);
|
IConsolePrintF(_icolour_err, "ERROR: %s", string);
|
||||||
}
|
}
|
||||||
|
@ -693,7 +693,7 @@ static inline int IConsoleCopyInParams(char *dst, const char *src, uint bufpos)
|
||||||
* @param tokencount the number of parameters passed
|
* @param tokencount the number of parameters passed
|
||||||
* @param *tokens are the parameters given to the original command (0 is the first param)
|
* @param *tokens are the parameters given to the original command (0 is the first param)
|
||||||
*/
|
*/
|
||||||
static void IConsoleAliasExec(const IConsoleAlias* alias, byte tokencount, char* tokens[ICON_TOKEN_COUNT])
|
static void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char *tokens[ICON_TOKEN_COUNT])
|
||||||
{
|
{
|
||||||
const char *cmdptr;
|
const char *cmdptr;
|
||||||
char *aliases[ICON_MAX_ALIAS_LINES], aliasstream[ICON_MAX_STREAMSIZE];
|
char *aliases[ICON_MAX_ALIAS_LINES], aliasstream[ICON_MAX_STREAMSIZE];
|
||||||
|
@ -859,7 +859,7 @@ static void IConsoleVarSetValue(const IConsoleVar *var, uint32 value)
|
||||||
* @param *var the variable in question
|
* @param *var the variable in question
|
||||||
* @param *value the new value
|
* @param *value the new value
|
||||||
*/
|
*/
|
||||||
static void IConsoleVarSetStringvalue(const IConsoleVar* var, const char* value)
|
static void IConsoleVarSetStringvalue(const IConsoleVar *var, const char *value)
|
||||||
{
|
{
|
||||||
if (var->type != ICONSOLE_VAR_STRING || var->addr == NULL) return;
|
if (var->type != ICONSOLE_VAR_STRING || var->addr == NULL) return;
|
||||||
|
|
||||||
|
|
2
elrail.c
2
elrail.c
|
@ -126,7 +126,7 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override)
|
||||||
* @param tile The tile to analyse
|
* @param tile The tile to analyse
|
||||||
* @param *tileh the tileh
|
* @param *tileh the tileh
|
||||||
*/
|
*/
|
||||||
static void AdjustTileh(TileIndex tile, Slope* tileh)
|
static void AdjustTileh(TileIndex tile, Slope *tileh)
|
||||||
{
|
{
|
||||||
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
|
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
|
||||||
if (IsTunnel(tile)) {
|
if (IsTunnel(tile)) {
|
||||||
|
|
16
engine.c
16
engine.c
|
@ -240,7 +240,7 @@ void EnginesDailyLoop(void)
|
||||||
if (_cur_year >= 130) return;
|
if (_cur_year >= 130) return;
|
||||||
|
|
||||||
for (i = 0; i != lengthof(_engines); i++) {
|
for (i = 0; i != lengthof(_engines); i++) {
|
||||||
Engine* e = &_engines[i];
|
Engine *e = &_engines[i];
|
||||||
|
|
||||||
if (e->flags & ENGINE_INTRODUCING) {
|
if (e->flags & ENGINE_INTRODUCING) {
|
||||||
if (e->flags & ENGINE_PREVIEWING) {
|
if (e->flags & ENGINE_PREVIEWING) {
|
||||||
|
@ -489,7 +489,7 @@ static EngineRenew *AllocateEngineRenew(void)
|
||||||
* engine type from the given renewlist */
|
* engine type from the given renewlist */
|
||||||
static EngineRenew *GetEngineReplacement(EngineRenewList erl, EngineID engine)
|
static EngineRenew *GetEngineReplacement(EngineRenewList erl, EngineID engine)
|
||||||
{
|
{
|
||||||
EngineRenew* er = (EngineRenew*)erl; /* Fetch first element */
|
EngineRenew *er = (EngineRenew*)erl; /* Fetch first element */
|
||||||
while (er) {
|
while (er) {
|
||||||
if (er->from == engine) return er;
|
if (er->from == engine) return er;
|
||||||
er = er->next;
|
er = er->next;
|
||||||
|
@ -497,9 +497,9 @@ static EngineRenew *GetEngineReplacement(EngineRenewList erl, EngineID engine)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveAllEngineReplacement(EngineRenewList* erl)
|
void RemoveAllEngineReplacement(EngineRenewList *erl)
|
||||||
{
|
{
|
||||||
EngineRenew* er = (EngineRenew*)(*erl); /* Fetch first element */
|
EngineRenew *er = (EngineRenew*)(*erl); /* Fetch first element */
|
||||||
while (er) {
|
while (er) {
|
||||||
er->from = INVALID_ENGINE; /* "Deallocate" all elements */
|
er->from = INVALID_ENGINE; /* "Deallocate" all elements */
|
||||||
er = er->next;
|
er = er->next;
|
||||||
|
@ -513,7 +513,7 @@ EngineID EngineReplacement(EngineRenewList erl, EngineID engine)
|
||||||
return er == NULL ? INVALID_ENGINE : er->to;
|
return er == NULL ? INVALID_ENGINE : er->to;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID new_engine, uint32 flags)
|
int32 AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, uint32 flags)
|
||||||
{
|
{
|
||||||
EngineRenew *er;
|
EngineRenew *er;
|
||||||
|
|
||||||
|
@ -538,10 +538,10 @@ int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID n
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 RemoveEngineReplacement(EngineRenewList* erl, EngineID engine, uint32 flags)
|
int32 RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, uint32 flags)
|
||||||
{
|
{
|
||||||
EngineRenew* er = (EngineRenew*)(*erl); /* Start at the first element */
|
EngineRenew *er = (EngineRenew*)(*erl); /* Start at the first element */
|
||||||
EngineRenew* prev = NULL;
|
EngineRenew *prev = NULL;
|
||||||
|
|
||||||
while (er)
|
while (er)
|
||||||
{
|
{
|
||||||
|
|
36
gfx.c
36
gfx.c
|
@ -677,8 +677,8 @@ void DrawSprite(uint32 img, int x, int y)
|
||||||
|
|
||||||
typedef struct BlitterParams {
|
typedef struct BlitterParams {
|
||||||
int start_x, start_y;
|
int start_x, start_y;
|
||||||
const byte* sprite;
|
const byte *sprite;
|
||||||
const byte* sprite_org;
|
const byte *sprite_org;
|
||||||
Pixel *dst;
|
Pixel *dst;
|
||||||
int mode;
|
int mode;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
@ -690,12 +690,12 @@ typedef struct BlitterParams {
|
||||||
|
|
||||||
static void GfxBlitTileZoomIn(BlitterParams *bp)
|
static void GfxBlitTileZoomIn(BlitterParams *bp)
|
||||||
{
|
{
|
||||||
const byte* src_o = bp->sprite;
|
const byte *src_o = bp->sprite;
|
||||||
const byte* src;
|
const byte *src;
|
||||||
int num, skip;
|
int num, skip;
|
||||||
byte done;
|
byte done;
|
||||||
Pixel *dst;
|
Pixel *dst;
|
||||||
const byte* ctab;
|
const byte *ctab;
|
||||||
|
|
||||||
if (bp->mode & 1) {
|
if (bp->mode & 1) {
|
||||||
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
|
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
|
||||||
|
@ -892,12 +892,12 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp)
|
||||||
|
|
||||||
static void GfxBlitTileZoomMedium(BlitterParams *bp)
|
static void GfxBlitTileZoomMedium(BlitterParams *bp)
|
||||||
{
|
{
|
||||||
const byte* src_o = bp->sprite;
|
const byte *src_o = bp->sprite;
|
||||||
const byte* src;
|
const byte *src;
|
||||||
int num, skip;
|
int num, skip;
|
||||||
byte done;
|
byte done;
|
||||||
Pixel *dst;
|
Pixel *dst;
|
||||||
const byte* ctab;
|
const byte *ctab;
|
||||||
|
|
||||||
if (bp->mode & 1) {
|
if (bp->mode & 1) {
|
||||||
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
|
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
|
||||||
|
@ -1097,12 +1097,12 @@ static void GfxBlitZoomMediumUncomp(BlitterParams *bp)
|
||||||
|
|
||||||
static void GfxBlitTileZoomOut(BlitterParams *bp)
|
static void GfxBlitTileZoomOut(BlitterParams *bp)
|
||||||
{
|
{
|
||||||
const byte* src_o = bp->sprite;
|
const byte *src_o = bp->sprite;
|
||||||
const byte* src;
|
const byte *src;
|
||||||
int num, skip;
|
int num, skip;
|
||||||
byte done;
|
byte done;
|
||||||
Pixel *dst;
|
Pixel *dst;
|
||||||
const byte* ctab;
|
const byte *ctab;
|
||||||
|
|
||||||
if (bp->mode & 1) {
|
if (bp->mode & 1) {
|
||||||
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
|
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
|
||||||
|
@ -1313,7 +1313,7 @@ static void GfxBlitTileZoomOut(BlitterParams *bp)
|
||||||
|
|
||||||
static void GfxBlitZoomOutUncomp(BlitterParams *bp)
|
static void GfxBlitZoomOutUncomp(BlitterParams *bp)
|
||||||
{
|
{
|
||||||
const byte* src = bp->sprite;
|
const byte *src = bp->sprite;
|
||||||
Pixel *dst = bp->dst;
|
Pixel *dst = bp->dst;
|
||||||
int height = bp->height;
|
int height = bp->height;
|
||||||
int width = bp->width;
|
int width = bp->width;
|
||||||
|
@ -1361,9 +1361,9 @@ static void GfxBlitZoomOutUncomp(BlitterParams *bp)
|
||||||
|
|
||||||
typedef void (*BlitZoomFunc)(BlitterParams *bp);
|
typedef void (*BlitZoomFunc)(BlitterParams *bp);
|
||||||
|
|
||||||
static void GfxMainBlitter(const Sprite* sprite, int x, int y, int mode)
|
static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode)
|
||||||
{
|
{
|
||||||
const DrawPixelInfo* dpi = _cur_dpi;
|
const DrawPixelInfo *dpi = _cur_dpi;
|
||||||
int start_x, start_y;
|
int start_x, start_y;
|
||||||
byte info;
|
byte info;
|
||||||
BlitterParams bp;
|
BlitterParams bp;
|
||||||
|
@ -1496,8 +1496,8 @@ void GfxInitPalettes(void)
|
||||||
|
|
||||||
void DoPaletteAnimations(void)
|
void DoPaletteAnimations(void)
|
||||||
{
|
{
|
||||||
const Colour* s;
|
const Colour *s;
|
||||||
Colour* d;
|
Colour *d;
|
||||||
/* Amount of colors to be rotated.
|
/* Amount of colors to be rotated.
|
||||||
* A few more for the DOS palette, because the water colors are
|
* A few more for the DOS palette, because the water colors are
|
||||||
* 245-254 for DOS and 217-226 for Windows. */
|
* 245-254 for DOS and 217-226 for Windows. */
|
||||||
|
@ -1712,7 +1712,7 @@ void DrawMouseCursor(void)
|
||||||
static void DbgScreenRect(int left, int top, int right, int bottom)
|
static void DbgScreenRect(int left, int top, int right, int bottom)
|
||||||
{
|
{
|
||||||
DrawPixelInfo dp;
|
DrawPixelInfo dp;
|
||||||
DrawPixelInfo* old;
|
DrawPixelInfo *old;
|
||||||
|
|
||||||
old = _cur_dpi;
|
old = _cur_dpi;
|
||||||
_cur_dpi = &dp;
|
_cur_dpi = &dp;
|
||||||
|
@ -1864,7 +1864,7 @@ void MarkWholeScreenDirty(void)
|
||||||
SetDirtyBlocks(0, 0, _screen.width, _screen.height);
|
SetDirtyBlocks(0, 0, _screen.width, _screen.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FillDrawPixelInfo(DrawPixelInfo* n, const DrawPixelInfo* o, int left, int top, int width, int height)
|
bool FillDrawPixelInfo(DrawPixelInfo *n, const DrawPixelInfo *o, int left, int top, int width, int height)
|
||||||
{
|
{
|
||||||
int t;
|
int t;
|
||||||
|
|
||||||
|
|
10
gui.h
10
gui.h
|
@ -41,9 +41,9 @@ void PlaceProc_BuyLand(TileIndex tile);
|
||||||
/* train_gui.c */
|
/* train_gui.c */
|
||||||
void ShowPlayerTrains(PlayerID player, StationID station);
|
void ShowPlayerTrains(PlayerID player, StationID station);
|
||||||
void ShowTrainViewWindow(const Vehicle *v);
|
void ShowTrainViewWindow(const Vehicle *v);
|
||||||
void ShowOrdersWindow(const Vehicle* v);
|
void ShowOrdersWindow(const Vehicle *v);
|
||||||
|
|
||||||
void ShowRoadVehViewWindow(const Vehicle* v);
|
void ShowRoadVehViewWindow(const Vehicle *v);
|
||||||
|
|
||||||
/* road_gui.c */
|
/* road_gui.c */
|
||||||
void ShowBuildRoadToolbar(void);
|
void ShowBuildRoadToolbar(void);
|
||||||
|
@ -54,7 +54,7 @@ void ShowPlayerRoadVehicles(PlayerID player, StationID station);
|
||||||
void ShowBuildDocksToolbar(void);
|
void ShowBuildDocksToolbar(void);
|
||||||
void ShowPlayerShips(PlayerID player, StationID station);
|
void ShowPlayerShips(PlayerID player, StationID station);
|
||||||
|
|
||||||
void ShowShipViewWindow(const Vehicle* v);
|
void ShowShipViewWindow(const Vehicle *v);
|
||||||
|
|
||||||
/* aircraft_gui.c */
|
/* aircraft_gui.c */
|
||||||
void ShowBuildAirToolbar(void);
|
void ShowBuildAirToolbar(void);
|
||||||
|
@ -93,7 +93,7 @@ void ShowEstimatedCostOrIncome(int32 cost, int x, int y);
|
||||||
void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y);
|
void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y);
|
||||||
|
|
||||||
void DrawStationCoverageAreaText(int sx, int sy, uint mask,int rad);
|
void DrawStationCoverageAreaText(int sx, int sy, uint mask,int rad);
|
||||||
void CheckRedrawStationCoverage(const Window* w);
|
void CheckRedrawStationCoverage(const Window *w);
|
||||||
|
|
||||||
void ShowSmallMap(void);
|
void ShowSmallMap(void);
|
||||||
void ShowExtraViewPortWindow(void);
|
void ShowExtraViewPortWindow(void);
|
||||||
|
@ -134,7 +134,7 @@ enum {
|
||||||
ZOOM_NONE = 2, // hack, used to update the button status
|
ZOOM_NONE = 2, // hack, used to update the button status
|
||||||
};
|
};
|
||||||
|
|
||||||
bool DoZoomInOutWindow(int how, Window * w);
|
bool DoZoomInOutWindow(int how, Window *w);
|
||||||
void ShowBuildIndustryWindow(void);
|
void ShowBuildIndustryWindow(void);
|
||||||
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WindowClass window_class, WindowNumber window_number);
|
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WindowClass window_class, WindowNumber window_number);
|
||||||
void ShowMusicWindow(void);
|
void ShowMusicWindow(void);
|
||||||
|
|
|
@ -279,7 +279,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
const Industry* i = GetIndustry(w->window_number);
|
const Industry *i = GetIndustry(w->window_number);
|
||||||
|
|
||||||
SetDParam(0, w->window_number);
|
SetDParam(0, w->window_number);
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
|
@ -433,7 +433,7 @@ static const WindowDesc _industry_view_desc = {
|
||||||
|
|
||||||
void ShowIndustryViewWindow(int industry)
|
void ShowIndustryViewWindow(int industry)
|
||||||
{
|
{
|
||||||
Window* w = AllocateWindowDescFront(&_industry_view_desc, industry);
|
Window *w = AllocateWindowDescFront(&_industry_view_desc, industry);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
w->flags4 |= WF_DISABLE_VP_SCROLL;
|
w->flags4 |= WF_DISABLE_VP_SCROLL;
|
||||||
|
@ -571,7 +571,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
while (p < _num_industry_sort) {
|
while (p < _num_industry_sort) {
|
||||||
const Industry* i = GetIndustry(_industry_sort[p]);
|
const Industry *i = GetIndustry(_industry_sort[p]);
|
||||||
|
|
||||||
SetDParam(0, i->index);
|
SetDParam(0, i->index);
|
||||||
if (i->produced_cargo[0] != CT_INVALID) {
|
if (i->produced_cargo[0] != CT_INVALID) {
|
||||||
|
@ -658,7 +658,7 @@ static const WindowDesc _industry_directory_desc = {
|
||||||
|
|
||||||
void ShowIndustryDirectory(void)
|
void ShowIndustryDirectory(void)
|
||||||
{
|
{
|
||||||
Window* w = AllocateWindowDescFront(&_industry_directory_desc, 0);
|
Window *w = AllocateWindowDescFront(&_industry_directory_desc, 0);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
w->vscroll.cap = 16;
|
w->vscroll.cap = 16;
|
||||||
|
|
|
@ -156,7 +156,7 @@ static const Widget _ask_abandon_game_widgets[] = {
|
||||||
{ WIDGETS_END },
|
{ WIDGETS_END },
|
||||||
};
|
};
|
||||||
|
|
||||||
static void AskAbandonGameWndProc(Window* w, WindowEvent* e)
|
static void AskAbandonGameWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
|
@ -220,7 +220,7 @@ static const Widget _ask_quit_game_widgets[] = {
|
||||||
{ WIDGETS_END },
|
{ WIDGETS_END },
|
||||||
};
|
};
|
||||||
|
|
||||||
static void AskQuitGameWndProc(Window* w, WindowEvent* e)
|
static void AskQuitGameWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
|
|
28
main_gui.c
28
main_gui.c
|
@ -537,7 +537,7 @@ static const Widget _player_menu_widgets[] = {
|
||||||
static int GetPlayerIndexFromMenu(int index)
|
static int GetPlayerIndexFromMenu(int index)
|
||||||
{
|
{
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
const Player* p;
|
const Player *p;
|
||||||
|
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (p->is_active && --index < 0) return p->index;
|
if (p->is_active && --index < 0) return p->index;
|
||||||
|
@ -549,7 +549,7 @@ static int GetPlayerIndexFromMenu(int index)
|
||||||
static void UpdatePlayerMenuHeight(Window *w)
|
static void UpdatePlayerMenuHeight(Window *w)
|
||||||
{
|
{
|
||||||
uint num = 0;
|
uint num = 0;
|
||||||
const Player* p;
|
const Player *p;
|
||||||
|
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (p->is_active) num++;
|
if (p->is_active) num++;
|
||||||
|
@ -786,7 +786,7 @@ static void ToolbarIndustryClick(Window *w)
|
||||||
|
|
||||||
static void ToolbarTrainClick(Window *w)
|
static void ToolbarTrainClick(Window *w)
|
||||||
{
|
{
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
int dis = -1;
|
int dis = -1;
|
||||||
|
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
|
@ -797,7 +797,7 @@ static void ToolbarTrainClick(Window *w)
|
||||||
|
|
||||||
static void ToolbarRoadClick(Window *w)
|
static void ToolbarRoadClick(Window *w)
|
||||||
{
|
{
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
int dis = -1;
|
int dis = -1;
|
||||||
|
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
|
@ -808,7 +808,7 @@ static void ToolbarRoadClick(Window *w)
|
||||||
|
|
||||||
static void ToolbarShipClick(Window *w)
|
static void ToolbarShipClick(Window *w)
|
||||||
{
|
{
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
int dis = -1;
|
int dis = -1;
|
||||||
|
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
|
@ -819,7 +819,7 @@ static void ToolbarShipClick(Window *w)
|
||||||
|
|
||||||
static void ToolbarAirClick(Window *w)
|
static void ToolbarAirClick(Window *w)
|
||||||
{
|
{
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
int dis = -1;
|
int dis = -1;
|
||||||
|
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
|
@ -869,7 +869,7 @@ bool DoZoomInOutWindow(int how, Window *w)
|
||||||
|
|
||||||
// routine to disable/enable the zoom buttons. Didn't know where to place these otherwise
|
// routine to disable/enable the zoom buttons. Didn't know where to place these otherwise
|
||||||
{
|
{
|
||||||
Window* wt = NULL;
|
Window *wt = NULL;
|
||||||
|
|
||||||
switch (w->window_class) {
|
switch (w->window_class) {
|
||||||
case WC_MAIN_WINDOW:
|
case WC_MAIN_WINDOW:
|
||||||
|
@ -920,7 +920,7 @@ static void ToolbarZoomOutClick(Window *w)
|
||||||
|
|
||||||
static void ToolbarBuildRailClick(Window *w)
|
static void ToolbarBuildRailClick(Window *w)
|
||||||
{
|
{
|
||||||
const Player* p = GetPlayer(_local_player);
|
const Player *p = GetPlayer(_local_player);
|
||||||
Window *w2;
|
Window *w2;
|
||||||
w2 = PopupMainToolbMenu(w, 457, 19, STR_1015_RAILROAD_CONSTRUCTION, RAILTYPE_END, ~p->avail_railtypes);
|
w2 = PopupMainToolbMenu(w, 457, 19, STR_1015_RAILROAD_CONSTRUCTION, RAILTYPE_END, ~p->avail_railtypes);
|
||||||
WP(w2,menu_d).sel_index = _last_built_railtype;
|
WP(w2,menu_d).sel_index = _last_built_railtype;
|
||||||
|
@ -1032,7 +1032,7 @@ static void ToolbarScenZoomOut(Window *w)
|
||||||
|
|
||||||
void ZoomInOrOutToCursorWindow(bool in, Window *w)
|
void ZoomInOrOutToCursorWindow(bool in, Window *w)
|
||||||
{
|
{
|
||||||
ViewPort * vp;
|
ViewPort *vp;
|
||||||
Point pt;
|
Point pt;
|
||||||
|
|
||||||
assert(w != 0);
|
assert(w != 0);
|
||||||
|
@ -1629,7 +1629,7 @@ static const Widget _scenedit_industry_candy_widgets[] = {
|
||||||
|
|
||||||
static bool AnyTownExists(void)
|
static bool AnyTownExists(void)
|
||||||
{
|
{
|
||||||
const Town* t;
|
const Town *t;
|
||||||
|
|
||||||
FOR_ALL_TOWNS(t) {
|
FOR_ALL_TOWNS(t) {
|
||||||
if (t->xy != 0) return true;
|
if (t->xy != 0) return true;
|
||||||
|
@ -1809,7 +1809,7 @@ static void ToolbarBtn_NULL(Window *w)
|
||||||
|
|
||||||
typedef void ToolbarButtonProc(Window *w);
|
typedef void ToolbarButtonProc(Window *w);
|
||||||
|
|
||||||
static ToolbarButtonProc* const _toolbar_button_procs[] = {
|
static ToolbarButtonProc * const _toolbar_button_procs[] = {
|
||||||
ToolbarPauseClick,
|
ToolbarPauseClick,
|
||||||
ToolbarFastForwardClick,
|
ToolbarFastForwardClick,
|
||||||
ToolbarOptionsClick,
|
ToolbarOptionsClick,
|
||||||
|
@ -2016,7 +2016,7 @@ static const Widget _toolb_scen_widgets[] = {
|
||||||
{WIDGETS_END},
|
{WIDGETS_END},
|
||||||
};
|
};
|
||||||
|
|
||||||
static ToolbarButtonProc* const _scen_toolbar_button_procs[] = {
|
static ToolbarButtonProc * const _scen_toolbar_button_procs[] = {
|
||||||
ToolbarPauseClick,
|
ToolbarPauseClick,
|
||||||
ToolbarFastForwardClick,
|
ToolbarFastForwardClick,
|
||||||
ToolbarOptionsClick,
|
ToolbarOptionsClick,
|
||||||
|
@ -2274,7 +2274,7 @@ static WindowDesc _main_status_desc = {
|
||||||
|
|
||||||
extern void UpdateAllStationVirtCoord(void);
|
extern void UpdateAllStationVirtCoord(void);
|
||||||
|
|
||||||
static void MainWindowWndProc(Window* w, WindowEvent* e)
|
static void MainWindowWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
int off_x;
|
int off_x;
|
||||||
|
|
||||||
|
@ -2392,7 +2392,7 @@ void SetupColorsAndInitialWindow(void)
|
||||||
int width,height;
|
int width,height;
|
||||||
|
|
||||||
for (i = 0; i != 16; i++) {
|
for (i = 0; i != 16; i++) {
|
||||||
const byte* b = GetNonSprite(PALETTE_RECOLOR_START + i);
|
const byte *b = GetNonSprite(PALETTE_RECOLOR_START + i);
|
||||||
|
|
||||||
assert(b);
|
assert(b);
|
||||||
_color_list[i] = *(const ColorList*)(b + 0xC6);
|
_color_list[i] = *(const ColorList*)(b + 0xC6);
|
||||||
|
|
14
misc_gui.c
14
misc_gui.c
|
@ -43,7 +43,7 @@ typedef struct LandInfoData {
|
||||||
static void LandInfoWndProc(Window *w, WindowEvent *e)
|
static void LandInfoWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
if (e->event == WE_PAINT) {
|
if (e->event == WE_PAINT) {
|
||||||
const LandInfoData* lid;
|
const LandInfoData *lid;
|
||||||
StringID str;
|
StringID str;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ static void ErrmsgWndProc(Window *w, WindowEvent *e)
|
||||||
_errmsg_message_1,
|
_errmsg_message_1,
|
||||||
238);
|
238);
|
||||||
} else {
|
} else {
|
||||||
const Player* p = GetPlayer(GetDParamX(_errmsg_decode_params,2));
|
const Player *p = GetPlayer(GetDParamX(_errmsg_decode_params,2));
|
||||||
DrawPlayerFace(p->face, p->player_color, 2, 16);
|
DrawPlayerFace(p->face, p->player_color, 2, 16);
|
||||||
|
|
||||||
DrawStringMultiCenter(
|
DrawStringMultiCenter(
|
||||||
|
@ -718,7 +718,7 @@ void DrawStationCoverageAreaText(int sx, int sy, uint mask, int rad) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckRedrawStationCoverage(const Window* w)
|
void CheckRedrawStationCoverage(const Window *w)
|
||||||
{
|
{
|
||||||
if (_thd.dirty & 1) {
|
if (_thd.dirty & 1) {
|
||||||
_thd.dirty &= ~1;
|
_thd.dirty &= ~1;
|
||||||
|
@ -1218,7 +1218,7 @@ static void GenerateFileName(void)
|
||||||
{
|
{
|
||||||
/* Check if we are not a specatator who wants to generate a name..
|
/* Check if we are not a specatator who wants to generate a name..
|
||||||
Let's use the name of player #0 for now. */
|
Let's use the name of player #0 for now. */
|
||||||
const Player* p = GetPlayer(_local_player < MAX_PLAYERS ? _local_player : 0);
|
const Player *p = GetPlayer(_local_player < MAX_PLAYERS ? _local_player : 0);
|
||||||
|
|
||||||
SetDParam(0, p->name_1);
|
SetDParam(0, p->name_1);
|
||||||
SetDParam(1, p->name_2);
|
SetDParam(1, p->name_2);
|
||||||
|
@ -1274,7 +1274,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
y = w->widget[7].top + 1;
|
y = w->widget[7].top + 1;
|
||||||
for (pos = w->vscroll.pos; pos < _fios_num; pos++) {
|
for (pos = w->vscroll.pos; pos < _fios_num; pos++) {
|
||||||
const FiosItem* item = _fios_list + pos;
|
const FiosItem *item = _fios_list + pos;
|
||||||
|
|
||||||
DoDrawStringTruncated(item->title, 4, y, _fios_colors[item->type], w->width - 18);
|
DoDrawStringTruncated(item->title, 4, y, _fios_colors[item->type], w->width - 18);
|
||||||
y += 10;
|
y += 10;
|
||||||
|
@ -1503,7 +1503,7 @@ static const Widget _select_scenario_widgets[] = {
|
||||||
{ WIDGETS_END},
|
{ WIDGETS_END},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void SelectScenarioWndProc(Window* w, WindowEvent* e)
|
static void SelectScenarioWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
const int list_start = 45;
|
const int list_start = 45;
|
||||||
|
|
||||||
|
@ -1560,7 +1560,7 @@ static void SelectScenarioWndProc(Window* w, WindowEvent* e)
|
||||||
GenRandomNewGame(Random(), InteractiveRandom());
|
GenRandomNewGame(Random(), InteractiveRandom());
|
||||||
} else {
|
} else {
|
||||||
int y = (e->click.pt.y - list_start) / 10;
|
int y = (e->click.pt.y - list_start) / 10;
|
||||||
const char* name;
|
const char *name;
|
||||||
const FiosItem *file;
|
const FiosItem *file;
|
||||||
|
|
||||||
if (y < 0 || (y += w->vscroll.pos) >= w->vscroll.count) return;
|
if (y < 0 || (y += w->vscroll.pos) >= w->vscroll.count) return;
|
||||||
|
|
|
@ -100,7 +100,7 @@ enum {
|
||||||
// called when a new server is found on the network
|
// called when a new server is found on the network
|
||||||
void UpdateNetworkGameWindow(bool unselect)
|
void UpdateNetworkGameWindow(bool unselect)
|
||||||
{
|
{
|
||||||
Window* w = FindWindowById(WC_NETWORK_WINDOW, 0);
|
Window *w = FindWindowById(WC_NETWORK_WINDOW, 0);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
if (unselect) WP(w, network_ql_d).n.server = NULL;
|
if (unselect) WP(w, network_ql_d).n.server = NULL;
|
||||||
|
@ -183,7 +183,7 @@ static void BuildNetworkGameList(network_ql_d *nqld)
|
||||||
|
|
||||||
static void SortNetworkGameList(network_ql_d *nqld)
|
static void SortNetworkGameList(network_ql_d *nqld)
|
||||||
{
|
{
|
||||||
static NGameNameSortFunction* const ngame_sorter[] = {
|
static NGameNameSortFunction * const ngame_sorter[] = {
|
||||||
&NGameNameSorter,
|
&NGameNameSorter,
|
||||||
&NGameClientSorter,
|
&NGameClientSorter,
|
||||||
&NGameAllowedSorter
|
&NGameAllowedSorter
|
||||||
|
@ -564,7 +564,7 @@ void ShowNetworkGameWindow(void)
|
||||||
|
|
||||||
w = AllocateWindowDesc(&_network_game_window_desc);
|
w = AllocateWindowDesc(&_network_game_window_desc);
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
querystr_d* querystr = &WP(w, network_ql_d).q;
|
querystr_d *querystr = &WP(w, network_ql_d).q;
|
||||||
|
|
||||||
ttd_strlcpy(_edit_str_buf, _network_player_name, lengthof(_edit_str_buf));
|
ttd_strlcpy(_edit_str_buf, _network_player_name, lengthof(_edit_str_buf));
|
||||||
w->vscroll.cap = 12;
|
w->vscroll.cap = 12;
|
||||||
|
@ -1052,9 +1052,9 @@ static WindowDesc _client_list_desc = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Finds the Xth client-info that is active
|
// Finds the Xth client-info that is active
|
||||||
static const NetworkClientInfo* NetworkFindClientInfo(byte client_no)
|
static const NetworkClientInfo *NetworkFindClientInfo(byte client_no)
|
||||||
{
|
{
|
||||||
const NetworkClientInfo* ci;
|
const NetworkClientInfo *ci;
|
||||||
|
|
||||||
for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) {
|
for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) {
|
||||||
// Skip non-active items
|
// Skip non-active items
|
||||||
|
@ -1174,7 +1174,7 @@ static uint ClientListPopupHeigth(void) {
|
||||||
static Window *PopupClientList(Window *w, int client_no, int x, int y)
|
static Window *PopupClientList(Window *w, int client_no, int x, int y)
|
||||||
{
|
{
|
||||||
int i, h;
|
int i, h;
|
||||||
const NetworkClientInfo* ci;
|
const NetworkClientInfo *ci;
|
||||||
DeleteWindowById(WC_TOOLBAR_MENU, 0);
|
DeleteWindowById(WC_TOOLBAR_MENU, 0);
|
||||||
|
|
||||||
// Clean the current actions
|
// Clean the current actions
|
||||||
|
@ -1476,7 +1476,7 @@ static byte _chat_type;
|
||||||
static byte _chat_dest;
|
static byte _chat_dest;
|
||||||
|
|
||||||
|
|
||||||
static void SendChat(const char* buf)
|
static void SendChat(const char *buf)
|
||||||
{
|
{
|
||||||
if (buf[0] == '\0') return;
|
if (buf[0] == '\0') return;
|
||||||
if (!_network_server) {
|
if (!_network_server) {
|
||||||
|
|
|
@ -459,7 +459,7 @@ static void MoveToNexItem(void)
|
||||||
|
|
||||||
switch (GetNewsDisplayValue(ni->type)) {
|
switch (GetNewsDisplayValue(ni->type)) {
|
||||||
case 0: { /* Off - show nothing only a small reminder in the status bar */
|
case 0: { /* Off - show nothing only a small reminder in the status bar */
|
||||||
Window* w = FindWindowById(WC_STATUS_BAR, 0);
|
Window *w = FindWindowById(WC_STATUS_BAR, 0);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
WP(w, def_d).data_2 = 91;
|
WP(w, def_d).data_2 = 91;
|
||||||
|
@ -866,7 +866,7 @@ void DeleteVehicleNews(VehicleID vid, StringID news)
|
||||||
if (ni->flags & NF_VEHICLE &&
|
if (ni->flags & NF_VEHICLE &&
|
||||||
ni->data_a == vid &&
|
ni->data_a == vid &&
|
||||||
(news == INVALID_STRING_ID || ni->string_id == news)) {
|
(news == INVALID_STRING_ID || ni->string_id == news)) {
|
||||||
Window* w;
|
Window *w;
|
||||||
byte i;
|
byte i;
|
||||||
|
|
||||||
if (_forced_news == n) MoveToNexItem();
|
if (_forced_news == n) MoveToNexItem();
|
||||||
|
|
16
openttd.c
16
openttd.c
|
@ -68,7 +68,7 @@ extern void ShowOSErrorBox(const char *buf);
|
||||||
* caused by the user, i.e. missing files or fatal configuration errors.
|
* caused by the user, i.e. missing files or fatal configuration errors.
|
||||||
* Post-0.4.0 since Celestar doesn't want this in SVN before. --pasky */
|
* Post-0.4.0 since Celestar doesn't want this in SVN before. --pasky */
|
||||||
|
|
||||||
void CDECL error(const char* s, ...)
|
void CDECL error(const char *s, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
char buf[512];
|
char buf[512];
|
||||||
|
@ -230,7 +230,7 @@ md_continue_here:;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ParseResolution(int res[2], const char* s)
|
static void ParseResolution(int res[2], const char *s)
|
||||||
{
|
{
|
||||||
char *t = strchr(s, 'x');
|
char *t = strchr(s, 'x');
|
||||||
if (t == NULL) {
|
if (t == NULL) {
|
||||||
|
@ -310,7 +310,7 @@ static void LoadIntroGame(void)
|
||||||
extern void DedicatedFork(void);
|
extern void DedicatedFork(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ttd_main(int argc, char* argv[])
|
int ttd_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
MyGetOptData mgo;
|
MyGetOptData mgo;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1001,7 +1001,7 @@ void GameLoop(void)
|
||||||
|
|
||||||
void BeforeSaveGame(void)
|
void BeforeSaveGame(void)
|
||||||
{
|
{
|
||||||
const Window* w = FindWindowById(WC_MAIN_WINDOW, 0);
|
const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
_saved_scrollpos_x = WP(w, const vp_d).scrollpos_x;
|
_saved_scrollpos_x = WP(w, const vp_d).scrollpos_x;
|
||||||
|
@ -1034,7 +1034,7 @@ static void ConvertTownOwner(void)
|
||||||
// before savegame version 4, the name of the company determined if it existed
|
// before savegame version 4, the name of the company determined if it existed
|
||||||
static void CheckIsPlayerActive(void)
|
static void CheckIsPlayerActive(void)
|
||||||
{
|
{
|
||||||
Player* p;
|
Player *p;
|
||||||
|
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (p->name_1 != 0) p->is_active = true;
|
if (p->name_1 != 0) p->is_active = true;
|
||||||
|
@ -1044,7 +1044,7 @@ static void CheckIsPlayerActive(void)
|
||||||
// since savegame version 4.1, exclusive transport rights are stored at towns
|
// since savegame version 4.1, exclusive transport rights are stored at towns
|
||||||
static void UpdateExclusiveRights(void)
|
static void UpdateExclusiveRights(void)
|
||||||
{
|
{
|
||||||
Town* t;
|
Town *t;
|
||||||
|
|
||||||
FOR_ALL_TOWNS(t) {
|
FOR_ALL_TOWNS(t) {
|
||||||
if (t->xy != 0) t->exclusivity = (byte)-1;
|
if (t->xy != 0) t->exclusivity = (byte)-1;
|
||||||
|
@ -1264,13 +1264,13 @@ bool AfterLoadGame(void)
|
||||||
|
|
||||||
/* Elrails got added in rev 24 */
|
/* Elrails got added in rev 24 */
|
||||||
if (CheckSavegameVersion(24)) {
|
if (CheckSavegameVersion(24)) {
|
||||||
Vehicle* v;
|
Vehicle *v;
|
||||||
uint i;
|
uint i;
|
||||||
TileIndex t;
|
TileIndex t;
|
||||||
RailType min_rail = RAILTYPE_ELECTRIC;
|
RailType min_rail = RAILTYPE_ELECTRIC;
|
||||||
|
|
||||||
for (i = 0; i < lengthof(_engines); i++) {
|
for (i = 0; i < lengthof(_engines); i++) {
|
||||||
Engine* e = GetEngine(i);
|
Engine *e = GetEngine(i);
|
||||||
if (e->type == VEH_Train &&
|
if (e->type == VEH_Train &&
|
||||||
(e->railtype != RAILTYPE_RAIL || RailVehInfo(i)->engclass == 2)) {
|
(e->railtype != RAILTYPE_RAIL || RailVehInfo(i)->engclass == 2)) {
|
||||||
e->railtype++;
|
e->railtype++;
|
||||||
|
|
34
order_gui.c
34
order_gui.c
|
@ -22,9 +22,9 @@
|
||||||
#include "train.h"
|
#include "train.h"
|
||||||
#include "water_map.h"
|
#include "water_map.h"
|
||||||
|
|
||||||
static int OrderGetSel(const Window* w)
|
static int OrderGetSel(const Window *w)
|
||||||
{
|
{
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
int num = WP(w,order_d).sel;
|
int num = WP(w,order_d).sel;
|
||||||
|
|
||||||
return (num >= 0 && num < v->num_orders) ? num : v->num_orders;
|
return (num >= 0 && num < v->num_orders) ? num : v->num_orders;
|
||||||
|
@ -259,7 +259,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
|
|
||||||
if (IsTileType(tile, MP_STATION)) {
|
if (IsTileType(tile, MP_STATION)) {
|
||||||
StationID st_index = GetStationIndex(tile);
|
StationID st_index = GetStationIndex(tile);
|
||||||
const Station* st = GetStation(st_index);
|
const Station *st = GetStation(st_index);
|
||||||
|
|
||||||
if (st->owner == _current_player || st->owner == OWNER_NONE) {
|
if (st->owner == _current_player || st->owner == OWNER_NONE) {
|
||||||
byte facil;
|
byte facil;
|
||||||
|
@ -284,7 +284,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandleOrderVehClick(const Vehicle* v, const Vehicle* u, Window* w)
|
static bool HandleOrderVehClick(const Vehicle *v, const Vehicle *u, Window *w)
|
||||||
{
|
{
|
||||||
if (u->type != v->type) return false;
|
if (u->type != v->type) return false;
|
||||||
|
|
||||||
|
@ -306,10 +306,10 @@ static bool HandleOrderVehClick(const Vehicle* v, const Vehicle* u, Window* w)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OrdersPlaceObj(const Vehicle* v, TileIndex tile, Window* w)
|
static void OrdersPlaceObj(const Vehicle *v, TileIndex tile, Window *w)
|
||||||
{
|
{
|
||||||
Order cmd;
|
Order cmd;
|
||||||
const Vehicle* u;
|
const Vehicle *u;
|
||||||
|
|
||||||
// check if we're clicking on a vehicle first.. clone orders in that case.
|
// check if we're clicking on a vehicle first.. clone orders in that case.
|
||||||
u = CheckMouseOverVehicle();
|
u = CheckMouseOverVehicle();
|
||||||
|
@ -324,7 +324,7 @@ static void OrdersPlaceObj(const Vehicle* v, TileIndex tile, Window* w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OrderClick_Goto(Window* w, const Vehicle* v)
|
static void OrderClick_Goto(Window *w, const Vehicle *v)
|
||||||
{
|
{
|
||||||
InvalidateWidget(w, 7);
|
InvalidateWidget(w, 7);
|
||||||
TOGGLEBIT(w->click_state, 7);
|
TOGGLEBIT(w->click_state, 7);
|
||||||
|
@ -336,17 +336,17 @@ static void OrderClick_Goto(Window* w, const Vehicle* v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OrderClick_FullLoad(Window* w, const Vehicle* v)
|
static void OrderClick_FullLoad(Window *w, const Vehicle *v)
|
||||||
{
|
{
|
||||||
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_FULL_LOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_FULL_LOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OrderClick_Unload(Window* w, const Vehicle* v)
|
static void OrderClick_Unload(Window *w, const Vehicle *v)
|
||||||
{
|
{
|
||||||
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_UNLOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_UNLOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OrderClick_Nonstop(Window* w, const Vehicle* v)
|
static void OrderClick_Nonstop(Window *w, const Vehicle *v)
|
||||||
{
|
{
|
||||||
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_NON_STOP, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_NON_STOP, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
||||||
}
|
}
|
||||||
|
@ -356,19 +356,19 @@ static void OrderClick_Transfer(Window* w, const Vehicle* v)
|
||||||
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_TRANSFER, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_TRANSFER, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OrderClick_Skip(Window* w, const Vehicle* v)
|
static void OrderClick_Skip(Window *w, const Vehicle *v)
|
||||||
{
|
{
|
||||||
DoCommandP(v->tile, v->index, 0, NULL, CMD_SKIP_ORDER);
|
DoCommandP(v->tile, v->index, 0, NULL, CMD_SKIP_ORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OrderClick_Delete(Window* w, const Vehicle* v)
|
static void OrderClick_Delete(Window *w, const Vehicle *v)
|
||||||
{
|
{
|
||||||
DoCommandP(v->tile, v->index, OrderGetSel(w), NULL, CMD_DELETE_ORDER | CMD_MSG(STR_8834_CAN_T_DELETE_THIS_ORDER));
|
DoCommandP(v->tile, v->index, OrderGetSel(w), NULL, CMD_DELETE_ORDER | CMD_MSG(STR_8834_CAN_T_DELETE_THIS_ORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void OnButtonClick(Window* w, const Vehicle* v);
|
typedef void OnButtonVehClick(Window *w, const Vehicle *v);
|
||||||
|
|
||||||
static OnButtonClick* const _order_button_proc[] = {
|
static OnButtonVehClick* const _order_button_proc[] = {
|
||||||
OrderClick_Skip,
|
OrderClick_Skip,
|
||||||
OrderClick_Delete,
|
OrderClick_Delete,
|
||||||
OrderClick_Nonstop,
|
OrderClick_Nonstop,
|
||||||
|
@ -469,7 +469,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
case WE_RCLICK: {
|
case WE_RCLICK: {
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
int s = OrderGetSel(w);
|
int s = OrderGetSel(w);
|
||||||
|
|
||||||
if (e->click.widget != 8) break;
|
if (e->click.widget != 8) break;
|
||||||
|
@ -491,7 +491,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
// check if a vehicle in a depot was clicked..
|
// check if a vehicle in a depot was clicked..
|
||||||
case WE_MOUSELOOP: {
|
case WE_MOUSELOOP: {
|
||||||
const Vehicle* v = _place_clicked_vehicle;
|
const Vehicle *v = _place_clicked_vehicle;
|
||||||
/*
|
/*
|
||||||
* Check if we clicked on a vehicle
|
* Check if we clicked on a vehicle
|
||||||
* and if the GOTO button of this window is pressed
|
* and if the GOTO button of this window is pressed
|
||||||
|
@ -587,7 +587,7 @@ static const WindowDesc _other_orders_desc = {
|
||||||
OrdersWndProc
|
OrdersWndProc
|
||||||
};
|
};
|
||||||
|
|
||||||
void ShowOrdersWindow(const Vehicle* v)
|
void ShowOrdersWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
VehicleID veh = v->index;
|
VehicleID veh = v->index;
|
||||||
|
|
14
player_gui.c
14
player_gui.c
|
@ -151,7 +151,7 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
PlayerID player = w->window_number;
|
PlayerID player = w->window_number;
|
||||||
const Player* p = GetPlayer(player);
|
const Player *p = GetPlayer(player);
|
||||||
|
|
||||||
w->disabled_state = p->current_loan != 0 ? 0 : (1 << 7);
|
w->disabled_state = p->current_loan != 0 ? 0 : (1 << 7);
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ static void SelectPlayerColorWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
const Player* p;
|
const Player *p;
|
||||||
uint used_colors = 0;
|
uint used_colors = 0;
|
||||||
int num_free = 16;
|
int num_free = 16;
|
||||||
int x,y,pos;
|
int x,y,pos;
|
||||||
|
@ -421,7 +421,7 @@ static void DrawPlayerVehiclesAmount(PlayerID player)
|
||||||
{
|
{
|
||||||
const int x = 110;
|
const int x = 110;
|
||||||
int y = 72;
|
int y = 72;
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
uint train = 0;
|
uint train = 0;
|
||||||
uint road = 0;
|
uint road = 0;
|
||||||
uint air = 0;
|
uint air = 0;
|
||||||
|
@ -479,7 +479,7 @@ int GetAmountOwnedBy(const Player *p, PlayerID owner)
|
||||||
|
|
||||||
static void DrawCompanyOwnerText(const Player *p)
|
static void DrawCompanyOwnerText(const Player *p)
|
||||||
{
|
{
|
||||||
const Player* p2;
|
const Player *p2;
|
||||||
int num = -1;
|
int num = -1;
|
||||||
|
|
||||||
FOR_ALL_PLAYERS(p2) {
|
FOR_ALL_PLAYERS(p2) {
|
||||||
|
@ -502,7 +502,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
const Player* p = GetPlayer(w->window_number);
|
const Player *p = GetPlayer(w->window_number);
|
||||||
uint32 dis = 0;
|
uint32 dis = 0;
|
||||||
|
|
||||||
if (!IsWindowOfPrototype(w, _other_player_company_widgets)) {
|
if (!IsWindowOfPrototype(w, _other_player_company_widgets)) {
|
||||||
|
@ -577,7 +577,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case 5: {/* change president name */
|
case 5: {/* change president name */
|
||||||
const Player* p = GetPlayer(w->window_number);
|
const Player *p = GetPlayer(w->window_number);
|
||||||
WP(w, def_d).byte_1 = 0;
|
WP(w, def_d).byte_1 = 0;
|
||||||
SetDParam(0, p->president_name_2);
|
SetDParam(0, p->president_name_2);
|
||||||
ShowQueryString(p->president_name_1, STR_700B_PRESIDENT_S_NAME, 31, 94, w->window_class, w->window_number);
|
ShowQueryString(p->president_name_1, STR_700B_PRESIDENT_S_NAME, 31, 94, w->window_class, w->window_number);
|
||||||
|
@ -686,7 +686,7 @@ static const WindowDesc _other_player_company_desc = {
|
||||||
|
|
||||||
void ShowPlayerCompany(PlayerID player)
|
void ShowPlayerCompany(PlayerID player)
|
||||||
{
|
{
|
||||||
Window* w;
|
Window *w;
|
||||||
|
|
||||||
w = AllocateWindowDescFront(player == _local_player ? &_my_player_company_desc : &_other_player_company_desc, player);
|
w = AllocateWindowDescFront(player == _local_player ? &_my_player_company_desc : &_other_player_company_desc, player);
|
||||||
if (w != NULL) w->caption_color = w->window_number;
|
if (w != NULL) w->caption_color = w->window_number;
|
||||||
|
|
|
@ -555,7 +555,7 @@ typedef enum {
|
||||||
* @param railtype the railtype to display
|
* @param railtype the railtype to display
|
||||||
* @param w the window to modify
|
* @param w the window to modify
|
||||||
*/
|
*/
|
||||||
static void SetupRailToolbar(RailType railtype, Window* w)
|
static void SetupRailToolbar(RailType railtype, Window *w)
|
||||||
{
|
{
|
||||||
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ static OnButtonClick* const _build_road_button_proc[] = {
|
||||||
BuildRoadClick_Landscaping,
|
BuildRoadClick_Landscaping,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void BuildRoadToolbWndProc(Window* w, WindowEvent* e)
|
static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
|
@ -346,7 +346,7 @@ void ShowBuildRoadScenToolbar(void)
|
||||||
AllocateWindowDescFront(&_build_road_scen_desc, 0);
|
AllocateWindowDescFront(&_build_road_scen_desc, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BuildRoadDepotWndProc(Window* w, WindowEvent* e)
|
static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number)
|
void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number)
|
||||||
{
|
{
|
||||||
const RoadVehicleInfo *rvi = RoadVehInfo(engine_number);
|
const RoadVehicleInfo *rvi = RoadVehInfo(engine_number);
|
||||||
const Engine* e = GetEngine(engine_number);
|
const Engine *e = GetEngine(engine_number);
|
||||||
bool refittable = (_engine_info[engine_number].refit_mask != 0);
|
bool refittable = (_engine_info[engine_number].refit_mask != 0);
|
||||||
YearMonthDay ymd;
|
YearMonthDay ymd;
|
||||||
ConvertDayToYMD(&ymd, e->intro_date);
|
ConvertDayToYMD(&ymd, e->intro_date);
|
||||||
|
@ -286,7 +286,7 @@ static const WindowDesc _roadveh_details_desc = {
|
||||||
RoadVehDetailsWndProc
|
RoadVehDetailsWndProc
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ShowRoadVehDetailsWindow(const Vehicle* v)
|
static void ShowRoadVehDetailsWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
VehicleID veh = v->index;
|
VehicleID veh = v->index;
|
||||||
|
@ -365,7 +365,7 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
|
|
||||||
switch (e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 5: /* start stop */
|
case 5: /* start stop */
|
||||||
|
@ -410,7 +410,7 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_MOUSELOOP:
|
||||||
{
|
{
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
uint32 h = IsRoadVehInDepotStopped(v) ? 1 << 7 | 1 << 8 : 1 << 11 | 1 << 12;
|
uint32 h = IsRoadVehInDepotStopped(v) ? 1 << 7 | 1 << 8 : 1 << 11 | 1 << 12;
|
||||||
|
|
||||||
if (h != w->hidden_state) {
|
if (h != w->hidden_state) {
|
||||||
|
@ -448,9 +448,9 @@ static const WindowDesc _roadveh_view_desc = {
|
||||||
RoadVehViewWndProc,
|
RoadVehViewWndProc,
|
||||||
};
|
};
|
||||||
|
|
||||||
void ShowRoadVehViewWindow(const Vehicle* v)
|
void ShowRoadVehViewWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window* w = AllocateWindowDescFront(&_roadveh_view_desc, v->index);
|
Window *w = AllocateWindowDescFront(&_roadveh_view_desc, v->index);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
w->caption_color = v->owner;
|
w->caption_color = v->owner;
|
||||||
|
@ -468,7 +468,7 @@ static void DrawNewRoadVehWindow(Window *w)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int num = NUM_ROAD_ENGINES;
|
int num = NUM_ROAD_ENGINES;
|
||||||
const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
|
const Engine *e = GetEngine(ROAD_ENGINES_INDEX);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (HASBIT(e->player_avail, _local_player))
|
if (HASBIT(e->player_avail, _local_player))
|
||||||
|
@ -481,7 +481,7 @@ static void DrawNewRoadVehWindow(Window *w)
|
||||||
|
|
||||||
{
|
{
|
||||||
int num = NUM_ROAD_ENGINES;
|
int num = NUM_ROAD_ENGINES;
|
||||||
const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
|
const Engine *e = GetEngine(ROAD_ENGINES_INDEX);
|
||||||
int x = 1;
|
int x = 1;
|
||||||
int y = 15;
|
int y = 15;
|
||||||
int sel = WP(w,buildtrain_d).sel_index;
|
int sel = WP(w,buildtrain_d).sel_index;
|
||||||
|
@ -510,7 +510,7 @@ static void DrawNewRoadVehWindow(Window *w)
|
||||||
|
|
||||||
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
|
|
||||||
if (!success) return;
|
if (!success) return;
|
||||||
|
|
||||||
|
@ -735,7 +735,7 @@ static void RoadDepotClickVeh(Window *w, int x, int y)
|
||||||
* @param *v is the original vehicle to clone
|
* @param *v is the original vehicle to clone
|
||||||
* @param *w is the window of the depot where the clone is build
|
* @param *w is the window of the depot where the clone is build
|
||||||
*/
|
*/
|
||||||
static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
static void HandleCloneVehClick(const Vehicle *v, const Window *w)
|
||||||
{
|
{
|
||||||
if (v == NULL || v->type != VEH_Road) return;
|
if (v == NULL || v->type != VEH_Road) return;
|
||||||
|
|
||||||
|
@ -746,9 +746,9 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClonePlaceObj(const Window* w)
|
static void ClonePlaceObj(const Window *w)
|
||||||
{
|
{
|
||||||
const Vehicle* v = CheckMouseOverVehicle();
|
const Vehicle *v = CheckMouseOverVehicle();
|
||||||
|
|
||||||
if (v != NULL) HandleCloneVehClick(v, w);
|
if (v != NULL) HandleCloneVehClick(v, w);
|
||||||
}
|
}
|
||||||
|
@ -801,7 +801,7 @@ static void RoadDepotWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
// check if a vehicle in a depot was clicked..
|
// check if a vehicle in a depot was clicked..
|
||||||
case WE_MOUSELOOP: {
|
case WE_MOUSELOOP: {
|
||||||
const Vehicle* v = _place_clicked_vehicle;
|
const Vehicle *v = _place_clicked_vehicle;
|
||||||
|
|
||||||
// since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button
|
// since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button
|
||||||
if (v != NULL && HASBIT(w->click_state, 8)) {
|
if (v != NULL && HASBIT(w->click_state, 8)) {
|
||||||
|
@ -891,7 +891,7 @@ static const WindowDesc _road_depot_desc = {
|
||||||
|
|
||||||
void ShowRoadDepotWindow(TileIndex tile)
|
void ShowRoadDepotWindow(TileIndex tile)
|
||||||
{
|
{
|
||||||
Window* w = AllocateWindowDescFront(&_road_depot_desc, tile);
|
Window *w = AllocateWindowDescFront(&_road_depot_desc, tile);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
w->caption_color = GetTileOwner(w->window_number);
|
w->caption_color = GetTileOwner(w->window_number);
|
||||||
|
@ -960,7 +960,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
/* draw the widgets */
|
/* draw the widgets */
|
||||||
if (station == INVALID_STATION) {
|
if (station == INVALID_STATION) {
|
||||||
const Player* p = GetPlayer(owner);
|
const Player *p = GetPlayer(owner);
|
||||||
|
|
||||||
/* Company Name -- (###) Road vehicles */
|
/* Company Name -- (###) Road vehicles */
|
||||||
SetDParam(0, p->name_1);
|
SetDParam(0, p->name_1);
|
||||||
|
@ -1024,7 +1024,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
|
||||||
return;
|
return;
|
||||||
case 7: { /* Matrix to show vehicles */
|
case 7: { /* Matrix to show vehicles */
|
||||||
uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_SMALL;
|
uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_SMALL;
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
|
|
||||||
if (id_v >= w->vscroll.cap) return; // click out of bounds
|
if (id_v >= w->vscroll.cap) return; // click out of bounds
|
||||||
|
|
||||||
|
|
38
ship_gui.c
38
ship_gui.c
|
@ -30,7 +30,7 @@ void DrawShipPurchaseInfo(int x, int y, EngineID engine_number)
|
||||||
{
|
{
|
||||||
YearMonthDay ymd;
|
YearMonthDay ymd;
|
||||||
const ShipVehicleInfo *svi = ShipVehInfo(engine_number);
|
const ShipVehicleInfo *svi = ShipVehInfo(engine_number);
|
||||||
const Engine* e;
|
const Engine *e;
|
||||||
|
|
||||||
/* Purchase cost - Max speed */
|
/* Purchase cost - Max speed */
|
||||||
SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5);
|
SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5);
|
||||||
|
@ -138,7 +138,7 @@ static const WindowDesc _ship_refit_desc = {
|
||||||
ShipRefitWndProc,
|
ShipRefitWndProc,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ShowShipRefitWindow(const Vehicle* v)
|
static void ShowShipRefitWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ static const WindowDesc _ship_details_desc = {
|
||||||
ShipDetailsWndProc
|
ShipDetailsWndProc
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ShowShipDetailsWindow(const Vehicle* v)
|
static void ShowShipDetailsWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
VehicleID veh = v->index;
|
VehicleID veh = v->index;
|
||||||
|
@ -297,7 +297,7 @@ static void ShowShipDetailsWindow(const Vehicle* v)
|
||||||
|
|
||||||
void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
if (!success) return;
|
if (!success) return;
|
||||||
|
|
||||||
v = GetVehicle(_new_vehicle_id);
|
v = GetVehicle(_new_vehicle_id);
|
||||||
|
@ -323,7 +323,7 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int num = NUM_SHIP_ENGINES;
|
int num = NUM_SHIP_ENGINES;
|
||||||
const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
|
const Engine *e = GetEngine(SHIP_ENGINES_INDEX);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (HASBIT(e->player_avail, _local_player)) count++;
|
if (HASBIT(e->player_avail, _local_player)) count++;
|
||||||
|
@ -335,7 +335,7 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
{
|
{
|
||||||
int num = NUM_SHIP_ENGINES;
|
int num = NUM_SHIP_ENGINES;
|
||||||
const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
|
const Engine *e = GetEngine(SHIP_ENGINES_INDEX);
|
||||||
int x = 2;
|
int x = 2;
|
||||||
int y = 15;
|
int y = 15;
|
||||||
int sel = WP(w,buildtrain_d).sel_index;
|
int sel = WP(w,buildtrain_d).sel_index;
|
||||||
|
@ -448,7 +448,7 @@ static void ShowBuildShipWindow(TileIndex tile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ShipViewWndProc(Window* w, WindowEvent* e)
|
static void ShipViewWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
|
@ -511,7 +511,7 @@ static void ShipViewWndProc(Window* w, WindowEvent* e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
|
|
||||||
switch (e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 5: /* start stop */
|
case 5: /* start stop */
|
||||||
|
@ -554,7 +554,7 @@ static void ShipViewWndProc(Window* w, WindowEvent* e)
|
||||||
|
|
||||||
case WE_MOUSELOOP:
|
case WE_MOUSELOOP:
|
||||||
{
|
{
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
uint32 h = IsShipInDepot(v) ? 1 << 7 : 1 << 11;
|
uint32 h = IsShipInDepot(v) ? 1 << 7 : 1 << 11;
|
||||||
|
|
||||||
if (h != w->hidden_state) {
|
if (h != w->hidden_state) {
|
||||||
|
@ -591,9 +591,9 @@ static const WindowDesc _ship_view_desc = {
|
||||||
ShipViewWndProc
|
ShipViewWndProc
|
||||||
};
|
};
|
||||||
|
|
||||||
void ShowShipViewWindow(const Vehicle* v)
|
void ShowShipViewWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window* w = AllocateWindowDescFront(&_ship_view_desc, v->index);
|
Window *w = AllocateWindowDescFront(&_ship_view_desc, v->index);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
w->caption_color = v->owner;
|
w->caption_color = v->owner;
|
||||||
|
@ -722,7 +722,7 @@ static void ShipDepotClick(Window *w, int x, int y)
|
||||||
* @param *v is the original vehicle to clone
|
* @param *v is the original vehicle to clone
|
||||||
* @param *w is the window of the depot where the clone is build
|
* @param *w is the window of the depot where the clone is build
|
||||||
*/
|
*/
|
||||||
static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
static void HandleCloneVehClick(const Vehicle *v, const Window *w)
|
||||||
{
|
{
|
||||||
if (v == NULL || v->type != VEH_Ship) return;
|
if (v == NULL || v->type != VEH_Ship) return;
|
||||||
|
|
||||||
|
@ -733,14 +733,14 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClonePlaceObj(const Window* w)
|
static void ClonePlaceObj(const Window *w)
|
||||||
{
|
{
|
||||||
const Vehicle* v = CheckMouseOverVehicle();
|
const Vehicle *v = CheckMouseOverVehicle();
|
||||||
|
|
||||||
if (v != NULL) HandleCloneVehClick(v, w);
|
if (v != NULL) HandleCloneVehClick(v, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShipDepotWndProc(Window* w, WindowEvent* e)
|
static void ShipDepotWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
|
@ -788,7 +788,7 @@ static void ShipDepotWndProc(Window* w, WindowEvent* e)
|
||||||
|
|
||||||
// check if a vehicle in a depot was clicked..
|
// check if a vehicle in a depot was clicked..
|
||||||
case WE_MOUSELOOP: {
|
case WE_MOUSELOOP: {
|
||||||
const Vehicle* v = _place_clicked_vehicle;
|
const Vehicle *v = _place_clicked_vehicle;
|
||||||
|
|
||||||
// since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button
|
// since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button
|
||||||
if (v != NULL && HASBIT(w->click_state, 8)) {
|
if (v != NULL && HASBIT(w->click_state, 8)) {
|
||||||
|
@ -875,7 +875,7 @@ static const WindowDesc _ship_depot_desc = {
|
||||||
|
|
||||||
void ShowShipDepotWindow(TileIndex tile)
|
void ShowShipDepotWindow(TileIndex tile)
|
||||||
{
|
{
|
||||||
Window* w = AllocateWindowDescFront(&_ship_depot_desc,tile);
|
Window *w = AllocateWindowDescFront(&_ship_depot_desc,tile);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
w->caption_color = GetTileOwner(w->window_number);
|
w->caption_color = GetTileOwner(w->window_number);
|
||||||
|
@ -889,7 +889,7 @@ void ShowShipDepotWindow(TileIndex tile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void DrawSmallOrderList(const Vehicle* v, int x, int y)
|
static void DrawSmallOrderList(const Vehicle *v, int x, int y)
|
||||||
{
|
{
|
||||||
const Order *order;
|
const Order *order;
|
||||||
int sel, i = 0;
|
int sel, i = 0;
|
||||||
|
@ -1035,7 +1035,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
|
||||||
return;
|
return;
|
||||||
case 7: { /* Matrix to show vehicles */
|
case 7: { /* Matrix to show vehicles */
|
||||||
uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG;
|
uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG;
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
|
|
||||||
if (id_v >= w->vscroll.cap) return; // click out of bounds
|
if (id_v >= w->vscroll.cap) return; // click out of bounds
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ static const uint16 * const _legend_table[] = {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */
|
/* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */
|
||||||
static inline void WRITE_PIXELS_OR(Pixel* d, uint32 val)
|
static inline void WRITE_PIXELS_OR(Pixel *d, uint32 val)
|
||||||
{
|
{
|
||||||
# if defined(TTD_BIG_ENDIAN)
|
# if defined(TTD_BIG_ENDIAN)
|
||||||
d[0] |= GB(val, 24, 8);
|
d[0] |= GB(val, 24, 8);
|
||||||
|
@ -262,7 +262,7 @@ typedef struct AndOr {
|
||||||
uint32 mand;
|
uint32 mand;
|
||||||
} AndOr;
|
} AndOr;
|
||||||
|
|
||||||
static inline uint32 ApplyMask(uint32 colour, const AndOr* mask)
|
static inline uint32 ApplyMask(uint32 colour, const AndOr *mask)
|
||||||
{
|
{
|
||||||
return (colour & mask->mand) | mask->mor;
|
return (colour & mask->mand) | mask->mor;
|
||||||
}
|
}
|
||||||
|
@ -605,7 +605,7 @@ static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_town
|
||||||
|
|
||||||
/* setup owner table */
|
/* setup owner table */
|
||||||
if (type == 5) {
|
if (type == 5) {
|
||||||
const Player* p;
|
const Player *p;
|
||||||
|
|
||||||
/* fill with some special colors */
|
/* fill with some special colors */
|
||||||
_owner_colors[OWNER_TOWN] = MKCOLOR(0xB4B4B4B4);
|
_owner_colors[OWNER_TOWN] = MKCOLOR(0xB4B4B4B4);
|
||||||
|
@ -672,7 +672,7 @@ static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_town
|
||||||
reps = (dpi->height - y + 1) / 2;
|
reps = (dpi->height - y + 1) / 2;
|
||||||
if (reps > 0) {
|
if (reps > 0) {
|
||||||
// assert(ptr >= dpi->dst_ptr);
|
// assert(ptr >= dpi->dst_ptr);
|
||||||
DrawSmallMapStuff(ptr, tile_x, tile_y, dpi->pitch*2, reps, mask, _smallmap_draw_procs[type]);
|
DrawSmallMapStuff(ptr, tile_x, tile_y, dpi->pitch * 2, reps, mask, _smallmap_draw_procs[type]);
|
||||||
}
|
}
|
||||||
|
|
||||||
skip_column:
|
skip_column:
|
||||||
|
@ -963,7 +963,7 @@ static void ExtraViewPortWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case 8: { /* inverse location button (move this view to same spot as main view) 'Copy Location' */
|
case 8: { /* inverse location button (move this view to same spot as main view) 'Copy Location' */
|
||||||
const Window* w2 = FindWindowById(WC_MAIN_WINDOW, 0);
|
const Window *w2 = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||||
int x = WP(w2, const vp_d).scrollpos_x;
|
int x = WP(w2, const vp_d).scrollpos_x;
|
||||||
int y = WP(w2, const vp_d).scrollpos_y;
|
int y = WP(w2, const vp_d).scrollpos_y;
|
||||||
|
|
||||||
|
|
12
sound.c
12
sound.c
|
@ -20,7 +20,7 @@ typedef struct FileEntry {
|
||||||
} FileEntry;
|
} FileEntry;
|
||||||
|
|
||||||
static uint _file_count;
|
static uint _file_count;
|
||||||
static FileEntry* _files;
|
static FileEntry *_files;
|
||||||
|
|
||||||
#define SOUND_SLOT 63
|
#define SOUND_SLOT 63
|
||||||
// Number of levels of panning per side
|
// Number of levels of panning per side
|
||||||
|
@ -29,7 +29,7 @@ static FileEntry* _files;
|
||||||
|
|
||||||
static void OpenBankFile(const char *filename)
|
static void OpenBankFile(const char *filename)
|
||||||
{
|
{
|
||||||
FileEntry* fe;
|
FileEntry *fe;
|
||||||
uint count;
|
uint count;
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ static void OpenBankFile(const char *filename)
|
||||||
|
|
||||||
static bool SetBankSource(MixerChannel *mc, uint bank)
|
static bool SetBankSource(MixerChannel *mc, uint bank)
|
||||||
{
|
{
|
||||||
const FileEntry* fe;
|
const FileEntry *fe;
|
||||||
int8* mem;
|
int8 *mem;
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
if (bank >= _file_count) return false;
|
if (bank >= _file_count) return false;
|
||||||
|
@ -136,7 +136,7 @@ bool SoundInitialize(const char *filename)
|
||||||
// Low level sound player
|
// Low level sound player
|
||||||
static void StartSound(uint sound, int panning, uint volume)
|
static void StartSound(uint sound, int panning, uint volume)
|
||||||
{
|
{
|
||||||
MixerChannel* mc;
|
MixerChannel *mc;
|
||||||
uint left_vol, right_vol;
|
uint left_vol, right_vol;
|
||||||
|
|
||||||
if (volume == 0) return;
|
if (volume == 0) return;
|
||||||
|
@ -182,7 +182,7 @@ static const byte _sound_idx[] = {
|
||||||
|
|
||||||
static void SndPlayScreenCoordFx(SoundFx sound, int x, int y)
|
static void SndPlayScreenCoordFx(SoundFx sound, int x, int y)
|
||||||
{
|
{
|
||||||
const Window* w;
|
const Window *w;
|
||||||
|
|
||||||
if (msf.effect_vol == 0) return;
|
if (msf.effect_vol == 0) return;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
static void HandleSubsidyClick(int y)
|
static void HandleSubsidyClick(int y)
|
||||||
{
|
{
|
||||||
const Subsidy* s;
|
const Subsidy *s;
|
||||||
uint num;
|
uint num;
|
||||||
int offs;
|
int offs;
|
||||||
TileIndex xy;
|
TileIndex xy;
|
||||||
|
@ -73,10 +73,10 @@ handle_click:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DrawSubsidiesWindow(const Window* w)
|
static void DrawSubsidiesWindow(const Window *w)
|
||||||
{
|
{
|
||||||
YearMonthDay ymd;
|
YearMonthDay ymd;
|
||||||
const Subsidy* s;
|
const Subsidy *s;
|
||||||
uint num;
|
uint num;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
@ -116,7 +116,7 @@ static void DrawSubsidiesWindow(const Window* w)
|
||||||
|
|
||||||
for (s = _subsidies; s != endof(_subsidies); s++) {
|
for (s = _subsidies; s != endof(_subsidies); s++) {
|
||||||
if (s->cargo_type != CT_INVALID && s->age >= 12) {
|
if (s->cargo_type != CT_INVALID && s->age >= 12) {
|
||||||
const Player* p;
|
const Player *p;
|
||||||
int xt;
|
int xt;
|
||||||
|
|
||||||
SetupSubsidyDecodeParam(s, 1);
|
SetupSubsidyDecodeParam(s, 1);
|
||||||
|
|
10
town_gui.c
10
town_gui.c
|
@ -110,7 +110,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
const Player* p;
|
const Player *p;
|
||||||
int r;
|
int r;
|
||||||
StringID str;
|
StringID str;
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ static const WindowDesc _town_authority_desc = {
|
||||||
|
|
||||||
static void ShowTownAuthorityWindow(uint town)
|
static void ShowTownAuthorityWindow(uint town)
|
||||||
{
|
{
|
||||||
Window* w = AllocateWindowDescFront(&_town_authority_desc, town);
|
Window *w = AllocateWindowDescFront(&_town_authority_desc, town);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
w->vscroll.cap = 5;
|
w->vscroll.cap = 5;
|
||||||
|
@ -442,7 +442,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
|
||||||
DoDrawString(_town_sort_order & 1 ? DOWNARROW : UPARROW, (_town_sort_order <= 1) ? 88 : 187, 15, 0x10);
|
DoDrawString(_town_sort_order & 1 ? DOWNARROW : UPARROW, (_town_sort_order <= 1) ? 88 : 187, 15, 0x10);
|
||||||
|
|
||||||
{
|
{
|
||||||
const Town* t;
|
const Town *t;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
uint16 i = w->vscroll.pos;
|
uint16 i = w->vscroll.pos;
|
||||||
int y = 28;
|
int y = 28;
|
||||||
|
@ -489,7 +489,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
|
||||||
if (id_v >= _num_town_sort) return; // click out of town bounds
|
if (id_v >= _num_town_sort) return; // click out of town bounds
|
||||||
|
|
||||||
{
|
{
|
||||||
const Town* t = GetTown(_town_sort[id_v]);
|
const Town *t = GetTown(_town_sort[id_v]);
|
||||||
assert(t->xy);
|
assert(t->xy);
|
||||||
|
|
||||||
ScrollMainWindowToTile(t->xy);
|
ScrollMainWindowToTile(t->xy);
|
||||||
|
@ -519,7 +519,7 @@ static const WindowDesc _town_directory_desc = {
|
||||||
|
|
||||||
void ShowTownDirectory(void)
|
void ShowTownDirectory(void)
|
||||||
{
|
{
|
||||||
Window* w = AllocateWindowDescFront(&_town_directory_desc, 0);
|
Window *w = AllocateWindowDescFront(&_town_directory_desc, 0);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
w->vscroll.cap = 16;
|
w->vscroll.cap = 16;
|
||||||
|
|
28
train_gui.c
28
train_gui.c
|
@ -30,7 +30,7 @@
|
||||||
void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number)
|
void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number)
|
||||||
{
|
{
|
||||||
const RailVehicleInfo *rvi = RailVehInfo(engine_number);
|
const RailVehicleInfo *rvi = RailVehInfo(engine_number);
|
||||||
const Engine* e = GetEngine(engine_number);
|
const Engine *e = GetEngine(engine_number);
|
||||||
int multihead = (rvi->flags&RVI_MULTIHEAD?1:0);
|
int multihead = (rvi->flags&RVI_MULTIHEAD?1:0);
|
||||||
YearMonthDay ymd;
|
YearMonthDay ymd;
|
||||||
ConvertDayToYMD(&ymd, e->intro_date);
|
ConvertDayToYMD(&ymd, e->intro_date);
|
||||||
|
@ -132,7 +132,7 @@ void DrawTrainWagonPurchaseInfo(int x, int y, EngineID engine_number)
|
||||||
|
|
||||||
void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
Vehicle *v,*found;
|
Vehicle *v, *found;
|
||||||
|
|
||||||
if (!success) return;
|
if (!success) return;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
{
|
{
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
|
|
||||||
if (!success) return;
|
if (!success) return;
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ void CcCloneTrain(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void engine_drawing_loop(int *x, int *y, int *pos, int *sel,
|
static void engine_drawing_loop(int *x, int *y, int *pos, int *sel,
|
||||||
EngineID* selected_id, RailType railtype, byte show_max, bool is_engine)
|
EngineID *selected_id, RailType railtype, byte show_max, bool is_engine)
|
||||||
{
|
{
|
||||||
EngineID j;
|
EngineID j;
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ static void TrainDepotClickTrain(Window *w, int x, int y)
|
||||||
* @param *v is the original vehicle to clone
|
* @param *v is the original vehicle to clone
|
||||||
* @param *w is the window of the depot where the clone is build
|
* @param *w is the window of the depot where the clone is build
|
||||||
*/
|
*/
|
||||||
static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
static void HandleCloneVehClick(const Vehicle *v, const Window *w)
|
||||||
{
|
{
|
||||||
if (v == NULL || v->type != VEH_Train) return;
|
if (v == NULL || v->type != VEH_Train) return;
|
||||||
|
|
||||||
|
@ -637,9 +637,9 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClonePlaceObj(const Window* w)
|
static void ClonePlaceObj(const Window *w)
|
||||||
{
|
{
|
||||||
Vehicle* v = CheckMouseOverVehicle();
|
Vehicle *v = CheckMouseOverVehicle();
|
||||||
|
|
||||||
if (v != NULL) HandleCloneVehClick(v, w);
|
if (v != NULL) HandleCloneVehClick(v, w);
|
||||||
}
|
}
|
||||||
|
@ -690,7 +690,7 @@ static void TrainDepotWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
// check if a vehicle in a depot was clicked..
|
// check if a vehicle in a depot was clicked..
|
||||||
case WE_MOUSELOOP: {
|
case WE_MOUSELOOP: {
|
||||||
const Vehicle* v = _place_clicked_vehicle;
|
const Vehicle *v = _place_clicked_vehicle;
|
||||||
|
|
||||||
// since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button
|
// since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button
|
||||||
if (v != NULL && HASBIT(w->click_state, 9)) {
|
if (v != NULL && HASBIT(w->click_state, 9)) {
|
||||||
|
@ -914,7 +914,7 @@ static const Widget _train_view_widgets[] = {
|
||||||
{ WIDGETS_END }
|
{ WIDGETS_END }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ShowTrainDetailsWindow(const Vehicle* v);
|
static void ShowTrainDetailsWindow(const Vehicle *v);
|
||||||
|
|
||||||
static void TrainViewWndProc(Window *w, WindowEvent *e)
|
static void TrainViewWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
|
@ -1053,7 +1053,7 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_MOUSELOOP: {
|
case WE_MOUSELOOP: {
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle *v = GetVehicle(w->window_number);
|
||||||
uint32 h;
|
uint32 h;
|
||||||
|
|
||||||
assert(v->type == VEH_Train);
|
assert(v->type == VEH_Train);
|
||||||
|
@ -1076,9 +1076,9 @@ static const WindowDesc _train_view_desc = {
|
||||||
TrainViewWndProc
|
TrainViewWndProc
|
||||||
};
|
};
|
||||||
|
|
||||||
void ShowTrainViewWindow(const Vehicle* v)
|
void ShowTrainViewWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window* w = AllocateWindowDescFront(&_train_view_desc,v->index);
|
Window *w = AllocateWindowDescFront(&_train_view_desc,v->index);
|
||||||
|
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
w->caption_color = v->owner;
|
w->caption_color = v->owner;
|
||||||
|
@ -1341,7 +1341,7 @@ static const WindowDesc _train_details_desc = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void ShowTrainDetailsWindow(const Vehicle* v)
|
static void ShowTrainDetailsWindow(const Vehicle *v)
|
||||||
{
|
{
|
||||||
Window *w;
|
Window *w;
|
||||||
VehicleID veh = v->index;
|
VehicleID veh = v->index;
|
||||||
|
@ -1485,7 +1485,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
case 7: { /* Matrix to show vehicles */
|
case 7: { /* Matrix to show vehicles */
|
||||||
uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_SMALL;
|
uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_SMALL;
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
|
|
||||||
if (id_v >= w->vscroll.cap) return; // click out of bounds
|
if (id_v >= w->vscroll.cap) return; // click out of bounds
|
||||||
|
|
||||||
|
|
18
viewport.c
18
viewport.c
|
@ -215,7 +215,7 @@ static void DoSetViewportPosition(Window *w, int left, int top, int width, int h
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetViewportPosition(Window* w, int x, int y)
|
static void SetViewportPosition(Window *w, int x, int y)
|
||||||
{
|
{
|
||||||
ViewPort *vp = w->viewport;
|
ViewPort *vp = w->viewport;
|
||||||
int old_left = vp->virtual_left;
|
int old_left = vp->virtual_left;
|
||||||
|
@ -420,7 +420,7 @@ void AddSortableSpriteToDraw(uint32 image, int x, int y, int w, int h, byte dz,
|
||||||
{
|
{
|
||||||
ViewportDrawer *vd = _cur_vd;
|
ViewportDrawer *vd = _cur_vd;
|
||||||
ParentSpriteToDraw *ps;
|
ParentSpriteToDraw *ps;
|
||||||
const Sprite* spr;
|
const Sprite *spr;
|
||||||
Point pt;
|
Point pt;
|
||||||
|
|
||||||
assert((image & SPRITE_MASK) < MAX_SPRITES);
|
assert((image & SPRITE_MASK) < MAX_SPRITES);
|
||||||
|
@ -1018,7 +1018,7 @@ static void ViewportDrawTileSprites(TileSpriteToDraw *ts)
|
||||||
} while (ts != NULL);
|
} while (ts != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ViewportSortParentSprites(ParentSpriteToDraw* psd[])
|
static void ViewportSortParentSprites(ParentSpriteToDraw *psd[])
|
||||||
{
|
{
|
||||||
while (*psd != NULL) {
|
while (*psd != NULL) {
|
||||||
ParentSpriteToDraw* ps = *psd;
|
ParentSpriteToDraw* ps = *psd;
|
||||||
|
@ -1662,9 +1662,9 @@ static void SafeShowTrainViewWindow(const Vehicle* v)
|
||||||
ShowTrainViewWindow(v);
|
ShowTrainViewWindow(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Nop(const Vehicle* v) {}
|
static void Nop(const Vehicle *v) {}
|
||||||
|
|
||||||
typedef void OnVehicleClickProc(const Vehicle* v);
|
typedef void OnVehicleClickProc(const Vehicle *v);
|
||||||
static OnVehicleClickProc* const _on_vehicle_click_proc[] = {
|
static OnVehicleClickProc* const _on_vehicle_click_proc[] = {
|
||||||
SafeShowTrainViewWindow,
|
SafeShowTrainViewWindow,
|
||||||
ShowRoadVehViewWindow,
|
ShowRoadVehViewWindow,
|
||||||
|
@ -1676,7 +1676,7 @@ static OnVehicleClickProc* const _on_vehicle_click_proc[] = {
|
||||||
|
|
||||||
void HandleViewportClicked(const ViewPort *vp, int x, int y)
|
void HandleViewportClicked(const ViewPort *vp, int x, int y)
|
||||||
{
|
{
|
||||||
const Vehicle* v;
|
const Vehicle *v;
|
||||||
|
|
||||||
if (CheckClickOnTown(vp, x, y)) return;
|
if (CheckClickOnTown(vp, x, y)) return;
|
||||||
if (CheckClickOnStation(vp, x, y)) return;
|
if (CheckClickOnStation(vp, x, y)) return;
|
||||||
|
@ -1693,8 +1693,8 @@ void HandleViewportClicked(const ViewPort *vp, int x, int y)
|
||||||
|
|
||||||
Vehicle *CheckMouseOverVehicle(void)
|
Vehicle *CheckMouseOverVehicle(void)
|
||||||
{
|
{
|
||||||
const Window* w;
|
const Window *w;
|
||||||
const ViewPort* vp;
|
const ViewPort *vp;
|
||||||
|
|
||||||
int x = _cursor.pos.x;
|
int x = _cursor.pos.x;
|
||||||
int y = _cursor.pos.y;
|
int y = _cursor.pos.y;
|
||||||
|
@ -1737,7 +1737,7 @@ void PlaceObject(void)
|
||||||
|
|
||||||
|
|
||||||
/* scrolls the viewport in a window to a given location */
|
/* scrolls the viewport in a window to a given location */
|
||||||
bool ScrollWindowTo(int x , int y, Window* w)
|
bool ScrollWindowTo(int x , int y, Window *w)
|
||||||
{
|
{
|
||||||
Point pt;
|
Point pt;
|
||||||
|
|
||||||
|
|
|
@ -479,7 +479,7 @@ void DrawShipDepotSprite(int x, int y, int image)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint GetSlopeZ_Water(const TileInfo* ti)
|
static uint GetSlopeZ_Water(const TileInfo *ti)
|
||||||
{
|
{
|
||||||
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
|
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
|
||||||
}
|
}
|
||||||
|
@ -610,7 +610,7 @@ static void FloodVehicle(Vehicle *v)
|
||||||
v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast
|
v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast
|
||||||
RebuildVehicleLists();
|
RebuildVehicleLists();
|
||||||
} else if (v->type == VEH_Train) {
|
} else if (v->type == VEH_Train) {
|
||||||
Vehicle* u;
|
Vehicle *u;
|
||||||
|
|
||||||
v = GetFirstVehicleInChain(v);
|
v = GetFirstVehicleInChain(v);
|
||||||
u = v;
|
u = v;
|
||||||
|
@ -747,7 +747,7 @@ const TileTypeProcs _tile_type_water_procs = {
|
||||||
ClearTile_Water, /* clear_tile_proc */
|
ClearTile_Water, /* clear_tile_proc */
|
||||||
GetAcceptedCargo_Water, /* get_accepted_cargo_proc */
|
GetAcceptedCargo_Water, /* get_accepted_cargo_proc */
|
||||||
GetTileDesc_Water, /* get_tile_desc_proc */
|
GetTileDesc_Water, /* get_tile_desc_proc */
|
||||||
GetTileTrackStatus_Water, /* get_tile_track_status_proc */
|
GetTileTrackStatus_Water,/* get_tile_track_status_proc */
|
||||||
ClickTile_Water, /* click_tile_proc */
|
ClickTile_Water, /* click_tile_proc */
|
||||||
AnimateTile_Water, /* animate_tile_proc */
|
AnimateTile_Water, /* animate_tile_proc */
|
||||||
TileLoop_Water, /* tile_loop_clear */
|
TileLoop_Water, /* tile_loop_clear */
|
||||||
|
|
42
window.c
42
window.c
|
@ -24,10 +24,10 @@ void HandleButtonClick(Window *w, byte widget)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Window* StartWindowDrag(Window* w);
|
static Window *StartWindowDrag(Window *w);
|
||||||
static Window* StartWindowSizing(Window* w);
|
static Window *StartWindowSizing(Window *w);
|
||||||
|
|
||||||
static void DispatchLeftClickEvent(Window* w, int x, int y)
|
static void DispatchLeftClickEvent(Window *w, int x, int y)
|
||||||
{
|
{
|
||||||
WindowEvent e;
|
WindowEvent e;
|
||||||
const Widget *wi;
|
const Widget *wi;
|
||||||
|
@ -86,7 +86,7 @@ static void DispatchLeftClickEvent(Window* w, int x, int y)
|
||||||
w->wndproc(w, &e);
|
w->wndproc(w, &e);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DispatchRightClickEvent(Window* w, int x, int y)
|
static void DispatchRightClickEvent(Window *w, int x, int y)
|
||||||
{
|
{
|
||||||
WindowEvent e;
|
WindowEvent e;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ static void DispatchRightClickEvent(Window* w, int x, int y)
|
||||||
* @param widget the widget where the scrollwheel was used
|
* @param widget the widget where the scrollwheel was used
|
||||||
* @param wheel scroll up or down
|
* @param wheel scroll up or down
|
||||||
*/
|
*/
|
||||||
static void DispatchMouseWheelEvent(Window* w, int widget, int wheel)
|
static void DispatchMouseWheelEvent(Window *w, int widget, int wheel)
|
||||||
{
|
{
|
||||||
const Widget *wi1, *wi2;
|
const Widget *wi1, *wi2;
|
||||||
Scrollbar *sb;
|
Scrollbar *sb;
|
||||||
|
@ -142,7 +142,7 @@ static void DispatchMouseWheelEvent(Window* w, int widget, int wheel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void DrawOverlappedWindow(Window* w, int left, int top, int right, int bottom);
|
static void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom);
|
||||||
|
|
||||||
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
|
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
|
||||||
{
|
{
|
||||||
|
@ -160,9 +160,9 @@ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DrawOverlappedWindow(Window* w, int left, int top, int right, int bottom)
|
static void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom)
|
||||||
{
|
{
|
||||||
const Window* v = w;
|
const Window *v = w;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
while (++v != _last_window) {
|
while (++v != _last_window) {
|
||||||
|
@ -219,7 +219,7 @@ void CallWindowEventNP(Window *w, int event)
|
||||||
w->wndproc(w, &e);
|
w->wndproc(w, &e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetWindowDirty(const Window* w)
|
void SetWindowDirty(const Window *w)
|
||||||
{
|
{
|
||||||
if (w == NULL) return;
|
if (w == NULL) return;
|
||||||
SetDirtyBlocks(w->left, w->top, w->left + w->width, w->top + w->height);
|
SetDirtyBlocks(w->left, w->top, w->left + w->width, w->top + w->height);
|
||||||
|
@ -293,7 +293,7 @@ void DeleteWindowByClass(WindowClass cls)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Window* BringWindowToFront(Window* w);
|
static Window *BringWindowToFront(Window *w);
|
||||||
|
|
||||||
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number)
|
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number)
|
||||||
{
|
{
|
||||||
|
@ -320,7 +320,7 @@ static inline bool IsVitalWindow(const Window *w)
|
||||||
* - New window, Chatbar (only if open)
|
* - New window, Chatbar (only if open)
|
||||||
* @param w window that is put into the foreground
|
* @param w window that is put into the foreground
|
||||||
*/
|
*/
|
||||||
static Window* BringWindowToFront(Window* w)
|
static Window *BringWindowToFront(Window *w)
|
||||||
{
|
{
|
||||||
Window *v;
|
Window *v;
|
||||||
Window temp;
|
Window temp;
|
||||||
|
@ -378,7 +378,7 @@ static Window *ForceFindDeletableWindow(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsWindowOfPrototype(const Window* w, const Widget* widget)
|
bool IsWindowOfPrototype(const Window *w, const Widget *widget)
|
||||||
{
|
{
|
||||||
return (w->original_widget == widget);
|
return (w->original_widget == widget);
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ void AssignWidgetToWindow(Window *w, const Widget *widget)
|
||||||
|
|
||||||
if (widget != NULL) {
|
if (widget != NULL) {
|
||||||
uint index = 1;
|
uint index = 1;
|
||||||
const Widget* wi;
|
const Widget *wi;
|
||||||
|
|
||||||
for (wi = widget; wi->type != WWT_LAST; wi++) index++;
|
for (wi = widget; wi->type != WWT_LAST; wi++) index++;
|
||||||
|
|
||||||
|
@ -1070,7 +1070,7 @@ static bool HandleWindowDragging(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Window* StartWindowDrag(Window* w)
|
static Window *StartWindowDrag(Window *w)
|
||||||
{
|
{
|
||||||
w->flags4 |= WF_DRAGGING;
|
w->flags4 |= WF_DRAGGING;
|
||||||
_dragging_window = true;
|
_dragging_window = true;
|
||||||
|
@ -1083,7 +1083,7 @@ static Window* StartWindowDrag(Window* w)
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Window* StartWindowSizing(Window* w)
|
static Window *StartWindowSizing(Window *w)
|
||||||
{
|
{
|
||||||
w->flags4 |= WF_SIZING;
|
w->flags4 |= WF_SIZING;
|
||||||
_dragging_window = true;
|
_dragging_window = true;
|
||||||
|
@ -1170,7 +1170,7 @@ stop_capt:;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w->window_class != WC_SMALLMAP) {
|
if (w->window_class != WC_SMALLMAP) {
|
||||||
ViewPort* vp = IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y);
|
ViewPort *vp = IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y);
|
||||||
|
|
||||||
if (vp == NULL)
|
if (vp == NULL)
|
||||||
goto stop_capt;
|
goto stop_capt;
|
||||||
|
@ -1282,7 +1282,7 @@ static Window *MaybeBringWindowToFront(Window *w)
|
||||||
* @param wparam Specifies additional message-specific information
|
* @param wparam Specifies additional message-specific information
|
||||||
* @param lparam Specifies additional message-specific information
|
* @param lparam Specifies additional message-specific information
|
||||||
*/
|
*/
|
||||||
static void SendWindowMessageW(Window* w, uint msg, uint wparam, uint lparam)
|
static void SendWindowMessageW(Window *w, uint msg, uint wparam, uint lparam)
|
||||||
{
|
{
|
||||||
WindowEvent e;
|
WindowEvent e;
|
||||||
|
|
||||||
|
@ -1536,14 +1536,14 @@ int GetMenuItemIndex(const Window *w, int x, int y)
|
||||||
|
|
||||||
void InvalidateWindow(WindowClass cls, WindowNumber number)
|
void InvalidateWindow(WindowClass cls, WindowNumber number)
|
||||||
{
|
{
|
||||||
const Window* w;
|
const Window *w;
|
||||||
|
|
||||||
for (w = _windows; w != _last_window; w++) {
|
for (w = _windows; w != _last_window; w++) {
|
||||||
if (w->window_class == cls && w->window_number == number) SetWindowDirty(w);
|
if (w->window_class == cls && w->window_number == number) SetWindowDirty(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InvalidateWidget(const Window* w, byte widget_index)
|
void InvalidateWidget(const Window *w, byte widget_index)
|
||||||
{
|
{
|
||||||
const Widget *wi = &w->widget[widget_index];
|
const Widget *wi = &w->widget[widget_index];
|
||||||
|
|
||||||
|
@ -1555,7 +1555,7 @@ void InvalidateWidget(const Window* w, byte widget_index)
|
||||||
|
|
||||||
void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index)
|
void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index)
|
||||||
{
|
{
|
||||||
const Window* w;
|
const Window *w;
|
||||||
|
|
||||||
for (w = _windows; w != _last_window; w++) {
|
for (w = _windows; w != _last_window; w++) {
|
||||||
if (w->window_class == cls && w->window_number == number) {
|
if (w->window_class == cls && w->window_number == number) {
|
||||||
|
@ -1566,7 +1566,7 @@ void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_in
|
||||||
|
|
||||||
void InvalidateWindowClasses(WindowClass cls)
|
void InvalidateWindowClasses(WindowClass cls)
|
||||||
{
|
{
|
||||||
const Window* w;
|
const Window *w;
|
||||||
|
|
||||||
for (w = _windows; w != _last_window; w++) {
|
for (w = _windows; w != _last_window; w++) {
|
||||||
if (w->window_class == cls) SetWindowDirty(w);
|
if (w->window_class == cls) SetWindowDirty(w);
|
||||||
|
|
8
window.h
8
window.h
|
@ -249,7 +249,7 @@ typedef struct querystr_d {
|
||||||
WindowClass wnd_class;
|
WindowClass wnd_class;
|
||||||
WindowNumber wnd_num;
|
WindowNumber wnd_num;
|
||||||
Textbuf text;
|
Textbuf text;
|
||||||
const char* orig;
|
const char *orig;
|
||||||
} querystr_d;
|
} querystr_d;
|
||||||
|
|
||||||
#define WP(ptr,str) (*(str*)(ptr)->custom)
|
#define WP(ptr,str) (*(str*)(ptr)->custom)
|
||||||
|
@ -556,7 +556,7 @@ enum WindowFlags {
|
||||||
/* window.c */
|
/* window.c */
|
||||||
void CallWindowEventNP(Window *w, int event);
|
void CallWindowEventNP(Window *w, int event);
|
||||||
void CallWindowTickEvent(void);
|
void CallWindowTickEvent(void);
|
||||||
void SetWindowDirty(const Window* w);
|
void SetWindowDirty(const Window *w);
|
||||||
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, uint msg, uint wparam, uint lparam);
|
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, uint msg, uint wparam, uint lparam);
|
||||||
|
|
||||||
Window *FindWindowById(WindowClass cls, WindowNumber number);
|
Window *FindWindowById(WindowClass cls, WindowNumber number);
|
||||||
|
@ -564,7 +564,7 @@ void DeleteWindow(Window *w);
|
||||||
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
|
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
|
||||||
Window *FindWindowFromPt(int x, int y);
|
Window *FindWindowFromPt(int x, int y);
|
||||||
|
|
||||||
bool IsWindowOfPrototype(const Window* w, const Widget* widget);
|
bool IsWindowOfPrototype(const Window *w, const Widget *widget);
|
||||||
void AssignWidgetToWindow(Window *w, const Widget *widget);
|
void AssignWidgetToWindow(Window *w, const Widget *widget);
|
||||||
Window *AllocateWindow(
|
Window *AllocateWindow(
|
||||||
int x,
|
int x,
|
||||||
|
@ -586,7 +586,7 @@ void ResetWindowSystem(void);
|
||||||
int GetMenuItemIndex(const Window *w, int x, int y);
|
int GetMenuItemIndex(const Window *w, int x, int y);
|
||||||
void InputLoop(void);
|
void InputLoop(void);
|
||||||
void UpdateWindows(void);
|
void UpdateWindows(void);
|
||||||
void InvalidateWidget(const Window* w, byte widget_index);
|
void InvalidateWidget(const Window *w, byte widget_index);
|
||||||
|
|
||||||
void GuiShowTooltips(StringID string_id);
|
void GuiShowTooltips(StringID string_id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue