id
int64
0
877k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
66
repo_stars
int64
94
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
11 values
repo_extraction_date
stringclasses
197 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
1,539,325
os2_m.cpp
EnergeticBark_OpenTTD-3DS/src/music/os2_m.cpp
/* $Id$ */ /** @file os2_m.cpp Music playback on OS/2. */ #include "../stdafx.h" #include "../openttd.h" #include "os2_m.h" #define INCL_DOS #define INCL_OS2MM #define INCL_WIN #include <stdarg.h> #include <os2.h> #include <os2me.h> /********************** * OS/2 MIDI PLAYER **********************/ /* Interesting how similar the MCI API in OS/2 is to the Win32 MCI API, * eh? Anyone would think they both came from the same place originally! ;) */ static long CDECL MidiSendCommand(const char *cmd, ...) { va_list va; char buf[512]; va_start(va, cmd); vseprintf(buf, lastof(buf), cmd, va); va_end(va); return mciSendString(buf, NULL, 0, NULL, 0); } static FMusicDriver_OS2 iFMusicDriver_OS2; void MusicDriver_OS2::PlaySong(const char *filename) { MidiSendCommand("close all"); if (MidiSendCommand("open %s type sequencer alias song", filename) != 0) return; MidiSendCommand("play song from 0"); } void MusicDriver_OS2::StopSong() { MidiSendCommand("close all"); } void MusicDriver_OS2::SetVolume(byte vol) { MidiSendCommand("set song audio volume %d", ((vol/127)*100)); } bool MusicDriver_OS2::IsSongPlaying() { char buf[16]; mciSendString("status song mode", buf, sizeof(buf), NULL, 0); return strcmp(buf, "playing") == 0 || strcmp(buf, "seeking") == 0; } const char *MusicDriver_OS2::Start(const char * const *parm) { return 0; } void MusicDriver_OS2::Stop() { MidiSendCommand("close all"); }
1,435
C++
.cpp
56
23.946429
75
0.695525
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
true
true
false
1,539,326
libtimidity.cpp
EnergeticBark_OpenTTD-3DS/src/music/libtimidity.cpp
/* $Id$ */ /** @file libtimidity.cpp Playing music via the timidity library. */ #include "../stdafx.h" #include "../openttd.h" #include "../sound_type.h" #include "../variables.h" #include "../debug.h" #include "libtimidity.h" #include <fcntl.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <signal.h> #include <sys/stat.h> #include <errno.h> #include <timidity.h> #if defined(PSP) #include <pspaudiolib.h> #endif /* PSP */ enum MidiState { MIDI_STOPPED = 0, MIDI_PLAYING = 1, }; static struct { MidIStream *stream; MidSongOptions options; MidSong *song; MidiState status; uint32 song_length; uint32 song_position; } _midi; #if defined(PSP) static void AudioOutCallback(void *buf, unsigned int _reqn, void *userdata) { memset(buf, 0, _reqn * PSP_NUM_AUDIO_CHANNELS); if (_midi.status == MIDI_PLAYING) { mid_song_read_wave(_midi.song, buf, _reqn * PSP_NUM_AUDIO_CHANNELS); } } #endif /* PSP */ static FMusicDriver_LibTimidity iFMusicDriver_LibTimidity; const char *MusicDriver_LibTimidity::Start(const char * const *param) { _midi.status = MIDI_STOPPED; _midi.song = NULL; if (mid_init(param == NULL ? NULL : (char *)param[0]) < 0) { /* If init fails, it can be because no configuration was found. * If it was not forced via param, try to load it without a * configuration. Who knows that works. */ if (param != NULL || mid_init_no_config() < 0) { return "error initializing timidity"; } } DEBUG(driver, 1, "successfully initialised timidity"); _midi.options.rate = 44100; _midi.options.format = MID_AUDIO_S16LSB; _midi.options.channels = 2; #if defined(PSP) _midi.options.buffer_size = PSP_NUM_AUDIO_SAMPLES; #else _midi.options.buffer_size = _midi.options.rate; #endif #if defined(PSP) pspAudioInit(); pspAudioSetChannelCallback(_midi.options.channels, &AudioOutCallback, NULL); pspAudioSetVolume(_midi.options.channels, PSP_VOLUME_MAX, PSP_VOLUME_MAX); #endif /* PSP */ return NULL; } void MusicDriver_LibTimidity::Stop() { if (_midi.status == MIDI_PLAYING) this->StopSong(); mid_exit(); } void MusicDriver_LibTimidity::PlaySong(const char *filename) { this->StopSong(); _midi.stream = mid_istream_open_file(filename); if (_midi.stream == NULL) { DEBUG(driver, 0, "Could not open music file"); return; } _midi.song = mid_song_load(_midi.stream, &_midi.options); mid_istream_close(_midi.stream); _midi.song_length = mid_song_get_total_time(_midi.song); if (_midi.song == NULL) { DEBUG(driver, 1, "Invalid MIDI file"); return; } mid_song_start(_midi.song); _midi.status = MIDI_PLAYING; } void MusicDriver_LibTimidity::StopSong() { _midi.status = MIDI_STOPPED; /* mid_song_free cannot handle NULL! */ if (_midi.song != NULL) mid_song_free(_midi.song); _midi.song = NULL; } bool MusicDriver_LibTimidity::IsSongPlaying() { if (_midi.status == MIDI_PLAYING) { _midi.song_position = mid_song_get_time(_midi.song); if (_midi.song_position >= _midi.song_length) { _midi.status = MIDI_STOPPED; _midi.song_position = 0; } } return (_midi.status == MIDI_PLAYING); } void MusicDriver_LibTimidity::SetVolume(byte vol) { if (_midi.song != NULL) mid_song_set_volume(_midi.song, vol); }
3,208
C++
.cpp
114
26.219298
77
0.714518
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
1,539,327
industry_map.h
EnergeticBark_OpenTTD-3DS/src/industry_map.h
/* $Id$ */ /** @file industry_map.h Accessors for industries */ #ifndef INDUSTRY_MAP_H #define INDUSTRY_MAP_H #include "industry.h" #include "tile_map.h" #include "water_map.h" /** * The following enums are indices used to know what to draw for this industry tile. * They all are pointing toward array _industry_draw_tile_data, in table/industry_land.h * How to calculate the correct position ? GFXid << 2 | IndustryStage (0 to 3) */ enum { GFX_COAL_MINE_TOWER_NOT_ANIMATED = 0, GFX_COAL_MINE_TOWER_ANIMATED = 1, GFX_POWERPLANT_CHIMNEY = 8, GFX_POWERPLANT_SPARKS = 10, GFX_OILRIG_1 = 24, GFX_OILRIG_2 = 25, GFX_OILRIG_3 = 26, GFX_OILRIG_4 = 27, GFX_OILRIG_5 = 28, GFX_OILWELL_NOT_ANIMATED = 29, GFX_OILWELL_ANIMATED_1 = 30, GFX_OILWELL_ANIMATED_2 = 31, GFX_OILWELL_ANIMATED_3 = 32, GFX_COPPER_MINE_TOWER_NOT_ANIMATED = 47, GFX_COPPER_MINE_TOWER_ANIMATED = 48, GFX_COPPER_MINE_CHIMNEY = 49, GFX_GOLD_MINE_TOWER_NOT_ANIMATED = 79, GFX_GOLD_MINE_TOWER_ANIMATED = 88, GFX_TOY_FACTORY = 143, GFX_PLASTIC_FOUNTAIN_ANIMATED_1 = 148, GFX_PLASTIC_FOUNTAIN_ANIMATED_2 = 149, GFX_PLASTIC_FOUNTAIN_ANIMATED_3 = 150, GFX_PLASTIC_FOUNTAIN_ANIMATED_4 = 151, GFX_PLASTIC_FOUNTAIN_ANIMATED_5 = 152, GFX_PLASTIC_FOUNTAIN_ANIMATED_6 = 153, GFX_PLASTIC_FOUNTAIN_ANIMATED_7 = 154, GFX_PLASTIC_FOUNTAIN_ANIMATED_8 = 155, GFX_BUBBLE_GENERATOR = 161, GFX_BUBBLE_CATCHER = 162, GFX_TOFFEE_QUARY = 165, GFX_SUGAR_MINE_SIEVE = 174, GFX_WATERTILE_SPECIALCHECK = 255, ///< not really a tile, but rather a very special check }; /** * Get the industry ID of the given tile * @param t the tile to get the industry ID from * @pre IsTileType(t, MP_INDUSTRY) * @return the industry ID */ static inline IndustryID GetIndustryIndex(TileIndex t) { assert(IsTileType(t, MP_INDUSTRY)); return _m[t].m2; } /** * Get the industry of the given tile * @param t the tile to get the industry from * @pre IsTileType(t, MP_INDUSTRY) * @return the industry */ static inline Industry *GetIndustryByTile(TileIndex t) { return GetIndustry(GetIndustryIndex(t)); } /** * Is this industry tile fully built? * @param t the tile to analyze * @pre IsTileType(t, MP_INDUSTRY) * @return true if and only if the industry tile is fully built */ static inline bool IsIndustryCompleted(TileIndex t) { assert(IsTileType(t, MP_INDUSTRY)); return HasBit(_m[t].m1, 7); } IndustryType GetIndustryType(TileIndex tile); /** * Set if the industry that owns the tile as under construction or not * @param tile the tile to query * @param isCompleted whether it is completed or not * @pre IsTileType(tile, MP_INDUSTRY) */ static inline void SetIndustryCompleted(TileIndex tile, bool isCompleted) { assert(IsTileType(tile, MP_INDUSTRY)); SB(_m[tile].m1, 7, 1, isCompleted ? 1 :0); } /** * Returns the industry construction stage of the specified tile * @param tile the tile to query * @pre IsTileType(tile, MP_INDUSTRY) * @return the construction stage */ static inline byte GetIndustryConstructionStage(TileIndex tile) { assert(IsTileType(tile, MP_INDUSTRY)); return IsIndustryCompleted(tile) ? (byte)INDUSTRY_COMPLETED : GB(_m[tile].m1, 0, 2); } /** * Sets the industry construction stage of the specified tile * @param tile the tile to query * @param value the new construction stage * @pre IsTileType(tile, MP_INDUSTRY) */ static inline void SetIndustryConstructionStage(TileIndex tile, byte value) { assert(IsTileType(tile, MP_INDUSTRY)); SB(_m[tile].m1, 0, 2, value); } static inline IndustryGfx GetCleanIndustryGfx(TileIndex t) { assert(IsTileType(t, MP_INDUSTRY)); return _m[t].m5 | (GB(_m[t].m6, 2, 1) << 8); } /** * Get the industry graphics ID for the given industry tile * @param t the tile to get the gfx for * @pre IsTileType(t, MP_INDUSTRY) * @return the gfx ID */ static inline IndustryGfx GetIndustryGfx(TileIndex t) { assert(IsTileType(t, MP_INDUSTRY)); return GetTranslatedIndustryTileID(GetCleanIndustryGfx(t)); } /** * Set the industry graphics ID for the given industry tile * @param t the tile to set the gfx for * @pre IsTileType(t, MP_INDUSTRY) * @param gfx the graphics ID */ static inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx) { assert(IsTileType(t, MP_INDUSTRY)); _m[t].m5 = GB(gfx, 0, 8); SB(_m[t].m6, 2, 1, GB(gfx, 8, 1)); } /** * Tests if the industry tile was built on water. * @param t the industry tile * @return true iff on water */ static inline bool IsIndustryTileOnWater(TileIndex t) { assert(IsTileType(t, MP_INDUSTRY)); return (GetWaterClass(t) != WATER_CLASS_INVALID); } /** * Returns this indutry tile's construction counter value * @param tile the tile to query * @pre IsTileType(tile, MP_INDUSTRY) * @return the construction counter */ static inline byte GetIndustryConstructionCounter(TileIndex tile) { assert(IsTileType(tile, MP_INDUSTRY)); return GB(_m[tile].m1, 2, 2); } /** * Sets this indutry tile's construction counter value * @param tile the tile to query * @param value the new value for the construction counter * @pre IsTileType(tile, MP_INDUSTRY) */ static inline void SetIndustryConstructionCounter(TileIndex tile, byte value) { assert(IsTileType(tile, MP_INDUSTRY)); SB(_m[tile].m1, 2, 2, value); } /** * Reset the construction stage counter of the industry, * as well as the completion bit. * In fact, it is the same as restarting construction frmo ground up * @param tile the tile to query * @pre IsTileType(tile, MP_INDUSTRY) */ static inline void ResetIndustryConstructionStage(TileIndex tile) { assert(IsTileType(tile, MP_INDUSTRY)); SB(_m[tile].m1, 0, 4, 0); SB(_m[tile].m1, 7, 1, 0); } /** * Get the animation loop number * @param tile the tile to get the animation loop number of * @pre IsTileType(tile, MP_INDUSTRY) */ static inline byte GetIndustryAnimationLoop(TileIndex tile) { assert(IsTileType(tile, MP_INDUSTRY)); return _m[tile].m4; } /** * Set the animation loop number * @param tile the tile to set the animation loop number of * @param count the new animation frame number * @pre IsTileType(tile, MP_INDUSTRY) */ static inline void SetIndustryAnimationLoop(TileIndex tile, byte count) { assert(IsTileType(tile, MP_INDUSTRY)); _m[tile].m4 = count; } /** * Get the animation state * @param tile the tile to get the animation state of * @pre IsTileType(tile, MP_INDUSTRY) */ static inline byte GetIndustryAnimationState(TileIndex tile) { assert(IsTileType(tile, MP_INDUSTRY)); return _m[tile].m3; } /** * Set the animation state * @param tile the tile to set the animation state of * @param state the new animation state * @pre IsTileType(tile, MP_INDUSTRY) */ static inline void SetIndustryAnimationState(TileIndex tile, byte state) { assert(IsTileType(tile, MP_INDUSTRY)); _m[tile].m3 = state; } /** * Get the random bits for this tile. * Used for grf callbacks * @param tile TileIndex of the tile to query * @pre IsTileType(tile, MP_INDUSTRY) * @return requested bits */ static inline byte GetIndustryRandomBits(TileIndex tile) { assert(IsTileType(tile, MP_INDUSTRY)); return _me[tile].m7; } /** * Set the random bits for this tile. * Used for grf callbacks * @param tile TileIndex of the tile to query * @param bits the random bits * @pre IsTileType(tile, MP_INDUSTRY) */ static inline void SetIndustryRandomBits(TileIndex tile, byte bits) { assert(IsTileType(tile, MP_INDUSTRY)); _me[tile].m7 = bits; } /** * Get the activated triggers bits for this industry tile * Used for grf callbacks * @param tile TileIndex of the tile to query * @pre IsTileType(tile, MP_INDUSTRY) * @return requested triggers */ static inline byte GetIndustryTriggers(TileIndex tile) { assert(IsTileType(tile, MP_INDUSTRY)); return GB(_m[tile].m6, 3, 3); } /** * Set the activated triggers bits for this industry tile * Used for grf callbacks * @param tile TileIndex of the tile to query * @param triggers the triggers to set * @pre IsTileType(tile, MP_INDUSTRY) */ static inline void SetIndustryTriggers(TileIndex tile, byte triggers) { assert(IsTileType(tile, MP_INDUSTRY)); SB(_m[tile].m6, 3, 3, triggers); } /** * Make the given tile an industry tile * @param t the tile to make an industry tile * @param index the industry this tile belongs to * @param gfx the graphics to use for the tile * @param random the random value */ static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx, uint8 random, WaterClass wc) { SetTileType(t, MP_INDUSTRY); _m[t].m1 = 0; _m[t].m2 = index; _m[t].m3 = 0; _m[t].m4 = 0; SetIndustryGfx(t, gfx); // m5, part of m6 SetIndustryTriggers(t, 0); // rest of m6 SetIndustryRandomBits(t, random); // m7 SetWaterClass(t, wc); } #endif /* INDUSTRY_MAP_H */
9,080
C++
.h
295
29.013559
108
0.712507
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,328
newgrf_sound.h
EnergeticBark_OpenTTD-3DS/src/newgrf_sound.h
/* $Id$ */ /** @file newgrf_sound.h Functions related to NewGRF provided sounds. */ #ifndef NEWGRF_SOUND_H #define NEWGRF_SOUND_H #include "sound_type.h" #include "tile_type.h" enum VehicleSoundEvent { VSE_START = 1, VSE_TUNNEL = 2, VSE_BREAKDOWN = 3, VSE_RUNNING = 4, VSE_TOUCHDOWN = 5, VSE_TRAIN_EFFECT = 6, VSE_RUNNING_16 = 7, VSE_STOPPED_16 = 8, VSE_LOAD_UNLOAD = 9, }; FileEntry *AllocateFileEntry(); void InitializeSoundPool(); FileEntry *GetSound(uint index); uint GetNumSounds(); bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event); bool PlayTileSound(const struct GRFFile *file, uint16 sound_id, TileIndex tile); #endif /* NEWGRF_SOUND_H */
708
C++
.h
24
27.833333
80
0.716396
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,329
tunnel_map.h
EnergeticBark_OpenTTD-3DS/src/tunnel_map.h
/* $Id$ */ /** @file tunnel_map.h Map accessors for tunnels. */ #ifndef TUNNEL_MAP_H #define TUNNEL_MAP_H #include "direction_func.h" #include "rail_type.h" #include "road_type.h" #include "transport_type.h" #include "road_map.h" /** * Is this a tunnel (entrance)? * @param t the tile that might be a tunnel * @pre IsTileType(t, MP_TUNNELBRIDGE) * @return true if and only if this tile is a tunnel (entrance) */ static inline bool IsTunnel(TileIndex t) { assert(IsTileType(t, MP_TUNNELBRIDGE)); return !HasBit(_m[t].m5, 7); } /** * Is this a tunnel (entrance)? * @param t the tile that might be a tunnel * @return true if and only if this tile is a tunnel (entrance) */ static inline bool IsTunnelTile(TileIndex t) { return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t); } TileIndex GetOtherTunnelEnd(TileIndex); bool IsTunnelInWay(TileIndex, uint z); bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir); /** * Makes a road tunnel entrance * @param t the entrance of the tunnel * @param o the owner of the entrance * @param d the direction facing out of the tunnel * @param r the road type used in the tunnel */ static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d, RoadTypes r) { SetTileType(t, MP_TUNNELBRIDGE); SetTileOwner(t, o); _m[t].m2 = 0; _m[t].m3 = 0; _m[t].m4 = 0; _m[t].m5 = TRANSPORT_ROAD << 2 | d; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; SetRoadOwner(t, ROADTYPE_ROAD, o); if (o != OWNER_TOWN) SetRoadOwner(t, ROADTYPE_TRAM, o); SetRoadTypes(t, r); } /** * Makes a rail tunnel entrance * @param t the entrance of the tunnel * @param o the owner of the entrance * @param d the direction facing out of the tunnel * @param r the rail type used in the tunnel */ static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r) { SetTileType(t, MP_TUNNELBRIDGE); SetTileOwner(t, o); _m[t].m2 = 0; _m[t].m3 = r; _m[t].m4 = 0; _m[t].m5 = TRANSPORT_RAIL << 2 | d; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } #endif /* TUNNEL_MAP_H */
2,039
C++
.h
72
26.583333
85
0.700562
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,330
bmp.h
EnergeticBark_OpenTTD-3DS/src/bmp.h
/* $Id$ */ /** @file bmp.h Read and write support for bmps. */ #ifndef BMP_H #define BMP_H #include "gfx_type.h" struct BmpInfo { uint32 offset; ///< offset of bitmap data from .bmp file begining uint32 width; ///< bitmap width uint32 height; ///< bitmap height bool os2_bmp; ///< true if OS/2 1.x or windows 2.x bitmap uint16 bpp; ///< bits per pixel uint32 compression; ///< compression method (0 = none, 1 = 8-bit RLE, 2 = 4-bit RLE) uint32 palette_size; ///< number of colours in palette }; struct BmpData { Colour *palette; byte *bitmap; }; #define BMP_BUFFER_SIZE 1024 struct BmpBuffer { byte data[BMP_BUFFER_SIZE]; int pos; int read; FILE *file; uint real_pos; }; void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file); bool BmpReadHeader(BmpBuffer *buffer, BmpInfo *info, BmpData *data); bool BmpReadBitmap(BmpBuffer *buffer, BmpInfo *info, BmpData *data); void BmpDestroyData(BmpData *data); #endif /* BMP_H */
982
C++
.h
31
29.935484
86
0.693206
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,331
industry_type.h
EnergeticBark_OpenTTD-3DS/src/industry_type.h
/* $Id$ */ /** @file industry_type.h Types related to the industry. */ #ifndef INDUSTRY_TYPE_H #define INDUSTRY_TYPE_H typedef uint16 IndustryID; typedef uint16 IndustryGfx; typedef uint8 IndustryType; struct Industry; struct IndustrySpec; struct IndustryTileSpec; #endif /* INDUSTRY_TYPE_H */
299
C++
.h
11
25.727273
59
0.795053
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,332
viewport_type.h
EnergeticBark_OpenTTD-3DS/src/viewport_type.h
/* $Id$ */ /** @file viewport_type.h Types related to viewports. */ #ifndef VIEWPORT_TYPE_H #define VIEWPORT_TYPE_H #include "zoom_type.h" /** * Data structure for viewport, display of a part of the world */ struct ViewPort { int left; ///< Screen coordinate left egde of the viewport int top; ///< Screen coordinate top edge of the viewport int width; ///< Screen width of the viewport int height; ///< Screen height of the viewport int virtual_left; ///< Virtual left coordinate int virtual_top; ///< Virtual top coordinate int virtual_width; ///< width << zoom int virtual_height; ///< height << zoom ZoomLevel zoom; }; struct ViewportSign { int32 left; int32 top; uint16 width_1, width_2; }; enum { ZOOM_IN = 0, ZOOM_OUT = 1, ZOOM_NONE = 2, // hack, used to update the button status }; /** * Some values for constructing bounding boxes (BB). The Z positions under bridges are: * z=0..5 Everything that can be built under low bridges. * z=6 reserved, currently unused. * z=7 Z separator between bridge/tunnel and the things under/above it. */ enum { BB_HEIGHT_UNDER_BRIDGE = 6, ///< Everything that can be built under low bridges, must not exceed this Z height. BB_Z_SEPARATOR = 7, ///< Separates the bridge/tunnel from the things under/above it. }; /** Viewport place method (type of highlighted area and placed objects) */ enum ViewportPlaceMethod { VPM_X_OR_Y = 0, ///< drag in X or Y direction VPM_FIX_X = 1, ///< drag only in X axis VPM_FIX_Y = 2, ///< drag only in Y axis VPM_RAILDIRS = 3, ///< all rail directions VPM_X_AND_Y = 4, ///< area of land in X and Y directions VPM_X_AND_Y_LIMITED = 5, ///< area of land of limited size VPM_SIGNALDIRS = 6, ///< similiar to VMP_RAILDIRS, but with different cursor }; /** Drag and drop selection process, or, what to do with an area of land when * you've selected it. */ enum ViewportDragDropSelectionProcess { DDSP_DEMOLISH_AREA, DDSP_RAISE_AND_LEVEL_AREA, DDSP_LOWER_AND_LEVEL_AREA, DDSP_LEVEL_AREA, DDSP_CREATE_DESERT, DDSP_CREATE_ROCKS, DDSP_CREATE_WATER, DDSP_CREATE_RIVER, DDSP_PLANT_TREES, DDSP_BUILD_BRIDGE, /* Rail specific actions */ DDSP_PLACE_RAIL_NE, DDSP_PLACE_RAIL_NW, DDSP_PLACE_AUTORAIL, DDSP_BUILD_SIGNALS, DDSP_BUILD_STATION, DDSP_REMOVE_STATION, DDSP_CONVERT_RAIL, /* Road specific actions */ DDSP_PLACE_ROAD_X_DIR, DDSP_PLACE_ROAD_Y_DIR, DDSP_PLACE_AUTOROAD, }; #endif /* VIEWPORT_TYPE_H */
2,521
C++
.h
76
31.276316
112
0.69601
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,333
minilzo.h
EnergeticBark_OpenTTD-3DS/src/minilzo.h
/* $Id$ */ /** * @file minilzo.h Mini subset of the LZO real-time data compression library * * This file is part of the LZO real-time data compression library. * * Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer * Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer * Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer * Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer * Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer * Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer * Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer * All Rights Reserved. * * The LZO library is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * The LZO library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the LZO library; see the file COPYING. * If not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Markus F.X.J. Oberhumer * <markus@oberhumer.com> * http://www.oberhumer.com/opensource/lzo/ * * NOTE: * the full LZO package can be found at * http://www.oberhumer.com/opensource/lzo/ */ #ifndef MINILZO_H #define MINILZO_H #define MINILZO_VERSION 0x1080 #ifdef __LZOCONF_H # error "you cannot use both LZO and miniLZO" #endif #undef LZO_HAVE_CONFIG_H #include "lzoconf.h" #if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION) # error "version mismatch in header files" #endif #ifdef __cplusplus extern "C" { #endif /* Memory required for the wrkmem parameter. * When the required size is 0, you can also pass a NULL pointer. */ #define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS #define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t)) #define LZO1X_MEM_DECOMPRESS (0) /* compression */ LZO_EXTERN(int) lzo1x_1_compress ( const lzo_byte *src, lzo_uint src_len, lzo_byte *dst, lzo_uintp dst_len, lzo_voidp wrkmem ); /* decompression */ LZO_EXTERN(int) lzo1x_decompress ( const lzo_byte *src, lzo_uint src_len, lzo_byte *dst, lzo_uintp dst_len, lzo_voidp wrkmem /* NOT USED */ ); /* safe decompression with overrun testing */ LZO_EXTERN(int) lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len, lzo_byte *dst, lzo_uintp dst_len, lzo_voidp wrkmem /* NOT USED */ ); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* MINILZO_H */
2,991
C++
.h
77
34.623377
76
0.688536
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
1,539,334
rail_map.h
EnergeticBark_OpenTTD-3DS/src/rail_map.h
/* $Id$ */ /** @file rail_map.h Hides the direct accesses to the map array with map accessors */ #ifndef RAIL_MAP_H #define RAIL_MAP_H #include "rail_type.h" #include "signal_func.h" #include "direction_func.h" #include "track_func.h" #include "tile_map.h" #include "signal_type.h" #include "waypoint_type.h" /** Different types of Rail-related tiles */ enum RailTileType { RAIL_TILE_NORMAL = 0, ///< Normal rail tile without signals RAIL_TILE_SIGNALS = 1, ///< Normal rail tile with signals RAIL_TILE_WAYPOINT = 2, ///< Waypoint (X or Y direction) RAIL_TILE_DEPOT = 3, ///< Depot (one entrance) }; /** * Returns the RailTileType (normal with or without signals, * waypoint or depot). * @param t the tile to get the information from * @pre IsTileType(t, MP_RAILWAY) * @return the RailTileType */ static inline RailTileType GetRailTileType(TileIndex t) { assert(IsTileType(t, MP_RAILWAY)); return (RailTileType)GB(_m[t].m5, 6, 2); } /** * Returns whether this is plain rails, with or without signals. Iow, if this * tiles RailTileType is RAIL_TILE_NORMAL or RAIL_TILE_SIGNALS. * @param t the tile to get the information from * @pre IsTileType(t, MP_RAILWAY) * @return true if and only if the tile is normal rail (with or without signals) */ static inline bool IsPlainRailTile(TileIndex t) { RailTileType rtt = GetRailTileType(t); return rtt == RAIL_TILE_NORMAL || rtt == RAIL_TILE_SIGNALS; } /** * Checks if a rail tile has signals. * @param t the tile to get the information from * @pre IsTileType(t, MP_RAILWAY) * @return true if and only if the tile has signals */ static inline bool HasSignals(TileIndex t) { return GetRailTileType(t) == RAIL_TILE_SIGNALS; } /** * Add/remove the 'has signal' bit from the RailTileType * @param tile the tile to add/remove the signals to/from * @param signals whether the rail tile should have signals or not * @pre IsPlainRailTile(tile) */ static inline void SetHasSignals(TileIndex tile, bool signals) { assert(IsPlainRailTile(tile)); SB(_m[tile].m5, 6, 1, signals); } /** * Is this rail tile a rail waypoint? * @param t the tile to get the information from * @pre IsTileType(t, MP_RAILWAY) * @return true if and only if the tile is a rail waypoint */ static inline bool IsRailWaypoint(TileIndex t) { return GetRailTileType(t) == RAIL_TILE_WAYPOINT; } /** * Is this tile rail tile and a rail waypoint? * @param t the tile to get the information from * @return true if and only if the tile is a rail waypoint */ static inline bool IsRailWaypointTile(TileIndex t) { return IsTileType(t, MP_RAILWAY) && IsRailWaypoint(t); } /** * Is this rail tile a rail depot? * @param t the tile to get the information from * @pre IsTileType(t, MP_RAILWAY) * @return true if and only if the tile is a rail depot */ static inline bool IsRailDepot(TileIndex t) { return GetRailTileType(t) == RAIL_TILE_DEPOT; } /** * Is this tile rail tile and a rail depot? * @param t the tile to get the information from * @return true if and only if the tile is a rail depot */ static inline bool IsRailDepotTile(TileIndex t) { return IsTileType(t, MP_RAILWAY) && IsRailDepot(t); } /** * Gets the rail type of the given tile * @param t the tile to get the rail type from * @return the rail type of the tile */ static inline RailType GetRailType(TileIndex t) { return (RailType)GB(_m[t].m3, 0, 4); } /** * Sets the rail type of the given tile * @param t the tile to set the rail type of * @param r the new rail type for the tile */ static inline void SetRailType(TileIndex t, RailType r) { SB(_m[t].m3, 0, 4, r); } /** * Gets the track bits of the given tile * @param t the tile to get the track bits from * @return the track bits of the tile */ static inline TrackBits GetTrackBits(TileIndex tile) { return (TrackBits)GB(_m[tile].m5, 0, 6); } /** * Sets the track bits of the given tile * @param t the tile to set the track bits of * @param b the new track bits for the tile */ static inline void SetTrackBits(TileIndex t, TrackBits b) { SB(_m[t].m5, 0, 6, b); } /** * Returns whether the given track is present on the given tile. * @param tile the tile to check the track presence of * @param track the track to search for on the tile * @pre IsPlainRailTile(tile) * @return true if and only if the given track exists on the tile */ static inline bool HasTrack(TileIndex tile, Track track) { return HasBit(GetTrackBits(tile), track); } /** * Returns the direction the depot is facing to * @param t the tile to get the depot facing from * @pre IsRailDepotTile(t) * @return the direction the depot is facing */ static inline DiagDirection GetRailDepotDirection(TileIndex t) { return (DiagDirection)GB(_m[t].m5, 0, 2); } /** * Returns the track of a depot, ignoring direction * @pre IsRailDepotTile(t) * @param t the tile to get the depot track from * @return the track of the depot */ static inline Track GetRailDepotTrack(TileIndex t) { return DiagDirToDiagTrack(GetRailDepotDirection(t)); } /** * Returns the axis of the waypoint * @param t the tile to get the waypoint axis from * @pre IsRailWaypointTile(t) * @return the axis of the waypoint */ static inline Axis GetWaypointAxis(TileIndex t) { return (Axis)GB(_m[t].m5, 0, 1); } /** * Returns the track of the waypoint * @param t the tile to get the waypoint track from * @pre IsRailWaypointTile(t) * @return the track of the waypoint */ static inline Track GetRailWaypointTrack(TileIndex t) { return AxisToTrack(GetWaypointAxis(t)); } /** * Returns the track bits of the waypoint * @param t the tile to get the waypoint track bits from * @pre IsRailWaypointTile(t) * @return the track bits of the waypoint */ static inline TrackBits GetRailWaypointBits(TileIndex t) { return TrackToTrackBits(GetRailWaypointTrack(t)); } /** * Returns waypoint index (for the waypoint pool) * @param t the tile to get the waypoint index from * @pre IsRailWaypointTile(t) * @return the waypoint index */ static inline WaypointID GetWaypointIndex(TileIndex t) { return (WaypointID)_m[t].m2; } /** * Returns the reserved track bits of the tile * @pre IsPlainRailTile(t) * @param t the tile to query * @return the track bits */ static inline TrackBits GetTrackReservation(TileIndex t) { assert(IsPlainRailTile(t)); byte track_b = GB(_m[t].m2, 8, 3); Track track = (Track)(track_b - 1); // map array saves Track+1 if (track_b == 0) return TRACK_BIT_NONE; return (TrackBits)(TrackToTrackBits(track) | (HasBit(_m[t].m2, 11) ? TrackToTrackBits(TrackToOppositeTrack(track)) : 0)); } /** * Sets the reserved track bits of the tile * @pre IsPlainRailTile(t) && !TracksOverlap(b) * @param t the tile to change * @param b the track bits */ static inline void SetTrackReservation(TileIndex t, TrackBits b) { assert(IsPlainRailTile(t)); assert(b != INVALID_TRACK_BIT); assert(!TracksOverlap(b)); Track track = RemoveFirstTrack(&b); SB(_m[t].m2, 8, 3, track == INVALID_TRACK ? 0 : track+1); SB(_m[t].m2, 11, 1, (byte)(b != TRACK_BIT_NONE)); } /** * Try to reserve a specific track on a tile * @pre IsPlainRailTile(t) && HasTrack(tile, t) * @param tile the tile * @param t the rack to reserve * @return true if successful */ static inline bool TryReserveTrack(TileIndex tile, Track t) { assert(HasTrack(tile, t)); TrackBits bits = TrackToTrackBits(t); TrackBits res = GetTrackReservation(tile); if ((res & bits) != TRACK_BIT_NONE) return false; // already reserved res |= bits; if (TracksOverlap(res)) return false; // crossing reservation present SetTrackReservation(tile, res); return true; } /** * Lift the reservation of a specific track on a tile * @pre IsPlainRailTile(t) && HasTrack(tile, t) * @param tile the tile * @param t the track to free */ static inline void UnreserveTrack(TileIndex tile, Track t) { assert(HasTrack(tile, t)); TrackBits res = GetTrackReservation(tile); res &= ~TrackToTrackBits(t); SetTrackReservation(tile, res); } /** * Get the reservation state of the waypoint or depot * @note Works for both waypoints and rail depots * @pre IsRailWaypoint(t) || IsRailDepot(t) * @param t the waypoint/depot tile * @return reservation state */ static inline bool GetDepotWaypointReservation(TileIndex t) { assert(IsRailWaypoint(t) || IsRailDepot(t)); return HasBit(_m[t].m5, 4); } /** * Set the reservation state of the waypoint or depot * @note Works for both waypoints and rail depots * @pre IsRailWaypoint(t) || IsRailDepot(t) * @param t the waypoint/depot tile * @param b the reservation state */ static inline void SetDepotWaypointReservation(TileIndex t, bool b) { assert(IsRailWaypoint(t) || IsRailDepot(t)); SB(_m[t].m5, 4, 1, (byte)b); } /** * Get the reserved track bits for a waypoint * @pre IsRailWaypoint(t) * @param t the tile * @return reserved track bits */ static inline TrackBits GetRailWaypointReservation(TileIndex t) { return GetDepotWaypointReservation(t) ? GetRailWaypointBits(t) : TRACK_BIT_NONE; } /** * Get the reserved track bits for a depot * @pre IsRailDepot(t) * @param t the tile * @return reserved track bits */ static inline TrackBits GetRailDepotReservation(TileIndex t) { return GetDepotWaypointReservation(t) ? TrackToTrackBits(GetRailDepotTrack(t)) : TRACK_BIT_NONE; } static inline bool IsPbsSignal(SignalType s) { return s == SIGTYPE_PBS || s == SIGTYPE_PBS_ONEWAY; } static inline SignalType GetSignalType(TileIndex t, Track track) { assert(GetRailTileType(t) == RAIL_TILE_SIGNALS); byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0; return (SignalType)GB(_m[t].m2, pos, 3); } static inline void SetSignalType(TileIndex t, Track track, SignalType s) { assert(GetRailTileType(t) == RAIL_TILE_SIGNALS); byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0; SB(_m[t].m2, pos, 3, s); if (track == INVALID_TRACK) SB(_m[t].m2, 4, 3, s); } static inline bool IsPresignalEntry(TileIndex t, Track track) { return GetSignalType(t, track) == SIGTYPE_ENTRY || GetSignalType(t, track) == SIGTYPE_COMBO; } static inline bool IsPresignalExit(TileIndex t, Track track) { return GetSignalType(t, track) == SIGTYPE_EXIT || GetSignalType(t, track) == SIGTYPE_COMBO; } /** One-way signals can't be passed the 'wrong' way. */ static inline bool IsOnewaySignal(TileIndex t, Track track) { return GetSignalType(t, track) != SIGTYPE_PBS; } static inline void CycleSignalSide(TileIndex t, Track track) { byte sig; byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 6; sig = GB(_m[t].m3, pos, 2); if (--sig == 0) sig = IsPbsSignal(GetSignalType(t, track)) ? 2 : 3; SB(_m[t].m3, pos, 2, sig); } static inline SignalVariant GetSignalVariant(TileIndex t, Track track) { byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3; return (SignalVariant)GB(_m[t].m2, pos, 1); } static inline void SetSignalVariant(TileIndex t, Track track, SignalVariant v) { byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 7 : 3; SB(_m[t].m2, pos, 1, v); if (track == INVALID_TRACK) SB(_m[t].m2, 7, 1, v); } /** These are states in which a signal can be. Currently these are only two, so * simple boolean logic will do. But do try to compare to this enum instead of * normal boolean evaluation, since that will make future additions easier. */ enum SignalState { SIGNAL_STATE_RED = 0, ///< The signal is red SIGNAL_STATE_GREEN = 1, ///< The signal is green }; /** * Set the states of the signals (Along/AgainstTrackDir) * @param tile the tile to set the states for * @param state the new state */ static inline void SetSignalStates(TileIndex tile, uint state) { SB(_m[tile].m4, 4, 4, state); } /** * Set the states of the signals (Along/AgainstTrackDir) * @param tile the tile to set the states for * @param state the new state */ static inline uint GetSignalStates(TileIndex tile) { return GB(_m[tile].m4, 4, 4); } /** * Get the state of a single signal * @param t the tile to get the signal state for * @param signalbit the signal * @return the state of the signal */ static inline SignalState GetSingleSignalState(TileIndex t, byte signalbit) { return (SignalState)HasBit(GetSignalStates(t), signalbit); } /** * Set whether the given signals are present (Along/AgainstTrackDir) * @param tile the tile to set the present signals for * @param signals the signals that have to be present */ static inline void SetPresentSignals(TileIndex tile, uint signals) { SB(_m[tile].m3, 4, 4, signals); } /** * Get whether the given signals are present (Along/AgainstTrackDir) * @param tile the tile to get the present signals for * @return the signals that are present */ static inline uint GetPresentSignals(TileIndex tile) { return GB(_m[tile].m3, 4, 4); } /** * Checks whether the given signals is present * @param t the tile to check on * @param signalbit the signal * @return true if and only if the signal is present */ static inline bool IsSignalPresent(TileIndex t, byte signalbit) { return HasBit(GetPresentSignals(t), signalbit); } /** * Checks for the presence of signals (either way) on the given track on the * given rail tile. */ static inline bool HasSignalOnTrack(TileIndex tile, Track track) { assert(IsValidTrack(track)); return GetRailTileType(tile) == RAIL_TILE_SIGNALS && (GetPresentSignals(tile) & SignalOnTrack(track)) != 0; } /** * Checks for the presence of signals along the given trackdir on the given * rail tile. * * Along meaning if you are currently driving on the given trackdir, this is * the signal that is facing us (for which we stop when it's red). */ static inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir) { assert (IsValidTrackdir(trackdir)); return GetRailTileType(tile) == RAIL_TILE_SIGNALS && GetPresentSignals(tile) & SignalAlongTrackdir(trackdir); } /** * Gets the state of the signal along the given trackdir. * * Along meaning if you are currently driving on the given trackdir, this is * the signal that is facing us (for which we stop when it's red). */ static inline SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir) { assert(IsValidTrackdir(trackdir)); assert(HasSignalOnTrack(tile, TrackdirToTrack(trackdir))); return GetSignalStates(tile) & SignalAlongTrackdir(trackdir) ? SIGNAL_STATE_GREEN : SIGNAL_STATE_RED; } /** * Sets the state of the signal along the given trackdir. */ static inline void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, SignalState state) { if (state == SIGNAL_STATE_GREEN) { // set 1 SetSignalStates(tile, GetSignalStates(tile) | SignalAlongTrackdir(trackdir)); } else { SetSignalStates(tile, GetSignalStates(tile) & ~SignalAlongTrackdir(trackdir)); } } /** * Is a pbs signal present along the trackdir? * @param tile the tile to check * @param td the trackdir to check */ static inline bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td) { return IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, td) && IsPbsSignal(GetSignalType(tile, TrackdirToTrack(td))); } /** * Is a one-way signal blocking the trackdir? A one-way signal on the * trackdir against will block, but signals on both trackdirs won't. * @param tile the tile to check * @param td the trackdir to check */ static inline bool HasOnewaySignalBlockingTrackdir(TileIndex tile, Trackdir td) { return IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, ReverseTrackdir(td)) && !HasSignalOnTrackdir(tile, td) && IsOnewaySignal(tile, TrackdirToTrack(td)); } /** * Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile. */ RailType GetTileRailType(TileIndex tile); /** The ground 'under' the rail */ enum RailGroundType { RAIL_GROUND_BARREN = 0, ///< Nothing (dirt) RAIL_GROUND_GRASS = 1, ///< Grassy RAIL_GROUND_FENCE_NW = 2, ///< Grass with a fence at the NW edge RAIL_GROUND_FENCE_SE = 3, ///< Grass with a fence at the SE edge RAIL_GROUND_FENCE_SENW = 4, ///< Grass with a fence at the NW and SE edges RAIL_GROUND_FENCE_NE = 5, ///< Grass with a fence at the NE edge RAIL_GROUND_FENCE_SW = 6, ///< Grass with a fence at the SW edge RAIL_GROUND_FENCE_NESW = 7, ///< Grass with a fence at the NE and SW edges RAIL_GROUND_FENCE_VERT1 = 8, ///< Grass with a fence at the eastern side RAIL_GROUND_FENCE_VERT2 = 9, ///< Grass with a fence at the western side RAIL_GROUND_FENCE_HORIZ1 = 10, ///< Grass with a fence at the southern side RAIL_GROUND_FENCE_HORIZ2 = 11, ///< Grass with a fence at the northern side RAIL_GROUND_ICE_DESERT = 12, ///< Icy or sandy RAIL_GROUND_WATER = 13, ///< Grass with a fence and shore or water on the free halftile RAIL_GROUND_HALF_SNOW = 14, ///< Snow only on higher part of slope (steep or one corner raised) }; static inline void SetRailGroundType(TileIndex t, RailGroundType rgt) { SB(_m[t].m4, 0, 4, rgt); } static inline RailGroundType GetRailGroundType(TileIndex t) { return (RailGroundType)GB(_m[t].m4, 0, 4); } static inline bool IsSnowRailGround(TileIndex t) { return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT; } static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r) { SetTileType(t, MP_RAILWAY); SetTileOwner(t, o); _m[t].m2 = 0; _m[t].m3 = r; _m[t].m4 = 0; _m[t].m5 = RAIL_TILE_NORMAL << 6 | b; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } static inline void MakeRailDepot(TileIndex t, Owner o, DiagDirection d, RailType r) { SetTileType(t, MP_RAILWAY); SetTileOwner(t, o); _m[t].m2 = 0; _m[t].m3 = r; _m[t].m4 = 0; _m[t].m5 = RAIL_TILE_DEPOT << 6 | d; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } static inline void MakeRailWaypoint(TileIndex t, Owner o, Axis a, RailType r, uint index) { SetTileType(t, MP_RAILWAY); SetTileOwner(t, o); _m[t].m2 = index; _m[t].m3 = r; _m[t].m4 = 0; _m[t].m5 = RAIL_TILE_WAYPOINT << 6 | a; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } #endif /* RAIL_MAP_H */
17,986
C++
.h
568
29.910211
122
0.727661
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,335
fontcache.h
EnergeticBark_OpenTTD-3DS/src/fontcache.h
/* $Id$ */ /** @file fontcache.h Functions to read fonts from files and cache them. */ #ifndef FONTCACHE_H #define FONTCACHE_H #include "gfx_type.h" /** Get the SpriteID mapped to the given font size and key */ SpriteID GetUnicodeGlyph(FontSize size, uint32 key); /** Map a SpriteID to the font size and key */ void SetUnicodeGlyph(FontSize size, uint32 key, SpriteID sprite); /** Initialize the glyph map */ void InitializeUnicodeGlyphMap(); #ifdef WITH_FREETYPE struct FreeTypeSettings { char small_font[MAX_PATH]; char medium_font[MAX_PATH]; char large_font[MAX_PATH]; uint small_size; uint medium_size; uint large_size; bool small_aa; bool medium_aa; bool large_aa; }; extern FreeTypeSettings _freetype; void InitFreeType(); void UninitFreeType(); const struct Sprite *GetGlyph(FontSize size, uint32 key); uint GetGlyphWidth(FontSize size, uint32 key); /** * We would like to have a fallback font as the current one * doesn't contain all characters we need. * This function must set all fonts of settings. * @param settings the settings to overwrite the fontname of. * @param language_isocode the language, e.g. en_GB. * @param winlangid the language ID windows style. * @return true if a font has been set, false otherwise. */ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid); #else /* Stub for initializiation */ static inline void InitFreeType() {} static inline void UninitFreeType() {} /** Get the Sprite for a glyph */ static inline const Sprite *GetGlyph(FontSize size, uint32 key) { SpriteID sprite = GetUnicodeGlyph(size, key); if (sprite == 0) sprite = GetUnicodeGlyph(size, '?'); return GetSprite(sprite, ST_FONT); } /** Get the width of a glyph */ static inline uint GetGlyphWidth(FontSize size, uint32 key) { SpriteID sprite = GetUnicodeGlyph(size, key); if (sprite == 0) sprite = GetUnicodeGlyph(size, '?'); return SpriteExists(sprite) ? GetSprite(sprite, ST_FONT)->width + (size != FS_NORMAL) : 0; } #endif /* WITH_FREETYPE */ #endif /* FONTCACHE_H */
2,057
C++
.h
58
33.758621
94
0.754669
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,336
settings_func.h
EnergeticBark_OpenTTD-3DS/src/settings_func.h
/* $Id$ */ /** @file settings_func.h Functions related to setting/changing the settings. */ #ifndef SETTINGS_FUNC_H #define SETTINGS_FUNC_H #include "core/smallvec_type.hpp" void IConsoleSetSetting(const char *name, const char *value); void IConsoleSetSetting(const char *name, int32 value); void IConsoleGetSetting(const char *name); void IConsoleListSettings(const char *prefilter); void LoadFromConfig(); void SaveToConfig(); void CheckConfig(); /* Functions to load and save NewGRF settings to a separate * configuration file, used for presets. */ typedef AutoFreeSmallVector<char *, 4> GRFPresetList; void GetGRFPresetList(GRFPresetList *list); struct GRFConfig *LoadGRFPresetFromConfig(const char *config_name); void SaveGRFPresetToConfig(const char *config_name, struct GRFConfig *config); void DeleteGRFPresetFromConfig(const char *config_name); #endif /* SETTINGS_FUNC_H */
892
C++
.h
20
43.15
80
0.803241
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,337
rail.h
EnergeticBark_OpenTTD-3DS/src/rail.h
/* $Id$ */ /** @file rail.h Rail specific functions. */ #ifndef RAIL_H #define RAIL_H #include "rail_type.h" #include "track_type.h" #include "vehicle_type.h" #include "gfx_type.h" #include "core/bitmath_func.hpp" #include "economy_func.h" #include "slope_type.h" enum RailTypeFlag { RTF_CATENARY = 0, ///< Set if the rail type should have catenary drawn }; enum RailTypeFlags { RTFB_NONE = 0, RTFB_CATENARY = 1 << RTF_CATENARY, }; DECLARE_ENUM_AS_BIT_SET(RailTypeFlags); /** Offsets from base sprite for fence sprites. These are in the order of * the sprites in the original data files. */ enum RailFenceOffset { RFO_FLAT_X, RFO_FLAT_Y, RFO_FLAT_VERT, RFO_FLAT_HORZ, RFO_SLOPE_SW, RFO_SLOPE_SE, RFO_SLOPE_NE, RFO_SLOPE_NW, }; /** This struct contains all the info that is needed to draw and construct tracks. */ struct RailtypeInfo { /** Struct containing the main sprites. @note not all sprites are listed, but only * the ones used directly in the code */ struct { SpriteID track_y; ///< single piece of rail in Y direction, with ground SpriteID track_ns; ///< two pieces of rail in North and South corner (East-West direction) SpriteID ground; ///< ground sprite for a 3-way switch SpriteID single_y; ///< single piece of rail in Y direction, without ground SpriteID single_x; ///< single piece of rail in X direction SpriteID single_n; ///< single piece of rail in the northern corner SpriteID single_s; ///< single piece of rail in the southern corner SpriteID single_e; ///< single piece of rail in the eastern corner SpriteID single_w; ///< single piece of rail in the western corner SpriteID single_sloped;///< single piecs of rail for slopes SpriteID crossing; ///< level crossing, rail in X direction SpriteID tunnel; ///< tunnel sprites base } base_sprites; /** struct containing the sprites for the rail GUI. @note only sprites referred to * directly in the code are listed */ struct { SpriteID build_ns_rail; ///< button for building single rail in N-S direction SpriteID build_x_rail; ///< button for building single rail in X direction SpriteID build_ew_rail; ///< button for building single rail in E-W direction SpriteID build_y_rail; ///< button for building single rail in Y direction SpriteID auto_rail; ///< button for the autorail construction SpriteID build_depot; ///< button for building depots SpriteID build_tunnel; ///< button for building a tunnel SpriteID convert_rail; ///< button for converting rail } gui_sprites; struct { CursorID rail_ns; ///< Cursor for building rail in N-S direction CursorID rail_swne; ///< Cursor for building rail in X direction CursorID rail_ew; ///< Cursor for building rail in E-W direction CursorID rail_nwse; ///< Cursor for building rail in Y direction CursorID autorail; ///< Cursor for autorail tool CursorID depot; ///< Cursor for building a depot CursorID tunnel; ///< Cursor for building a tunnel CursorID convert; ///< Cursor for converting track } cursor; struct { StringID toolbar_caption; StringID menu_text; StringID build_caption; StringID replace_text; StringID new_loco; } strings; /** sprite number difference between a piece of track on a snowy ground and the corresponding one on normal ground */ SpriteID snow_offset; /** bitmask to the OTHER railtypes on which an engine of THIS railtype generates power */ RailTypes powered_railtypes; /** bitmask to the OTHER railtypes on which an engine of THIS railtype can physically travel */ RailTypes compatible_railtypes; /** * Offset between the current railtype and normal rail. This means that:<p> * 1) All the sprites in a railset MUST be in the same order. This order * is determined by normal rail. Check sprites 1005 and following for this order<p> * 2) The position where the railtype is loaded must always be the same, otherwise * the offset will fail. * @note: Something more flexible might be desirable in the future. */ SpriteID total_offset; /** * Bridge offset */ SpriteID bridge_offset; /** * Offset to add to ground sprite when drawing custom waypoints / stations */ byte custom_ground_offset; /** * Multiplier for curve maximum speed advantage */ byte curve_speed; /** * Bit mask of rail type flags */ RailTypeFlags flags; /** * Cost multiplier for building this rail type */ uint8 cost_multiplier; /** * Unique 32 bit rail type identifier */ RailTypeLabel label; }; /** * Returns a pointer to the Railtype information for a given railtype * @param railtype the rail type which the information is requested for * @return The pointer to the RailtypeInfo */ static inline const RailtypeInfo *GetRailTypeInfo(RailType railtype) { extern RailtypeInfo _railtypes[RAILTYPE_END]; assert(railtype < RAILTYPE_END); return &_railtypes[railtype]; } /** * Checks if an engine of the given RailType can drive on a tile with a given * RailType. This would normally just be an equality check, but for electric * rails (which also support non-electric engines). * @return Whether the engine can drive on this tile. * @param enginetype The RailType of the engine we are considering. * @param tiletype The RailType of the tile we are considering. */ static inline bool IsCompatibleRail(RailType enginetype, RailType tiletype) { return HasBit(GetRailTypeInfo(enginetype)->compatible_railtypes, tiletype); } /** * Checks if an engine of the given RailType got power on a tile with a given * RailType. This would normally just be an equality check, but for electric * rails (which also support non-electric engines). * @return Whether the engine got power on this tile. * @param enginetype The RailType of the engine we are considering. * @param tiletype The RailType of the tile we are considering. */ static inline bool HasPowerOnRail(RailType enginetype, RailType tiletype) { return HasBit(GetRailTypeInfo(enginetype)->powered_railtypes, tiletype); } /** * Returns the cost of building the specified railtype. * @param railtype The railtype being built. * @return The cost multiplier. */ static inline Money RailBuildCost(RailType railtype) { assert(railtype < RAILTYPE_END); return (_price.build_rail * GetRailTypeInfo(railtype)->cost_multiplier) >> 3; } /** * Calculates the cost of rail conversion * @param from The railtype we are converting from * @param to The railtype we are converting to * @return Cost per TrackBit */ static inline Money RailConvertCost(RailType from, RailType to) { /* rail -> el. rail * calculate the price as 5 / 4 of (cost build el. rail) - (cost build rail) * (the price of workers to get to place is that 1/4) */ if (HasPowerOnRail(from, to)) { Money cost = ((RailBuildCost(to) - RailBuildCost(from)) * 5) >> 2; if (cost != 0) return cost; } /* el. rail -> rail * calculate the price as 1 / 4 of (cost build el. rail) - (cost build rail) * (the price of workers is 1 / 4 + price of copper sold to a recycle center) */ if (HasPowerOnRail(to, from)) { Money cost = (RailBuildCost(from) - RailBuildCost(to)) >> 2; if (cost != 0) return cost; } /* make the price the same as remove + build new type */ return RailBuildCost(to) + _price.remove_rail; } Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data); void DrawTrainDepotSprite(int x, int y, int image, RailType railtype); void DrawDefaultWaypointSprite(int x, int y, RailType railtype); Vehicle *EnsureNoTrainOnTrackProc(Vehicle *v, void *data); int TicksToLeaveDepot(const Vehicle *v); Foundation GetRailFoundation(Slope tileh, TrackBits bits); /** * Finds out if a company has a certain railtype available * @param company the company in question * @param railtype requested RailType * @return true if company has requested RailType available */ bool HasRailtypeAvail(const CompanyID company, const RailType railtype); /** * Validate functions for rail building. * @param rail the railtype to check. * @return true if the current company may build the rail. */ bool ValParamRailtype(const RailType rail); /** * Returns the "best" railtype a company can build. * As the AI doesn't know what the BEST one is, we have our own priority list * here. When adding new railtypes, modify this function * @param company the company "in action" * @return The "best" railtype a company has available */ RailType GetBestRailtype(const CompanyID company); /** * Get the rail types the given company can build. * @param company the company to get the rail types for. * @return the rail types. */ RailTypes GetCompanyRailtypes(const CompanyID c); /** * Get the rail type for a given label. * @param label the railtype label. * @return the railtype. */ RailType GetRailTypeByLabel(RailTypeLabel label); /** * Reset all rail type information to its default values. */ void ResetRailTypes(); #endif /* RAIL_H */
9,022
C++
.h
236
36.055085
118
0.736283
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,338
console_internal.h
EnergeticBark_OpenTTD-3DS/src/console_internal.h
/* $Id$ */ /** @file console_internal.h Internally used functions for the console. */ #ifndef CONSOLE_INTERNAL_H #define CONSOLE_INTERNAL_H #include "console_func.h" enum { ICON_CMDLN_SIZE = 1024, ///< maximum length of a typed in command ICON_MAX_STREAMSIZE = 2048, ///< maximum length of a totally expanded command }; enum IConsoleVarTypes { ICONSOLE_VAR_BOOLEAN, ICONSOLE_VAR_BYTE, ICONSOLE_VAR_UINT16, ICONSOLE_VAR_UINT32, ICONSOLE_VAR_INT16, ICONSOLE_VAR_INT32, ICONSOLE_VAR_STRING }; enum IConsoleHookTypes { ICONSOLE_HOOK_ACCESS, ICONSOLE_HOOK_PRE_ACTION, ICONSOLE_HOOK_POST_ACTION }; /** --Hooks-- * Hooks are certain triggers get get accessed/executed on either * access, before execution/change or after execution/change. This allows * for general flow of permissions or special action needed in some cases */ typedef bool IConsoleHook(); struct IConsoleHooks{ IConsoleHook *access; ///< trigger when accessing the variable/command IConsoleHook *pre; ///< trigger before the variable/command is changed/executed IConsoleHook *post; ///< trigger after the variable/command is changed/executed }; /** --Commands-- * Commands are commands, or functions. They get executed once and any * effect they produce are carried out. The arguments to the commands * are given to them, each input word seperated by a double-quote (") is an argument * If you want to handle multiple words as one, enclose them in double-quotes * eg. 'say "hello sexy boy"' */ typedef bool (IConsoleCmdProc)(byte argc, char *argv[]); struct IConsoleCmd { char *name; ///< name of command IConsoleCmd *next; ///< next command in list IConsoleCmdProc *proc; ///< process executed when command is typed IConsoleHooks hook; ///< any special trigger action that needs executing }; /** --Variables-- * Variables are pointers to real ingame variables which allow for * changing while ingame. After changing they keep their new value * and can be used for debugging, gameplay, etc. It accepts: * - no arguments; just print out current value * - '= <new value>' to assign a new value to the variable * - '++' to increase value by one * - '--' to decrease value by one */ struct IConsoleVar { char *name; ///< name of the variable IConsoleVar *next; ///< next variable in list void *addr; ///< the address where the variable is pointing at uint32 size; ///< size of the variable, used for strings char *help; ///< the optional help string shown when requesting information IConsoleVarTypes type; ///< type of variable (for correct assignment/output) IConsoleCmdProc *proc; ///< some variables need really special handling, use a callback function for that IConsoleHooks hook; ///< any special trigger action that needs executing }; /** --Aliases-- * Aliases are like shortcuts for complex functions, variable assignments, * etc. You can use a simple alias to rename a longer command (eg 'lv' for * 'list_vars' for example), or concatenate more commands into one * (eg. 'ng' for 'load %A; unpause; debug_level 5'). Aliases can parse the arguments * given to them in the command line. * - "%A - %Z" substitute arguments 1 t/m 26 * - "%+" lists all parameters keeping them seperated * - "%!" also lists all parameters but presenting them to the aliased command as one argument * - ";" allows for combining commands (see example 'ng') */ struct IConsoleAlias { char *name; ///< name of the alias IConsoleAlias *next; ///< next alias in list char *cmdline; ///< command(s) that is/are being aliased }; /* console parser */ extern IConsoleCmd *_iconsole_cmds; ///< list of registred commands extern IConsoleVar *_iconsole_vars; ///< list of registred vars extern IConsoleAlias *_iconsole_aliases; ///< list of registred aliases /* console functions */ void IConsoleClearBuffer(); void IConsoleOpen(); /* Commands */ void IConsoleCmdRegister(const char *name, IConsoleCmdProc *proc); void IConsoleAliasRegister(const char *name, const char *cmd); IConsoleCmd *IConsoleCmdGet(const char *name); IConsoleAlias *IConsoleAliasGet(const char *name); /* Variables */ void IConsoleVarRegister(const char *name, void *addr, IConsoleVarTypes type, const char *help); void IConsoleVarStringRegister(const char *name, void *addr, uint32 size, const char *help); IConsoleVar *IConsoleVarGet(const char *name); void IConsoleVarPrintGetValue(const IConsoleVar *var); void IConsoleVarPrintSetValue(const IConsoleVar *var); /* Parser */ void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[]); /* console std lib (register ingame commands/aliases/variables) */ void IConsoleStdLibRegister(); /* Hooking code */ void IConsoleCmdHookAdd(const char *name, IConsoleHookTypes type, IConsoleHook *proc); void IConsoleVarHookAdd(const char *name, IConsoleHookTypes type, IConsoleHook *proc); void IConsoleVarProcAdd(const char *name, IConsoleCmdProc *proc); /* Supporting functions */ bool GetArgumentInteger(uint32 *value, const char *arg); void IConsoleGUIInit(); void IConsoleGUIFree(); void IConsoleGUIPrint(ConsoleColour colour_code, char *string); #endif /* CONSOLE_INTERNAL_H */
5,285
C++
.h
115
44.243478
109
0.738826
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,339
town_type.h
EnergeticBark_OpenTTD-3DS/src/town_type.h
/* $Id$ */ /** @file town_type.h Types related to towns. */ #ifndef TOWN_TYPE_H #define TOWN_TYPE_H #include "core/enum_type.hpp" typedef uint16 TownID; typedef uint16 HouseID; typedef uint16 HouseClassID; struct Town; struct HouseSpec; /** Supported initial town sizes */ enum TownSize { TS_SMALL, ///< small town TS_MEDIUM, ///< medium town TS_LARGE, ///< large town TS_RANDOM, ///< random size, bigger than small, smaller than large }; enum { /* These refer to the maximums, so Appalling is -1000 to -400 * MAXIMUM RATINGS BOUNDARIES */ RATING_MINIMUM = -1000, RATING_APPALLING = -400, RATING_VERYPOOR = -200, RATING_POOR = 0, RATING_MEDIOCRE = 200, RATING_GOOD = 400, RATING_VERYGOOD = 600, RATING_EXCELLENT = 800, RATING_OUTSTANDING = 1000, ///< OUTSTANDING RATING_MAXIMUM = RATING_OUTSTANDING, RATING_INITIAL = 500, ///< initial rating /* RATINGS AFFECTING NUMBERS */ RATING_TREE_DOWN_STEP = -35, RATING_TREE_MINIMUM = RATING_MINIMUM, RATING_TREE_UP_STEP = 7, RATING_TREE_MAXIMUM = 220, RATING_GROWTH_UP_STEP = 5, ///< when a town grows, all companies have rating increased a bit ... RATING_GROWTH_MAXIMUM = RATING_MEDIOCRE, ///< ... up to RATING_MEDIOCRE RATING_STATION_UP_STEP = 12, ///< when a town grows, company gains reputation for all well serviced stations ... RATING_STATION_DOWN_STEP = -15, ///< ... but loses for bad serviced stations RATING_TUNNEL_BRIDGE_DOWN_STEP = -250, RATING_TUNNEL_BRIDGE_MINIMUM = 0, RATING_ROAD_DOWN_STEP_INNER = -50, ///< removing a roadpiece in the middle RATING_ROAD_DOWN_STEP_EDGE = -18, ///< removing a roadpiece at the edge RATING_ROAD_MINIMUM = -100, RATING_HOUSE_MINIMUM = RATING_MINIMUM, RATING_BRIBE_UP_STEP = 200, RATING_BRIBE_MAXIMUM = 800, RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER? }; /** * Town Layouts */ enum TownLayout { TL_BEGIN = 0, TL_ORIGINAL = 0, ///< Original algorithm (min. 1 distance between roads) TL_BETTER_ROADS, ///< Extended original algorithm (min. 2 distance between roads) TL_2X2_GRID, ///< Geometric 2x2 grid algorithm TL_3X3_GRID, ///< Geometric 3x3 grid algorithm TL_RANDOM, ///< Random town layout NUM_TLS, ///< Number of town layouts }; /** It needs to be 8bits, because we save and load it as such * Define basic enum properties */ template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_BEGIN, NUM_TLS, NUM_TLS> {}; typedef TinyEnumT<TownLayout> TownLayoutByte; // typedefing-enumification of TownLayout enum { MAX_LENGTH_TOWN_NAME_BYTES = 31, ///< The maximum length of a town name in bytes including '\0' MAX_LENGTH_TOWN_NAME_PIXELS = 130, ///< The maximum length of a town name in pixels }; #endif /* TOWN_TYPE_H */
2,847
C++
.h
71
38.140845
116
0.689405
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,340
cargo_type.h
EnergeticBark_OpenTTD-3DS/src/cargo_type.h
/* $Id$ */ /** @file cargo_type.h Types related to cargos... */ #ifndef CARGO_TYPE_H #define CARGO_TYPE_H typedef byte CargoID; /** Available types of cargo */ enum CargoTypes { /* Temperate */ CT_PASSENGERS = 0, CT_COAL = 1, CT_MAIL = 2, CT_OIL = 3, CT_LIVESTOCK = 4, CT_GOODS = 5, CT_GRAIN = 6, CT_WOOD = 7, CT_IRON_ORE = 8, CT_STEEL = 9, CT_VALUABLES = 10, /* Arctic */ CT_WHEAT = 6, CT_HILLY_UNUSED = 8, CT_PAPER = 9, CT_GOLD = 10, CT_FOOD = 11, /* Tropic */ CT_RUBBER = 1, CT_FRUIT = 4, CT_MAIZE = 6, CT_COPPER_ORE = 8, CT_WATER = 9, CT_DIAMONDS = 10, /* Toyland */ CT_SUGAR = 1, CT_TOYS = 3, CT_BATTERIES = 4, CT_CANDY = 5, CT_TOFFEE = 6, CT_COLA = 7, CT_COTTON_CANDY = 8, CT_BUBBLES = 9, CT_PLASTIC = 10, CT_FIZZY_DRINKS = 11, NUM_CARGO = 32, CT_NO_REFIT = 0xFE, CT_INVALID = 0xFF }; /** Array for storing amounts of accepted cargo */ typedef uint AcceptedCargo[NUM_CARGO]; #endif /* CARGO_TYPE_H */
1,176
C++
.h
50
21.52
52
0.513004
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,342
vehicle_gui.h
EnergeticBark_OpenTTD-3DS/src/vehicle_gui.h
/* $Id$ */ /** @file vehicle_gui.h Functions related to the vehicle's GUIs. */ #ifndef VEHICLE_GUI_H #define VEHICLE_GUI_H #include "window_type.h" #include "vehicle_type.h" #include "order_type.h" #include "station_type.h" #include "engine_type.h" #include "waypoint.h" void DrawVehicleProfitButton(const Vehicle *v, int x, int y); void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent); /** Constants of vehicle view widget indices */ enum VehicleViewWindowWidgets { VVW_WIDGET_CLOSEBOX = 0, VVW_WIDGET_CAPTION, VVW_WIDGET_STICKY, VVW_WIDGET_PANEL, VVW_WIDGET_VIEWPORT, VVW_WIDGET_START_STOP_VEH, VVW_WIDGET_CENTER_MAIN_VIEH, VVW_WIDGET_GOTO_DEPOT, VVW_WIDGET_REFIT_VEH, VVW_WIDGET_SHOW_ORDERS, VVW_WIDGET_SHOW_DETAILS, VVW_WIDGET_CLONE_VEH, VVW_WIDGET_EMPTY_BOTTOM_RIGHT, VVW_WIDGET_RESIZE, VVW_WIDGET_TURN_AROUND, VVW_WIDGET_FORCE_PROCEED, }; /** Vehicle List Window type flags */ enum { VLW_STANDARD = 0 << 8, VLW_SHARED_ORDERS = 1 << 8, VLW_STATION_LIST = 2 << 8, VLW_DEPOT_LIST = 3 << 8, VLW_GROUP_LIST = 4 << 8, VLW_WAYPOINT_LIST = 5 << 8, VLW_MASK = 0x700, }; static inline bool ValidVLWFlags(uint16 flags) { return (flags == VLW_STANDARD || flags == VLW_SHARED_ORDERS || flags == VLW_STATION_LIST || flags == VLW_DEPOT_LIST || flags == VLW_GROUP_LIST); } int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number); void DrawTrainImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip); void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count); void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection); void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection); void ShowBuildVehicleWindow(TileIndex tile, VehicleType type); uint ShowAdditionalText(int x, int y, uint w, EngineID engine); uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine); StringID GetCargoSubtypeText(const Vehicle *v); void ShowVehicleListWindow(const Vehicle *v); void ShowVehicleListWindow(const Waypoint *wp); void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type); void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, StationID station); void ShowVehicleListWindow(CompanyID company, VehicleType vehicle_type, TileIndex depot_tile); /* ChangeVehicleViewWindow() moves all windows for one vehicle to another vehicle. * For ease of use it can be called with both Vehicle pointers and VehicleIDs. */ void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index); static inline uint GetVehicleListHeight(VehicleType type) { return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24; } /** Get WindowClass for vehicle list of given vehicle type * @param vt vehicle type to check * @return corresponding window class * @note works only for company buildable vehicle types */ static inline WindowClass GetWindowClassForVehicleType(VehicleType vt) { switch (vt) { default: NOT_REACHED(); case VEH_TRAIN: return WC_TRAINS_LIST; case VEH_ROAD: return WC_ROADVEH_LIST; case VEH_SHIP: return WC_SHIPS_LIST; case VEH_AIRCRAFT: return WC_AIRCRAFT_LIST; } } /* Unified window procedure */ void ShowVehicleViewWindow(const Vehicle *v); Vehicle *CheckClickOnVehicle(const struct ViewPort *vp, int x, int y); #endif /* VEHICLE_GUI_H */
3,382
C++
.h
85
38.070588
145
0.764185
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,343
signs_base.h
EnergeticBark_OpenTTD-3DS/src/signs_base.h
/* $Id$ */ /** @file signs_base.h Base class for signs. */ #ifndef SIGNS_BASE_H #define SIGNS_BASE_H #include "signs_type.h" #include "viewport_type.h" #include "tile_type.h" #include "oldpool.h" DECLARE_OLD_POOL(Sign, Sign, 2, 16000) struct Sign : PoolItem<Sign, SignID, &_Sign_pool> { char *name; ViewportSign sign; int32 x; int32 y; byte z; OwnerByte owner; // placed by this company. Anyone can delete them though. OWNER_NONE for gray signs from old games. /** * Creates a new sign */ Sign(Owner owner = INVALID_OWNER); /** Destroy the sign */ ~Sign(); inline bool IsValid() const { return this->owner != INVALID_OWNER; } }; static inline SignID GetMaxSignIndex() { /* TODO - This isn't the real content of the function, but * with the new pool-system this will be replaced with one that * _really_ returns the highest index. Now it just returns * the next safe value we are sure about everything is below. */ return GetSignPoolSize() - 1; } static inline bool IsValidSignID(uint index) { return index < GetSignPoolSize() && GetSign(index)->IsValid(); } #define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1U < GetSignPoolSize()) ? GetSign(ss->index + 1U) : NULL) if (ss->IsValid()) #define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0) #endif /* SIGNS_BASE_H */
1,373
C++
.h
40
32.375
170
0.694171
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,344
economy_type.h
EnergeticBark_OpenTTD-3DS/src/economy_type.h
/* $Id$ */ /** @file economy_type.h Types related to the economy. */ #ifndef ECONOMY_TYPE_H #define ECONOMY_TYPE_H #include "core/overflowsafe_type.hpp" #include "core/enum_type.hpp" #include "cargo_type.h" typedef OverflowSafeInt64 Money; struct Economy { Money max_loan; ///< Maximum possible loan Money max_loan_unround; ///< Economy fluctuation status uint16 max_loan_unround_fract; ///< Fraction of the unrounded max loan int16 fluct; byte interest_rate; ///< Interest byte infl_amount; ///< inflation amount byte infl_amount_pr; ///< inflation rate for payment rates uint32 industry_daily_change_counter; ///< Bits 31-16 are number of industry to be performed, 15-0 are fractional collected daily uint32 industry_daily_increment; ///< The value which will increment industry_daily_change_counter. Computed value. NOSAVE }; struct Subsidy { CargoID cargo_type; byte age; /* from and to can either be TownID, StationID or IndustryID */ uint16 from; uint16 to; }; enum ScoreID { SCORE_BEGIN = 0, SCORE_VEHICLES = 0, SCORE_STATIONS = 1, SCORE_MIN_PROFIT = 2, SCORE_MIN_INCOME = 3, SCORE_MAX_INCOME = 4, SCORE_DELIVERED = 5, SCORE_CARGO = 6, SCORE_MONEY = 7, SCORE_LOAN = 8, SCORE_TOTAL = 9, ///< This must always be the last entry SCORE_END = 10, ///< How many scores are there.. SCORE_MAX = 1000 ///< The max score that can be in the performance history /* the scores together of score_info is allowed to be more! */ }; DECLARE_POSTFIX_INCREMENT(ScoreID); struct ScoreInfo { byte id; ///< Unique ID of the score int needed; ///< How much you need to get the perfect score int score; ///< How much score it will give }; struct Prices { Money station_value; Money build_rail; Money build_road; Money build_signals; Money build_bridge; Money build_train_depot; Money build_road_depot; Money build_ship_depot; Money build_tunnel; Money train_station_track; Money train_station_length; Money build_airport; Money build_bus_station; Money build_truck_station; Money build_dock; Money build_railvehicle; Money build_railwagon; Money aircraft_base; Money roadveh_base; Money ship_base; Money build_trees; Money terraform; Money clear_grass; Money clear_roughland; Money clear_rocks; Money clear_fields; Money remove_trees; Money remove_rail; Money remove_signals; Money clear_bridge; Money remove_train_depot; Money remove_road_depot; Money remove_ship_depot; Money clear_tunnel; Money clear_water; Money remove_rail_station; Money remove_airport; Money remove_bus_station; Money remove_truck_station; Money remove_dock; Money remove_house; Money remove_road; Money running_rail[3]; Money aircraft_running; Money roadveh_running; Money ship_running; Money build_industry; }; enum { NUM_PRICES = 49, }; assert_compile(NUM_PRICES * sizeof(Money) == sizeof(Prices)); enum ExpensesType { EXPENSES_CONSTRUCTION = 0, EXPENSES_NEW_VEHICLES, EXPENSES_TRAIN_RUN, EXPENSES_ROADVEH_RUN, EXPENSES_AIRCRAFT_RUN, EXPENSES_SHIP_RUN, EXPENSES_PROPERTY, EXPENSES_TRAIN_INC, EXPENSES_ROADVEH_INC, EXPENSES_AIRCRAFT_INC, EXPENSES_SHIP_INC, EXPENSES_LOAN_INT, EXPENSES_OTHER, EXPENSES_END, INVALID_EXPENSES = 0xFF, }; /* The "steps" in loan size, in British Pounds! */ enum { LOAN_INTERVAL = 10000, LOAN_INTERVAL_OLD_AI = 50000, }; #endif /* ECONOMY_TYPE_H */
3,511
C++
.h
124
26.419355
130
0.723013
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,345
transparency_gui.h
EnergeticBark_OpenTTD-3DS/src/transparency_gui.h
/* $Id$ */ /** @file transparency_gui.h GUI functions related to transparency. */ #ifndef TRANSPARENCY_GUI_H #define TRANSPARENCY_GUI_H void ShowTransparencyToolbar(); #endif /* TRANSPARENCY_GUI_H */
204
C++
.h
6
32.333333
70
0.757732
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,346
terraform_gui.h
EnergeticBark_OpenTTD-3DS/src/terraform_gui.h
/* $Id$ */ /** @file terraform_gui.h GUI stuff related to terraforming. */ #ifndef TERRAFORM_GUI_H #define TERRAFORM_GUI_H #include "window_type.h" void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2); void ShowTerraformToolbar(Window *link = NULL); void ShowEditorTerraformToolbar(); #endif /* GUI_H */
326
C++
.h
9
34.555556
69
0.758842
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,348
depot_map.h
EnergeticBark_OpenTTD-3DS/src/depot_map.h
/* $Id$ */ /** @file depot_map.h Map related accessors for depots. */ #ifndef DEPOT_MAP_H #define DEPOT_MAP_H #include "road_map.h" #include "rail_map.h" #include "water_map.h" #include "station_map.h" /** * Check if a tile is a depot and it is a depot of the given type. */ static inline bool IsDepotTypeTile(TileIndex tile, TransportType type) { switch (type) { default: NOT_REACHED(); case TRANSPORT_RAIL: return IsRailDepotTile(tile); case TRANSPORT_ROAD: return IsRoadDepotTile(tile); case TRANSPORT_WATER: return IsShipDepotTile(tile); } } /** * Is the given tile a tile with a depot on it? * @param tile the tile to check * @return true if and only if there is a depot on the tile. */ static inline bool IsDepotTile(TileIndex tile) { return IsRailDepotTile(tile) || IsRoadDepotTile(tile) || IsShipDepotTile(tile) || IsHangarTile(tile); } #endif /* DEPOT_MAP_H */
904
C++
.h
33
25.363636
102
0.73117
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,349
depot_func.h
EnergeticBark_OpenTTD-3DS/src/depot_func.h
/* $Id$ */ /** @file depot_func.h Functions related to depots. */ #ifndef DEPOT_FUNC_H #define DEPOT_FUNC_H #include "depot_type.h" #include "tile_type.h" #include "vehicle_type.h" #include "direction_type.h" #include "slope_type.h" void ShowDepotWindow(TileIndex tile, VehicleType type); void InitializeDepots(); void DeleteDepotHighlightOfVehicle(const Vehicle *v); /** * Find out if the slope of the tile is suitable to build a depot of given direction * @param direction The direction in which the depot's exit points * @param tileh The slope of the tile in question * @return true if the construction is possible * This is checked by the ugly 0x4C >> direction magic, which does the following: * 0x4C is 0100 1100 and tileh has only bits 0..3 set (steep tiles are ruled out) * So: for direction (only the significant bits are shown)<p> * 00 (exit towards NE) we need either bit 2 or 3 set in tileh: 0x4C >> 0 = 1100<p> * 01 (exit towards SE) we need either bit 1 or 2 set in tileh: 0x4C >> 1 = 0110<p> * 02 (exit towards SW) we need either bit 0 or 1 set in tileh: 0x4C >> 2 = 0011<p> * 03 (exit towards NW) we need either bit 0 or 4 set in tileh: 0x4C >> 3 = 1001<p> * So ((0x4C >> direction) & tileh) determines whether the depot can be built on the current tileh */ static inline bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh) { return ((0x4C >> direction) & tileh) != 0; } #endif /* DEPOT_FUNC_H */
1,447
C++
.h
31
44.967742
98
0.729403
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,350
animated_tile_func.h
EnergeticBark_OpenTTD-3DS/src/animated_tile_func.h
/* $Id$ */ /** @file animated_tile_func.h Tile animation! */ #ifndef ANIMATED_TILE_H #define ANIMATED_TILE_H #include "tile_type.h" void AddAnimatedTile(TileIndex tile); void DeleteAnimatedTile(TileIndex tile); void AnimateAnimatedTiles(); void InitializeAnimatedTiles(); #endif /* ANIMATED_TILE_H */
306
C++
.h
10
29.1
49
0.776632
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,351
newgrf_industries.h
EnergeticBark_OpenTTD-3DS/src/newgrf_industries.h
/* $Id$ */ /** @file newgrf_industries.h Functions for NewGRF industries. */ #ifndef NEWGRF_INDUSTRIES_H #define NEWGRF_INDUSTRIES_H #include "industry_type.h" #include "newgrf_spritegroup.h" /** When should the industry(tile) be triggered for random bits? */ enum IndustryTrigger { /** Triggered each tile loop */ INDUSTRY_TRIGGER_TILELOOP_PROCESS = 1, /** Triggered (whole industry) each 256 ticks */ INDUSTRY_TRIGGER_256_TICKS = 2, /** Triggered on cargo delivery */ INDUSTRY_TRIGGER_CARGO_DELIVERY = 4, }; /** From where is callback CBID_INDUSTRY_AVAILABLE been called */ enum IndustryAvailabilityCallType { IACT_MAPGENERATION, ///< during random map generation IACT_RANDOMCREATION, ///< during creation of random ingame industry IACT_USERCREATION, ///< from the Fund/build window }; /* in newgrf_industry.cpp */ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available); uint16 GetIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile); uint32 GetIndustryIDAtOffset(TileIndex new_tile, const Industry *i); void IndustryProductionCallback(Industry *ind, int reason); bool CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uint itspec_index, uint32 seed); bool CheckIfCallBackAllowsAvailability(IndustryType type, IndustryAvailabilityCallType creation_type); IndustryType MapNewGRFIndustryType(IndustryType grf_type, uint32 grf_id); /* in newgrf_industrytiles.cpp*/ uint32 GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index); #endif /* NEWGRF_INDUSTRIES_H */
1,656
C++
.h
32
50.1875
133
0.794427
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,352
rev.h
EnergeticBark_OpenTTD-3DS/src/rev.h
/* $Id$ */ /** @file rev.h declaration of OTTD revision dependant variables */ #ifndef REV_H #define REV_H extern const char _openttd_revision[]; extern const byte _openttd_revision_modified; extern const uint32 _openttd_newgrf_version; #endif /* REV_H */
260
C++
.h
8
31
67
0.754032
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,353
track_func.h
EnergeticBark_OpenTTD-3DS/src/track_func.h
/* $Id$ */ /** @file track_func.h Different conversion functions from one kind of track to another. */ #ifndef TRACK_FUNC_H #define TRACK_FUNC_H #include "core/bitmath_func.hpp" #include "track_type.h" #include "direction_type.h" #include "slope_func.h" /** * Convert an Axis to the corresponding Track * AXIS_X -> TRACK_X * AXIS_Y -> TRACK_Y * Uses the fact that they share the same internal encoding * * @param a the axis to convert * @return the track corresponding to the axis */ static inline Track AxisToTrack(Axis a) { return (Track)a; } /** * Maps a Track to the corresponding TrackBits value * @param track the track to convert * @return the converted TrackBits value of the track */ static inline TrackBits TrackToTrackBits(Track track) { return (TrackBits)(1 << track); } /** * Maps an Axis to the corresponding TrackBits value * @param a the axis to convert * @return the converted TrackBits value of the axis */ static inline TrackBits AxisToTrackBits(Axis a) { return TrackToTrackBits(AxisToTrack(a)); } /** * Returns a single horizontal/vertical trackbit, that is in a specific tile corner. * * @param corner The corner of a tile. * @return The TrackBits of the track in the corner. */ static inline TrackBits CornerToTrackBits(Corner corner) { extern const TrackBits _corner_to_trackbits[]; assert(IsValidCorner(corner)); return _corner_to_trackbits[corner]; } /** * Maps a Trackdir to the corresponding TrackdirBits value * @param trackdir the track direction to convert * @return the converted TrackdirBits value */ static inline TrackdirBits TrackdirToTrackdirBits(Trackdir trackdir) { return (TrackdirBits)(1 << trackdir); } /** * Removes first Track from TrackBits and returns it * * This function searchs for the first bit in the TrackBits, * remove this bit from the parameter and returns the found * bit as Track value. It returns INVALID_TRACK if the * parameter was TRACK_BIT_NONE or INVALID_TRACK_BIT. This * is basically used in while-loops to get up to 6 possible * tracks on a tile until the parameter becomes TRACK_BIT_NONE. * * @param tracks The value with the TrackBits * @return The first Track from the TrackBits value * @see FindFirstTrack */ static inline Track RemoveFirstTrack(TrackBits *tracks) { if (*tracks != TRACK_BIT_NONE && *tracks != INVALID_TRACK_BIT) { Track first = (Track)FIND_FIRST_BIT(*tracks); ClrBit(*tracks, first); return first; } return INVALID_TRACK; } /** * Removes first Trackdir from TrackdirBits and returns it * * This function searchs for the first bit in the TrackdirBits parameter, * remove this bit from the parameter and returns the fnound bit as * Trackdir value. It returns INVALID_TRACKDIR if the trackdirs is * TRACKDIR_BIT_NONE or INVALID_TRACKDIR_BIT. This is basically used in a * while-loop to get all track-directions step by step until the value * reaches TRACKDIR_BIT_NONE. * * @param trackdirs The value with the TrackdirBits * @return The first Trackdir from the TrackdirBits value * @see FindFirstTrackdir */ static inline Trackdir RemoveFirstTrackdir(TrackdirBits *trackdirs) { if (*trackdirs != TRACKDIR_BIT_NONE && *trackdirs != INVALID_TRACKDIR_BIT) { Trackdir first = (Trackdir)FindFirstBit2x64(*trackdirs); ClrBit(*trackdirs, first); return first; } return INVALID_TRACKDIR; } /** * Returns first Track from TrackBits or INVALID_TRACK * * This function returns the first Track found in the TrackBits value as Track-value. * It returns INVALID_TRACK if the parameter is TRACK_BIT_NONE or INVALID_TRACK_BIT. * * @param tracks The TrackBits value * @return The first Track found or INVALID_TRACK * @see RemoveFirstTrack */ static inline Track FindFirstTrack(TrackBits tracks) { return (tracks != TRACK_BIT_NONE && tracks != INVALID_TRACK_BIT) ? (Track)FIND_FIRST_BIT(tracks) : INVALID_TRACK; } /** * Converts TrackBits to Track. * * This function converts a TrackBits value to a Track value. As it * is not possible to convert two or more tracks to one track the * parameter must contain only one track or be the INVALID_TRACK_BIT value. * * @param tracks The TrackBits value to convert * @return The Track from the value or INVALID_TRACK * @pre tracks must contains only one Track or be INVALID_TRACK_BIT */ static inline Track TrackBitsToTrack(TrackBits tracks) { assert(tracks == INVALID_TRACK_BIT || (tracks != TRACK_BIT_NONE && KillFirstBit(tracks & TRACK_BIT_MASK) == TRACK_BIT_NONE)); return tracks != INVALID_TRACK_BIT ? (Track)FIND_FIRST_BIT(tracks & TRACK_BIT_MASK) : INVALID_TRACK; } /** * Returns first Trackdir from TrackdirBits or INVALID_TRACKDIR * * This function returns the first Trackdir in the given TrackdirBits value or * INVALID_TRACKDIR if the value is TRACKDIR_BIT_NONE. The TrackdirBits must * not be INVALID_TRACKDIR_BIT. * * @param trackdirs The TrackdirBits value * @return The first Trackdir from the TrackdirBits or INVALID_TRACKDIR on TRACKDIR_BIT_NONE. * @pre trackdirs must not be INVALID_TRACKDIR_BIT * @see RemoveFirstTrackdir */ static inline Trackdir FindFirstTrackdir(TrackdirBits trackdirs) { assert((trackdirs & ~TRACKDIR_BIT_MASK) == TRACKDIR_BIT_NONE); return (trackdirs != TRACKDIR_BIT_NONE) ? (Trackdir)FindFirstBit2x64(trackdirs) : INVALID_TRACKDIR; } /** * Checks if a Track is valid. * * @param track The value to check * @return true if the given value is a valid track. * @note Use this in an assert() */ static inline bool IsValidTrack(Track track) { return track < TRACK_END; } /** * Checks if a Trackdir is valid. * * @param trackdir The value to check * @return true if the given valie is a valid Trackdir * @note Use this in an assert() */ static inline bool IsValidTrackdir(Trackdir trackdir) { return (TrackdirToTrackdirBits(trackdir) & TRACKDIR_BIT_MASK) != 0; } /* * Functions describing logical relations between Tracks, TrackBits, Trackdirs * TrackdirBits, Direction and DiagDirections. */ /** * Find the opposite track to a given track. * * TRACK_LOWER -> TRACK_UPPER and vice versa, likewise for left/right. * TRACK_X is mapped to TRACK_Y and reversed. * * @param t the track to convert * @return the opposite track */ static inline Track TrackToOppositeTrack(Track t) { assert(t != INVALID_TRACK); return (Track)(t ^ 1); } /** * Maps a trackdir to the reverse trackdir. * * Returns the reverse trackdir of a Trackdir value. The reverse trackdir * is the same track with the other direction on it. * * @param trackdir The Trackdir value * @return The reverse trackdir * @pre trackdir must not be INVALID_TRACKDIR */ static inline Trackdir ReverseTrackdir(Trackdir trackdir) { assert(trackdir != INVALID_TRACKDIR); return (Trackdir)(trackdir ^ 8); } /** * Returns the Track that a given Trackdir represents * * This function filters the Track which is used in the Trackdir value and * returns it as a Track value. * * @param trackdir The trackdir value * @return The Track which is used in the value */ static inline Track TrackdirToTrack(Trackdir trackdir) { return (Track)(trackdir & 0x7); } /** * Returns a Trackdir for the given Track * * Since every Track corresponds to two Trackdirs, we choose the * one which points between NE and S. Note that the actual * implementation is quite futile, but this might change * in the future. * * @param track The given Track * @return The Trackdir from the given Track */ static inline Trackdir TrackToTrackdir(Track track) { return (Trackdir)track; } /** * Returns a TrackdirBit mask from a given Track * * The TrackdirBit mask contains the two TrackdirBits that * correspond with the given Track (one for each direction). * * @param track The track to get the TrackdirBits from * @return The TrackdirBits which the selected tracks */ static inline TrackdirBits TrackToTrackdirBits(Track track) { Trackdir td = TrackToTrackdir(track); return (TrackdirBits)(TrackdirToTrackdirBits(td) | TrackdirToTrackdirBits(ReverseTrackdir(td))); } /** * Discards all directional information from a TrackdirBits value * * Any Track which is present in either direction will be present in the result. * * @param bits The TrackdirBits to get the TrackBits from * @return The TrackBits */ static inline TrackBits TrackdirBitsToTrackBits(TrackdirBits bits) { return (TrackBits)((bits | (bits >> 8)) & TRACK_BIT_MASK); } /** * Converts TrackBits to TrackdirBits while allowing both directions. * * @param bits The TrackBits * @return The TrackdirBits containing of bits in both directions. */ static inline TrackdirBits TrackBitsToTrackdirBits(TrackBits bits) { return (TrackdirBits)(bits * 0x101); } /** * Returns the present-trackdir-information of a TrackStatus. * * @param ts The TrackStatus returned by GetTileTrackStatus() * @return the present trackdirs */ static inline TrackdirBits TrackStatusToTrackdirBits(TrackStatus ts) { return (TrackdirBits)(ts & TRACKDIR_BIT_MASK); } /** * Returns the present-track-information of a TrackStatus. * * @param ts The TrackStatus returned by GetTileTrackStatus() * @return the present tracks */ static inline TrackBits TrackStatusToTrackBits(TrackStatus ts) { return TrackdirBitsToTrackBits(TrackStatusToTrackdirBits(ts)); } /** * Returns the red-signal-information of a TrackStatus. * * Note: The result may contain red signals for non-present tracks. * * @param ts The TrackStatus returned by GetTileTrackStatus() * @return the The trackdirs that are blocked by red-signals */ static inline TrackdirBits TrackStatusToRedSignals(TrackStatus ts) { return (TrackdirBits)((ts >> 16) & TRACKDIR_BIT_MASK); } /** * Builds a TrackStatus * * @param trackdirbits present trackdirs * @param red_signals red signals * @return the TrackStatus representing the given information */ static inline TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals) { return (TrackStatus)(trackdirbits | (red_signals << 16)); } /** * Maps a trackdir to the trackdir that you will end up on if you go straight * ahead. * * This will be the same trackdir for diagonal trackdirs, but a * different (alternating) one for straight trackdirs * * @param trackdir The given trackdir * @return The next Trackdir value of the next tile. */ static inline Trackdir NextTrackdir(Trackdir trackdir) { extern const Trackdir _next_trackdir[TRACKDIR_END]; return _next_trackdir[trackdir]; } /** * Maps a track to all tracks that make 90 deg turns with it. * * For the diagonal directions these are the complement of the * direction, for the straight directions these are the * two vertical or horizontal tracks, depend on the given direction * * @param track The given track * @return The TrackBits with the tracks marked which cross the given track by 90 deg. */ static inline TrackBits TrackCrossesTracks(Track track) { extern const TrackBits _track_crosses_tracks[TRACK_END]; return _track_crosses_tracks[track]; } /** * Maps a trackdir to the (4-way) direction the tile is exited when following * that trackdir. * * For the diagonal directions these are the same directions. For * the straight directions these are the directions from the imagined * base-tile to the bordering tile which will be joined if the given * straight direction is leaved from the base-tile. * * @param trackdir The given track direction * @return The direction which points to the resulting tile if following the Trackdir */ static inline DiagDirection TrackdirToExitdir(Trackdir trackdir) { extern const DiagDirection _trackdir_to_exitdir[TRACKDIR_END]; return _trackdir_to_exitdir[trackdir]; } /** * Maps a track and an (4-way) dir to the trackdir that represents the track * with the exit in the given direction. * * For the diagonal tracks the resulting track direction are clear for a given * DiagDirection. It either matches the direction or it returns INVALID_TRACKDIR, * as a TRACK_X cannot be applied with DIAG_SE. * For the straight tracks the resulting track direction will be the * direction which the DiagDirection is pointing. But this will be INVALID_TRACKDIR * if the DiagDirection is pointing 'away' the track. * * @param track The track to applie an direction on * @param diagdir The DiagDirection to applie on * @return The resulting track direction or INVALID_TRACKDIR if not possible. */ static inline Trackdir TrackExitdirToTrackdir(Track track, DiagDirection diagdir) { extern const Trackdir _track_exitdir_to_trackdir[TRACK_END][DIAGDIR_END]; return _track_exitdir_to_trackdir[track][diagdir]; } /** * Maps a track and an (4-way) dir to the trackdir that represents the track * with the entry in the given direction. * * For the diagonal tracks the return value is clear, its either the matching * track direction or INVALID_TRACKDIR. * For the straight tracks this returns the track direction which results if * you follow the DiagDirection and then turn by 45 deg left or right on the * next tile. The new direction on the new track will be the returning Trackdir * value. If the parameters makes no sense like the track TRACK_UPPER and the * diraction DIAGDIR_NE (target track cannot be reached) this function returns * INVALID_TRACKDIR. * * @param track The target track * @param diagdir The direction to "come from" * @return the resulting Trackdir or INVALID_TRACKDIR if not possible. */ static inline Trackdir TrackEnterdirToTrackdir(Track track, DiagDirection diagdir) { extern const Trackdir _track_enterdir_to_trackdir[TRACK_END][DIAGDIR_END]; return _track_enterdir_to_trackdir[track][diagdir]; } /** * Maps a track and a full (8-way) direction to the trackdir that represents * the track running in the given direction. */ static inline Trackdir TrackDirectionToTrackdir(Track track, Direction dir) { extern const Trackdir _track_direction_to_trackdir[TRACK_END][DIR_END]; return _track_direction_to_trackdir[track][dir]; } /** * Maps a (4-way) direction to the diagonal track incidating with that diagdir * * @param diagdir The direction * @return The resulting Track */ static inline Track DiagDirToDiagTrack(DiagDirection diagdir) { return (Track)(diagdir & 1); } /** * Maps a (4-way) direction to the diagonal track bits incidating with that diagdir * * @param diagdir The direction * @return The resulting TrackBits */ static inline TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir) { return TrackToTrackBits(DiagDirToDiagTrack(diagdir)); } /** * Maps a (4-way) direction to the diagonal trackdir that runs in that * direction. * * @param diagdir The direction * @return The resulting Trackdir direction */ static inline Trackdir DiagDirToDiagTrackdir(DiagDirection diagdir) { extern const Trackdir _dir_to_diag_trackdir[DIAGDIR_END]; return _dir_to_diag_trackdir[diagdir]; } /** * Returns all trackdirs that can be reached when entering a tile from a given * (diagonal) direction. * * This will obviously include 90 degree turns, since no information is available * about the exact angle of entering * * @param diagdir The joining direction * @return The TrackdirBits which can be used from the given direction * @see DiagdirReachesTracks */ static inline TrackdirBits DiagdirReachesTrackdirs(DiagDirection diagdir) { extern const TrackdirBits _exitdir_reaches_trackdirs[DIAGDIR_END]; return _exitdir_reaches_trackdirs[diagdir]; } /** * Returns all tracks that can be reached when entering a tile from a given * (diagonal) direction. * * This will obviously include 90 degree turns, since no * information is available about the exact angle of entering * * @param diagdir The joining irection * @return The tracks which can be used * @see DiagdirReachesTrackdirs */ static inline TrackBits DiagdirReachesTracks(DiagDirection diagdir) { return TrackdirBitsToTrackBits(DiagdirReachesTrackdirs(diagdir)); } /** * Maps a trackdir to the trackdirs that can be reached from it (ie, when * entering the next tile. * * This will include 90 degree turns! * * @param trackdir The track direction which will be leaved * @return The track directions which can be used from this direction (in the next tile) */ static inline TrackdirBits TrackdirReachesTrackdirs(Trackdir trackdir) { extern const TrackdirBits _exitdir_reaches_trackdirs[DIAGDIR_END]; return _exitdir_reaches_trackdirs[TrackdirToExitdir(trackdir)]; } /* Note that there is no direct table for this function (there used to be), * but it uses two simpeler tables to achieve the result */ /** * Maps a trackdir to all trackdirs that make 90 deg turns with it. * * For the diagonal tracks this returns the track direction bits * of the other axis in both directions, which cannot be joined by * the given track direction. * For the straight tracks this returns all possible 90 deg turns * either on the current tile (which no train can joined) or on the * bordering tiles. * * @param trackdir The track direction * @return The TrackdirBits which are (more or less) 90 deg turns. */ static inline TrackdirBits TrackdirCrossesTrackdirs(Trackdir trackdir) { extern const TrackdirBits _track_crosses_trackdirs[TRACKDIR_END]; return _track_crosses_trackdirs[TrackdirToTrack(trackdir)]; } /** * Checks if a given Track is diagonal * * @param track The given track to check * @return true if diagonal, else false */ static inline bool IsDiagonalTrack(Track track) { return (track == TRACK_X) || (track == TRACK_Y); } /** * Checks if a given Trackdir is diagonal. * * @param trackdir The given trackdir * @return true if the trackdir use a diagonal track */ static inline bool IsDiagonalTrackdir(Trackdir trackdir) { return IsDiagonalTrack(TrackdirToTrack(trackdir)); } /** * Checks if the given tracks overlap, ie form a crossing. Basically this * means when there is more than one track on the tile, exept when there are * two parallel tracks. * @param bits The tracks present. * @return Whether the tracks present overlap in any way. */ static inline bool TracksOverlap(TrackBits bits) { /* With no, or only one track, there is no overlap */ if (bits == TRACK_BIT_NONE || KillFirstBit(bits) == TRACK_BIT_NONE) return false; /* We know that there are at least two tracks present. When there are more * than 2 tracks, they will surely overlap. When there are two, they will * always overlap unless they are lower & upper or right & left. */ return bits != TRACK_BIT_HORZ && bits != TRACK_BIT_VERT; } /** * Check if a given track is contained within or overlaps some other tracks. * * @param tracks Tracks to be testet against * @param track The track to test * @return true if the track is already in the tracks or overlaps the tracks. */ static inline bool TrackOverlapsTracks(TrackBits tracks, Track track) { if (HasBit(tracks, track)) return true; return TracksOverlap(tracks | TrackToTrackBits(track)); } /** * Checks whether the trackdir means that we are reversing. * @param dir the trackdir to check * @return true if it is a reversing road trackdir */ static inline bool IsReversingRoadTrackdir(Trackdir dir) { return (dir & 0x07) >= 6; } /** * Checks whether the given trackdir is a straight road * @param dir the trackdir to check * @return true if it is a straight road trackdir */ static inline bool IsStraightRoadTrackdir(Trackdir dir) { return (dir & 0x06) == 0; } /** * Checks whether a trackdir on a specific slope is going uphill. * * Valid for rail and road tracks. * Valid for tile-slopes (under foundation) and foundation-slopes (on foundation). * * @param slope The slope of the tile. * @param dir The trackdir of interest. * @return true iff the track goes upwards. */ static inline bool IsUphillTrackdir(Slope slope, Trackdir dir) { extern const TrackdirBits _uphill_trackdirs[]; return HasBit(_uphill_trackdirs[RemoveHalftileSlope(slope)], dir); } #endif /* TRACK_FUNC_H */
19,942
C++
.h
589
32.062818
137
0.771307
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,354
tunnelbridge_map.h
EnergeticBark_OpenTTD-3DS/src/tunnelbridge_map.h
/* $Id$ */ /** @file tunnelbridge_map.h Functions that have tunnels and bridges in common */ #ifndef TUNNELBRIDGE_MAP_H #define TUNNELBRIDGE_MAP_H #include "direction_func.h" #include "core/bitmath_func.hpp" #include "tile_map.h" #include "bridge_map.h" #include "tunnel_map.h" #include "transport_type.h" #include "track_func.h" /** * Get the direction pointing to the other end. * * Tunnel: Get the direction facing into the tunnel * Bridge: Get the direction pointing onto the bridge * @param t The tile to analyze * @pre IsTileType(t, MP_TUNNELBRIDGE) * @return the above mentionned direction */ static inline DiagDirection GetTunnelBridgeDirection(TileIndex t) { assert(IsTileType(t, MP_TUNNELBRIDGE)); return (DiagDirection)GB(_m[t].m5, 0, 2); } /** * Tunnel: Get the transport type of the tunnel (road or rail) * Bridge: Get the transport type of the bridge's ramp * @param t The tile to analyze * @pre IsTileType(t, MP_TUNNELBRIDGE) * @return the transport type in the tunnel/bridge */ static inline TransportType GetTunnelBridgeTransportType(TileIndex t) { assert(IsTileType(t, MP_TUNNELBRIDGE)); return (TransportType)GB(_m[t].m5, 2, 2); } /** * Tunnel: Is this tunnel entrance in a snowy or desert area? * Bridge: Does the bridge ramp lie in a snow or desert area? * @param t The tile to analyze * @pre IsTileType(t, MP_TUNNELBRIDGE) * @return true if and only if the tile is in a snowy/desert area */ static inline bool HasTunnelBridgeSnowOrDesert(TileIndex t) { assert(IsTileType(t, MP_TUNNELBRIDGE)); return HasBit(_me[t].m7, 5); } /** * Tunnel: Places this tunnel entrance in a snowy or desert area, or takes it out of there. * Bridge: Sets whether the bridge ramp lies in a snow or desert area. * @param t the tunnel entrance / bridge ramp tile * @param snow_or_desert is the entrance/ramp in snow or desert (true), when * not in snow and not in desert false * @pre IsTileType(t, MP_TUNNELBRIDGE) */ static inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert) { assert(IsTileType(t, MP_TUNNELBRIDGE)); SB(_me[t].m7, 5, 1, snow_or_desert); } /** * Determines type of the wormhole and returns its other end * @param t one end * @pre IsTileType(t, MP_TUNNELBRIDGE) * @return other end */ static inline TileIndex GetOtherTunnelBridgeEnd(TileIndex t) { assert(IsTileType(t, MP_TUNNELBRIDGE)); return IsTunnel(t) ? GetOtherTunnelEnd(t) : GetOtherBridgeEnd(t); } /** * Get the reservation state of the rail tunnel/bridge * @pre IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL * @param t the tile * @return reservation state */ static inline bool GetTunnelBridgeReservation(TileIndex t) { assert(IsTileType(t, MP_TUNNELBRIDGE)); assert(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL); return HasBit(_m[t].m5, 4); } /** * Set the reservation state of the rail tunnel/bridge * @pre IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL * @param t the tile * @param b the reservation state */ static inline void SetTunnelBridgeReservation(TileIndex t, bool b) { assert(IsTileType(t, MP_TUNNELBRIDGE)); assert(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL); SB(_m[t].m5, 4, 1, b ? 1 : 0); } /** * Get the reserved track bits for a rail tunnel/bridge * @pre IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL * @param t the tile * @return reserved track bits */ static inline TrackBits GetRailTunnelBridgeReservation(TileIndex t) { return GetTunnelBridgeReservation(t) ? DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t)) : TRACK_BIT_NONE; } #endif /* TUNNELBRIDGE_MAP_H */
3,705
C++
.h
108
32.583333
109
0.751884
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,355
window_func.h
EnergeticBark_OpenTTD-3DS/src/window_func.h
/* $Id$ */ /** @file window_func.h Window functions not directly related to making/drawing windows. */ #ifndef WINDOW_FUNC_H #define WINDOW_FUNC_H #include "window_type.h" #include "company_type.h" void SetWindowDirty(const Window *w); Window *FindWindowById(WindowClass cls, WindowNumber number); void ChangeWindowOwner(Owner old_owner, Owner new_owner); void ResizeWindow(Window *w, int x, int y); int PositionMainToolbar(Window *w); void InitWindowSystem(); void UnInitWindowSystem(); void ResetWindowSystem(); void SetupColoursAndInitialWindow(); void InputLoop(); void InvalidateThisWindowData(Window *w, int data = 0); void InvalidateWindowData(WindowClass cls, WindowNumber number, int data = 0); void InvalidateWindowClassesData(WindowClass cls, int data = 0); void DeleteNonVitalWindows(); void DeleteAllNonVitalWindows(); void DeleteConstructionWindows(); void HideVitalWindows(); void ShowVitalWindows(); void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index); void InvalidateWindow(WindowClass cls, WindowNumber number); void InvalidateWindowClasses(WindowClass cls); void DeleteWindowById(WindowClass cls, WindowNumber number, bool force = true); void DeleteWindowByClass(WindowClass cls); #endif /* WINDOW_FUNC_H */
1,272
C++
.h
30
41
91
0.817886
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,356
tile_map.h
EnergeticBark_OpenTTD-3DS/src/tile_map.h
/* $Id$ */ /** @file tile_map.h Map writing/reading functions for tiles. */ #ifndef TILE_MAP_H #define TILE_MAP_H #include "tile_type.h" #include "slope_type.h" #include "company_type.h" #include "map_func.h" #include "core/bitmath_func.hpp" #include "settings_type.h" /** * Returns the height of a tile * * This function returns the height of the northern corner of a tile. * This is saved in the global map-array. It does not take affect by * any slope-data of the tile. * * @param tile The tile to get the height from * @return the height of the tile * @pre tile < MapSize() */ static inline uint TileHeight(TileIndex tile) { assert(tile < MapSize()); return GB(_m[tile].type_height, 0, 4); } /** * Sets the height of a tile. * * This function sets the height of the northern corner of a tile. * * @param tile The tile to change the height * @param height The new height value of the tile * @pre tile < MapSize() * @pre heigth <= MAX_TILE_HEIGHT */ static inline void SetTileHeight(TileIndex tile, uint height) { assert(tile < MapSize()); assert(height <= MAX_TILE_HEIGHT); SB(_m[tile].type_height, 0, 4, height); } /** * Returns the height of a tile in pixels. * * This function returns the height of the northern corner of a tile in pixels. * * @param tile The tile to get the height * @return The height of the tile in pixel */ static inline uint TilePixelHeight(TileIndex tile) { return TileHeight(tile) * TILE_HEIGHT; } /** * Get the tiletype of a given tile. * * @param tile The tile to get the TileType * @return The tiletype of the tile * @pre tile < MapSize() */ static inline TileType GetTileType(TileIndex tile) { assert(tile < MapSize()); return (TileType)GB(_m[tile].type_height, 4, 4); } /** * Set the type of a tile * * This functions sets the type of a tile. If the type * MP_VOID is selected the tile must be at the south-west or * south-east edges of the map and vice versa. * * @param tile The tile to save the new type * @param type The type to save * @pre tile < MapSize() * @pre type MP_VOID <=> tile is on the south-east or south-west edge. */ static inline void SetTileType(TileIndex tile, TileType type) { assert(tile < MapSize()); /* VOID tiles (and no others) are exactly allowed at the lower left and right * edges of the map. If _settings_game.construction.freeform_edges is true, * the upper edges of the map are also VOID tiles. */ assert((TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY() || (_settings_game.construction.freeform_edges && (TileX(tile) == 0 || TileY(tile) == 0))) == (type == MP_VOID)); SB(_m[tile].type_height, 4, 4, type); } /** * Checks if a tile is a give tiletype. * * This function checks if a tile got the given tiletype. * * @param tile The tile to check * @param type The type to check agains * @return true If the type matches agains the type of the tile */ static inline bool IsTileType(TileIndex tile, TileType type) { return GetTileType(tile) == type; } /** * Checks if a tile is valid * * @param tile The tile to check * @return True if the tile is on the map and not one of MP_VOID. */ static inline bool IsValidTile(TileIndex tile) { return tile < MapSize() && !IsTileType(tile, MP_VOID); } /** * Returns the owner of a tile * * This function returns the owner of a tile. This cannot used * for tiles which type is one of MP_HOUSE, MP_VOID and MP_INDUSTRY * as no company owned any of these buildings. * * @param tile The tile to check * @return The owner of the tile * @pre IsValidTile(tile) * @pre The type of the tile must not be MP_HOUSE and MP_INDUSTRY */ static inline Owner GetTileOwner(TileIndex tile) { assert(IsValidTile(tile)); assert(!IsTileType(tile, MP_HOUSE)); assert(!IsTileType(tile, MP_INDUSTRY)); return (Owner)_m[tile].m1; } /** * Sets the owner of a tile * * This function sets the owner status of a tile. Note that you cannot * set a owner for tiles of type MP_HOUSE, MP_VOID and MP_INDUSTRY. * * @param tile The tile to change the owner status. * @param owner The new owner. * @pre IsValidTile(tile) * @pre The type of the tile must not be MP_HOUSE and MP_INDUSTRY */ static inline void SetTileOwner(TileIndex tile, Owner owner) { assert(IsValidTile(tile)); assert(!IsTileType(tile, MP_HOUSE)); assert(!IsTileType(tile, MP_INDUSTRY)); _m[tile].m1 = owner; } /** * Checks if a tile belongs to the given owner * * @param tile The tile to check * @param owner The owner to check agains * @return True if a tile belongs the the given owner */ static inline bool IsTileOwner(TileIndex tile, Owner owner) { return GetTileOwner(tile) == owner; } /** * Set the tropic zone * @param tile the tile to set the zone of * @param type the new type * @pre tile < MapSize() */ static inline void SetTropicZone(TileIndex tile, TropicZone type) { assert(tile < MapSize()); SB(_m[tile].m6, 0, 2, type); } /** * Get the tropic zone * @param tile the tile to get the zone of * @pre tile < MapSize() * @return the zone type */ static inline TropicZone GetTropicZone(TileIndex tile) { assert(tile < MapSize()); return (TropicZone)GB(_m[tile].m6, 0, 2); } Slope GetTileSlope(TileIndex tile, uint *h); uint GetTileZ(TileIndex tile); uint GetTileMaxZ(TileIndex tile); #endif /* TILE_TYPE_H */
5,303
C++
.h
184
27.043478
175
0.717647
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,357
tile_type.h
EnergeticBark_OpenTTD-3DS/src/tile_type.h
/* $Id$ */ /** @file tile_type.h Types related to tiles. */ #ifndef TILE_TYPE_H #define TILE_TYPE_H #include "core/enum_type.hpp" enum { TILE_SIZE = 16, ///< Tiles are 16x16 "units" in size TILE_PIXELS = 32, ///< a tile is 32x32 pixels TILE_HEIGHT = 8, ///< The standard height-difference between tiles on two levels is 8 (z-diff 8) MAX_TILE_HEIGHT = 15, ///< Maximum allowed tile height MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2), ///< Maximum allowed snowline height }; /** * The different types of tiles. * * Each tile belongs to one type, according whatever is build on it. * * @note A railway with a crossing street is marked as MP_ROAD. */ enum TileType { MP_CLEAR, ///< A tile without any structures, i.e. grass, rocks, farm fields etc. MP_RAILWAY, ///< A railway MP_ROAD, ///< A tile with road (or tram tracks) MP_HOUSE, ///< A house by a town MP_TREES, ///< Tile got trees MP_STATION, ///< A tile of a station MP_WATER, ///< Water tile MP_VOID, ///< Invisible tiles at the SW and SE border MP_INDUSTRY, ///< Part of an industry MP_TUNNELBRIDGE, ///< Tunnel entry/exit and bridge heads MP_UNMOVABLE, ///< Contains an object with cannot be removed like transmitters }; /** * Additional infos of a tile on a tropic game. * * The tropiczone is not modified during gameplay. It mainly affects tree growth. (desert tiles are visible though) * * In randomly generated maps: * TROPICZONE_DESERT: Generated everywhere, if there is neither water nor mountains (TileHeight >= 4) in a certain distance from the tile. * TROPICZONE_RAINFOREST: Genereated everywhere, if there is no desert in a certain distance from the tile. * TROPICZONE_NORMAL: Everywhere else, i.e. between desert and rainforest and on sea (if you clear the water). * * In scenarios: * TROPICZONE_NORMAL: Default value. * TROPICZONE_DESERT: Placed manually. * TROPICZONE_RAINFOREST: Placed if you plant certain rainforest-trees. */ enum TropicZone { TROPICZONE_NORMAL = 0, ///< Normal tropiczone TROPICZONE_DESERT = 1, ///< Tile is desert TROPICZONE_RAINFOREST = 2, ///< Rainforest tile }; /** * The index/ID of a Tile. */ typedef uint32 TileIndex; /** * The very nice invalid tile marker */ static const TileIndex INVALID_TILE = (TileIndex)-1; #endif /* TILE_TYPE_H */
2,489
C++
.h
61
38.918033
139
0.66115
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,358
unmovable_map.h
EnergeticBark_OpenTTD-3DS/src/unmovable_map.h
/* $Id$ */ /** @file unmovable_map.h Map accessors for unmovable tiles. */ #ifndef UNMOVABLE_MAP_H #define UNMOVABLE_MAP_H #include "core/bitmath_func.hpp" #include "tile_map.h" /** Types of unmovable structure */ enum UnmovableType { UNMOVABLE_TRANSMITTER = 0, ///< The large antenna UNMOVABLE_LIGHTHOUSE = 1, ///< The nice lighthouse UNMOVABLE_STATUE = 2, ///< Statue in towns UNMOVABLE_OWNED_LAND = 3, ///< Owned land 'flag' UNMOVABLE_HQ = 4, ///< HeadQuarter of a player UNMOVABLE_MAX, }; /** * Gets the UnmovableType of the given unmovable tile * @param t the tile to get the type from. * @pre IsTileType(t, MP_UNMOVABLE) * @return the type. */ static inline UnmovableType GetUnmovableType(TileIndex t) { assert(IsTileType(t, MP_UNMOVABLE)); return (UnmovableType)_m[t].m5; } /** * Does the given tile have a transmitter? * @param t the tile to inspect. * @return true if and only if the tile has a transmitter. */ static inline bool IsTransmitterTile(TileIndex t) { return IsTileType(t, MP_UNMOVABLE) && GetUnmovableType(t) == UNMOVABLE_TRANSMITTER; } /** * Is this unmovable tile an 'owned land' tile? * @param t the tile to inspect. * @pre IsTileType(t, MP_UNMOVABLE) * @return true if and only if the tile is an 'owned land' tile. */ static inline bool IsOwnedLand(TileIndex t) { assert(IsTileType(t, MP_UNMOVABLE)); return GetUnmovableType(t) == UNMOVABLE_OWNED_LAND; } /** * Is the given tile (pre-)owned by someone (the little flags)? * @param t the tile to inspect. * @return true if and only if the tile is an 'owned land' tile. */ static inline bool IsOwnedLandTile(TileIndex t) { return IsTileType(t, MP_UNMOVABLE) && IsOwnedLand(t); } /** * Is this unmovable tile a HQ tile? * @param t the tile to inspect. * @pre IsTileType(t, MP_UNMOVABLE) * @return true if and only if the tile is a HQ tile. */ static inline bool IsCompanyHQ(TileIndex t) { assert(IsTileType(t, MP_UNMOVABLE)); return _m[t].m5 == UNMOVABLE_HQ; } /** * Is this unmovable tile a statue? * @param t the tile to inspect. * @pre IsTileType(t, MP_UNMOVABLE) * @return true if and only if the tile is a statue. */ static inline bool IsStatue(TileIndex t) { assert(IsTileType(t, MP_UNMOVABLE)); return GetUnmovableType(t) == UNMOVABLE_STATUE; } /** * Is the given tile a statue? * @param t the tile to inspect. * @return true if and only if the tile is a statue. */ static inline bool IsStatueTile(TileIndex t) { return IsTileType(t, MP_UNMOVABLE) && IsStatue(t); } /** * Get the town of the given statue tile. * @param t the tile of the statue. * @pre IsStatueTile(t) * @return the town the given statue is in. */ static inline TownID GetStatueTownID(TileIndex t) { assert(IsStatueTile(t)); return _m[t].m2; } /** * Get the 'stage' of the HQ. * @param t a tile of the HQ. * @pre IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t) * @return the 'stage' of the HQ. */ static inline byte GetCompanyHQSize(TileIndex t) { assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)); return GB(_m[t].m3, 2, 3); } /** * Set the 'stage' of the HQ. * @param t a tile of the HQ. * @param size the actual stage of the HQ * @pre IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t) */ static inline void SetCompanyHQSize(TileIndex t, uint8 size) { assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)); SB(_m[t].m3, 2, 3, size); } /** * Get the 'section' of the HQ. * The scetion is in fact which side of teh HQ the tile represent * @param t a tile of the HQ. * @pre IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t) * @return the 'section' of the HQ. */ static inline byte GetCompanyHQSection(TileIndex t) { assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)); return GB(_m[t].m3, 0, 2); } /** * Set the 'section' of the HQ. * @param t a tile of the HQ. * param section to be set. * @pre IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t) */ static inline void SetCompanyHQSection(TileIndex t, uint8 section) { assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)); SB(_m[t].m3, 0, 2, section); } /** * Enlarge the given HQ to the given size. If the new size * is larger than the current size, nothing happens. * @param t the tile of the HQ. * @param size the new size of the HQ. * @pre t is the northern tile of the HQ */ static inline void EnlargeCompanyHQ(TileIndex t, byte size) { assert(GetCompanyHQSection(t) == 0); assert(size <= 4); if (size <= GetCompanyHQSize(t)) return; SetCompanyHQSize(t , size); SetCompanyHQSize(t + TileDiffXY(0, 1), size); SetCompanyHQSize(t + TileDiffXY(1, 0), size); SetCompanyHQSize(t + TileDiffXY(1, 1), size); } /** * Make an Unmovable tile. * @note do not use this function directly. Use one of the other Make* functions. * @param t the tile to make unmovable. * @param u the unmovable type of the tile. * @param o the new owner of the tile. */ static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o) { SetTileType(t, MP_UNMOVABLE); SetTileOwner(t, o); _m[t].m2 = 0; _m[t].m3 = 0; _m[t].m4 = 0; _m[t].m5 = u; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } /** * Make a transmitter tile. * @param t the tile to make a transmitter. */ static inline void MakeTransmitter(TileIndex t) { MakeUnmovable(t, UNMOVABLE_TRANSMITTER, OWNER_NONE); } /** * Make a lighthouse tile. * @param t the tile to make a transmitter. */ static inline void MakeLighthouse(TileIndex t) { MakeUnmovable(t, UNMOVABLE_LIGHTHOUSE, OWNER_NONE); } /** * Make a statue tile. * @param t the tile to make a statue. * @param o the owner of the statue. * @param town_id the town the statue was built in. */ static inline void MakeStatue(TileIndex t, Owner o, TownID town_id) { MakeUnmovable(t, UNMOVABLE_STATUE, o); _m[t].m2 = town_id; } /** * Make an 'owned land' tile. * @param t the tile to make an 'owned land' tile. * @param o the owner of the land. */ static inline void MakeOwnedLand(TileIndex t, Owner o) { MakeUnmovable(t, UNMOVABLE_OWNED_LAND, o); } /** * Make a HeadQuarter tile after making it an Unmovable * @param t the tile to make an HQ. * @param section the part of the HQ this one will be. * @param o the new owner of the tile. */ static inline void MakeUnmovableHQHelper(TileIndex t, uint8 section, Owner o) { MakeUnmovable(t, UNMOVABLE_HQ, o); SetCompanyHQSection(t, section); } /** * Make an HQ with the give tile as it's northern tile. * @param t the tile to make the northern tile of a HQ. * @param o the owner of the HQ. */ static inline void MakeCompanyHQ(TileIndex t, Owner o) { MakeUnmovableHQHelper(t , 0, o); MakeUnmovableHQHelper(t + TileDiffXY(0, 1), 1, o); MakeUnmovableHQHelper(t + TileDiffXY(1, 0), 2, o); MakeUnmovableHQHelper(t + TileDiffXY(1, 1), 3, o); } #endif /* UNMOVABLE_MAP_H */
6,820
C++
.h
237
27.037975
84
0.705416
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,359
newgrf_canal.h
EnergeticBark_OpenTTD-3DS/src/newgrf_canal.h
/* $Id$ */ /** @file newgrf_canal.h Handling of NewGRF canals. */ #ifndef NEWGRF_CANAL_H #define NEWGRF_CANAL_H /** List of different canal 'features'. * Each feature gets an entry in the canal spritegroup table */ enum CanalFeature { CF_WATERSLOPE, CF_LOCKS, CF_DIKES, CF_ICON, CF_DOCKS, CF_RIVER_SLOPE, CF_RIVER_EDGE, CF_END, }; struct WaterFeature { const SpriteGroup *group; const GRFFile *grffile; ///< newgrf where 'group' belongs to uint8 callbackmask; uint8 flags; }; /** Table of canal 'feature' sprite groups */ extern WaterFeature _water_feature[CF_END]; /** Lookup the base sprite to use for a canal. * @param feature Which canal feature we want. * @param tile Tile index of canal, if appropriate. * @return Base sprite returned by GRF, or 0 if none. */ SpriteID GetCanalSprite(CanalFeature feature, TileIndex tile); #endif /* NEWGRF_CANAL_H */
886
C++
.h
31
26.709677
63
0.740828
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,360
fios.h
EnergeticBark_OpenTTD-3DS/src/fios.h
/* $Id$ */ /** @file fios.h Declarations for savegames operations */ #ifndef FIOS_H #define FIOS_H #include "strings_type.h" #include "core/smallvec_type.hpp" enum { /** * Slot used for the GRF scanning and such. This slot cannot be reused * as it will otherwise cause issues when pressing "rescan directories". * It can furthermore not be larger than LAST_GRF_SLOT as that complicates * the testing for "too much NewGRFs". */ CONFIG_SLOT = 0, /** Slot for the sound. */ SOUND_SLOT = 1, /** First slot useable for (New)GRFs used during the game. */ FIRST_GRF_SLOT = 2, /** Last slot useable for (New)GRFs used during the game. */ LAST_GRF_SLOT = 63, /** Maximum number of slots. */ MAX_FILE_SLOTS = 64 }; enum SaveLoadDialogMode{ SLD_LOAD_GAME, SLD_LOAD_SCENARIO, SLD_SAVE_GAME, SLD_SAVE_SCENARIO, SLD_LOAD_HEIGHTMAP, SLD_NEW_GAME, }; /* The different types of files been handled by the system */ enum FileType { FT_NONE, ///< nothing to do FT_SAVEGAME, ///< old or new savegame FT_SCENARIO, ///< old or new scenario FT_HEIGHTMAP, ///< heightmap file }; enum FiosType { FIOS_TYPE_DRIVE, FIOS_TYPE_PARENT, FIOS_TYPE_DIR, FIOS_TYPE_FILE, FIOS_TYPE_OLDFILE, FIOS_TYPE_SCENARIO, FIOS_TYPE_OLD_SCENARIO, FIOS_TYPE_DIRECT, FIOS_TYPE_PNG, FIOS_TYPE_BMP, FIOS_TYPE_INVALID = 255, }; /* Deals with finding savegames */ struct FiosItem { FiosType type; uint64 mtime; char title[64]; char name[MAX_PATH]; }; /* Deals with the type of the savegame, independent of extension */ struct SmallFiosItem { int mode; ///< savegame/scenario type (old, new) FileType filetype; ///< what type of file are we dealing with char name[MAX_PATH]; ///< name char title[255]; ///< internal name of the game }; enum { SORT_ASCENDING = 0, SORT_DESCENDING = 1, SORT_BY_DATE = 0, SORT_BY_NAME = 2 }; /* Variables to display file lists */ extern SmallVector<FiosItem, 32> _fios_items; ///< defined in fios.cpp extern SmallFiosItem _file_to_saveload; extern SaveLoadDialogMode _saveload_mode; ///< defined in misc_gui.cpp extern byte _savegame_sort_order; /* Launch save/load dialog */ void ShowSaveLoadDialog(SaveLoadDialogMode mode); /* Get a list of savegames */ void FiosGetSavegameList(SaveLoadDialogMode mode); /* Get a list of scenarios */ void FiosGetScenarioList(SaveLoadDialogMode mode); /* Get a list of Heightmaps */ void FiosGetHeightmapList(SaveLoadDialogMode mode); /* Free the list of savegames */ void FiosFreeSavegameList(); /* Browse to. Returns a filename w/path if we reached a file. */ const char *FiosBrowseTo(const FiosItem *item); /* Return path, free space and stringID */ StringID FiosGetDescText(const char **path, uint64 *total_free); /* Delete a name */ bool FiosDelete(const char *name); /* Make a filename from a name */ void FiosMakeSavegameName(char *buf, const char *name, size_t size); /* Determines type of savegame (or tells it is not a savegame) */ FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file, const char *ext, char *title, const char *last); int CDECL compare_FiosItems(const void *a, const void *b); #endif /* FIOS_H */
3,177
C++
.h
98
30.72449
128
0.729439
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,361
road_internal.h
EnergeticBark_OpenTTD-3DS/src/road_internal.h
/* $Id$ */ /** @file road_internal.h Functions used internally by the roads. */ #ifndef ROAD_INTERNAL_H #define ROAD_INTERNAL_H #include "tile_cmd.h" /** * Clean up unneccesary RoadBits of a planed tile. * @param tile current tile * @param org_rb planed RoadBits * @return optimised RoadBits */ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb); /** * Is it allowed to remove the given road bits from the given tile? * @param tile the tile to remove the road from * @param remove the roadbits that are going to be removed * @param owner the actual owner of the roadbits of the tile * @param rt the road type to remove the bits from * @param flags command flags * @param town_check Shall the town rating checked/affected * @return true when it is allowed to remove the road bits */ bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadType rt, DoCommandFlag flags, bool town_check = true); /** * Draw the catenary for tram road bits * @param ti information about the tile (position, slope) * @param tram the roadbits to draw the catenary for */ void DrawTramCatenary(const TileInfo *ti, RoadBits tram); #endif /* ROAD_INTERNAL_H */
1,218
C++
.h
30
38.766667
130
0.741744
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,362
md5.h
EnergeticBark_OpenTTD-3DS/src/md5.h
/* $Id$ */ /** @file md5.h Functions to create MD5 checksums. */ /* Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. L. Peter Deutsch ghost@aladdin.com */ /* Independent implementation of MD5 (RFC 1321). This code implements the MD5 Algorithm defined in RFC 1321, whose text is available at http://www.ietf.org/rfc/rfc1321.txt The code is derived from the text of the RFC, including the test suite (section A.5) but excluding the rest of Appendix A. It does not include any code or documentation that is identified in the RFC as being copyrighted. The original and principal author of md5.h is L. Peter Deutsch <ghost@aladdin.com>. Other authors are noted in the change history that follows (in reverse chronological order): 2007-12-24 Changed to C++ and adapted to OpenTTD source 2002-04-13 lpd Removed support for non-ANSI compilers; removed references to Ghostscript; clarified derivation from RFC 1321; now handles byte order either statically or dynamically. 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); added conditionalization for C++ compilation from Martin Purschke <purschke@bnl.gov>. 1999-05-03 lpd Original version. */ #ifndef MD5_INCLUDED #define MD5_INCLUDED /* * This package supports both compile-time and run-time determination of CPU * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is * defined as non-zero, the code will be compiled to run only on big-endian * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to * run on either big- or little-endian CPUs, but will run slightly less * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. */ struct Md5 { private: uint32 count[2]; ///< message length in bits, lsw first uint32 abcd[4]; ///< digest buffer uint8 buf[64]; ///< accumulate block void Process(const uint8 *data); public: Md5(); void Append(const void *data, const size_t nbytes); void Finish(uint8 digest[16]); }; #endif /* MD5_INCLUDED */
3,083
C++
.h
65
43.938462
76
0.754082
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,363
landscape.h
EnergeticBark_OpenTTD-3DS/src/landscape.h
/* $Id$ */ /** @file landscape.h Functions related to OTTD's landscape. */ #ifndef LANDSCAPE_H #define LANDSCAPE_H #include "core/geometry_type.hpp" #include "tile_cmd.h" #include "slope_type.h" #include "direction_type.h" enum { SNOW_LINE_MONTHS = 12, ///< Number of months in the snow line table. SNOW_LINE_DAYS = 32, ///< Number of days in each month in the snow line table. }; /** Structure describing the height of the snow line each day of the year * @ingroup SnowLineGroup */ struct SnowLine { byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]; ///< Height of the snow line each day of the year byte highest_value; ///< Highest snow line of the year byte lowest_value; ///< Lowest snow line of the year }; bool IsSnowLineSet(void); void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]); byte GetSnowLine(void); byte HighestSnowLine(void); byte LowestSnowLine(void); void ClearSnowLine(void); uint GetPartialZ(int x, int y, Slope corners); uint GetSlopeZ(int x, int y); void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2); int GetSlopeZInCorner(Slope tileh, Corner corner); Slope GetFoundationSlope(TileIndex tile, uint *z); static inline Point RemapCoords(int x, int y, int z) { Point pt; pt.x = (y - x) * 2; pt.y = y + x - z; return pt; } static inline Point RemapCoords2(int x, int y) { return RemapCoords(x, y, GetSlopeZ(x, y)); } uint ApplyFoundationToSlope(Foundation f, Slope *s); void DrawFoundation(TileInfo *ti, Foundation f); void DoClearSquare(TileIndex tile); void RunTileLoop(); void InitializeLandscape(); void GenerateLandscape(byte mode); #endif /* LANDSCAPE_H */
1,638
C++
.h
48
32.625
96
0.750793
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,364
rail_gui.h
EnergeticBark_OpenTTD-3DS/src/rail_gui.h
/* $Id$ */ /** @file rail_gui.h Functions/types etc. related to the rail GUI. */ #ifndef RAIL_GUI_H #define RAIL_GUI_H #include "rail_type.h" void ShowBuildRailToolbar(RailType railtype, int button); void ReinitGuiAfterToggleElrail(bool disable); bool ResetSignalVariant(int32 = 0); #endif /* RAIL_GUI_H */
312
C++
.h
9
33.111111
69
0.755034
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,365
group_type.h
EnergeticBark_OpenTTD-3DS/src/group_type.h
/* $Id$ */ /** @file group_type.h Types of a group. */ #ifndef GROUP_TYPE_H #define GROUP_TYPE_H typedef uint16 GroupID; enum { ALL_GROUP = 0xFFFD, DEFAULT_GROUP = 0xFFFE, ///< ungrouped vehicles are in this group. INVALID_GROUP = 0xFFFF, MAX_LENGTH_GROUP_NAME_BYTES = 31, ///< The maximum length of a group name in bytes including '\0' MAX_LENGTH_GROUP_NAME_PIXELS = 150, ///< The maximum length of a group name in pixels }; struct Group; #endif /* GROUP_TYPE_H */
484
C++
.h
14
32.714286
100
0.701944
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,366
newgrf_commons.h
EnergeticBark_OpenTTD-3DS/src/newgrf_commons.h
/* $Id$ */ /** @file newgrf_commons.h This file simplyfies and embeds a common mechanism of * loading/saving and mapping of grf entities. */ #ifndef NEWGRF_COMMONS_H #define NEWGRF_COMMONS_H #include "core/bitmath_func.hpp" #include "table/sprites.h" /** * Maps an entity id stored on the map to a GRF file. * Entities are objects used ingame (houses, industries, industry tiles) for * which we need to correlate the ids from the grf files with the ones in the * the savegames themselves. * An array of EntityIDMapping structs is saved with the savegame so * that those GRFs can be loaded in a different order, or removed safely. The * index in the array is the entity's ID stored on the map. * * The substitute ID is the ID of an original entity that should be used instead * if the GRF containing the new entity is not available. */ struct EntityIDMapping { uint32 grfid; ///< The GRF ID of the file the entity belongs to uint8 entity_id; ///< The entity ID within the GRF file uint8 substitute_id; ///< The (original) entity ID to use if this GRF is not available }; class OverrideManagerBase { protected: uint16 *entity_overrides; uint32 *grfid_overrides; uint16 max_offset; ///< what is the length of the original entity's array of specs uint16 max_new_entities; ///< what is the amount of entities, old and new summed uint16 invalid_ID; ///< ID used to dected invalid entities; virtual bool CheckValidNewID(uint16 testid) { return true; } public: EntityIDMapping *mapping_ID; ///< mapping of ids from grf files. Public out of convenience OverrideManagerBase(uint16 offset, uint16 maximum, uint16 invalid); virtual ~OverrideManagerBase(); void ResetOverride(); void ResetMapping(); void Add(uint8 local_id, uint32 grfid, uint entity_type); virtual uint16 AddEntityID(byte grf_local_id, uint32 grfid, byte substitute_id); uint16 GetSubstituteID(byte entity_id); virtual uint16 GetID(uint8 grf_local_id, uint32 grfid); inline uint16 GetMaxMapping() { return max_new_entities; } inline uint16 GetMaxOffset() { return max_offset; } }; struct HouseSpec; class HouseOverrideManager : public OverrideManagerBase { public: HouseOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) : OverrideManagerBase(offset, maximum, invalid) {} void SetEntitySpec(const HouseSpec *hs); }; struct IndustrySpec; class IndustryOverrideManager : public OverrideManagerBase { public: IndustryOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) : OverrideManagerBase(offset, maximum, invalid) {} virtual uint16 AddEntityID(byte grf_local_id, uint32 grfid, byte substitute_id); virtual uint16 GetID(uint8 grf_local_id, uint32 grfid); void SetEntitySpec(IndustrySpec *inds); }; struct IndustryTileSpec; class IndustryTileOverrideManager : public OverrideManagerBase { protected: virtual bool CheckValidNewID(uint16 testid) { return testid != 0xFF; } public: IndustryTileOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) : OverrideManagerBase(offset, maximum, invalid) {} void SetEntitySpec(const IndustryTileSpec *indts); }; extern HouseOverrideManager _house_mngr; extern IndustryOverrideManager _industry_mngr; extern IndustryTileOverrideManager _industile_mngr; uint32 GetTerrainType(TileIndex tile); TileIndex GetNearbyTile(byte parameter, TileIndex tile); uint32 GetNearbyTileInformation(TileIndex tile); /** * Applies PALETTE_MODIFIER_TRANSPARENT and PALETTE_MODIFIER_COLOUR to a palette entry of a sprite layout entry * @Note for ground sprites use #GroundSpritePaletteTransform * @Note Not useable for OTTD internal spritelayouts from table/xxx_land.h as PALETTE_MODIFIER_TRANSPARENT is only set * when to use the default palette. * * @param image The sprite to draw * @param pal The palette from the sprite layout * @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour) * @return The palette to use */ static inline SpriteID SpriteLayoutPaletteTransform(SpriteID image, SpriteID pal, SpriteID default_pal) { if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOUR)) { return (pal != 0 ? pal : default_pal); } else { return PAL_NONE; } } /** * Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite * @Note Not useable for OTTD internal spritelayouts from table/xxx_land.h as PALETTE_MODIFIER_TRANSPARENT is only set * when to use the default palette. * * @param image The sprite to draw * @param pal The palette from the sprite layout * @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour) * @return The palette to use */ static inline SpriteID GroundSpritePaletteTransform(SpriteID image, SpriteID pal, SpriteID default_pal) { if (HasBit(image, PALETTE_MODIFIER_COLOUR)) { return (pal != 0 ? pal : default_pal); } else { return PAL_NONE; } } #endif /* NEWGRF_COMMONS_H */
5,018
C++
.h
115
41.669565
118
0.778507
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,367
waypoint_type.h
EnergeticBark_OpenTTD-3DS/src/waypoint_type.h
/* $Id$ */ /** @file waypoint_type.h Types related to waypoints. */ #ifndef WAYPOINT_TYPE_H #define WAYPOINT_TYPE_H typedef uint16 WaypointID; struct Waypoint; enum { MAX_LENGTH_WAYPOINT_NAME_BYTES = 31, ///< The maximum length of a waypoint name in bytes including '\0' MAX_LENGTH_WAYPOINT_NAME_PIXELS = 180, ///< The maximum length of a waypoint name in pixels }; #endif /* WAYPOINT_TYPE_H */
404
C++
.h
11
35.090909
106
0.731959
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,368
queue.h
EnergeticBark_OpenTTD-3DS/src/queue.h
/* $Id$ */ /** @file queue.h Simple Queue/Hash implementations. */ #ifndef QUEUE_H #define QUEUE_H //#define NOFREE //#define QUEUE_DEBUG //#define HASH_DEBUG //#define HASH_STATS struct Queue; typedef bool Queue_PushProc(Queue *q, void *item, int priority); typedef void *Queue_PopProc(Queue *q); typedef bool Queue_DeleteProc(Queue *q, void *item, int priority); typedef void Queue_ClearProc(Queue *q, bool free_values); typedef void Queue_FreeProc(Queue *q, bool free_values); struct InsSortNode { void *item; int priority; InsSortNode *next; }; struct BinaryHeapNode { void *item; int priority; }; struct Queue{ /* * Pushes an element into the queue, at the appropriate place for the queue. * Requires the queue pointer to be of an appropriate type, of course. */ Queue_PushProc *push; /* * Pops the first element from the queue. What exactly is the first element, * is defined by the exact type of queue. */ Queue_PopProc *pop; /* * Deletes the item from the queue. priority should be specified if * known, which speeds up the deleting for some queue's. Should be -1 * if not known. */ Queue_DeleteProc *del; /* Clears the queue, by removing all values from it. It's state is * effectively reset. If free_items is true, each of the items cleared * in this way are free()'d. */ Queue_ClearProc *clear; /* Frees the queue, by reclaiming all memory allocated by it. After * this it is no longer usable. If free_items is true, any remaining * items are free()'d too. */ Queue_FreeProc *free; union { struct { InsSortNode *first; } inssort; struct { uint max_size; uint size; uint blocks; ///< The amount of blocks for which space is reserved in elements BinaryHeapNode **elements; } binaryheap; } data; }; /** * Insertion Sorter */ /* Initializes a inssort and allocates internal memory. There is no maximum * size */ void init_InsSort(Queue *q); /* * Binary Heap * For information, see: * http://www.policyalmanac.org/games/binaryHeaps.htm */ /* The amount of elements that will be malloc'd at a time */ #define BINARY_HEAP_BLOCKSIZE_BITS 10 /** Initializes a binary heap and allocates internal memory for maximum of * max_size elements */ void init_BinaryHeap(Queue *q, uint max_size); /* * Hash */ struct HashNode { uint key1; uint key2; void *value; HashNode *next; }; /** * Generates a hash code from the given key pair. You should make sure that * the resulting range is clearly defined. */ typedef uint Hash_HashProc(uint key1, uint key2); struct Hash { /* The hash function used */ Hash_HashProc *hash; /* The amount of items in the hash */ uint size; /* The number of buckets allocated */ uint num_buckets; /* A pointer to an array of num_buckets buckets. */ HashNode *buckets; /* A pointer to an array of numbuckets booleans, which will be true if * there are any Nodes in the bucket */ bool *buckets_in_use; }; /* Call these function to manipulate a hash */ /** Deletes the value with the specified key pair from the hash and returns * that value. Returns NULL when the value was not present. The value returned * is _not_ free()'d! */ void *Hash_Delete(Hash *h, uint key1, uint key2); /** Sets the value associated with the given key pair to the given value. * Returns the old value if the value was replaced, NULL when it was not yet present. */ void *Hash_Set(Hash *h, uint key1, uint key2, void *value); /** Gets the value associated with the given key pair, or NULL when it is not * present. */ void *Hash_Get(const Hash *h, uint key1, uint key2); /* Call these function to create/destroy a hash */ /** Builds a new hash in an existing struct. Make sure that hash() always * returns a hash less than num_buckets! Call delete_hash after use */ void init_Hash(Hash *h, Hash_HashProc *hash, uint num_buckets); /** * Deletes the hash and cleans up. Only cleans up memory allocated by new_Hash * & friends. If free is true, it will call free() on all the values that * are left in the hash. */ void delete_Hash(Hash *h, bool free_values); /** * Cleans the hash, but keeps the memory allocated */ void clear_Hash(Hash *h, bool free_values); /** * Gets the current size of the Hash */ uint Hash_Size(const Hash *h); #endif /* QUEUE_H */
4,290
C++
.h
135
29.748148
88
0.726634
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,369
gfx_func.h
EnergeticBark_OpenTTD-3DS/src/gfx_func.h
/* $Id$ */ /** @file gfx_func.h Functions related to the gfx engine. */ /** * @defgroup dirty Dirty * * Handles the repaint of some part of the screen. * * Some places in the code are called functions which makes something "dirty". * This has nothing to do with making a Tile or Window darker or less visible. * This term comes from memory caching and is used to define an object must * be repaint. If some data of an object (like a Tile, Window, Vehicle, whatever) * are changed which are so extensive the object must be repaint its marked * as "dirty". The video driver repaint this object instead of the whole screen * (this is btw. also possible if needed). This is used to avoid a * flickering of the screen by the video driver constantly repainting it. * * This whole mechanism is controlled by an rectangle defined in #_invalid_rect. This * rectangle defines the area on the screen which must be repaint. If a new object * needs to be repainted this rectangle is extended to 'catch' the object on the * screen. At some point (which is normaly uninteressted for patch writers) this * rectangle is send to the video drivers method * VideoDriver::MakeDirty and it is truncated back to an empty rectangle. At some * later point (which is uninteressted, too) the video driver * repaints all these saved rectangle instead of the whole screen and drop the * rectangle informations. Then a new round begins by marking objects "dirty". * * @see VideoDriver::MakeDirty * @see _invalid_rect * @see _screen */ #ifndef GFX_FUNC_H #define GFX_FUNC_H #include "gfx_type.h" #include "strings_type.h" void GameLoop(); void CreateConsole(); extern byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down extern bool _fullscreen; extern CursorVars _cursor; extern bool _ctrl_pressed; ///< Is Ctrl pressed? extern bool _shift_pressed; ///< Is Shift pressed? extern byte _fast_forward; extern bool _left_button_down; extern bool _left_button_clicked; extern bool _right_button_down; extern bool _right_button_clicked; extern DrawPixelInfo _screen; extern bool _screen_disable_anim; ///< Disable palette animation (important for 32bpp-anim blitter during giant screenshot) extern int _pal_first_dirty; extern int _pal_count_dirty; extern int _num_resolutions; extern Dimension _resolutions[32]; extern Dimension _cur_resolution; extern Colour _cur_palette[256]; ///< Current palette. Entry 0 has to be always fully transparent! void HandleKeypress(uint32 key); void HandleCtrlChanged(); void HandleMouseEvents(); void CSleep(int milliseconds); void UpdateWindows(); void DrawMouseCursor(); void ScreenSizeChanged(); void GameSizeChanged(); void UndrawMouseCursor(); enum { /* Size of the buffer used for drawing strings. */ DRAW_STRING_BUFFER = 2048, }; void RedrawScreenRect(int left, int top, int right, int bottom); void GfxScroll(int left, int top, int width, int height, int xo, int yo); void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub = NULL); int DrawStringCentered(int x, int y, StringID str, TextColour colour); int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, TextColour colour); int DoDrawStringCentered(int x, int y, const char *str, TextColour colour); int DrawString(int x, int y, StringID str, TextColour colour); int DrawStringTruncated(int x, int y, StringID str, TextColour colour, uint maxw); int DoDrawString(const char *string, int x, int y, TextColour colour, bool parse_string_also_when_clipped = false); int DoDrawStringTruncated(const char *str, int x, int y, TextColour colour, uint maxw); void DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour); void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, TextColour colour); int DrawStringRightAligned(int x, int y, StringID str, TextColour colour); void DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colour, uint maxw); void DrawStringRightAlignedUnderline(int x, int y, StringID str, TextColour colour); void DrawCharCentered(uint32 c, int x, int y, TextColour colour); void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode = FILLRECT_OPAQUE); void GfxDrawLine(int left, int top, int right, int bottom, int colour); void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3); Dimension GetStringBoundingBox(const char *str); uint32 FormatStringLinebreaks(char *str, int maxw); int GetStringHeight(StringID str, int maxw); void LoadStringWidthTable(); void DrawStringMultiCenter(int x, int y, StringID str, int maxw); uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh = -1); /** * Let the dirty blocks repainting by the video driver. * * @ingroup dirty */ void DrawDirtyBlocks(); /** * Set a new dirty block. * * @ingroup dirty */ void SetDirtyBlocks(int left, int top, int right, int bottom); /** * Marks the whole screen as dirty. * * @ingroup dirty */ void MarkWholeScreenDirty(); void GfxInitPalettes(); bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height); /* window.cpp */ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom); void SetMouseCursor(SpriteID sprite, SpriteID pal); void SetAnimatedMouseCursor(const AnimCursor *table); void CursorTick(); bool ChangeResInGame(int w, int h); void SortResolutions(int count); bool ToggleFullScreen(bool fs); /* gfx.cpp */ #define ASCII_LETTERSTART 32 extern FontSize _cur_fontsize; byte GetCharacterWidth(FontSize size, uint32 key); /** * Get height of a character for a given font size. * @param size Font size to get height of * @return Height of characters in the given font (pixels) */ static inline byte GetCharacterHeight(FontSize size) { switch (size) { default: NOT_REACHED(); case FS_NORMAL: return 10; case FS_SMALL: return 6; case FS_LARGE: return 18; } } extern DrawPixelInfo *_cur_dpi; /** * All 16 colour gradients * 8 colours per gradient from darkest (0) to lightest (7) */ extern byte _colour_gradient[COLOUR_END][8]; extern PaletteType _use_palette; extern bool _palette_remap_grf[]; extern const byte *_palette_remap; extern const byte *_palette_reverse_remap; #endif /* GFX_FUNC_H */
6,280
C++
.h
149
40.503356
125
0.768423
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,370
autoreplace_base.h
EnergeticBark_OpenTTD-3DS/src/autoreplace_base.h
/* $Id$ */ /** @file autoreplace_base.h Base class for autoreplaces/autorenews. */ #ifndef AUTOREPLACE_BASE_H #define AUTOREPLACE_BASE_H #include "oldpool.h" #include "autoreplace_type.h" typedef uint16 EngineRenewID; /** * Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is * placed here so the only exception to this rule, the saveload code, can use * it. */ DECLARE_OLD_POOL(EngineRenew, EngineRenew, 3, 8000) /** * Struct to store engine replacements. DO NOT USE outside of engine.c. Is * placed here so the only exception to this rule, the saveload code, can use * it. */ struct EngineRenew : PoolItem<EngineRenew, EngineRenewID, &_EngineRenew_pool> { EngineID from; EngineID to; EngineRenew *next; GroupID group_id; EngineRenew(EngineID from = INVALID_ENGINE, EngineID to = INVALID_ENGINE) : from(from), to(to), next(NULL) {} ~EngineRenew() { this->from = INVALID_ENGINE; } inline bool IsValid() const { return this->from != INVALID_ENGINE; } }; #define FOR_ALL_ENGINE_RENEWS_FROM(er, start) for (er = GetEngineRenew(start); er != NULL; er = (er->index + 1U < GetEngineRenewPoolSize()) ? GetEngineRenew(er->index + 1U) : NULL) if (er->IsValid()) #define FOR_ALL_ENGINE_RENEWS(er) FOR_ALL_ENGINE_RENEWS_FROM(er, 0) #endif /* AUTOREPLACE_BASE_H */
1,300
C++
.h
30
41.5
199
0.734127
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,371
airport_movement.h
EnergeticBark_OpenTTD-3DS/src/airport_movement.h
/* $Id$ */ /** @file airport_movement.h Heart of the airports and their finite state machines */ #ifndef AIRPORT_MOVEMENT_H #define AIRPORT_MOVEMENT_H /* state machine input struct (from external file, etc.) * Finite sTate mAchine --> FTA */ struct AirportFTAbuildup { byte position; // the position that an airplane is at byte heading; // the current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.) uint64 block; // the block this position is on on the airport (st->airport_flags) byte next; // next position from this position }; /////////////////////////////////////////////////////////////////////// /////*********Movement Positions on Airports********************/////// static const AirportMovingData _airport_moving_data_dummy[] = { { 0, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, { 0, 96, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, { 96, 96, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, { 96, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, }; /* Country Airfield (small) 4x3 */ static const AirportMovingData _airport_moving_data_country[22] = { { 53, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar { 53, 27, 0, {DIR_N} }, // 01 Taxi to right outside depot { 32, 23, AMED_EXACTPOS, {DIR_NW} }, // 02 Terminal 1 { 10, 23, AMED_EXACTPOS, {DIR_NW} }, // 03 Terminal 2 { 43, 37, 0, {DIR_N} }, // 04 Going towards terminal 2 { 24, 37, 0, {DIR_N} }, // 05 Going towards terminal 2 { 53, 37, 0, {DIR_N} }, // 06 Going for takeoff { 61, 40, AMED_EXACTPOS, {DIR_NE} }, // 07 Taxi to start of runway (takeoff) { 3, 40, AMED_NOSPDCLAMP, {DIR_N} }, // 08 Accelerate to end of runway { -79, 40, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 09 Take off { 177, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 10 Fly to landing position in air { 56, 40, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 11 Going down for land { 3, 40, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 12 Just landed, brake until end of runway { 7, 40, 0, {DIR_N} }, // 13 Just landed, turn around and taxi 1 square { 53, 40, 0, {DIR_N} }, // 14 Taxi from runway to crossing { -31, 193, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 15 Fly around waiting for a landing spot (north-east) { 1, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 16 Fly around waiting for a landing spot (north-west) { 257, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 17 Fly around waiting for a landing spot (south-west) { 273, 49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 18 Fly around waiting for a landing spot (south) { 44, 37, AMED_HELI_RAISE, {DIR_N} }, // 19 Helicopter takeoff { 44, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 20 In position above landing spot helicopter { 44, 40, AMED_HELI_LOWER, {DIR_N} }, // 21 Helicopter landing }; /* Commuter Airfield (small) 5x4 */ static const AirportMovingData _airport_moving_data_commuter[37] = { { 69, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar { 72, 22, 0, {DIR_N} }, // 01 Taxi to right outside depot { 8, 22, AMED_EXACTPOS, {DIR_SW} }, // 01 Taxi to right outside depot { 24, 36, AMED_EXACTPOS, {DIR_SE} }, // 03 Terminal 1 { 40, 36, AMED_EXACTPOS, {DIR_SE} }, // 04 Terminal 2 { 56, 36, AMED_EXACTPOS, {DIR_SE} }, // 05 Terminal 3 { 40, 8, AMED_EXACTPOS, {DIR_NE} }, // 06 Helipad 1 { 56, 8, AMED_EXACTPOS, {DIR_NE} }, // 07 Helipad 2 { 24, 22, 0, {DIR_SW} }, // 08 Taxiing { 40, 22, 0, {DIR_SW} }, // 09 Taxiing { 56, 22, 0, {DIR_SW} }, // 10 Taxiing { 72, 40, 0, {DIR_SE} }, // 11 Airport OUTWAY { 72, 54, AMED_EXACTPOS, {DIR_NE} }, // 12 Accelerate to end of runway { 7, 54, AMED_NOSPDCLAMP, {DIR_N} }, // 13 Release control of runway, for smoother movement { 5, 54, AMED_NOSPDCLAMP, {DIR_N} }, // 14 End of runway { -79, 54, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 15 Take off { 145, 54, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 16 Fly to landing position in air { 73, 54, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 17 Going down for land { 3, 54, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 18 Just landed, brake until end of runway { 12, 54, AMED_SLOWTURN, {DIR_NW} }, // 19 Just landed, turn around and taxi { 8, 32, 0, {DIR_NW} }, // 20 Taxi from runway to crossing { -31, 149, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 21 Fly around waiting for a landing spot (north-east) { 1, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 22 Fly around waiting for a landing spot (north-west) { 193, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 23 Fly around waiting for a landing spot (south-west) { 225, 81, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 24 Fly around waiting for a landing spot (south) /* Helicopter */ { 80, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 25 Bufferspace before helipad { 80, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 26 Bufferspace before helipad { 32, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 27 Get in position for Helipad1 { 48, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 28 Get in position for Helipad2 { 32, 8, AMED_HELI_LOWER, {DIR_N} }, // 29 Land at Helipad1 { 48, 8, AMED_HELI_LOWER, {DIR_N} }, // 30 Land at Helipad2 { 32, 8, AMED_HELI_RAISE, {DIR_N} }, // 31 Takeoff Helipad1 { 48, 8, AMED_HELI_RAISE, {DIR_N} }, // 32 Takeoff Helipad2 { 64, 22, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 33 Go to position for Hangarentrance in air { 64, 22, AMED_HELI_LOWER, {DIR_N} }, // 34 Land in front of hangar { 40, 8, AMED_EXACTPOS, {DIR_N} }, // pre-helitakeoff helipad 1 { 56, 8, AMED_EXACTPOS, {DIR_N} }, // pre-helitakeoff helipad 2 }; /* City Airport (large) 6x6 */ static const AirportMovingData _airport_moving_data_town[] = { { 85, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar { 85, 27, 0, {DIR_N} }, // 01 Taxi to right outside depot { 26, 41, AMED_EXACTPOS, {DIR_SW} }, // 02 Terminal 1 { 56, 20, AMED_EXACTPOS, {DIR_SE} }, // 03 Terminal 2 { 38, 8, AMED_EXACTPOS, {DIR_SW} }, // 04 Terminal 3 { 65, 6, 0, {DIR_N} }, // 05 Taxi to right in infront of terminal 2/3 { 80, 27, 0, {DIR_N} }, // 06 Taxiway terminals 2-3 { 44, 63, 0, {DIR_N} }, // 07 Taxi to Airport center { 58, 71, 0, {DIR_N} }, // 08 Towards takeoff { 72, 85, 0, {DIR_N} }, // 09 Taxi to runway (takeoff) { 89, 85, AMED_EXACTPOS, {DIR_NE} }, // 10 Taxi to start of runway (takeoff) { 3, 85, AMED_NOSPDCLAMP, {DIR_N} }, // 11 Accelerate to end of runway { -79, 85, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 12 Take off { 177, 87, AMED_HOLD | AMED_SLOWTURN, {DIR_N} }, // 13 Fly to landing position in air { 89, 87, AMED_HOLD | AMED_LAND, {DIR_N} }, // 14 Going down for land { 20, 87, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 15 Just landed, brake until end of runway { 20, 87, 0, {DIR_N} }, // 16 Just landed, turn around and taxi 1 square // NOT USED { 36, 71, 0, {DIR_N} }, // 17 Taxi from runway to crossing { 160, 87, AMED_HOLD | AMED_SLOWTURN, {DIR_N} }, // 18 Fly around waiting for a landing spot (north-east) { 140, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 19 Final approach fix { 257, 1, AMED_HOLD | AMED_SLOWTURN, {DIR_N} }, // 20 Fly around waiting for a landing spot (south-west) { 273, 49, AMED_HOLD | AMED_SLOWTURN, {DIR_N} }, // 21 Fly around waiting for a landing spot (south) { 44, 63, AMED_HELI_RAISE, {DIR_N} }, // 22 Helicopter takeoff { 28, 74, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 23 In position above landing spot helicopter { 28, 74, AMED_HELI_LOWER, {DIR_N} }, // 24 Helicopter landing { 145, 1, AMED_HOLD | AMED_SLOWTURN, {DIR_N} }, // 25 Fly around waiting for a landing spot (north-west) { -32, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 26 Initial approach fix (north) { 300, -48, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 27 Initial approach fix (south) { 140, -48, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 28 Intermediadate Approach fix (south), IAF (west) { -32, 120, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 29 Initial approach fix (east) }; /* Metropolitan Airport (metropolitan) - 2 runways */ static const AirportMovingData _airport_moving_data_metropolitan[27] = { { 85, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar { 85, 27, 0, {DIR_N} }, // 01 Taxi to right outside depot { 26, 41, AMED_EXACTPOS, {DIR_SW} }, // 02 Terminal 1 { 56, 20, AMED_EXACTPOS, {DIR_SE} }, // 03 Terminal 2 { 38, 8, AMED_EXACTPOS, {DIR_SW} }, // 04 Terminal 3 { 65, 6, 0, {DIR_N} }, // 05 Taxi to right in infront of terminal 2/3 { 70, 33, 0, {DIR_N} }, // 06 Taxiway terminals 2-3 { 44, 58, 0, {DIR_N} }, // 07 Taxi to Airport center { 72, 58, 0, {DIR_N} }, // 08 Towards takeoff { 72, 69, 0, {DIR_N} }, // 09 Taxi to runway (takeoff) { 89, 69, AMED_EXACTPOS, {DIR_NE} }, // 10 Taxi to start of runway (takeoff) { 3, 69, AMED_NOSPDCLAMP, {DIR_N} }, // 11 Accelerate to end of runway { -79, 69, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 12 Take off { 177, 85, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 13 Fly to landing position in air { 89, 85, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 14 Going down for land { 3, 85, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 15 Just landed, brake until end of runway { 21, 85, 0, {DIR_N} }, // 16 Just landed, turn around and taxi 1 square { 21, 69, 0, {DIR_N} }, // 17 On Runway-out taxiing to In-Way { 21, 54, AMED_EXACTPOS, {DIR_SW} }, // 18 Taxi from runway to crossing { -31, 193, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 19 Fly around waiting for a landing spot (north-east) { 1, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 20 Fly around waiting for a landing spot (north-west) { 257, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 21 Fly around waiting for a landing spot (south-west) { 273, 49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 22 Fly around waiting for a landing spot (south) { 44, 58, 0, {DIR_N} }, // 23 Helicopter takeoff spot on ground (to clear airport sooner) { 44, 63, AMED_HELI_RAISE, {DIR_N} }, // 24 Helicopter takeoff { 15, 54, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 25 Get in position above landing spot helicopter { 15, 54, AMED_HELI_LOWER, {DIR_N} }, // 26 Helicopter landing }; /* International Airport (international) - 2 runways, 6 terminals, dedicated helipod */ static const AirportMovingData _airport_moving_data_international[51] = { { 7, 55, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar 1 { 100, 21, AMED_EXACTPOS, {DIR_SE} }, // 01 In Hangar 2 { 7, 70, 0, {DIR_N} }, // 02 Taxi to right outside depot { 100, 36, 0, {DIR_N} }, // 03 Taxi to right outside depot { 38, 70, AMED_EXACTPOS, {DIR_SW} }, // 04 Terminal 1 { 38, 54, AMED_EXACTPOS, {DIR_SW} }, // 05 Terminal 2 { 38, 38, AMED_EXACTPOS, {DIR_SW} }, // 06 Terminal 3 { 70, 70, AMED_EXACTPOS, {DIR_NE} }, // 07 Terminal 4 { 70, 54, AMED_EXACTPOS, {DIR_NE} }, // 08 Terminal 5 { 70, 38, AMED_EXACTPOS, {DIR_NE} }, // 09 Terminal 6 { 104, 71, AMED_EXACTPOS, {DIR_NE} }, // 10 Helipad 1 { 104, 55, AMED_EXACTPOS, {DIR_NE} }, // 11 Helipad 2 { 22, 87, 0, {DIR_N} }, // 12 Towards Terminals 4/5/6, Helipad 1/2 { 60, 87, 0, {DIR_N} }, // 13 Towards Terminals 4/5/6, Helipad 1/2 { 66, 87, 0, {DIR_N} }, // 14 Towards Terminals 4/5/6, Helipad 1/2 { 86, 87, AMED_EXACTPOS, {DIR_NW} }, // 15 Towards Terminals 4/5/6, Helipad 1/2 { 86, 70, 0, {DIR_N} }, // 16 In Front of Terminal 4 / Helipad 1 { 86, 54, 0, {DIR_N} }, // 17 In Front of Terminal 5 / Helipad 2 { 86, 38, 0, {DIR_N} }, // 18 In Front of Terminal 6 { 86, 22, 0, {DIR_N} }, // 19 Towards Terminals Takeoff (Taxiway) { 66, 22, 0, {DIR_N} }, // 20 Towards Terminals Takeoff (Taxiway) { 60, 22, 0, {DIR_N} }, // 21 Towards Terminals Takeoff (Taxiway) { 38, 22, 0, {DIR_N} }, // 22 Towards Terminals Takeoff (Taxiway) { 22, 70, 0, {DIR_N} }, // 23 In Front of Terminal 1 { 22, 58, 0, {DIR_N} }, // 24 In Front of Terminal 2 { 22, 38, 0, {DIR_N} }, // 25 In Front of Terminal 3 { 22, 22, AMED_EXACTPOS, {DIR_NW} }, // 26 Going for Takeoff { 22, 6, 0, {DIR_N} }, // 27 On Runway-out, prepare for takeoff { 3, 6, AMED_EXACTPOS, {DIR_SW} }, // 28 Accelerate to end of runway { 60, 6, AMED_NOSPDCLAMP, {DIR_N} }, // 29 Release control of runway, for smoother movement { 105, 6, AMED_NOSPDCLAMP, {DIR_N} }, // 30 End of runway { 190, 6, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 31 Take off { 193, 104, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 32 Fly to landing position in air { 105, 104, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 33 Going down for land { 3, 104, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 34 Just landed, brake until end of runway { 12, 104, AMED_SLOWTURN, {DIR_N} }, // 35 Just landed, turn around and taxi 1 square { 7, 84, 0, {DIR_N} }, // 36 Taxi from runway to crossing { -31, 209, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 37 Fly around waiting for a landing spot (north-east) { 1, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 38 Fly around waiting for a landing spot (north-west) { 273, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 39 Fly around waiting for a landing spot (south-west) { 305, 81, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 40 Fly around waiting for a landing spot (south) /* Helicopter */ { 128, 80, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 41 Bufferspace before helipad { 128, 80, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 42 Bufferspace before helipad { 96, 71, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 43 Get in position for Helipad1 { 96, 55, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 44 Get in position for Helipad2 { 96, 71, AMED_HELI_LOWER, {DIR_N} }, // 45 Land at Helipad1 { 96, 55, AMED_HELI_LOWER, {DIR_N} }, // 46 Land at Helipad2 { 104, 71, AMED_HELI_RAISE, {DIR_N} }, // 47 Takeoff Helipad1 { 104, 55, AMED_HELI_RAISE, {DIR_N} }, // 48 Takeoff Helipad2 { 104, 32, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 49 Go to position for Hangarentrance in air { 104, 32, AMED_HELI_LOWER, {DIR_N} }, // 50 Land in HANGAR2_AREA to go to hangar }; /* Intercontinental Airport - 4 runways, 8 terminals, 2 dedicated helipads */ static const AirportMovingData _airport_moving_data_intercontinental[77] = { { 7, 87, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar 1 { 135, 72, AMED_EXACTPOS, {DIR_SE} }, // 01 In Hangar 2 { 7, 104, 0, {DIR_N} }, // 02 Taxi to right outside depot 1 { 135, 88, 0, {DIR_N} }, // 03 Taxi to right outside depot 2 { 56, 120, AMED_EXACTPOS, {DIR_W} }, // 04 Terminal 1 { 56, 104, AMED_EXACTPOS, {DIR_SW} }, // 05 Terminal 2 { 56, 88, AMED_EXACTPOS, {DIR_SW} }, // 06 Terminal 3 { 56, 72, AMED_EXACTPOS, {DIR_SW} }, // 07 Terminal 4 { 88, 120, AMED_EXACTPOS, {DIR_N} }, // 08 Terminal 5 { 88, 104, AMED_EXACTPOS, {DIR_NE} }, // 09 Terminal 6 { 88, 88, AMED_EXACTPOS, {DIR_NE} }, // 10 Terminal 7 { 88, 72, AMED_EXACTPOS, {DIR_NE} }, // 11 Terminal 8 { 88, 56, AMED_EXACTPOS, {DIR_SE} }, // 12 Helipad 1 { 72, 56, AMED_EXACTPOS, {DIR_NE} }, // 13 Helipad 2 { 40, 136, 0, {DIR_N} }, // 14 Term group 2 enter 1 a { 56, 136, 0, {DIR_N} }, // 15 Term group 2 enter 1 b { 88, 136, 0, {DIR_N} }, // 16 Term group 2 enter 2 a { 104, 136, 0, {DIR_N} }, // 17 Term group 2 enter 2 b { 104, 120, 0, {DIR_N} }, // 18 Term group 2 - opp term 5 { 104, 104, 0, {DIR_N} }, // 19 Term group 2 - opp term 6 & exit2 { 104, 88, 0, {DIR_N} }, // 20 Term group 2 - opp term 7 & hangar area 2 { 104, 72, 0, {DIR_N} }, // 21 Term group 2 - opp term 8 { 104, 56, 0, {DIR_N} }, // 22 Taxi Term group 2 exit a { 104, 40, 0, {DIR_N} }, // 23 Taxi Term group 2 exit b { 56, 40, 0, {DIR_N} }, // 24 Term group 2 exit 2a { 40, 40, 0, {DIR_N} }, // 25 Term group 2 exit 2b { 40, 120, 0, {DIR_N} }, // 26 Term group 1 - opp term 1 { 40, 104, 0, {DIR_N} }, // 27 Term group 1 - opp term 2 & hangar area 1 { 40, 88, 0, {DIR_N} }, // 28 Term group 1 - opp term 3 { 40, 72, 0, {DIR_N} }, // 29 Term group 1 - opp term 4 { 18, 72, 0, {DIR_NW} }, // 30 Outway 1 { 8, 40, 0, {DIR_NW} }, // 31 Airport OUTWAY { 8, 24, AMED_EXACTPOS, {DIR_SW} }, // 32 Accelerate to end of runway { 119, 24, AMED_NOSPDCLAMP, {DIR_N} }, // 33 Release control of runway, for smoother movement { 117, 24, AMED_NOSPDCLAMP, {DIR_N} }, // 34 End of runway { 197, 24, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 35 Take off { 254, 84, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 36 Flying to landing position in air { 117, 168, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 37 Going down for land { 3, 168, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 38 Just landed, brake until end of runway { 8, 168, 0, {DIR_N} }, // 39 Just landed, turn around and taxi { 8, 144, 0, {DIR_NW} }, // 40 Taxi from runway { 8, 128, 0, {DIR_NW} }, // 41 Taxi from runway { 8, 120, AMED_EXACTPOS, {DIR_SW} }, // 42 Airport entrance { 56, 344, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 43 Fly around waiting for a landing spot (north-east) { -200, 88, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 44 Fly around waiting for a landing spot (north-west) { 56, -168, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 45 Fly around waiting for a landing spot (south-west) { 312, 88, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 46 Fly around waiting for a landing spot (south) /* Helicopter */ { 96, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 47 Bufferspace before helipad { 96, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 48 Bufferspace before helipad { 82, 54, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 49 Get in position for Helipad1 { 64, 56, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 50 Get in position for Helipad2 { 81, 55, AMED_HELI_LOWER, {DIR_N} }, // 51 Land at Helipad1 { 64, 56, AMED_HELI_LOWER, {DIR_N} }, // 52 Land at Helipad2 { 80, 56, AMED_HELI_RAISE, {DIR_N} }, // 53 Takeoff Helipad1 { 64, 56, AMED_HELI_RAISE, {DIR_N} }, // 54 Takeoff Helipad2 { 136, 96, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 55 Go to position for Hangarentrance in air { 136, 96, AMED_HELI_LOWER, {DIR_N} }, // 56 Land in front of hangar2 { 126, 104, 0, {DIR_SE} }, // 57 Outway 2 { 136, 136, 0, {DIR_NE} }, // 58 Airport OUTWAY 2 { 136, 152, AMED_EXACTPOS, {DIR_NE} }, // 59 Accelerate to end of runway2 { 16, 152, AMED_NOSPDCLAMP, {DIR_N} }, // 60 Release control of runway2, for smoother movement { 20, 152, AMED_NOSPDCLAMP, {DIR_N} }, // 61 End of runway2 { -56, 152, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 62 Take off2 { 24, 8, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 63 Going down for land2 { 136, 8, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 64 Just landed, brake until end of runway2in { 136, 8, 0, {DIR_N} }, // 65 Just landed, turn around and taxi { 136, 24, 0, {DIR_SE} }, // 66 Taxi from runway 2in { 136, 40, 0, {DIR_SE} }, // 67 Taxi from runway 2in { 136, 56, AMED_EXACTPOS, {DIR_NE} }, // 68 Airport entrance2 { -56, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 69 Fly to landing position in air2 { 88, 40, 0, {DIR_N} }, // 70 Taxi Term group 2 exit - opp heli1 { 72, 40, 0, {DIR_N} }, // 71 Taxi Term group 2 exit - opp heli2 { 88, 57, AMED_EXACTPOS, {DIR_SE} }, // 72 pre-helitakeoff helipad 1 { 71, 56, AMED_EXACTPOS, {DIR_NE} }, // 73 pre-helitakeoff helipad 2 { 8, 120, AMED_HELI_RAISE, {DIR_N} }, // 74 Helitakeoff outside depot 1 { 136, 104, AMED_HELI_RAISE, {DIR_N} }, // 75 Helitakeoff outside depot 2 { 197, 168, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 76 Fly to landing position in air1 }; /* Heliport (heliport) */ static const AirportMovingData _airport_moving_data_heliport[9] = { { 5, 9, AMED_EXACTPOS, {DIR_NE} }, // 0 - At heliport terminal { 2, 9, AMED_HELI_RAISE, {DIR_N} }, // 1 - Take off (play sound) { -3, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 2 - In position above landing spot helicopter { -3, 9, AMED_HELI_LOWER, {DIR_N} }, // 3 - Land { 2, 9, 0, {DIR_N} }, // 4 - Goto terminal on ground { -31, 59, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 5 - Circle #1 (north-east) { -31, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 6 - Circle #2 (north-west) { 49, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 7 - Circle #3 (south-west) { 70, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 8 - Circle #4 (south) }; /* HeliDepot 2x2 (heliport) */ static const AirportMovingData _airport_moving_data_helidepot[18] = { { 24, 4, AMED_EXACTPOS, {DIR_NE} }, // 0 - At depot { 24, 28, 0, {DIR_N} }, // 1 Taxi to right outside depot { 5, 38, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 2 Flying { -15, -15, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 3 - Circle #1 (north-east) { -15, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 4 - Circle #2 (north-west) { 49, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 5 - Circle #3 (south-west) { 49, -15, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 6 - Circle #4 (south-east) { 8, 32, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_NW} }, // 7 - PreHelipad { 8, 32, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_NW} }, // 8 - Helipad { 8, 16, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_NW} }, // 9 - Land { 8, 16, AMED_HELI_LOWER, {DIR_NW} }, // 10 - Land { 8, 24, AMED_HELI_RAISE, {DIR_N} }, // 11 - Take off (play sound) { 32, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_NW} }, // 12 Air to above hangar area { 32, 24, AMED_HELI_LOWER, {DIR_NW} }, // 13 Taxi to right outside depot { 8, 24, AMED_EXACTPOS, {DIR_NW} }, // 14 - on helipad1 { 24, 28, AMED_HELI_RAISE, {DIR_N} }, // 15 Takeoff right outside depot { 8, 24, AMED_HELI_RAISE, {DIR_SW} }, // 16 - Take off (play sound) { 8, 24, AMED_SLOWTURN | AMED_EXACTPOS, {DIR_E} }, // 17 - turn on helipad1 for takeoff }; /* HeliDepot 2x2 (heliport) */ static const AirportMovingData _airport_moving_data_helistation[33] = { { 8, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar2 { 8, 22, 0, {DIR_N} }, // 01 outside hangar 2 { 116, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 02 Fly to landing position in air { 14, 22, AMED_HELI_RAISE, {DIR_N} }, // 03 Helitakeoff outside hangar1(play sound) { 24, 22, 0, {DIR_N} }, // 04 taxiing { 40, 22, 0, {DIR_N} }, // 05 taxiing { 40, 8, AMED_EXACTPOS, {DIR_NE} }, // 06 Helipad 1 { 56, 8, AMED_EXACTPOS, {DIR_NE} }, // 07 Helipad 2 { 56, 24, AMED_EXACTPOS, {DIR_NE} }, // 08 Helipad 3 { 40, 8, AMED_EXACTPOS, {DIR_N} }, // 09 pre-helitakeoff helipad 1 { 56, 8, AMED_EXACTPOS, {DIR_N} }, // 10 pre-helitakeoff helipad 2 { 56, 24, AMED_EXACTPOS, {DIR_N} }, // 11 pre-helitakeoff helipad 3 { 32, 8, AMED_HELI_RAISE, {DIR_N} }, // 12 Takeoff Helipad1 { 48, 8, AMED_HELI_RAISE, {DIR_N} }, // 13 Takeoff Helipad2 { 48, 24, AMED_HELI_RAISE, {DIR_N} }, // 14 Takeoff Helipad3 { 84, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 15 Bufferspace before helipad { 68, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 16 Bufferspace before helipad { 32, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 17 Get in position for Helipad1 { 48, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 18 Get in position for Helipad2 { 48, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_NE} }, // 19 Get in position for Helipad3 { 40, 8, AMED_HELI_LOWER, {DIR_N} }, // 20 Land at Helipad1 { 48, 8, AMED_HELI_LOWER, {DIR_N} }, // 21 Land at Helipad2 { 48, 24, AMED_HELI_LOWER, {DIR_N} }, // 22 Land at Helipad3 { 0, 22, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 23 Go to position for Hangarentrance in air { 0, 22, AMED_HELI_LOWER, {DIR_N} }, // 24 Land in front of hangar { 148, -8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 25 Fly around waiting for a landing spot (south-east) { 148, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 26 Fly around waiting for a landing spot (south-west) { 132, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 27 Fly around waiting for a landing spot (south-west) { 100, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 28 Fly around waiting for a landing spot (north-east) { 84, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 29 Fly around waiting for a landing spot (south-east) { 84, -8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 30 Fly around waiting for a landing spot (south-west) { 100, -24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 31 Fly around waiting for a landing spot (north-west) { 132, -24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 32 Fly around waiting for a landing spot (north-east) }; /* Oilrig */ static const AirportMovingData _airport_moving_data_oilrig[9] = { { 31, 9, AMED_EXACTPOS, {DIR_NE} }, // 0 - At oilrig terminal { 28, 9, AMED_HELI_RAISE, {DIR_N} }, // 1 - Take off (play sound) { 23, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 2 - In position above landing spot helicopter { 23, 9, AMED_HELI_LOWER, {DIR_N} }, // 3 - Land { 28, 9, 0, {DIR_N} }, // 4 - Goto terminal on ground { -31, 69, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 5 - circle #1 (north-east) { -31, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 6 - circle #2 (north-west) { 69, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 7 - circle #3 (south-west) { 69, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 8 - circle #4 (south) }; /////////////////////////////////////////////////////////////////////// /////**********Movement Machine on Airports*********************/////// static const byte _airport_entries_dummy[] = {0, 1, 2, 3}; static const AirportFTAbuildup _airport_fta_dummy[] = { { 0, 0, 0, 3}, { 1, 0, 0, 0}, { 2, 0, 0, 1}, { 3, 0, 0, 2}, { MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE }; /* First element of terminals array tells us how many depots there are (to know size of array) * this may be changed later when airports are moved to external file */ static const TileIndexDiffC _airport_depots_country[] = {{3, 0}}; static const byte _airport_terminal_country[] = {1, 2}; static const byte _airport_entries_country[] = {16, 16, 16, 16}; static const AirportFTAbuildup _airport_fta_country[] = { { 0, HANGAR, NOTHING_block, 1 }, { 1, 255, AIRPORT_BUSY_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, TERM1, TERM1_block, 2 }, { 1, TERM2, 0, 4 }, { 1, HELITAKEOFF, 0, 19 }, { 1, 0, 0, 6 }, { 2, TERM1, TERM1_block, 1 }, { 3, TERM2, TERM2_block, 5 }, { 4, 255, AIRPORT_BUSY_block, 0 }, { 4, TERM2, 0, 5 }, { 4, HANGAR, 0, 1 }, { 4, TAKEOFF, 0, 6 }, { 4, HELITAKEOFF, 0, 1 }, { 5, 255, AIRPORT_BUSY_block, 0 }, { 5, TERM2, TERM2_block, 3 }, { 5, 0, 0, 4 }, { 6, 0, AIRPORT_BUSY_block, 7 }, /* takeoff */ { 7, TAKEOFF, AIRPORT_BUSY_block, 8 }, { 8, STARTTAKEOFF, NOTHING_block, 9 }, { 9, ENDTAKEOFF, NOTHING_block, 0 }, /* landing */ { 10, FLYING, NOTHING_block, 15 }, { 10, LANDING, 0, 11 }, { 10, HELILANDING, 0, 20 }, { 11, LANDING, AIRPORT_BUSY_block, 12 }, { 12, 0, AIRPORT_BUSY_block, 13 }, { 13, ENDLANDING, AIRPORT_BUSY_block, 14 }, { 13, TERM2, 0, 5 }, { 13, 0, 0, 14 }, { 14, 0, AIRPORT_BUSY_block, 1 }, /* In air */ { 15, 0, NOTHING_block, 16 }, { 16, 0, NOTHING_block, 17 }, { 17, 0, NOTHING_block, 18 }, { 18, 0, NOTHING_block, 10 }, { 19, HELITAKEOFF, NOTHING_block, 0 }, { 20, HELILANDING, AIRPORT_BUSY_block, 21 }, { 21, HELIENDLANDING, AIRPORT_BUSY_block, 1 }, { MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE }; static const TileIndexDiffC _airport_depots_commuter[] = { { 4, 0 } }; static const byte _airport_terminal_commuter[] = { 1, 3 }; static const byte _airport_helipad_commuter[] = { 1, 2 }; static const byte _airport_entries_commuter[] = {21, 21, 21, 21}; static const AirportFTAbuildup _airport_fta_commuter[] = { { 0, HANGAR, NOTHING_block, 1 }, { 0, HELITAKEOFF, HELIPAD2_block, 1 }, { 0, 0, 0, 1 }, { 1, 255, TAXIWAY_BUSY_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, TAKEOFF, 0, 11 }, { 1, TERM1, TAXIWAY_BUSY_block, 10 }, { 1, TERM2, TAXIWAY_BUSY_block, 10 }, { 1, TERM3, TAXIWAY_BUSY_block, 10 }, { 1, HELIPAD1, TAXIWAY_BUSY_block, 10 }, { 1, HELIPAD2, TAXIWAY_BUSY_block, 10 }, { 1, HELITAKEOFF, TAXIWAY_BUSY_block, 10 }, { 1, 0, 0, 0 }, { 2, 255, AIRPORT_ENTRANCE_block, 2 }, { 2, HANGAR, 0, 8 }, { 2, TERM1, 0, 8 }, { 2, TERM2, 0, 8 }, { 2, TERM3, 0, 8 }, { 2, HELIPAD1, 0, 8 }, { 2, HELIPAD2, 0, 8 }, { 2, HELITAKEOFF, 0, 8 }, { 2, 0, 0, 2 }, { 3, TERM1, TERM1_block, 8 }, { 3, HANGAR, 0, 8 }, { 3, TAKEOFF, 0, 8 }, { 3, 0, 0, 3 }, { 4, TERM2, TERM2_block, 9 }, { 4, HANGAR, 0, 9 }, { 4, TAKEOFF, 0, 9 }, { 4, 0, 0, 4 }, { 5, TERM3, TERM3_block, 10 }, { 5, HANGAR, 0, 10 }, { 5, TAKEOFF, 0, 10 }, { 5, 0, 0, 5 }, { 6, HELIPAD1, HELIPAD1_block, 6 }, { 6, HANGAR, TAXIWAY_BUSY_block, 9 }, { 6, HELITAKEOFF, 0, 35 }, { 7, HELIPAD2, HELIPAD2_block, 7 }, { 7, HANGAR, TAXIWAY_BUSY_block, 10 }, { 7, HELITAKEOFF, 0, 36 }, { 8, 255, TAXIWAY_BUSY_block, 8 }, { 8, TAKEOFF, TAXIWAY_BUSY_block, 9 }, { 8, HANGAR, TAXIWAY_BUSY_block, 9 }, { 8, TERM1, TERM1_block, 3 }, { 8, 0, TAXIWAY_BUSY_block, 9 }, { 9, 255, TAXIWAY_BUSY_block, 9 }, { 9, TAKEOFF, TAXIWAY_BUSY_block, 10 }, { 9, HANGAR, TAXIWAY_BUSY_block, 10 }, { 9, TERM2, TERM2_block, 4 }, { 9, HELIPAD1, HELIPAD1_block, 6 }, { 9, HELITAKEOFF, HELIPAD1_block, 6 }, { 9, TERM1, TAXIWAY_BUSY_block, 8 }, { 9, 0, TAXIWAY_BUSY_block, 10 }, { 10, 255, TAXIWAY_BUSY_block, 10 }, { 10, TERM3, TERM3_block, 5 }, { 10, HELIPAD1, 0, 9 }, { 10, HELIPAD2, HELIPAD2_block, 7 }, { 10, HELITAKEOFF, HELIPAD2_block, 7 }, { 10, TAKEOFF, TAXIWAY_BUSY_block, 1 }, { 10, HANGAR, TAXIWAY_BUSY_block, 1 }, { 10, 0, TAXIWAY_BUSY_block, 9 }, { 11, 0, OUT_WAY_block, 12 }, /* takeoff */ { 12, TAKEOFF, RUNWAY_IN_OUT_block, 13 }, { 13, 0, RUNWAY_IN_OUT_block, 14 }, { 14, STARTTAKEOFF, RUNWAY_IN_OUT_block, 15 }, { 15, ENDTAKEOFF, NOTHING_block, 0 }, /* landing */ { 16, FLYING, NOTHING_block, 21 }, { 16, LANDING, IN_WAY_block, 17 }, { 16, HELILANDING, 0, 25 }, { 17, LANDING, RUNWAY_IN_OUT_block, 18 }, { 18, 0, RUNWAY_IN_OUT_block, 19 }, { 19, 0, RUNWAY_IN_OUT_block, 20 }, { 20, ENDLANDING, IN_WAY_block, 2 }, /* In Air */ { 21, 0, NOTHING_block, 22 }, { 22, 0, NOTHING_block, 23 }, { 23, 0, NOTHING_block, 24 }, { 24, 0, NOTHING_block, 16 }, /* Helicopter -- stay in air in special place as a buffer to choose from helipads */ { 25, HELILANDING, PRE_HELIPAD_block, 26 }, { 26, HELIENDLANDING, PRE_HELIPAD_block, 26 }, { 26, HELIPAD1, 0, 27 }, { 26, HELIPAD2, 0, 28 }, { 26, HANGAR, 0, 33 }, { 27, 0, NOTHING_block, 29 }, // helipad1 approach { 28, 0, NOTHING_block, 30 }, /* landing */ { 29, 255, NOTHING_block, 0 }, { 29, HELIPAD1, HELIPAD1_block, 6 }, { 30, 255, NOTHING_block, 0 }, { 30, HELIPAD2, HELIPAD2_block, 7 }, /* Helicopter -- takeoff */ { 31, HELITAKEOFF, NOTHING_block, 0 }, { 32, HELITAKEOFF, NOTHING_block, 0 }, { 33, 0, TAXIWAY_BUSY_block, 34 }, // need to go to hangar when waiting in air { 34, 0, TAXIWAY_BUSY_block, 1 }, { 35, 0, HELIPAD1_block, 31 }, { 36, 0, HELIPAD2_block, 32 }, { MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE }; static const TileIndexDiffC _airport_depots_city[] = { { 5, 0 } }; static const byte _airport_terminal_city[] = { 1, 3 }; static const byte _airport_entries_city[] = {26, 29, 27, 28}; static const AirportFTAbuildup _airport_fta_city[] = { { 0, HANGAR, NOTHING_block, 1 }, { 0, TAKEOFF, OUT_WAY_block, 1 }, { 0, 0, 0, 1 }, { 1, 255, TAXIWAY_BUSY_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, TERM2, 0, 6 }, { 1, TERM3, 0, 6 }, { 1, 0, 0, 7 }, // for all else, go to 7 { 2, TERM1, TERM1_block, 7 }, { 2, TAKEOFF, OUT_WAY_block, 7 }, { 2, 0, 0, 7 }, { 3, TERM2, TERM2_block, 5 }, { 3, TAKEOFF, OUT_WAY_block, 5 }, { 3, 0, 0, 5 }, { 4, TERM3, TERM3_block, 5 }, { 4, TAKEOFF, OUT_WAY_block, 5 }, { 4, 0, 0, 5 }, { 5, 255, TAXIWAY_BUSY_block, 0 }, { 5, TERM2, TERM2_block, 3 }, { 5, TERM3, TERM3_block, 4 }, { 5, 0, 0, 6 }, { 6, 255, TAXIWAY_BUSY_block, 0 }, { 6, TERM2, 0, 5 }, { 6, TERM3, 0, 5 }, { 6, HANGAR, 0, 1 }, { 6, 0, 0, 7 }, { 7, 255, TAXIWAY_BUSY_block, 0 }, { 7, TERM1, TERM1_block, 2 }, { 7, TAKEOFF, OUT_WAY_block, 8 }, { 7, HELITAKEOFF, 0, 22 }, { 7, HANGAR, 0, 1 }, { 7, 0, 0, 6 }, { 8, 0, OUT_WAY_block, 9 }, { 9, 0, RUNWAY_IN_OUT_block, 10 }, /* takeoff */ { 10, TAKEOFF, RUNWAY_IN_OUT_block, 11 }, { 11, STARTTAKEOFF, NOTHING_block, 12 }, { 12, ENDTAKEOFF, NOTHING_block, 0 }, /* landing */ { 13, FLYING, NOTHING_block, 18 }, { 13, LANDING, 0, 14 }, { 13, HELILANDING, 0, 23 }, { 14, LANDING, RUNWAY_IN_OUT_block, 15 }, { 15, 0, RUNWAY_IN_OUT_block, 17 }, { 16, 0, RUNWAY_IN_OUT_block, 17 }, // not used, left for compatibility { 17, ENDLANDING, IN_WAY_block, 7 }, /* In Air */ { 18, 0, NOTHING_block, 25 }, { 19, 0, NOTHING_block, 20 }, { 20, 0, NOTHING_block, 21 }, { 21, 0, NOTHING_block, 13 }, /* helicopter */ { 22, HELITAKEOFF, NOTHING_block, 0 }, { 23, HELILANDING, IN_WAY_block, 24 }, { 24, HELIENDLANDING, IN_WAY_block, 17 }, { 25, 0, NOTHING_block, 20}, { 26, 0, NOTHING_block, 19}, { 27, 0, NOTHING_block, 28}, { 28, 0, NOTHING_block, 19}, { 29, 0, NOTHING_block, 26}, { MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE }; static const TileIndexDiffC _airport_depots_metropolitan[] = { { 5, 0 } }; static const byte _airport_terminal_metropolitan[] = { 1, 3 }; static const byte _airport_entries_metropolitan[] = {20, 20, 20, 20}; static const AirportFTAbuildup _airport_fta_metropolitan[] = { { 0, HANGAR, NOTHING_block, 1 }, { 1, 255, TAXIWAY_BUSY_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, TERM2, 0, 6 }, { 1, TERM3, 0, 6 }, { 1, 0, 0, 7 }, // for all else, go to 7 { 2, TERM1, TERM1_block, 7 }, { 3, TERM2, TERM2_block, 5 }, { 4, TERM3, TERM3_block, 5 }, { 5, 255, TAXIWAY_BUSY_block, 0 }, { 5, TERM2, TERM2_block, 3 }, { 5, TERM3, TERM3_block, 4 }, { 5, 0, 0, 6 }, { 6, 255, TAXIWAY_BUSY_block, 0 }, { 6, TERM2, 0, 5 }, { 6, TERM3, 0, 5 }, { 6, HANGAR, 0, 1 }, { 6, 0, 0, 7 }, { 7, 255, TAXIWAY_BUSY_block, 0 }, { 7, TERM1, TERM1_block, 2 }, { 7, TAKEOFF, 0, 8 }, { 7, HELITAKEOFF, 0, 23 }, { 7, HANGAR, 0, 1 }, { 7, 0, 0, 6 }, { 8, 0, OUT_WAY_block, 9 }, { 9, 0, RUNWAY_OUT_block, 10 }, /* takeoff */ { 10, TAKEOFF, RUNWAY_OUT_block, 11 }, { 11, STARTTAKEOFF, NOTHING_block, 12 }, { 12, ENDTAKEOFF, NOTHING_block, 0 }, /* landing */ { 13, FLYING, NOTHING_block, 19 }, { 13, LANDING, 0, 14 }, { 13, HELILANDING, 0, 25 }, { 14, LANDING, RUNWAY_IN_block, 15 }, { 15, 0, RUNWAY_IN_block, 16 }, { 16, 255, RUNWAY_IN_block, 0 }, { 16, ENDLANDING, IN_WAY_block, 17 }, { 17, 255, RUNWAY_OUT_block, 0 }, { 17, ENDLANDING, IN_WAY_block, 18 }, { 18, ENDLANDING, IN_WAY_block, 7 }, /* In Air */ { 19, 0, NOTHING_block, 20 }, { 20, 0, NOTHING_block, 21 }, { 21, 0, NOTHING_block, 22 }, { 22, 0, NOTHING_block, 13 }, /* helicopter */ { 23, 0, NOTHING_block, 24 }, { 24, HELITAKEOFF, NOTHING_block, 0 }, { 25, HELILANDING, IN_WAY_block, 26 }, { 26, HELIENDLANDING, IN_WAY_block, 18 }, { MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE }; static const TileIndexDiffC _airport_depots_international[] = { { 0, 3 }, { 6, 1 } }; static const byte _airport_terminal_international[] = { 2, 3, 3 }; static const byte _airport_helipad_international[] = { 1, 2 }; static const byte _airport_entries_international[] = { 37, 37, 37, 37 }; static const AirportFTAbuildup _airport_fta_international[] = { { 0, HANGAR, NOTHING_block, 2 }, { 0, 255, TERM_GROUP1_block, 0 }, { 0, 255, TERM_GROUP2_ENTER1_block, 1 }, { 0, HELITAKEOFF, HELIPAD1_block, 2 }, { 0, 0, 0, 2 }, { 1, HANGAR, NOTHING_block, 3 }, { 1, 255, HANGAR2_AREA_block, 1 }, { 1, HELITAKEOFF, HELIPAD2_block, 3 }, { 1, 0, 0, 3 }, { 2, 255, AIRPORT_ENTRANCE_block, 0 }, { 2, HANGAR, 0, 0 }, { 2, TERM4, 0, 12 }, { 2, TERM5, 0, 12 }, { 2, TERM6, 0, 12 }, { 2, HELIPAD1, 0, 12 }, { 2, HELIPAD2, 0, 12 }, { 2, HELITAKEOFF, 0, 12 }, { 2, 0, 0, 23 }, { 3, 255, HANGAR2_AREA_block, 0 }, { 3, HANGAR, 0, 1 }, { 3, 0, 0, 18 }, { 4, TERM1, TERM1_block, 23 }, { 4, HANGAR, AIRPORT_ENTRANCE_block, 23 }, { 4, 0, 0, 23 }, { 5, TERM2, TERM2_block, 24 }, { 5, HANGAR, AIRPORT_ENTRANCE_block, 24 }, { 5, 0, 0, 24 }, { 6, TERM3, TERM3_block, 25 }, { 6, HANGAR, AIRPORT_ENTRANCE_block, 25 }, { 6, 0, 0, 25 }, { 7, TERM4, TERM4_block, 16 }, { 7, HANGAR, HANGAR2_AREA_block, 16 }, { 7, 0, 0, 16 }, { 8, TERM5, TERM5_block, 17 }, { 8, HANGAR, HANGAR2_AREA_block, 17 }, { 8, 0, 0, 17 }, { 9, TERM6, TERM6_block, 18 }, { 9, HANGAR, HANGAR2_AREA_block, 18 }, { 9, 0, 0, 18 }, { 10, HELIPAD1, HELIPAD1_block, 10 }, { 10, HANGAR, HANGAR2_AREA_block, 16 }, { 10, HELITAKEOFF, 0, 47 }, { 11, HELIPAD2, HELIPAD2_block, 11 }, { 11, HANGAR, HANGAR2_AREA_block, 17 }, { 11, HELITAKEOFF, 0, 48 }, { 12, 0, TERM_GROUP2_ENTER1_block, 13 }, { 13, 0, TERM_GROUP2_ENTER1_block, 14 }, { 14, 0, TERM_GROUP2_ENTER2_block, 15 }, { 15, 0, TERM_GROUP2_ENTER2_block, 16 }, { 16, 255, TERM_GROUP2_block, 0 }, { 16, TERM4, TERM4_block, 7 }, { 16, HELIPAD1, HELIPAD1_block, 10 }, { 16, HELITAKEOFF, HELIPAD1_block, 10 }, { 16, 0, 0, 17 }, { 17, 255, TERM_GROUP2_block, 0 }, { 17, TERM5, TERM5_block, 8 }, { 17, TERM4, 0, 16 }, { 17, HELIPAD1, 0, 16 }, { 17, HELIPAD2, HELIPAD2_block, 11 }, { 17, HELITAKEOFF, HELIPAD2_block, 11 }, { 17, 0, 0, 18 }, { 18, 255, TERM_GROUP2_block, 0 }, { 18, TERM6, TERM6_block, 9 }, { 18, TAKEOFF, 0, 19 }, { 18, HANGAR, HANGAR2_AREA_block, 3 }, { 18, 0, 0, 17 }, { 19, 0, TERM_GROUP2_EXIT1_block, 20 }, { 20, 0, TERM_GROUP2_EXIT1_block, 21 }, { 21, 0, TERM_GROUP2_EXIT2_block, 22 }, { 22, 0, TERM_GROUP2_EXIT2_block, 26 }, { 23, 255, TERM_GROUP1_block, 0 }, { 23, TERM1, TERM1_block, 4 }, { 23, HANGAR, AIRPORT_ENTRANCE_block, 2 }, { 23, 0, 0, 24 }, { 24, 255, TERM_GROUP1_block, 0 }, { 24, TERM2, TERM2_block, 5 }, { 24, TERM1, 0, 23 }, { 24, HANGAR, 0, 23 }, { 24, 0, 0, 25 }, { 25, 255, TERM_GROUP1_block, 0 }, { 25, TERM3, TERM3_block, 6 }, { 25, TAKEOFF, 0, 26 }, { 25, 0, 0, 24 }, { 26, 255, TAXIWAY_BUSY_block, 0 }, { 26, TAKEOFF, 0, 27 }, { 26, 0, 0, 25 }, { 27, 0, OUT_WAY_block, 28 }, /* takeoff */ { 28, TAKEOFF, OUT_WAY_block, 29 }, { 29, 0, RUNWAY_OUT_block, 30 }, { 30, STARTTAKEOFF, NOTHING_block, 31 }, { 31, ENDTAKEOFF, NOTHING_block, 0 }, /* landing */ { 32, FLYING, NOTHING_block, 37 }, { 32, LANDING, 0, 33 }, { 32, HELILANDING, 0, 41 }, { 33, LANDING, RUNWAY_IN_block, 34 }, { 34, 0, RUNWAY_IN_block, 35 }, { 35, 0, RUNWAY_IN_block, 36 }, { 36, ENDLANDING, IN_WAY_block, 36 }, { 36, 255, TERM_GROUP1_block, 0 }, { 36, 255, TERM_GROUP2_ENTER1_block, 1 }, { 36, TERM4, 0, 12 }, { 36, TERM5, 0, 12 }, { 36, TERM6, 0, 12 }, { 36, 0, 0, 2 }, /* In Air */ { 37, 0, NOTHING_block, 38 }, { 38, 0, NOTHING_block, 39 }, { 39, 0, NOTHING_block, 40 }, { 40, 0, NOTHING_block, 32 }, /* Helicopter -- stay in air in special place as a buffer to choose from helipads */ { 41, HELILANDING, PRE_HELIPAD_block, 42 }, { 42, HELIENDLANDING, PRE_HELIPAD_block, 42 }, { 42, HELIPAD1, 0, 43 }, { 42, HELIPAD2, 0, 44 }, { 42, HANGAR, 0, 49 }, { 43, 0, NOTHING_block, 45 }, { 44, 0, NOTHING_block, 46 }, /* landing */ { 45, 255, NOTHING_block, 0 }, { 45, HELIPAD1, HELIPAD1_block, 10 }, { 46, 255, NOTHING_block, 0 }, { 46, HELIPAD2, HELIPAD2_block, 11 }, /* Helicopter -- takeoff */ { 47, HELITAKEOFF, NOTHING_block, 0 }, { 48, HELITAKEOFF, NOTHING_block, 0 }, { 49, 0, HANGAR2_AREA_block, 50 }, // need to go to hangar when waiting in air { 50, 0, HANGAR2_AREA_block, 3 }, { MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE }; /* intercontinental */ static const TileIndexDiffC _airport_depots_intercontinental[] = { { 0, 5 }, { 8, 4 } }; static const byte _airport_terminal_intercontinental[] = { 2, 4, 4 }; static const byte _airport_helipad_intercontinental[] = { 1, 2 }; static const byte _airport_entries_intercontinental[] = { 43, 43, 43, 43 }; static const AirportFTAbuildup _airport_fta_intercontinental[] = { { 0, HANGAR, NOTHING_block, 2 }, { 0, 255, HANGAR1_AREA_block | TERM_GROUP1_block, 0 }, { 0, 255, HANGAR1_AREA_block | TERM_GROUP1_block, 1 }, { 0, TAKEOFF, HANGAR1_AREA_block | TERM_GROUP1_block, 2 }, { 0, 0, 0, 2 }, { 1, HANGAR, NOTHING_block, 3 }, { 1, 255, HANGAR2_AREA_block, 1 }, { 1, 255, HANGAR2_AREA_block, 0 }, { 1, 0, 0, 3 }, { 2, 255, HANGAR1_AREA_block, 0 }, { 2, 255, TERM_GROUP1_block, 0 }, { 2, 255, TERM_GROUP1_block, 1 }, { 2, HANGAR, 0, 0 }, { 2, TAKEOFF, TERM_GROUP1_block, 27 }, { 2, TERM5, 0, 26 }, { 2, TERM6, 0, 26 }, { 2, TERM7, 0, 26 }, { 2, TERM8, 0, 26 }, { 2, HELIPAD1, 0, 26 }, { 2, HELIPAD2, 0, 26 }, { 2, HELITAKEOFF, 0, 74 }, { 2, 0, 0, 27 }, { 3, 255, HANGAR2_AREA_block, 0 }, { 3, HANGAR, 0, 1 }, { 3, HELITAKEOFF, 0, 75 }, { 3, 0, 0, 20 }, { 4, TERM1, TERM1_block, 26 }, { 4, HANGAR, HANGAR1_AREA_block | TERM_GROUP1_block, 26 }, { 4, 0, 0, 26 }, { 5, TERM2, TERM2_block, 27 }, { 5, HANGAR, HANGAR1_AREA_block | TERM_GROUP1_block, 27 }, { 5, 0, 0, 27 }, { 6, TERM3, TERM3_block, 28 }, { 6, HANGAR, HANGAR1_AREA_block | TERM_GROUP1_block, 28 }, { 6, 0, 0, 28 }, { 7, TERM4, TERM4_block, 29 }, { 7, HANGAR, HANGAR1_AREA_block | TERM_GROUP1_block, 29 }, { 7, 0, 0, 29 }, { 8, TERM5, TERM5_block, 18 }, { 8, HANGAR, HANGAR2_AREA_block, 18 }, { 8, 0, 0, 18 }, { 9, TERM6, TERM6_block, 19 }, { 9, HANGAR, HANGAR2_AREA_block, 19 }, { 9, 0, 0, 19 }, { 10, TERM7, TERM7_block, 20 }, { 10, HANGAR, HANGAR2_AREA_block, 20 }, { 10, 0, 0, 20 }, { 11, TERM8, TERM8_block, 21 }, { 11, HANGAR, HANGAR2_AREA_block, 21 }, { 11, 0, 0, 21 }, { 12, HELIPAD1, HELIPAD1_block, 12 }, { 12, HANGAR, 0, 70 }, { 12, HELITAKEOFF, 0, 72 }, { 13, HELIPAD2, HELIPAD2_block, 13 }, { 13, HANGAR, 0, 71 }, { 13, HELITAKEOFF, 0, 73 }, { 14, 0, TERM_GROUP2_ENTER1_block, 15 }, { 15, 0, TERM_GROUP2_ENTER1_block, 16 }, { 16, 0, TERM_GROUP2_ENTER2_block, 17 }, { 17, 0, TERM_GROUP2_ENTER2_block, 18 }, { 18, 255, TERM_GROUP2_block, 0 }, { 18, TERM5, TERM5_block, 8 }, { 18, TAKEOFF, 0, 19 }, { 18, HELITAKEOFF, HELIPAD1_block, 19 }, { 18, 0, TERM_GROUP2_EXIT1_block, 19 }, { 19, 255, TERM_GROUP2_block, 0 }, { 19, TERM6, TERM6_block, 9 }, { 19, TERM5, 0, 18 }, { 19, TAKEOFF, 0, 57 }, { 19, HELITAKEOFF, HELIPAD1_block, 20 }, { 19, 0, TERM_GROUP2_EXIT1_block, 20 }, // add exit to runway out 2 { 20, 255, TERM_GROUP2_block, 0 }, { 20, TERM7, TERM7_block, 10 }, { 20, TERM5, 0, 19 }, { 20, TERM6, 0, 19 }, { 20, HANGAR, HANGAR2_AREA_block, 3 }, { 20, TAKEOFF, 0, 19 }, { 20, 0, TERM_GROUP2_EXIT1_block, 21 }, { 21, 255, TERM_GROUP2_block, 0 }, { 21, TERM8, TERM8_block, 11 }, { 21, HANGAR, HANGAR2_AREA_block, 20 }, { 21, TERM5, 0, 20 }, { 21, TERM6, 0, 20 }, { 21, TERM7, 0, 20 }, { 21, TAKEOFF, 0, 20 }, { 21, 0, TERM_GROUP2_EXIT1_block, 22 }, { 22, 255, TERM_GROUP2_block, 0 }, { 22, HANGAR, 0, 21 }, { 22, TERM5, 0, 21 }, { 22, TERM6, 0, 21 }, { 22, TERM7, 0, 21 }, { 22, TERM8, 0, 21 }, { 22, TAKEOFF, 0, 21 }, { 22, 0, 0, 23 }, { 23, 0, TERM_GROUP2_EXIT1_block, 70 }, { 24, 0, TERM_GROUP2_EXIT2_block, 25 }, { 25, 255, TERM_GROUP2_EXIT2_block, 0 }, { 25, HANGAR, HANGAR1_AREA_block | TERM_GROUP1_block, 29 }, { 25, 0, 0, 29 }, { 26, 255, TERM_GROUP1_block, 0 }, { 26, TERM1, TERM1_block, 4 }, { 26, HANGAR, HANGAR1_AREA_block, 27 }, { 26, TERM5, TERM_GROUP2_ENTER1_block, 14 }, { 26, TERM6, TERM_GROUP2_ENTER1_block, 14 }, { 26, TERM7, TERM_GROUP2_ENTER1_block, 14 }, { 26, TERM8, TERM_GROUP2_ENTER1_block, 14 }, { 26, HELIPAD1, TERM_GROUP2_ENTER1_block, 14 }, { 26, HELIPAD2, TERM_GROUP2_ENTER1_block, 14 }, { 26, HELITAKEOFF, TERM_GROUP2_ENTER1_block, 14 }, { 26, 0, 0, 27 }, { 27, 255, TERM_GROUP1_block, 0 }, { 27, TERM2, TERM2_block, 5 }, { 27, HANGAR, HANGAR1_AREA_block, 2 }, { 27, TERM1, 0, 26 }, { 27, TERM5, 0, 26 }, { 27, TERM6, 0, 26 }, { 27, TERM7, 0, 26 }, { 27, TERM8, 0, 26 }, { 27, HELIPAD1, 0, 14 }, { 27, HELIPAD2, 0, 14 }, { 27, 0, 0, 28 }, { 28, 255, TERM_GROUP1_block, 0 }, { 28, TERM3, TERM3_block, 6 }, { 28, HANGAR, HANGAR1_AREA_block, 27 }, { 28, TERM1, 0, 27 }, { 28, TERM2, 0, 27 }, { 28, TERM4, 0, 29 }, { 28, TERM5, 0, 14 }, { 28, TERM6, 0, 14 }, { 28, TERM7, 0, 14 }, { 28, TERM8, 0, 14 }, { 28, HELIPAD1, 0, 14 }, { 28, HELIPAD2, 0, 14 }, { 28, 0, 0, 29 }, { 29, 255, TERM_GROUP1_block, 0 }, { 29, TERM4, TERM4_block, 7 }, { 29, HANGAR, HANGAR1_AREA_block, 27 }, { 29, TAKEOFF, 0, 30 }, { 29, 0, 0, 28 }, { 30, 0, OUT_WAY_block2, 31 }, { 31, 0, OUT_WAY_block, 32 }, /* takeoff */ { 32, TAKEOFF, RUNWAY_OUT_block, 33 }, { 33, 0, RUNWAY_OUT_block, 34 }, { 34, STARTTAKEOFF, NOTHING_block, 35 }, { 35, ENDTAKEOFF, NOTHING_block, 0 }, /* landing */ { 36, 0, 0, 0 }, { 37, LANDING, RUNWAY_IN_block, 38 }, { 38, 0, RUNWAY_IN_block, 39 }, { 39, 0, RUNWAY_IN_block, 40 }, { 40, ENDLANDING, RUNWAY_IN_block, 41 }, { 41, 0, IN_WAY_block, 42 }, { 42, 255, IN_WAY_block, 0 }, { 42, 255, TERM_GROUP1_block, 0 }, { 42, 255, TERM_GROUP1_block, 1 }, { 42, HANGAR, 0, 2 }, { 42, 0, 0, 26 }, /* In Air */ { 43, 0, 0, 44 }, { 44, FLYING, 0, 45 }, { 44, HELILANDING, 0, 47 }, { 44, LANDING, 0, 69 }, { 44, 0, 0, 45 }, { 45, 0, 0, 46 }, { 46, FLYING, 0, 43 }, { 46, LANDING, 0, 76 }, { 46, 0, 0, 43 }, /* Helicopter -- stay in air in special place as a buffer to choose from helipads */ { 47, HELILANDING, PRE_HELIPAD_block, 48 }, { 48, HELIENDLANDING, PRE_HELIPAD_block, 48 }, { 48, HELIPAD1, 0, 49 }, { 48, HELIPAD2, 0, 50 }, { 48, HANGAR, 0, 55 }, { 49, 0, NOTHING_block, 51 }, { 50, 0, NOTHING_block, 52 }, /* landing */ { 51, 255, NOTHING_block, 0 }, { 51, HELIPAD1, HELIPAD1_block, 12 }, { 51, HANGAR, 0, 55 }, { 51, 0, 0, 12 }, { 52, 255, NOTHING_block, 0 }, { 52, HELIPAD2, HELIPAD2_block, 13 }, { 52, HANGAR, 0, 55 }, { 52, 0, 0, 13 }, /* Helicopter -- takeoff */ { 53, HELITAKEOFF, NOTHING_block, 0 }, { 54, HELITAKEOFF, NOTHING_block, 0 }, { 55, 0, HANGAR2_AREA_block, 56 }, // need to go to hangar when waiting in air { 56, 0, HANGAR2_AREA_block, 3 }, /* runway 2 out support */ { 57, 255, OUT_WAY2_block, 0 }, { 57, TAKEOFF, 0, 58 }, { 57, 0, 0, 58 }, { 58, 0, OUT_WAY2_block, 59 }, { 59, TAKEOFF, RUNWAY_OUT2_block, 60 }, // takeoff { 60, 0, RUNWAY_OUT2_block, 61 }, { 61, STARTTAKEOFF, NOTHING_block, 62 }, { 62, ENDTAKEOFF, NOTHING_block, 0 }, /* runway 2 in support */ { 63, LANDING, RUNWAY_IN2_block, 64 }, { 64, 0, RUNWAY_IN2_block, 65 }, { 65, 0, RUNWAY_IN2_block, 66 }, { 66, ENDLANDING, RUNWAY_IN2_block, 0 }, { 66, 255, 0, 1 }, { 66, 255, 0, 0 }, { 66, 0, 0, 67 }, { 67, 0, IN_WAY2_block, 68 }, { 68, 255, IN_WAY2_block, 0 }, { 68, 255, TERM_GROUP2_block, 1 }, { 68, 255, TERM_GROUP1_block, 0 }, { 68, HANGAR, HANGAR2_AREA_block, 22 }, { 68, 0, 0, 22 }, { 69, 255, RUNWAY_IN2_block, 0 }, { 69, 0, RUNWAY_IN2_block, 63 }, { 70, 255, TERM_GROUP2_EXIT1_block, 0 }, { 70, HELIPAD1, HELIPAD1_block, 12 }, { 70, HELITAKEOFF, HELIPAD1_block, 12 }, { 70, 0, 0, 71 }, { 71, 255, TERM_GROUP2_EXIT1_block, 0 }, { 71, HELIPAD2, HELIPAD2_block, 13 }, { 71, HELITAKEOFF, HELIPAD1_block, 12 }, { 71, 0, 0, 24 }, { 72, 0, HELIPAD1_block, 53 }, { 73, 0, HELIPAD2_block, 54 }, { 74, HELITAKEOFF, NOTHING_block, 0 }, { 75, HELITAKEOFF, NOTHING_block, 0 }, { 76, 255, RUNWAY_IN_block, 0 }, { 76, 0, RUNWAY_IN_block, 37 }, { MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE }; /* heliports, oilrigs don't have depots */ static const byte _airport_helipad_heliport_oilrig[] = { 1, 1 }; static const byte _airport_entries_heliport_oilrig[] = { 7, 7, 7, 7 }; static const AirportFTAbuildup _airport_fta_heliport_oilrig[] = { { 0, HELIPAD1, HELIPAD1_block, 1 }, { 1, HELITAKEOFF, NOTHING_block, 0 }, // takeoff { 2, 255, AIRPORT_BUSY_block, 0 }, { 2, HELILANDING, 0, 3 }, { 2, HELITAKEOFF, 0, 1 }, { 3, HELILANDING, AIRPORT_BUSY_block, 4 }, { 4, HELIENDLANDING, AIRPORT_BUSY_block, 4 }, { 4, HELIPAD1, HELIPAD1_block, 0 }, { 4, HELITAKEOFF, 0, 2 }, /* In Air */ { 5, 0, NOTHING_block, 6 }, { 6, 0, NOTHING_block, 7 }, { 7, 0, NOTHING_block, 8 }, { 8, FLYING, NOTHING_block, 5 }, { 8, HELILANDING, HELIPAD1_block, 2 }, // landing { MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE }; /* helidepots */ static const TileIndexDiffC _airport_depots_helidepot[] = { { 1, 0 } }; static const byte _airport_helipad_helidepot[] = { 1, 1 }; static const byte _airport_entries_helidepot[] = { 4, 4, 4, 4 }; static const AirportFTAbuildup _airport_fta_helidepot[] = { { 0, HANGAR, NOTHING_block, 1 }, { 1, 255, HANGAR2_AREA_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, HELIPAD1, HELIPAD1_block, 14 }, { 1, HELITAKEOFF, 0, 15 }, { 1, 0, 0, 0 }, { 2, FLYING, NOTHING_block, 3 }, { 2, HELILANDING, PRE_HELIPAD_block, 7 }, { 2, HANGAR, 0, 12 }, { 2, HELITAKEOFF, NOTHING_block, 16 }, /* In Air */ { 3, 0, NOTHING_block, 4 }, { 4, 0, NOTHING_block, 5 }, { 5, 0, NOTHING_block, 6 }, { 6, 0, NOTHING_block, 2 }, /* Helicopter -- stay in air in special place as a buffer to choose from helipads */ { 7, HELILANDING, PRE_HELIPAD_block, 8 }, { 8, HELIENDLANDING, PRE_HELIPAD_block, 8 }, { 8, HELIPAD1, 0, 9 }, { 8, HANGAR, 0, 12 }, { 8, 0, 0, 2 }, { 9, 0, NOTHING_block, 10 }, /* landing */ { 10, 255, NOTHING_block, 10 }, { 10, HELIPAD1, HELIPAD1_block, 14 }, { 10, HANGAR, 0, 1 }, { 10, 0, 0, 14 }, /* Helicopter -- takeoff */ { 11, HELITAKEOFF, NOTHING_block, 0 }, { 12, 0, HANGAR2_AREA_block, 13 }, // need to go to hangar when waiting in air { 13, 0, HANGAR2_AREA_block, 1 }, { 14, HELIPAD1, HELIPAD1_block, 14 }, { 14, HANGAR, 0, 1 }, { 14, HELITAKEOFF, 0, 17 }, { 15, HELITAKEOFF, NOTHING_block, 0 }, // takeoff outside depot { 16, HELITAKEOFF, 0, 14 }, { 17, 0, NOTHING_block, 11 }, { MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE }; /* helistation */ static const TileIndexDiffC _airport_depots_helistation[] = { { 0, 0 } }; static const byte _airport_helipad_helistation[] = { 1, 3 }; static const byte _airport_entries_helistation[] = { 25, 25, 25, 25 }; static const AirportFTAbuildup _airport_fta_helistation[] = { { 0, HANGAR, NOTHING_block, 8 }, { 0, HELIPAD1, 0, 1 }, { 0, HELIPAD2, 0, 1 }, { 0, HELIPAD3, 0, 1 }, { 0, HELITAKEOFF, 0, 1 }, { 0, 0, 0, 0 }, { 1, 255, HANGAR2_AREA_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, HELITAKEOFF, 0, 3 }, { 1, 0, 0, 4 }, /* landing */ { 2, FLYING, NOTHING_block, 28 }, { 2, HELILANDING, 0, 15 }, { 2, 0, 0, 28 }, /* helicopter side */ { 3, HELITAKEOFF, NOTHING_block, 0 }, // helitakeoff outside hangar2 { 4, 255, TAXIWAY_BUSY_block, 0 }, { 4, HANGAR, HANGAR2_AREA_block, 1 }, { 4, HELITAKEOFF, 0, 1 }, { 4, 0, 0, 5 }, { 5, 255, TAXIWAY_BUSY_block, 0 }, { 5, HELIPAD1, HELIPAD1_block, 6 }, { 5, HELIPAD2, HELIPAD2_block, 7 }, { 5, HELIPAD3, HELIPAD3_block, 8 }, { 5, 0, 0, 4 }, { 6, HELIPAD1, HELIPAD1_block, 5 }, { 6, HANGAR, HANGAR2_AREA_block, 5 }, { 6, HELITAKEOFF, 0, 9 }, { 6, 0, 0, 6 }, { 7, HELIPAD2, HELIPAD2_block, 5 }, { 7, HANGAR, HANGAR2_AREA_block, 5 }, { 7, HELITAKEOFF, 0, 10 }, { 7, 0, 0, 7 }, { 8, HELIPAD3, HELIPAD3_block, 5 }, { 8, HANGAR, HANGAR2_AREA_block, 5 }, { 8, HELITAKEOFF, 0, 11 }, { 8, 0, 0, 8 }, { 9, 0, HELIPAD1_block, 12 }, { 10, 0, HELIPAD2_block, 13 }, { 11, 0, HELIPAD3_block, 14 }, { 12, HELITAKEOFF, NOTHING_block, 0 }, { 13, HELITAKEOFF, NOTHING_block, 0 }, { 14, HELITAKEOFF, NOTHING_block, 0 }, /* heli - in flight moves */ { 15, HELILANDING, PRE_HELIPAD_block, 16 }, { 16, HELIENDLANDING, PRE_HELIPAD_block, 16 }, { 16, HELIPAD1, 0, 17 }, { 16, HELIPAD2, 0, 18 }, { 16, HELIPAD3, 0, 19 }, { 16, HANGAR, 0, 23 }, { 17, 0, NOTHING_block, 20 }, { 18, 0, NOTHING_block, 21 }, { 19, 0, NOTHING_block, 22 }, /* heli landing */ { 20, 255, NOTHING_block, 0 }, { 20, HELIPAD1, HELIPAD1_block, 6 }, { 20, HANGAR, 0, 23 }, { 20, 0, 0, 6 }, { 21, 255, NOTHING_block, 0 }, { 21, HELIPAD2, HELIPAD2_block, 7 }, { 21, HANGAR, 0, 23 }, { 21, 0, 0, 7 }, { 22, 255, NOTHING_block, 0 }, { 22, HELIPAD3, HELIPAD3_block, 8 }, { 22, HANGAR, 0, 23 }, { 22, 0, 0, 8 }, { 23, 0, HANGAR2_AREA_block, 24 }, // need to go to helihangar when waiting in air { 24, 0, HANGAR2_AREA_block, 1 }, { 25, 0, NOTHING_block, 26 }, { 26, 0, NOTHING_block, 27 }, { 27, 0, NOTHING_block, 2 }, { 28, 0, NOTHING_block, 29 }, { 29, 0, NOTHING_block, 30 }, { 30, 0, NOTHING_block, 31 }, { 31, 0, NOTHING_block, 32 }, { 32, 0, NOTHING_block, 25 }, { MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE }; #endif /* AIRPORT_MOVEMENT_H */
57,779
C++
.h
783
71.881226
451
0.546755
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,372
engine_gui.h
EnergeticBark_OpenTTD-3DS/src/engine_gui.h
/* $Id$ */ /** @file engine_gui.h Engine GUI functions, used by build_vehicle_gui and autoreplace_gui */ #ifndef ENGINE_GUI_H #define ENGINE_GUI_H #include "sortlist_type.h" typedef GUIList<EngineID> GUIEngineList; typedef int CDECL EngList_SortTypeFunction(const void*, const void*); ///< argument type for EngList_Sort() void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare); ///< qsort of the engine list void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items); ///< qsort of specified portion of the engine list #endif /* ENGINE_GUI_H */
616
C++
.h
10
60
157
0.77
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,373
signal_func.h
EnergeticBark_OpenTTD-3DS/src/signal_func.h
/* $Id$ */ /** @file signal_func.h Functions related to signals. */ #ifndef SIGNAL_FUNC_H #define SIGNAL_FUNC_H #include "track_type.h" #include "tile_type.h" #include "direction_type.h" #include "company_type.h" /** * Maps a trackdir to the bit that stores its status in the map arrays, in the * direction along with the trackdir. */ static inline byte SignalAlongTrackdir(Trackdir trackdir) { extern const byte _signal_along_trackdir[TRACKDIR_END]; return _signal_along_trackdir[trackdir]; } /** * Maps a trackdir to the bit that stores its status in the map arrays, in the * direction against the trackdir. */ static inline byte SignalAgainstTrackdir(Trackdir trackdir) { extern const byte _signal_against_trackdir[TRACKDIR_END]; return _signal_against_trackdir[trackdir]; } /** * Maps a Track to the bits that store the status of the two signals that can * be present on the given track. */ static inline byte SignalOnTrack(Track track) { extern const byte _signal_on_track[TRACK_END]; return _signal_on_track[track]; } /** State of the signal segment */ enum SigSegState { SIGSEG_FREE, ///< Free and has no pre-signal exits or at least one green exit SIGSEG_FULL, ///< Occupied by a train SIGSEG_PBS, ///< Segment is a PBS segment }; SigSegState UpdateSignalsOnSegment(TileIndex tile, DiagDirection side, Owner owner); void SetSignalsOnBothDir(TileIndex tile, Track track, Owner owner); void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner); void AddSideToSignalBuffer(TileIndex tile, DiagDirection side, Owner owner); void UpdateSignalsInBuffer(); #endif /* SIGNAL_FUNC_H */
1,634
C++
.h
47
33.191489
84
0.768695
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,374
tree_map.h
EnergeticBark_OpenTTD-3DS/src/tree_map.h
/* $Id$ */ /** @file tree_map.h Map accessors for tree tiles. */ #ifndef TREE_MAP_H #define TREE_MAP_H /** * List of tree types along all landscape types. * * This enumeration contains a list of the different tree types along * all landscape types. The values for the enumerations may be used for * offsets from the grfs files. These points to the start of * the tree list for a landscape. See the TREE_COUNT_* enumerations * for the amount of different trees for a specific landscape. * * @note TREE_INVALID may be 0xFF according to the coding style, not -1 (Progman) */ enum TreeType { TREE_INVALID = -1, ///< An invalid tree TREE_TEMPERATE = 0x00, ///< temperate tree TREE_SUB_ARCTIC = 0x0C, ///< tree on a sub_arctic landscape TREE_RAINFOREST = 0x14, ///< tree on the 'green part' on a sub-tropical map TREE_CACTUS = 0x1B, ///< a catus for the 'desert part' on a sub-tropical map TREE_SUB_TROPICAL = 0x1C, ///< tree on a sub-tropical map, non-rainforest, non-desert TREE_TOYLAND = 0x20, ///< tree on a toyland map }; /** * Counts the number of treetypes for each landscape. * * This list contains the counts of different treetypes for each landscape. This list contains * 5 entries instead of 4 (as there are only 4 landscape types) as the sub tropic landscape * got two types of area, one for normal trees and one only for cacti. */ enum { TREE_COUNT_TEMPERATE = TREE_SUB_ARCTIC - TREE_TEMPERATE, ///< number of treetypes on a temperate map TREE_COUNT_SUB_ARCTIC = TREE_RAINFOREST - TREE_SUB_ARCTIC, ///< number of treetypes on a sub arctic map TREE_COUNT_RAINFOREST = TREE_CACTUS - TREE_RAINFOREST, ///< number of treetypes for the 'green part' of a sub tropic map TREE_COUNT_SUB_TROPICAL = TREE_SUB_TROPICAL - TREE_CACTUS, ///< number of treetypes for the 'desert part' of a sub tropic map TREE_COUNT_TOYLAND = 9 ///< number of treetypes on a toyland map }; /** * Enumeration for ground types of tiles with trees. * * This enumeration defines the ground types for tiles with trees on it. */ enum TreeGround { TREE_GROUND_GRASS = 0, ///< normal grass TREE_GROUND_ROUGH = 1, ///< some rough tile TREE_GROUND_SNOW_DESERT = 2, ///< a desert or snow tile, depend on landscape TREE_GROUND_SHORE = 3, ///< shore }; /** * Returns the treetype of a tile. * * This function returns the treetype of a given tile. As there are more * possible treetypes for a tile in a game as the enumeration #TreeType defines * this function may be return a value which isn't catch by an entry of the * enumeration #TreeType. But there is no problem known about it. * * @param t The tile to get the treetype from * @return The treetype of the given tile with trees * @pre Tile t must be of type MP_TREES */ static inline TreeType GetTreeType(TileIndex t) { assert(IsTileType(t, MP_TREES)); return (TreeType)_m[t].m3; } /** * Returns the groundtype for tree tiles. * * This function returns the groundtype of a tile with trees. * * @param t The tile to get the groundtype from * @return The groundtype of the tile * @pre Tile must be of type MP_TREES */ static inline TreeGround GetTreeGround(TileIndex t) { assert(IsTileType(t, MP_TREES)); return (TreeGround)GB(_m[t].m2, 4, 2); } /** * Returns the 'density' of a tile with trees. * * This function returns the density of a tile which got trees. Note * that this value doesn't count the number of trees on a tile, use * #GetTreeCount instead. This function instead returns some kind of * groundtype of the tile. As the map-array is finite in size and * the informations about the trees must be saved somehow other * informations about a tile must be saved somewhere encoded in the * tile. So this function returns the density of a tile for sub arctic * and sub tropical games. This means for sub arctic the type of snowline * (0 to 3 for all 4 types of snowtiles) and for sub tropical the value * 3 for a desert (and 0 for non-desert). The functionname is not read as * "get the tree density of a tile" but "get the density of a tile which got trees". * * @param t The tile to get the 'density' * @pre Tile must be of type MP_TREES * @see GetTreeCount */ static inline uint GetTreeDensity(TileIndex t) { assert(IsTileType(t, MP_TREES)); return GB(_m[t].m2, 6, 2); } /** * Set the density and ground type of a tile with trees. * * This functions saves the ground type and the density which belongs to it * for a given tile. * * @param t The tile to set the density and ground type * @param g The ground type to save * @param d The density to save with * @pre Tile must be of type MP_TREES */ static inline void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d) { assert(IsTileType(t, MP_TREES)); // XXX incomplete SB(_m[t].m2, 4, 2, g); SB(_m[t].m2, 6, 2, d); } /** * Returns the number of trees on a tile. * * This function returns the number of trees of a tile (1-4). * The tile must be contains at least one tree or be more specific: it must be * of type MP_TREES. * * @param t The index to get the number of trees * @return The number of trees (1-4) * @pre Tile must be of type MP_TREES */ static inline uint GetTreeCount(TileIndex t) { assert(IsTileType(t, MP_TREES)); return GB(_m[t].m5, 6, 2) + 1; } /** * Add a amount to the tree-count value of a tile with trees. * * This function add a value to the tree-count value of a tile. This * value may be negative to reduce the tree-counter. If the resulting * value reach 0 it doesn't get converted to a "normal" tile. * * @param t The tile to change the tree amount * @param c The value to add (or reduce) on the tree-count value * @pre Tile must be of type MP_TREES */ static inline void AddTreeCount(TileIndex t, int c) { assert(IsTileType(t, MP_TREES)); // XXX incomplete _m[t].m5 += c << 6; } /** * Returns the tree growth status. * * This function returns the tree growth status of a tile with trees. * * @param t The tile to get the tree growth status * @return The tree growth status * @pre Tile must be of type MP_TREES */ static inline uint GetTreeGrowth(TileIndex t) { assert(IsTileType(t, MP_TREES)); return GB(_m[t].m5, 0, 3); } /** * Add a value to the tree growth status. * * This function adds a value to the tree grow status of a tile. * * @param t The tile to add the value on * @param a The value to add on the tree growth status * @pre Tile must be of type MP_TREES */ static inline void AddTreeGrowth(TileIndex t, int a) { assert(IsTileType(t, MP_TREES)); // XXX incomplete _m[t].m5 += a; } /** * Sets the tree growth status of a tile. * * This function sets the tree growth status of a tile directly with * the given value. * * @param t The tile to change the tree growth status * @param g The new value * @pre Tile must be of type MP_TREES */ static inline void SetTreeGrowth(TileIndex t, uint g) { assert(IsTileType(t, MP_TREES)); // XXX incomplete SB(_m[t].m5, 0, 3, g); } /** * Get the tick counter of a tree tile. * * Returns the saved tick counter of a given tile. * * @param t The tile to get the counter value from * @pre Tile must be of type MP_TREES */ static inline uint GetTreeCounter(TileIndex t) { assert(IsTileType(t, MP_TREES)); return GB(_m[t].m2, 0, 4); } /** * Add a value on the tick counter of a tree-tile * * This function adds a value on the tick counter of a tree-tile. * * @param t The tile to add the value on * @param a The value to add on the tick counter * @pre Tile must be of type MP_TREES */ static inline void AddTreeCounter(TileIndex t, int a) { assert(IsTileType(t, MP_TREES)); // XXX incomplete _m[t].m2 += a; } /** * Set the tick counter for a tree-tile * * This function sets directly the tick counter for a tree-tile. * * @param t The tile to set the tick counter * @param c The new tick counter value * @pre Tile must be of type MP_TREES */ static inline void SetTreeCounter(TileIndex t, uint c) { assert(IsTileType(t, MP_TREES)); // XXX incomplete SB(_m[t].m2, 0, 4, c); } /** * Make a tree-tile. * * This functions change the tile to a tile with trees and all informations which belongs to it. * * @param t The tile to make a tree-tile from * @param type The type of the tree * @param set the number of trees * @param growth the growth status * @param ground the ground type * @param density the density (not the number of trees) */ static inline void MakeTree(TileIndex t, TreeType type, uint count, uint growth, TreeGround ground, uint density) { SetTileType(t, MP_TREES); SetTileOwner(t, OWNER_NONE); _m[t].m2 = density << 6 | ground << 4 | 0; _m[t].m3 = type; _m[t].m4 = 0 << 5 | 0 << 2; _m[t].m5 = count << 6 | growth; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } #endif /* TREE_MAP_H */
8,860
C++
.h
261
32.122605
130
0.708474
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,375
lzoconf.h
EnergeticBark_OpenTTD-3DS/src/lzoconf.h
/* $Id$ */ /** @file lzoconf.h -- configuration for the LZO real-time data compression library This file is part of the LZO real-time data compression library. Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer All Rights Reserved. The LZO library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The LZO library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the LZO library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Markus F.X.J. Oberhumer <markus@oberhumer.com> http://www.oberhumer.com/opensource/lzo/ */ #ifndef LZOCONF_H #define LZOCONF_H #define LZO_VERSION 0x1080 #define LZO_VERSION_STRING "1.08" #define LZO_VERSION_DATE "Jul 12 2002" /* internal Autoconf configuration file - only used when building LZO */ #if defined(LZO_HAVE_CONFIG_H) # include <config.h> #endif #include <limits.h> #ifdef __cplusplus extern "C" { #endif /*********************************************************************** * LZO requires a conforming <limits.h> ***********************************************************************/ #if !defined(CHAR_BIT) || (CHAR_BIT != 8) # error "invalid CHAR_BIT" #endif #if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) # error "check your compiler installation" #endif #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) # error "your limits.h macros are broken" #endif /* workaround a cpp bug under hpux 10.20 */ #define LZO_0xffffffffL 4294967295ul #if !defined(LZO_UINT32_C) # if (UINT_MAX < LZO_0xffffffffL) # define LZO_UINT32_C(c) c ## UL # else # define LZO_UINT32_C(c) c ## U # endif #endif /*********************************************************************** * architecture defines ***********************************************************************/ #if !defined(__LZO_WIN) && !defined(__LZO_DOS) && !defined(__LZO_OS2) # if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) # define __LZO_WIN # elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) # define __LZO_WIN # elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__) # define __LZO_WIN # elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS) # define __LZO_DOS # elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2) # define __LZO_OS2 # elif defined(__palmos__) # define __LZO_PALMOS # elif defined(__TOS__) || defined(__atarist__) # define __LZO_TOS # endif #endif #if (UINT_MAX < LZO_0xffffffffL) # if defined(__LZO_WIN) # define __LZO_WIN16 # elif defined(__LZO_DOS) # define __LZO_DOS16 # elif defined(__LZO_PALMOS) # define __LZO_PALMOS16 # elif defined(__LZO_TOS) # define __LZO_TOS16 # elif defined(__C166__) # else /* porting hint: for pure 16-bit architectures try compiling * everything with -D__LZO_STRICT_16BIT */ # error "16-bit target not supported - contact me for porting hints" # endif #endif #if !defined(__LZO_i386) # if defined(__LZO_DOS) || defined(__LZO_WIN16) # define __LZO_i386 # elif defined(__i386__) || defined(__386__) || defined(_M_IX86) # define __LZO_i386 # endif #endif #if defined(__LZO_STRICT_16BIT) # if (UINT_MAX < LZO_0xffffffffL) # include <lzo16bit.h> # endif #endif /* memory checkers */ #if !defined(__LZO_CHECKER) # if defined(__BOUNDS_CHECKING_ON) # define __LZO_CHECKER # elif defined(__CHECKER__) # define __LZO_CHECKER # elif defined(__INSURE__) # define __LZO_CHECKER # elif defined(__PURIFY__) # define __LZO_CHECKER # endif #endif /*********************************************************************** * integral and pointer types ***********************************************************************/ /* Integral types with 32 bits or more */ #if !defined(LZO_UINT32_MAX) # if (UINT_MAX >= LZO_0xffffffffL) typedef unsigned int lzo_uint32; typedef int lzo_int32; # define LZO_UINT32_MAX UINT_MAX # define LZO_INT32_MAX INT_MAX # define LZO_INT32_MIN INT_MIN # elif (ULONG_MAX >= LZO_0xffffffffL) typedef unsigned long lzo_uint32; typedef long lzo_int32; # define LZO_UINT32_MAX ULONG_MAX # define LZO_INT32_MAX LONG_MAX # define LZO_INT32_MIN LONG_MIN # else # error "lzo_uint32" # endif #endif /* lzo_uint is used like size_t */ #if !defined(LZO_UINT_MAX) # if (UINT_MAX >= LZO_0xffffffffL) typedef unsigned int lzo_uint; typedef int lzo_int; # define LZO_UINT_MAX UINT_MAX # define LZO_INT_MAX INT_MAX # define LZO_INT_MIN INT_MIN # elif (ULONG_MAX >= LZO_0xffffffffL) typedef unsigned long lzo_uint; typedef long lzo_int; # define LZO_UINT_MAX ULONG_MAX # define LZO_INT_MAX LONG_MAX # define LZO_INT_MIN LONG_MIN # else # error "lzo_uint" # endif #endif typedef int lzo_bool; /*********************************************************************** * memory models ***********************************************************************/ /* Memory model for the public code segment. */ #if !defined(__LZO_CMODEL) # if defined(__LZO_DOS16) || defined(__LZO_WIN16) # define __LZO_CMODEL __far # elif defined(__LZO_i386) && defined(__WATCOMC__) # define __LZO_CMODEL __near # else # define __LZO_CMODEL # endif #endif /* Memory model for the public data segment. */ #if !defined(__LZO_DMODEL) # if defined(__LZO_DOS16) || defined(__LZO_WIN16) # define __LZO_DMODEL __far # elif defined(__LZO_i386) && defined(__WATCOMC__) # define __LZO_DMODEL __near # else # define __LZO_DMODEL # endif #endif /* Memory model that allows to access memory at offsets of lzo_uint. */ #if !defined(__LZO_MMODEL) # if (LZO_UINT_MAX <= UINT_MAX) # define __LZO_MMODEL # elif defined(__LZO_DOS16) || defined(__LZO_WIN16) # define __LZO_MMODEL __huge # define LZO_999_UNSUPPORTED # elif defined(__LZO_PALMOS16) || defined(__LZO_TOS16) # define __LZO_MMODEL # else # error "__LZO_MMODEL" # endif #endif /* no typedef here because of const-pointer issues */ #define lzo_byte unsigned char __LZO_MMODEL #define lzo_bytep unsigned char __LZO_MMODEL * #define lzo_charp char __LZO_MMODEL * #define lzo_voidp void __LZO_MMODEL * #define lzo_shortp short __LZO_MMODEL * #define lzo_ushortp unsigned short __LZO_MMODEL * #define lzo_uint32p lzo_uint32 __LZO_MMODEL * #define lzo_int32p lzo_int32 __LZO_MMODEL * #define lzo_uintp lzo_uint __LZO_MMODEL * #define lzo_intp lzo_int __LZO_MMODEL * #define lzo_voidpp lzo_voidp __LZO_MMODEL * #define lzo_bytepp lzo_bytep __LZO_MMODEL * #ifndef lzo_sizeof_dict_t # define lzo_sizeof_dict_t sizeof(lzo_bytep) #endif /*********************************************************************** * calling conventions and function types ***********************************************************************/ /* linkage */ #if !defined(__LZO_EXTERN_C) # ifdef __cplusplus # define __LZO_EXTERN_C extern "C" # else # define __LZO_EXTERN_C extern # endif #endif /* calling convention */ #if !defined(__LZO_CDECL) # if defined(__LZO_DOS16) || defined(__LZO_WIN16) # define __LZO_CDECL __LZO_CMODEL __cdecl # elif defined(__LZO_i386) && defined(_MSC_VER) # define __LZO_CDECL __LZO_CMODEL __cdecl # elif defined(__LZO_i386) && defined(__WATCOMC__) # define __LZO_CDECL __LZO_CMODEL __cdecl # else # define __LZO_CDECL __LZO_CMODEL # endif #endif #if !defined(__LZO_ENTRY) # define __LZO_ENTRY __LZO_CDECL #endif /* C++ exception specification for extern "C" function types */ #if !defined(__cplusplus) # undef LZO_NOTHROW # define LZO_NOTHROW #elif !defined(LZO_NOTHROW) # define LZO_NOTHROW #endif typedef int (__LZO_ENTRY *lzo_compress_t) ( const lzo_byte *src, lzo_uint src_len, lzo_byte *dst, lzo_uintp dst_len, lzo_voidp wrkmem ); typedef int (__LZO_ENTRY *lzo_decompress_t) ( const lzo_byte *src, lzo_uint src_len, lzo_byte *dst, lzo_uintp dst_len, lzo_voidp wrkmem ); typedef int (__LZO_ENTRY *lzo_optimize_t) ( lzo_byte *src, lzo_uint src_len, lzo_byte *dst, lzo_uintp dst_len, lzo_voidp wrkmem ); typedef int (__LZO_ENTRY *lzo_compress_dict_t)(const lzo_byte *src, lzo_uint src_len, lzo_byte *dst, lzo_uintp dst_len, lzo_voidp wrkmem, const lzo_byte *dict, lzo_uint dict_len ); typedef int (__LZO_ENTRY *lzo_decompress_dict_t)(const lzo_byte *src, lzo_uint src_len, lzo_byte *dst, lzo_uintp dst_len, lzo_voidp wrkmem, const lzo_byte *dict, lzo_uint dict_len ); /* assembler versions always use __cdecl */ typedef int (__LZO_CDECL *lzo_compress_asm_t)( const lzo_byte *src, lzo_uint src_len, lzo_byte *dst, lzo_uintp dst_len, lzo_voidp wrkmem ); typedef int (__LZO_CDECL *lzo_decompress_asm_t)( const lzo_byte *src, lzo_uint src_len, lzo_byte *dst, lzo_uintp dst_len, lzo_voidp wrkmem ); /* a progress indicator callback function */ typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint); /*********************************************************************** * export information ***********************************************************************/ /* DLL export information */ #if !defined(__LZO_EXPORT1) # define __LZO_EXPORT1 #endif #if !defined(__LZO_EXPORT2) # define __LZO_EXPORT2 #endif /* exported calling convention for C functions */ #if !defined(LZO_PUBLIC) # define LZO_PUBLIC(_rettype) \ __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_ENTRY #endif #if !defined(LZO_EXTERN) # define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype) #endif #if !defined(LZO_PRIVATE) # define LZO_PRIVATE(_rettype) static _rettype __LZO_ENTRY #endif /* exported __cdecl calling convention for assembler functions */ #if !defined(LZO_PUBLIC_CDECL) # define LZO_PUBLIC_CDECL(_rettype) \ __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL #endif #if !defined(LZO_EXTERN_CDECL) # define LZO_EXTERN_CDECL(_rettype) __LZO_EXTERN_C LZO_PUBLIC_CDECL(_rettype) #endif /* exported global variables (LZO currently uses no static variables and * is fully thread safe) */ #if !defined(LZO_PUBLIC_VAR) # define LZO_PUBLIC_VAR(_type) \ __LZO_EXPORT1 _type __LZO_EXPORT2 __LZO_DMODEL #endif #if !defined(LZO_EXTERN_VAR) # define LZO_EXTERN_VAR(_type) extern LZO_PUBLIC_VAR(_type) #endif /*********************************************************************** * error codes and prototypes ***********************************************************************/ /* Error codes for the compression/decompression functions. Negative * values are errors, positive values will be used for special but * normal events. */ #define LZO_E_OK 0 #define LZO_E_ERROR (-1) #define LZO_E_OUT_OF_MEMORY (-2) /* not used right now */ #define LZO_E_NOT_COMPRESSIBLE (-3) /* not used right now */ #define LZO_E_INPUT_OVERRUN (-4) #define LZO_E_OUTPUT_OVERRUN (-5) #define LZO_E_LOOKBEHIND_OVERRUN (-6) #define LZO_E_EOF_NOT_FOUND (-7) #define LZO_E_INPUT_NOT_CONSUMED (-8) /* lzo_init() should be the first function you call. * Check the return code ! * * lzo_init() is a macro to allow checking that the library and the * compiler's view of various types are consistent. */ #define lzo_init() __lzo_init2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\ (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ (int)sizeof(lzo_compress_t)) LZO_EXTERN(int) __lzo_init2(unsigned,int,int,int,int,int,int,int,int,int); /* version functions (useful for shared libraries) */ LZO_EXTERN(unsigned) lzo_version(); LZO_EXTERN(const char *) lzo_version_string(); LZO_EXTERN(const char *) lzo_version_date(); LZO_EXTERN(const lzo_charp) _lzo_version_string(); LZO_EXTERN(const lzo_charp) _lzo_version_date(); /* string functions */ LZO_EXTERN(int) lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len); LZO_EXTERN(lzo_voidp) lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); LZO_EXTERN(lzo_voidp) lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len); LZO_EXTERN(lzo_voidp) lzo_memset(lzo_voidp _s, int _c, lzo_uint _len); /* checksum functions */ LZO_EXTERN(lzo_uint32) lzo_adler32(lzo_uint32 _adler, const lzo_byte *_buf, lzo_uint _len); LZO_EXTERN(lzo_uint32) lzo_crc32(lzo_uint32 _c, const lzo_byte *_buf, lzo_uint _len); /* misc. */ LZO_EXTERN(lzo_bool) lzo_assert(int _expr); LZO_EXTERN(int) _lzo_config_check(); typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u; typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u; typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t; /* align a char pointer on a boundary that is a multiple of `size' */ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size); #define LZO_PTR_ALIGN_UP(_ptr,_size) \ ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size))) /* deprecated - only for backward compatibility */ #define LZO_ALIGN(_ptr,_size) LZO_PTR_ALIGN_UP(_ptr,_size) #ifdef __cplusplus } /* extern "C" */ #endif #endif /* LZOCONF_H */
15,092
C++
.h
379
36.424802
84
0.59791
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
1,539,376
console_gui.h
EnergeticBark_OpenTTD-3DS/src/console_gui.h
/* $Id$ */ /** @file console_gui.h GUI related functions in the console. */ #ifndef CONSOLE_GUI_H #define CONSOLE_GUI_H #include "window_type.h" void IConsoleResize(Window *w); void IConsoleSwitch(); #endif /* CONSOLE_GUI_H */
232
C++
.h
8
27.375
64
0.726027
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,378
road_gui.h
EnergeticBark_OpenTTD-3DS/src/road_gui.h
/* $Id$ */ /** @file road_gui.h Functions/types related to the road GUIs. */ #ifndef ROAD_GUI_H #define ROAD_GUI_H #include "road_type.h" void ShowBuildRoadToolbar(RoadType roadtype); void ShowBuildRoadScenToolbar(); #endif /* ROAD_GUI_H */
246
C++
.h
8
29.125
65
0.742489
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,379
zoom_type.h
EnergeticBark_OpenTTD-3DS/src/zoom_type.h
/* $Id$ */ /** @file zoom_type.h Types related to zooming in and out. */ #ifndef ZOOM_TYPE_H #define ZOOM_TYPE_H #include "core/enum_type.hpp" enum ZoomLevel { /* Our possible zoom-levels */ ZOOM_LVL_BEGIN = 0, ZOOM_LVL_NORMAL = 0, ZOOM_LVL_OUT_2X, ZOOM_LVL_OUT_4X, ZOOM_LVL_OUT_8X, ZOOM_LVL_END, /* Number of zoom levels */ ZOOM_LVL_COUNT = ZOOM_LVL_END - ZOOM_LVL_BEGIN, /* Here we define in which zoom viewports are */ ZOOM_LVL_VIEWPORT = ZOOM_LVL_NORMAL, ZOOM_LVL_NEWS = ZOOM_LVL_NORMAL, ZOOM_LVL_INDUSTRY = ZOOM_LVL_OUT_2X, ZOOM_LVL_TOWN = ZOOM_LVL_OUT_2X, ZOOM_LVL_AIRCRAFT = ZOOM_LVL_NORMAL, ZOOM_LVL_SHIP = ZOOM_LVL_NORMAL, ZOOM_LVL_TRAIN = ZOOM_LVL_NORMAL, ZOOM_LVL_ROADVEH = ZOOM_LVL_NORMAL, ZOOM_LVL_WORLD_SCREENSHOT = ZOOM_LVL_NORMAL, ZOOM_LVL_DETAIL = ZOOM_LVL_OUT_2X, ///< All zoomlevels below or equal to this, will result in details on the screen, like road-work, ... ZOOM_LVL_MIN = ZOOM_LVL_NORMAL, ZOOM_LVL_MAX = ZOOM_LVL_OUT_8X, }; DECLARE_POSTFIX_INCREMENT(ZoomLevel) #endif /* ZOOM_TYPE_H */
1,073
C++
.h
31
32.612903
139
0.696999
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,380
timetable.h
EnergeticBark_OpenTTD-3DS/src/timetable.h
/* $Id$ */ /** @file timetable.h Functions related to time tabling. */ #ifndef TIMETABLE_H #define TIMETABLE_H void ShowTimetableWindow(const Vehicle *v); void UpdateVehicleTimetable(Vehicle *v, bool travelling); void SetTimetableParams(int param1, int param2, uint32 time); #endif /* TIMETABLE_H */
304
C++
.h
8
36.5
61
0.773973
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,381
group.h
EnergeticBark_OpenTTD-3DS/src/group.h
/* $Id$ */ /** @file group.h Base class from groups. */ #ifndef GROUP_H #define GROUP_H #include "group_type.h" #include "oldpool.h" #include "company_type.h" #include "vehicle_type.h" #include "engine_type.h" DECLARE_OLD_POOL(Group, Group, 5, 2047) struct Group : PoolItem<Group, GroupID, &_Group_pool> { char *name; ///< Group Name uint16 num_vehicle; ///< Number of vehicles wich belong to the group OwnerByte owner; ///< Group Owner VehicleTypeByte vehicle_type; ///< Vehicle type of the group bool replace_protection; ///< If set to true, the global autoreplace have no effect on the group uint16 *num_engines; ///< Caches the number of engines of each type the company owns (no need to save this) Group(CompanyID owner = INVALID_COMPANY); virtual ~Group(); bool IsValid() const; }; static inline bool IsValidGroupID(GroupID index) { return index < GetGroupPoolSize() && GetGroup(index)->IsValid(); } static inline bool IsDefaultGroupID(GroupID index) { return index == DEFAULT_GROUP; } /** * Checks if a GroupID stands for all vehicles of a company * @param id_g The GroupID to check * @return true is id_g is identical to ALL_GROUP */ static inline bool IsAllGroupID(GroupID id_g) { return id_g == ALL_GROUP; } #define FOR_ALL_GROUPS_FROM(g, start) for (g = GetGroup(start); g != NULL; g = (g->index + 1U < GetGroupPoolSize()) ? GetGroup(g->index + 1) : NULL) if (g->IsValid()) #define FOR_ALL_GROUPS(g) FOR_ALL_GROUPS_FROM(g, 0) /** * Get the current size of the GroupPool */ static inline uint GetGroupArraySize(void) { const Group *g; uint num = 0; FOR_ALL_GROUPS(g) num++; return num; } /** * Get the number of engines with EngineID id_e in the group with GroupID * id_g * @param id_g The GroupID of the group used * @param id_e The EngineID of the engine to count * @return The number of engines with EngineID id_e in the group */ uint GetGroupNumEngines(CompanyID company, GroupID id_g, EngineID id_e); static inline void IncreaseGroupNumVehicle(GroupID id_g) { if (IsValidGroupID(id_g)) GetGroup(id_g)->num_vehicle++; } static inline void DecreaseGroupNumVehicle(GroupID id_g) { if (IsValidGroupID(id_g)) GetGroup(id_g)->num_vehicle--; } void InitializeGroup(); void SetTrainGroupID(Vehicle *v, GroupID grp); void UpdateTrainGroupID(Vehicle *v); void RemoveVehicleFromGroup(const Vehicle *v); void RemoveAllGroupsForCompany(const CompanyID company); extern GroupID _new_group_id; #endif /* GROUP_H */
2,584
C++
.h
73
33.657534
166
0.708484
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,382
gfxinit.h
EnergeticBark_OpenTTD-3DS/src/gfxinit.h
/* $Id$ */ /** @file gfxinit.h Functions related to the graphics initialization. */ #ifndef GFXINIT_H #define GFXINIT_H #include "gfx_type.h" void CheckExternalFiles(); void GfxLoadSprites(); void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_tbl); void FindGraphicsSets(); bool SetGraphicsSet(const char *name); char *GetGraphicsSetsList(char *p, const char *last); int GetNumGraphicsSets(); int GetIndexOfCurrentGraphicsSet(); const char *GetGraphicsSetName(int index); extern char *_ini_graphics_set; #endif /* GFXINIT_H */
563
C++
.h
16
33.6875
84
0.784787
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,383
oldpool.h
EnergeticBark_OpenTTD-3DS/src/oldpool.h
/* $Id$ */ /** @file oldpool.h Base for the old pool. */ #ifndef OLDPOOL_H #define OLDPOOL_H #include "core/math_func.hpp" /* The function that is called after a new block is added start_item is the first item of the new made block */ typedef void OldMemoryPoolNewBlock(uint start_item); /* The function that is called before a block is cleaned up */ typedef void OldMemoryPoolCleanBlock(uint start_item, uint end_item); /** * Stuff for dynamic vehicles. Use the wrappers to access the OldMemoryPool * please try to avoid manual calls! */ struct OldMemoryPoolBase { void CleanPool(); bool AddBlockToPool(); bool AddBlockIfNeeded(uint index); protected: OldMemoryPoolBase(const char *name, uint max_blocks, uint block_size_bits, uint item_size, OldMemoryPoolNewBlock *new_block_proc, OldMemoryPoolCleanBlock *clean_block_proc) : name(name), max_blocks(max_blocks), block_size_bits(block_size_bits), new_block_proc(new_block_proc), clean_block_proc(clean_block_proc), current_blocks(0), total_items(0), cleaning_pool(false), item_size(item_size), first_free_index(0), blocks(NULL) {} const char *name; ///< Name of the pool (just for debugging) const uint max_blocks; ///< The max amount of blocks this pool can have const uint block_size_bits; ///< The size of each block in bits /** Pointer to a function that is called after a new block is added */ OldMemoryPoolNewBlock *new_block_proc; /** Pointer to a function that is called to clean a block */ OldMemoryPoolCleanBlock *clean_block_proc; uint current_blocks; ///< How many blocks we have in our pool uint total_items; ///< How many items we now have in this pool bool cleaning_pool; ///< Are we currently cleaning the pool? public: const uint item_size; ///< How many bytes one block is uint first_free_index; ///< The index of the first free pool item in this pool byte **blocks; ///< An array of blocks (one block hold all the items) /** * Check if the index of pool item being deleted is lower than cached first_free_index * @param index index of pool item * @note usage of min() will result in better code on some architectures */ inline void UpdateFirstFreeIndex(uint index) { first_free_index = min(first_free_index, index); } /** * Get the size of this pool, i.e. the total number of items you * can put into it at the current moment; the pool might still * be able to increase the size of the pool. * @return the size of the pool */ inline uint GetSize() const { return this->total_items; } /** * Can this pool allocate more blocks, i.e. is the maximum amount * of allocated blocks not yet reached? * @return the if and only if the amount of allocable blocks is * less than the amount of allocated blocks. */ inline bool CanAllocateMoreBlocks() const { return this->current_blocks < this->max_blocks; } /** * Get the maximum number of allocable blocks. * @return the numebr of blocks */ inline uint GetBlockCount() const { return this->current_blocks; } /** * Get the name of this pool. * @return the name */ inline const char *GetName() const { return this->name; } /** * Is the pool in the cleaning phase? * @return true if it is */ inline bool CleaningPool() const { return this->cleaning_pool; } }; template <typename T> struct OldMemoryPool : public OldMemoryPoolBase { OldMemoryPool(const char *name, uint max_blocks, uint block_size_bits, uint item_size, OldMemoryPoolNewBlock *new_block_proc, OldMemoryPoolCleanBlock *clean_block_proc) : OldMemoryPoolBase(name, max_blocks, block_size_bits, item_size, new_block_proc, clean_block_proc) {} /** * Get the pool entry at the given index. * @param index the index into the pool * @pre index < this->GetSize() * @return the pool entry. */ inline T *Get(uint index) const { assert(index < this->GetSize()); return (T*)(this->blocks[index >> this->block_size_bits] + (index & ((1 << this->block_size_bits) - 1)) * this->item_size); } }; /** * Generic function to initialize a new block in a pool. * @param start_item the first item that needs to be initialized */ template <typename T, OldMemoryPool<T> *Tpool> static void PoolNewBlock(uint start_item) { for (T *t = Tpool->Get(start_item); t != NULL; t = (t->index + 1U < Tpool->GetSize()) ? Tpool->Get(t->index + 1U) : NULL) { t = new (t) T(); t->index = start_item++; } } /** * Generic function to free a new block in a pool. * @param start_item the first item that needs to be cleaned * @param end_item the last item that needs to be cleaned */ template <typename T, OldMemoryPool<T> *Tpool> static void PoolCleanBlock(uint start_item, uint end_item) { for (uint i = start_item; i <= end_item; i++) { T *t = Tpool->Get(i); delete t; } } /** * Template providing a predicate to allow STL containers of * pointers to pool items to be sorted by index. */ template <typename T> struct PoolItemIndexLess { /** * The actual comparator. * @param lhs the left hand side of the comparison. * @param rhs the right hand side of the comparison. * @return true if lhs' index is less than rhs' index. */ bool operator()(const T *lhs, const T *rhs) const { return lhs->index < rhs->index; } }; /** * Generalization for all pool items that are saved in the savegame. * It specifies all the mechanics to access the pool easily. */ template <typename T, typename Tid, OldMemoryPool<T> *Tpool> struct PoolItem { /** * The pool-wide index of this object. */ Tid index; /** * We like to have the correct class destructed. * @warning It is called even for object allocated on stack, * so it is not present in the TPool! * Then, index is undefined, not associated with TPool in any way. * @note The idea is to free up allocated memory etc. */ virtual ~PoolItem() { } /** * Constructor of given class. * @warning It is called even for object allocated on stack, * so it may not be present in TPool! * Then, index is undefined, not associated with TPool in any way. * @note The idea is to initialize variables (except index) */ PoolItem() { } /** * An overriden version of new that allocates memory on the pool. * @param size the size of the variable (unused) * @pre CanAllocateItem() * @return the memory that is 'allocated' */ void *operator new(size_t size) { return AllocateRaw(); } /** * 'Free' the memory allocated by the overriden new. * @param p the memory to 'free' * @note we only update Tpool->first_free_index */ void operator delete(void *p) { Tpool->UpdateFirstFreeIndex(((T*)p)->index); } /** * An overriden version of new, so you can directly allocate a new object with * the correct index when one is loading the savegame. * @param size the size of the variable (unused) * @param index the index of the object * @return the memory that is 'allocated' */ void *operator new(size_t size, int index) { if (!Tpool->AddBlockIfNeeded(index)) error("%s: failed loading savegame: too many %s", Tpool->GetName(), Tpool->GetName()); return Tpool->Get(index); } /** * 'Free' the memory allocated by the overriden new. * @param p the memory to 'free' * @param index the original parameter given to create the memory * @note we only update Tpool->first_free_index */ void operator delete(void *p, int index) { Tpool->UpdateFirstFreeIndex(index); } /** * An overriden version of new, so you can use the vehicle instance * instead of a newly allocated piece of memory. * @param size the size of the variable (unused) * @param pn the already existing object to use as 'storage' backend * @return the memory that is 'allocated' */ void *operator new(size_t size, T *pn) { return pn; } /** * 'Free' the memory allocated by the overriden new. * @param p the memory to 'free' * @param pn the pointer that was given to 'new' on creation. * @note we only update Tpool->first_free_index */ void operator delete(void *p, T *pn) { Tpool->UpdateFirstFreeIndex(pn->index); } private: static T *AllocateSafeRaw(uint &first); protected: /** * Allocate a pool item; possibly allocate a new block in the pool. * @pre CanAllocateItem() * @return the allocated pool item. */ static inline T *AllocateRaw() { return AllocateSafeRaw(Tpool->first_free_index); } /** * Allocate a pool item; possibly allocate a new block in the pool. * @param first the first pool item to start searching * @pre CanAllocateItem() * @return the allocated pool item. */ static inline T *AllocateRaw(uint &first) { if (first >= Tpool->GetSize() && !Tpool->AddBlockToPool()) return NULL; return AllocateSafeRaw(first); } /** * Are we cleaning this pool? * @return true if we are */ static inline bool CleaningPool() { return Tpool->CleaningPool(); } public: static bool CanAllocateItem(uint count = 1); }; #define OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \ enum { \ name##_POOL_BLOCK_SIZE_BITS = block_size_bits, \ name##_POOL_MAX_BLOCKS = max_blocks \ }; #define OLD_POOL_ACCESSORS(name, type) \ static inline type *Get##name(uint index) { return _##name##_pool.Get(index); } \ static inline uint Get##name##PoolSize() { return _##name##_pool.GetSize(); } #define DECLARE_OLD_POOL(name, type, block_size_bits, max_blocks) \ OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \ extern OldMemoryPool<type> _##name##_pool; \ OLD_POOL_ACCESSORS(name, type) #define DEFINE_OLD_POOL(name, type, new_block_proc, clean_block_proc) \ OldMemoryPool<type> _##name##_pool( \ #name, name##_POOL_MAX_BLOCKS, name##_POOL_BLOCK_SIZE_BITS, sizeof(type), \ new_block_proc, clean_block_proc); #define DEFINE_OLD_POOL_GENERIC(name, type) \ OldMemoryPool<type> _##name##_pool( \ #name, name##_POOL_MAX_BLOCKS, name##_POOL_BLOCK_SIZE_BITS, sizeof(type), \ PoolNewBlock<type, &_##name##_pool>, PoolCleanBlock<type, &_##name##_pool>); \ template type *PoolItem<type, type##ID, &_##name##_pool>::AllocateSafeRaw(uint &first); \ template bool PoolItem<type, type##ID, &_##name##_pool>::CanAllocateItem(uint count); #define STATIC_OLD_POOL(name, type, block_size_bits, max_blocks, new_block_proc, clean_block_proc) \ OLD_POOL_ENUM(name, type, block_size_bits, max_blocks) \ static DEFINE_OLD_POOL(name, type, new_block_proc, clean_block_proc) \ OLD_POOL_ACCESSORS(name, type) #endif /* OLDPOOL_H */
10,575
C++
.h
305
32.193443
125
0.703073
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,384
tile_cmd.h
EnergeticBark_OpenTTD-3DS/src/tile_cmd.h
/* $Id$ */ /** @file tile_cmd.h Generic 'commands' that can be performed on all tiles. */ #ifndef TILE_CMD_H #define TILE_CMD_H #include "slope_type.h" #include "tile_type.h" #include "command_type.h" #include "vehicle_type.h" #include "cargo_type.h" #include "strings_type.h" #include "date_type.h" #include "company_type.h" #include "direction_type.h" #include "track_type.h" #include "transport_type.h" /** The returned bits of VehicleEnterTile. */ enum VehicleEnterTileStatus { VETS_ENTERED_STATION = 1, ///< The vehicle entered a station VETS_ENTERED_WORMHOLE = 2, ///< The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/tunnel) VETS_CANNOT_ENTER = 3, ///< The vehicle cannot enter the tile /** * Shift the VehicleEnterTileStatus this many bits * to the right to get the station ID when * VETS_ENTERED_STATION is set */ VETS_STATION_ID_OFFSET = 8, VETS_STATION_MASK = 0xFFFF << VETS_STATION_ID_OFFSET, /** Bit sets of the above specified bits */ VETSB_CONTINUE = 0, ///< The vehicle can continue normally VETSB_ENTERED_STATION = 1 << VETS_ENTERED_STATION, ///< The vehicle entered a station VETSB_ENTERED_WORMHOLE = 1 << VETS_ENTERED_WORMHOLE, ///< The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/tunnel) VETSB_CANNOT_ENTER = 1 << VETS_CANNOT_ENTER, ///< The vehicle cannot enter the tile }; DECLARE_ENUM_AS_BIT_SET(VehicleEnterTileStatus); /** Tile information, used while rendering the tile */ struct TileInfo { uint x; ///< X position of the tile in unit coordinates uint y; ///< Y position of the tile in unit coordinates Slope tileh; ///< Slope of the tile TileIndex tile; ///< Tile index uint z; ///< Height }; /** Tile description for the 'land area information' tool */ struct TileDesc { StringID str; ///< Description of the tile Owner owner[4]; ///< Name of the owner(s) StringID owner_type[4]; ///< Type of each owner Date build_date; ///< Date of construction of tile contents StringID station_class; ///< Class of station StringID station_name; ///< Type of station within the class const char *grf; ///< newGRF used for the tile contents uint64 dparam[2]; ///< Parameters of the \a str string }; /** * Tile callback function signature for drawing a tile and its contents to the screen * @param ti Information about the tile to draw */ typedef void DrawTileProc(TileInfo *ti); typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y); typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlag flags); /** * Tile callback function signature for obtaining accepted carog of a tile * @param tile Tile queried for its accepted cargo * @param res Storage destination of the cargo accepted */ typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res); /** * Tile callback function signature for obtaining a tile description * @param tile Tile being queried * @param td Storage pointer for returned tile description */ typedef void GetTileDescProc(TileIndex tile, TileDesc *td); /** * Tile callback function signature for getting the possible tracks * that can be taken on a given tile by a given transport. * * The return value contains the existing trackdirs and signal states. * * see track_func.h for usage of TrackStatus. * * @param tile the tile to get the track status from * @param mode the mode of transportation * @param sub_mode used to differentiate between different kinds within the mode * @return the track status information */ typedef TrackStatus GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side); /** * Tile callback function signature for obtaining the produced cargo of a tile. * @param tile Tile being queried * @param b Destination array of produced cargo */ typedef void GetProducedCargoProc(TileIndex tile, CargoID *b); typedef bool ClickTileProc(TileIndex tile); typedef void AnimateTileProc(TileIndex tile); typedef void TileLoopProc(TileIndex tile); typedef void ChangeTileOwnerProc(TileIndex tile, Owner old_owner, Owner new_owner); /** @see VehicleEnterTileStatus to see what the return values mean */ typedef VehicleEnterTileStatus VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y); typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh); /** * Tile callback function signature of the terraforming callback. * * The function is called when a tile is affected by a terraforming operation. * It has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype. * With DC_EXEC in \a flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself). * * @note The terraforming has not yet taken place. So GetTileZ() and GetTileSlope() refer to the landscape before the terraforming operation. * * @param tile The involved tile. * @param flags Command flags passed to the terraform command (DC_EXEC, DC_QUERY_COST, etc.). * @param z_new TileZ after terraforming. * @param tileh_new Slope after terraforming. * @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.) */ typedef CommandCost TerraformTileProc(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new); /** * Set of callback functions for performing tile operations of a given tile type. * @see TileType */ struct TileTypeProcs { DrawTileProc *draw_tile_proc; ///< Called to render the tile and its contents to the screen GetSlopeZProc *get_slope_z_proc; ClearTileProc *clear_tile_proc; GetAcceptedCargoProc *get_accepted_cargo_proc; ///< Return accepted cargo of the tile GetTileDescProc *get_tile_desc_proc; ///< Get a description of a tile (for the 'land area information' tool) GetTileTrackStatusProc *get_tile_track_status_proc; ///< Get available tracks and status of a tile ClickTileProc *click_tile_proc; ///< Called when tile is clicked AnimateTileProc *animate_tile_proc; TileLoopProc *tile_loop_proc; ChangeTileOwnerProc *change_tile_owner_proc; GetProducedCargoProc *get_produced_cargo_proc; ///< Return produced cargo of the tile VehicleEnterTileProc *vehicle_enter_tile_proc; ///< Called when a vehicle enters a tile GetFoundationProc *get_foundation_proc; TerraformTileProc *terraform_tile_proc; ///< Called when a terraforming operation is about to take place }; extern const TileTypeProcs * const _tile_type_procs[16]; TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side = INVALID_DIAGDIR); VehicleEnterTileStatus VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y); void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac); void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner); void AnimateTile(TileIndex tile); bool ClickTile(TileIndex tile); void GetTileDesc(TileIndex tile, TileDesc *td); #endif /* TILE_CMD_H */
7,175
C++
.h
143
48.41958
167
0.751604
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,385
newgrf_townname.h
EnergeticBark_OpenTTD-3DS/src/newgrf_townname.h
/* $Id$ */ /** @file newgrf_townname.h * Header of Action 0F "universal holder" structure and functions */ #ifndef NEWGRF_TOWNNAME_H #define NEWGRF_TOWNNAME_H #include "strings_type.h" struct NamePart { byte prob; ///< The relative probablity of the following name to appear in the bottom 7 bits. union { char *text; ///< If probability bit 7 is clear byte id; ///< If probability bit 7 is set } data; }; struct NamePartList { byte partcount; byte bitstart; byte bitcount; uint16 maxprob; NamePart *parts; }; struct GRFTownName { uint32 grfid; byte nb_gen; byte id[128]; StringID name[128]; byte nbparts[128]; NamePartList *partlist[128]; GRFTownName *next; }; GRFTownName *AddGRFTownName(uint32 grfid); GRFTownName *GetGRFTownName(uint32 grfid); void DelGRFTownName(uint32 grfid); void CleanUpGRFTownNames(); StringID *GetGRFTownNameList(); char *GRFTownNameGenerate(char *buf, uint32 grfid, uint16 gen, uint32 seed, const char *last); uint32 GetGRFTownNameId(int gen); uint16 GetGRFTownNameType(int gen); #endif /* NEWGRF_TOWNNAME_H */
1,080
C++
.h
39
25.948718
98
0.757986
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,386
highscore.h
EnergeticBark_OpenTTD-3DS/src/highscore.h
/* $Id$ */ /** @file highscore.h Declaration of functions and types defined in highscore.h and highscore_gui.h */ #ifndef HIGHSCORE_H #define HIGHSCORE_H #include "stdafx.h" #include "strings_type.h" #include "core/math_func.hpp" #include "company_type.h" struct HighScore { char company[100]; StringID title; ///< NOSAVE, has troubles with changing string-numbers. uint16 score; ///< do NOT change type, will break hs.dat }; extern HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5 void SaveToHighScore(); void LoadFromHighScore(); int8 SaveHighScoreValue(const Company *c); int8 SaveHighScoreValueNetwork(); StringID EndGameGetPerformanceTitleFromValue(uint value); void ShowHighscoreTable(int difficulty, int8 rank); #endif /* HIGHSCORE_H */
785
C++
.h
21
35.904762
102
0.774108
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,387
namegen_func.h
EnergeticBark_OpenTTD-3DS/src/namegen_func.h
/* $Id$ */ /** @file namegen_func.h Town name generator stuff. */ #ifndef NAMEGEN_H #define NAMEGEN_H typedef byte TownNameGenerator(char *buf, uint32 seed, const char *last); extern TownNameGenerator * const _town_name_generators[]; #endif /* NAMEGEN_H */
262
C++
.h
7
35.714286
73
0.74
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,388
autoreplace_gui.h
EnergeticBark_OpenTTD-3DS/src/autoreplace_gui.h
/* $Id$ */ /** @file autoreplace_gui.h Functions related to the autoreplace GUIs*/ #ifndef AUTOREPLACE_GUI_H #define AUTOREPLACE_GUI_H #include "vehicle_type.h" /** * When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists * @param type The type of engine */ void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type); void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g); void ShowReplaceGroupVehicleWindow(GroupID group, VehicleType veh); #endif /* AUTOREPLACE_GUI_H */
556
C++
.h
13
41.153846
118
0.799257
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,389
gfx_type.h
EnergeticBark_OpenTTD-3DS/src/gfx_type.h
/* $Id$ */ /** @file gfx_type.h Types related to the graphics and/or input devices. */ #ifndef GFX_TYPE_H #define GFX_TYPE_H #include "core/endian_type.hpp" #include "core/enum_type.hpp" #include "core/geometry_type.hpp" #include "zoom_type.h" typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colourtables /** Combination of a palette sprite and a 'real' sprite */ struct PalSpriteID { SpriteID sprite; ///< The 'real' sprite SpriteID pal; ///< The palette (use \c PAL_NONE) if not needed) }; typedef int32 CursorID; enum WindowKeyCodes { WKC_SHIFT = 0x8000, WKC_CTRL = 0x4000, WKC_ALT = 0x2000, WKC_META = 0x1000, /* Special ones */ WKC_NONE = 0, WKC_ESC = 1, WKC_BACKSPACE = 2, WKC_INSERT = 3, WKC_DELETE = 4, WKC_PAGEUP = 5, WKC_PAGEDOWN = 6, WKC_END = 7, WKC_HOME = 8, /* Arrow keys */ WKC_LEFT = 9, WKC_UP = 10, WKC_RIGHT = 11, WKC_DOWN = 12, /* Return & tab */ WKC_RETURN = 13, WKC_TAB = 14, /* Space */ WKC_SPACE = 32, /* Function keys */ WKC_F1 = 33, WKC_F2 = 34, WKC_F3 = 35, WKC_F4 = 36, WKC_F5 = 37, WKC_F6 = 38, WKC_F7 = 39, WKC_F8 = 40, WKC_F9 = 41, WKC_F10 = 42, WKC_F11 = 43, WKC_F12 = 44, /* Backquote is the key left of "1" * we only store this key here, no matter what character is really mapped to it * on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) */ WKC_BACKQUOTE = 45, WKC_PAUSE = 46, /* 0-9 are mapped to 48-57 * A-Z are mapped to 65-90 * a-z are mapped to 97-122 */ /* Numerical keyboard */ WKC_NUM_DIV = 138, WKC_NUM_MUL = 139, WKC_NUM_MINUS = 140, WKC_NUM_PLUS = 141, WKC_NUM_ENTER = 142, WKC_NUM_DECIMAL = 143, /* Other keys */ WKC_SLASH = 144, ///< / Forward slash WKC_SEMICOLON = 145, ///< ; Semicolon WKC_EQUALS = 146, ///< = Equals WKC_L_BRACKET = 147, ///< [ Left square bracket WKC_BACKSLASH = 148, ///< \ Backslash WKC_R_BRACKET = 149, ///< ] Right square bracket WKC_SINGLEQUOTE = 150, ///< ' Single quote WKC_COMMA = 151, ///< , Comma WKC_PERIOD = 152, ///< . Period WKC_MINUS = 153, ///< - Minus }; /** A single sprite of a list of animated cursors */ struct AnimCursor { static const CursorID LAST = MAX_UVALUE(CursorID); CursorID sprite; ///< Must be set to LAST_ANIM when it is the last sprite of the loop byte display_time; ///< Amount of ticks this sprite will be shown }; /** Collection of variables for cursor-display and -animation */ struct CursorVars { Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement Point draw_pos, draw_size; ///< position and size bounding-box for drawing int short_vehicle_offset; ///< offset of the X for short vehicles SpriteID sprite; ///< current image of cursor SpriteID pal; int wheel; ///< mouse wheel movement /* We need two different vars to keep track of how far the scrollwheel moved. * OSX uses this for scrolling around the map. */ int v_wheel; int h_wheel; const AnimCursor *animate_list; ///< in case of animated cursor, list of frames const AnimCursor *animate_cur; ///< in case of animated cursor, current frame uint animate_timeout; ///< in case of animated cursor, number of ticks to show the current cursor bool visible; ///< cursor is visible bool dirty; ///< the rect occupied by the mouse is dirty (redraw) bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling) bool in_window; ///< mouse inside this window, determines drawing logic bool vehchain; ///< vehicle chain is dragged }; struct DrawPixelInfo { void *dst_ptr; int left, top, width, height; int pitch; ZoomLevel zoom; }; struct Colour { #if TTD_ENDIAN == TTD_BIG_ENDIAN uint8 a, r, g, b; ///< colour channels in BE order #else uint8 b, g, r, a; ///< colour channels in LE order #endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */ operator uint32 () const { return *(uint32 *)this; } }; /** Available font sizes */ enum FontSize { FS_NORMAL, FS_SMALL, FS_LARGE, FS_END, }; DECLARE_POSTFIX_INCREMENT(FontSize); /** * Used to only draw a part of the sprite. * Draw the subsprite in the rect (sprite_x_offset + left, sprite_y_offset + top) to (sprite_x_offset + right, sprite_y_offset + bottom). * Both corners are included in the drawing area. */ struct SubSprite { int left, top, right, bottom; }; enum Colours { COLOUR_DARK_BLUE, COLOUR_PALE_GREEN, COLOUR_PINK, COLOUR_YELLOW, COLOUR_RED, COLOUR_LIGHT_BLUE, COLOUR_GREEN, COLOUR_DARK_GREEN, COLOUR_BLUE, COLOUR_CREAM, COLOUR_MAUVE, COLOUR_PURPLE, COLOUR_ORANGE, COLOUR_BROWN, COLOUR_GREY, COLOUR_WHITE, COLOUR_END, INVALID_COLOUR = 0xFF, }; /** Colour of the strings, see _string_colourmap in table/palettes.h or docs/ottd-colourtext-palette.png */ enum TextColour { TC_FROMSTRING = 0x00, TC_BLUE = 0x00, TC_SILVER = 0x01, TC_GOLD = 0x02, TC_RED = 0x03, TC_PURPLE = 0x04, TC_LIGHT_BROWN = 0x05, TC_ORANGE = 0x06, TC_GREEN = 0x07, TC_YELLOW = 0x08, TC_DARK_GREEN = 0x09, TC_CREAM = 0x0A, TC_BROWN = 0x0B, TC_WHITE = 0x0C, TC_LIGHT_BLUE = 0x0D, TC_GREY = 0x0E, TC_DARK_BLUE = 0x0F, TC_BLACK = 0x10, TC_INVALID = 0xFF, IS_PALETTE_COLOUR = 0x100, ///< colour value is already a real palette colour index, not an index of a StringColour }; DECLARE_ENUM_AS_BIT_SET(TextColour); /** Defines a few values that are related to animations using palette changes */ enum PaletteAnimationSizes { PALETTE_ANIM_SIZE_WIN = 28, ///< number of animated colours in Windows palette PALETTE_ANIM_SIZE_DOS = 38, ///< number of animated colours in DOS palette PALETTE_ANIM_SIZE_START = 217, ///< Index in the _palettes array from which all animations are taking places (table/palettes.h) }; /** Define the operation GfxFillRect performs */ enum FillRectMode { FILLRECT_OPAQUE, ///< Fill rectangle with a single colour FILLRECT_CHECKER, ///< Draw only every second pixel, used for greying-out FILLRECT_RECOLOUR, ///< Apply a recolour sprite to the screen content }; /** Palettes OpenTTD supports. */ enum PaletteType { PAL_DOS, ///< Use the DOS palette. PAL_WINDOWS, ///< Use the Windows palette. PAL_AUTODETECT, ///< Automatically detect the palette based on the graphics pack. MAX_PAL = 2, ///< The number of palettes. }; /** Types of sprites that might be loaded */ enum SpriteType { ST_NORMAL = 0, ///< The most basic (normal) sprite ST_MAPGEN = 1, ///< Special sprite for the map generator ST_FONT = 2, ///< A sprite used for fonts ST_RECOLOUR = 3, ///< Recolour sprite ST_INVALID = 4, ///< Pseudosprite or other unusable sprite, used only internally }; #endif /* GFX_TYPE_H */
7,034
C++
.h
209
31.717703
137
0.654294
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,391
roadveh.h
EnergeticBark_OpenTTD-3DS/src/roadveh.h
/* $Id$ */ /** @file src/roadveh.h Road vehicle states */ #ifndef ROADVEH_H #define ROADVEH_H #include "vehicle_base.h" #include "engine_func.h" #include "engine_base.h" #include "economy_func.h" /** State information about the Road Vehicle controller */ enum { RDE_NEXT_TILE = 0x80, ///< We should enter the next tile RDE_TURNED = 0x40, ///< We just finished turning /* Start frames for when a vehicle enters a tile/changes its state. * The start frame is different for vehicles that turned around or * are leaving the depot as the do not start at the edge of the tile. * For trams there are a few different start frames as there are two * places where trams can turn. */ RVC_DEFAULT_START_FRAME = 0, RVC_TURN_AROUND_START_FRAME = 1, RVC_DEPOT_START_FRAME = 6, RVC_START_FRAME_AFTER_LONG_TRAM = 21, RVC_TURN_AROUND_START_FRAME_SHORT_TRAM = 16, /* Stop frame for a vehicle in a drive-through stop */ RVC_DRIVE_THROUGH_STOP_FRAME = 7, RVC_DEPOT_STOP_FRAME = 11, }; enum RoadVehicleSubType { RVST_FRONT, RVST_ARTIC_PART, }; static inline bool IsRoadVehFront(const Vehicle *v) { assert(v->type == VEH_ROAD); return v->subtype == RVST_FRONT; } static inline void SetRoadVehFront(Vehicle *v) { assert(v->type == VEH_ROAD); v->subtype = RVST_FRONT; } static inline bool IsRoadVehArticPart(const Vehicle *v) { assert(v->type == VEH_ROAD); return v->subtype == RVST_ARTIC_PART; } static inline void SetRoadVehArticPart(Vehicle *v) { assert(v->type == VEH_ROAD); v->subtype = RVST_ARTIC_PART; } static inline bool RoadVehHasArticPart(const Vehicle *v) { assert(v->type == VEH_ROAD); return v->Next() != NULL && IsRoadVehArticPart(v->Next()); } void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2); byte GetRoadVehLength(const Vehicle *v); void RoadVehUpdateCache(Vehicle *v); /** * This class 'wraps' Vehicle; you do not actually instantiate this class. * You create a Vehicle using AllocateVehicle, so it is added to the pool * and you reinitialize that to a Train using: * v = new (v) RoadVehicle(); * * As side-effect the vehicle type is set correctly. */ struct RoadVehicle : public Vehicle { /** Initializes the Vehicle to a road vehicle */ RoadVehicle() { this->type = VEH_ROAD; } /** We want to 'destruct' the right class. */ virtual ~RoadVehicle() { this->PreDestructor(); } const char *GetTypeString() const { return "road vehicle"; } void MarkDirty(); void UpdateDeltaXY(Direction direction); ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; } bool IsPrimaryVehicle() const { return IsRoadVehFront(this); } SpriteID GetImage(Direction direction) const; int GetDisplaySpeed() const { return this->cur_speed / 2; } int GetDisplayMaxSpeed() const { return this->max_speed / 2; } Money GetRunningCost() const { return RoadVehInfo(this->engine_type)->running_cost * GetPriceByIndex(RoadVehInfo(this->engine_type)->running_cost_class); } bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; } bool IsStoppedInDepot() const; void Tick(); void OnNewDay(); TileIndex GetOrderStationLocation(StationID station); bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse); }; #endif /* ROADVEH_H */
3,376
C++
.h
88
36.488636
156
0.723684
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,392
vehicle_type.h
EnergeticBark_OpenTTD-3DS/src/vehicle_type.h
/* $Id$ */ /** @file vehicle_type.h Types related to vehicles. */ #ifndef VEHICLE_TYPE_H #define VEHICLE_TYPE_H #include "core/enum_type.hpp" typedef uint16 VehicleID; enum VehicleType { VEH_TRAIN, VEH_ROAD, VEH_SHIP, VEH_AIRCRAFT, VEH_EFFECT, VEH_DISASTER, VEH_END, VEH_INVALID = 0xFF, }; DECLARE_POSTFIX_INCREMENT(VehicleType); template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID> {}; typedef TinyEnumT<VehicleType> VehicleTypeByte; struct Vehicle; struct BaseVehicle { VehicleTypeByte type; ///< Type of vehicle /** * Is this vehicle a valid vehicle? * @return true if and only if the vehicle is valid. */ inline bool IsValid() const { return this->type != VEH_INVALID; } }; static const VehicleID INVALID_VEHICLE = 0xFFFF; /** Pathfinding option states */ enum { VPF_OPF = 0, ///< The Original PathFinder VPF_NTP = 0, ///< New Train Pathfinder, replacing OPF for trains VPF_NPF = 1, ///< New PathFinder VPF_YAPF = 2, ///< Yet Another PathFinder }; /* Flags to add to p2 for goto depot commands * Note: bits 8-10 are used for VLW flags */ enum DepotCommand { DEPOT_SERVICE = (1 << 0), ///< The vehicle will leave the depot right after arrival (serivce only) DEPOT_MASS_SEND = (1 << 1), ///< Tells that it's a mass send to depot command (type in VLW flag) DEPOT_DONT_CANCEL = (1 << 2), ///< Don't cancel current goto depot command if any DEPOT_LOCATE_HANGAR = (1 << 3), ///< Find another airport if the target one lacks a hangar DEPOT_COMMAND_MASK = 0xF, }; enum { MAX_LENGTH_VEHICLE_NAME_BYTES = 31, ///< The maximum length of a vehicle name in bytes including '\0' MAX_LENGTH_VEHICLE_NAME_PIXELS = 150, ///< The maximum length of a vehicle name in pixels }; enum TrainAccelerationModel { TAM_ORIGINAL, TAM_REALISTIC, }; #endif /* VEHICLE_TYPE_H */
1,877
C++
.h
55
32.309091
115
0.714602
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,393
news_type.h
EnergeticBark_OpenTTD-3DS/src/news_type.h
/* $Id$ */ /** @file news_type.h Types related to news. */ #ifndef NEWS_TYPE_H #define NEWS_TYPE_H #include "date_type.h" #include "strings_type.h" #include "sound_type.h" /** * Type of news. */ enum NewsType { NT_ARRIVAL_COMPANY, ///< Cargo arrived for company NT_ARRIVAL_OTHER, ///< Cargo arrived for competitor NT_ACCIDENT, ///< An accident or disaster has occurred NT_COMPANY_INFO, ///< Company info (new companies, bankrupcy messages) NT_INDUSTRY_OPEN, ///< Opening of industries NT_INDUSTRY_CLOSE, ///< Closing of industries NT_ECONOMY, ///< Economic changes (recession, industry up/dowm) NT_INDUSTRY_COMPANY,///< Production changes of industry serviced by local company NT_INDUSTRY_OTHER, ///< Production changes of industry serviced by competitor(s) NT_INDUSTRY_NOBODY, ///< Other industry production changes NT_ADVICE, ///< Bits of news about vehicles of the company NT_NEW_VEHICLES, ///< New vehicle has become available NT_ACCEPTANCE, ///< A type of cargo is (no longer) accepted NT_SUBSIDIES, ///< News about subsidies (announcements, expirations, acceptance) NT_GENERAL, ///< General news (from towns) NT_END, ///< end-of-array marker }; /** * News subtypes. */ enum NewsSubtype { NS_ARRIVAL_COMPANY, ///< NT_ARRIVAL_COMPANY NS_ARRIVAL_OTHER, ///< NT_ARRIVAL_OTHER NS_ACCIDENT_TILE, ///< NT_ACCIDENT (tile) NS_ACCIDENT_VEHICLE, ///< NT_ACCIDENT (vehicle) NS_COMPANY_TROUBLE, ///< NT_COMPANY_INFO (trouble) NS_COMPANY_MERGER, ///< NT_COMPANY_INFO (merger) NS_COMPANY_BANKRUPT, ///< NT_COMPANY_INFO (bankrupt) NS_COMPANY_NEW, ///< NT_COMPANY_INFO (new company) NS_INDUSTRY_OPEN, ///< NT_INDUSTRY_OPEN NS_INDUSTRY_CLOSE, ///< NT_INDUSTRY_CLOSE NS_ECONOMY, ///< NT_ECONOMY NS_INDUSTRY_COMPANY, ///< NT_INDUSTRY_COMPANY NS_INDUSTRY_OTHER, ///< NT_INDUSTRY_OTHER NS_INDUSTRY_NOBODY, ///< NT_INDUSTRY_NOBODY NS_ADVICE, ///< NT_ADVICE NS_NEW_VEHICLES, ///< NT_NEW_VEHICLES NS_ACCEPTANCE, ///< NT_ACCEPTANCE NS_SUBSIDIES, ///< NT_SUBSIDIES NS_GENERAL, ///< NT_GENERAL NS_END, ///< end-of-array marker }; /** * News mode. */ enum NewsMode { NM_SMALL = 0, ///< Show only a small popup informing us about vehicle age for example NM_NORMAL = 1, ///< Show a simple news message (height 170 pixels) NM_THIN = 2, ///< Show a simple news message (height 130 pixels) }; /** * Various OR-able news-item flags. * note: NF_INCOLOUR is set automatically if needed */ enum NewsFlag { NF_NONE = 0, ///< No flag is set. NF_VIEWPORT = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening) NF_TILE = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a NF_VEHICLE = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a NF_INCOLOUR = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white NF_TILE2 = (1 << 6), ///< There is a second tile to scroll to; tile is in data_b }; DECLARE_ENUM_AS_BIT_SET(NewsFlag); /** * News display options */ enum NewsDisplay { ND_OFF, ///< Only show a reminder in the status bar ND_SUMMARY, ///< Show ticker ND_FULL, ///< Show newspaper }; /** * Per-NewsType data */ struct NewsTypeData { const char * const name; ///< Name const byte age; ///< Maximum age of news items (in days) const SoundFx sound; ///< Sound NewsDisplay display; ///< Display mode (off, summary, full) }; struct NewsItem { NewsItem *prev; ///< Previous news item NewsItem *next; ///< Next news item StringID string_id; ///< Message text Date date; ///< Date of the news NewsSubtype subtype; ///< News subtype @see NewsSubtype NewsFlag flags; ///< NewsFlags bits @see NewsFlag uint data_a; ///< Custom data 1 (usually tile or vehicle) uint data_b; ///< Custom data 2 void *free_data; ///< Data to be freed when the news item has reached it's end. uint64 params[10]; }; /** * Data that needs to be stored for company news messages. * The problem with company news messages are the custom name * of the companies and the fact that the company data is reset, * resulting in wrong names and such. */ struct CompanyNewsInformation { char company_name[64]; ///< The name of the company char president_name[64]; ///< The name of the president char other_company_name[64]; ///< The name of the company taking over this one uint32 face; ///< The face of the president byte colour; ///< The colour related to the company void FillData(const struct Company *c, const struct Company *other = NULL); }; #endif /* NEWS_TYPE_H */
4,824
C++
.h
118
39
105
0.663183
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,394
water_map.h
EnergeticBark_OpenTTD-3DS/src/water_map.h
/* $Id$ */ /** @file water_map.h Map accessors for water tiles. */ #ifndef WATER_MAP_H #define WATER_MAP_H enum WaterTileType { WATER_TILE_CLEAR, WATER_TILE_COAST, WATER_TILE_LOCK, WATER_TILE_DEPOT, }; enum WaterClass { WATER_CLASS_SEA, WATER_CLASS_CANAL, WATER_CLASS_RIVER, WATER_CLASS_INVALID, ///< Used for industry tiles on land (also for oilrig if newgrf says so) }; enum DepotPart { DEPOT_NORTH = 0x80, DEPOT_SOUTH = 0x81, DEPOT_END = 0x84, }; enum LockPart { LOCK_MIDDLE = 0x10, LOCK_LOWER = 0x14, LOCK_UPPER = 0x18, LOCK_END = 0x1C }; static inline WaterTileType GetWaterTileType(TileIndex t) { assert(IsTileType(t, MP_WATER)); if (_m[t].m5 == 0) return WATER_TILE_CLEAR; if (_m[t].m5 == 1) return WATER_TILE_COAST; if (IsInsideMM(_m[t].m5, LOCK_MIDDLE, LOCK_END)) return WATER_TILE_LOCK; assert(IsInsideMM(_m[t].m5, DEPOT_NORTH, DEPOT_END)); return WATER_TILE_DEPOT; } static inline WaterClass GetWaterClass(TileIndex t) { assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY)); return (WaterClass)(IsTileType(t, MP_INDUSTRY) ? GB(_m[t].m1, 5, 2) : GB(_m[t].m3, 0, 2)); } static inline void SetWaterClass(TileIndex t, WaterClass wc) { assert(IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY)); if (IsTileType(t, MP_INDUSTRY)) { SB(_m[t].m1, 5, 2, wc); } else { SB(_m[t].m3, 0, 2, wc); } } /** IsWater return true if any type of clear water like ocean, river, canal */ static inline bool IsWater(TileIndex t) { return GetWaterTileType(t) == WATER_TILE_CLEAR; } static inline bool IsSea(TileIndex t) { return IsWater(t) && GetWaterClass(t) == WATER_CLASS_SEA; } static inline bool IsCanal(TileIndex t) { return IsWater(t) && GetWaterClass(t) == WATER_CLASS_CANAL; } static inline bool IsRiver(TileIndex t) { return IsWater(t) && GetWaterClass(t) == WATER_CLASS_RIVER; } static inline bool IsWaterTile(TileIndex t) { return IsTileType(t, MP_WATER) && IsWater(t); } static inline bool IsCoast(TileIndex t) { return GetWaterTileType(t) == WATER_TILE_COAST; } static inline TileIndex GetOtherShipDepotTile(TileIndex t) { return t + (HasBit(_m[t].m5, 0) ? -1 : 1) * (HasBit(_m[t].m5, 1) ? TileDiffXY(0, 1) : TileDiffXY(1, 0)); } static inline bool IsShipDepot(TileIndex t) { return IsInsideMM(_m[t].m5, DEPOT_NORTH, DEPOT_END); } static inline bool IsShipDepotTile(TileIndex t) { return IsTileType(t, MP_WATER) && IsShipDepot(t); } static inline Axis GetShipDepotAxis(TileIndex t) { return (Axis)GB(_m[t].m5, 1, 1); } static inline DiagDirection GetShipDepotDirection(TileIndex t) { return XYNSToDiagDir(GetShipDepotAxis(t), GB(_m[t].m5, 0, 1)); } static inline bool IsLock(TileIndex t) { return IsInsideMM(_m[t].m5, LOCK_MIDDLE, LOCK_END); } static inline DiagDirection GetLockDirection(TileIndex t) { return (DiagDirection)GB(_m[t].m5, 0, 2); } static inline byte GetSection(TileIndex t) { assert(GetWaterTileType(t) == WATER_TILE_LOCK || GetWaterTileType(t) == WATER_TILE_DEPOT); return GB(_m[t].m5, 0, 4); } static inline byte GetWaterTileRandomBits(TileIndex t) { return _m[t].m4; } static inline void MakeWater(TileIndex t) { SetTileType(t, MP_WATER); SetTileOwner(t, OWNER_WATER); _m[t].m2 = 0; _m[t].m3 = WATER_CLASS_SEA; _m[t].m4 = 0; _m[t].m5 = 0; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } static inline void MakeShore(TileIndex t) { SetTileType(t, MP_WATER); SetTileOwner(t, OWNER_WATER); _m[t].m2 = 0; _m[t].m3 = 0; _m[t].m4 = 0; _m[t].m5 = 1; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } static inline void MakeRiver(TileIndex t, uint8 random_bits) { SetTileType(t, MP_WATER); SetTileOwner(t, OWNER_WATER); _m[t].m2 = 0; _m[t].m3 = WATER_CLASS_RIVER; _m[t].m4 = random_bits; _m[t].m5 = 0; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } static inline void MakeCanal(TileIndex t, Owner o, uint8 random_bits) { assert(o != OWNER_WATER); SetTileType(t, MP_WATER); SetTileOwner(t, o); _m[t].m2 = 0; _m[t].m3 = WATER_CLASS_CANAL; _m[t].m4 = random_bits; _m[t].m5 = 0; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } static inline void MakeShipDepot(TileIndex t, Owner o, DepotPart base, Axis a, WaterClass original_water_class) { SetTileType(t, MP_WATER); SetTileOwner(t, o); _m[t].m2 = 0; _m[t].m3 = original_water_class; _m[t].m4 = 0; _m[t].m5 = base + a * 2; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } static inline void MakeLockTile(TileIndex t, Owner o, byte section, WaterClass original_water_class) { SetTileType(t, MP_WATER); SetTileOwner(t, o); _m[t].m2 = 0; _m[t].m3 = original_water_class; _m[t].m4 = 0; _m[t].m5 = section; SB(_m[t].m6, 2, 4, 0); _me[t].m7 = 0; } static inline void MakeLock(TileIndex t, Owner o, DiagDirection d, WaterClass wc_lower, WaterClass wc_upper) { TileIndexDiff delta = TileOffsByDiagDir(d); MakeLockTile(t, o, LOCK_MIDDLE + d, WATER_CLASS_CANAL); MakeLockTile(t - delta, o, LOCK_LOWER + d, wc_lower); MakeLockTile(t + delta, o, LOCK_UPPER + d, wc_upper); } #endif /* WATER_MAP_H */
5,017
C++
.h
187
25.101604
111
0.69587
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,395
string_func.h
EnergeticBark_OpenTTD-3DS/src/string_func.h
/* $Id$ */ /** @file string_func.h Functions related to low-level strings. * * @note Be aware of "dangerous" string functions; string functions that * have behaviour that could easily cause buffer overruns and such: * - strncpy: does not '\0' terminate when input string is longer than * the size of the output string. Use strecpy instead. * - [v]snprintf: returns the length of the string as it would be written * when the output is large enough, so it can be more than the size of * the buffer and than can underflow size_t (uint-ish) which makes all * subsequent snprintf alikes write outside of the buffer. Use * [v]seprintf instead; it will return the number of bytes actually * added so no [v]seprintf will cause outside of bounds writes. * - [v]sprintf: does not bounds checking: use [v]seprintf instead. */ #ifndef STRING_FUNC_H #define STRING_FUNC_H #include "core/bitmath_func.hpp" #include "string_type.h" /** * Appends characters from one string to another. * * Appends the source string to the destination string with respect of the * terminating null-character and the maximum size of the destination * buffer. * * @note usage ttd_strlcat(dst, src, lengthof(dst)); * @note lengthof() applies only to fixed size arrays * * @param dst The buffer containing the target string * @param src The buffer containing the string to append * @param size The maximum size of the destination buffer */ void ttd_strlcat(char *dst, const char *src, size_t size); /** * Copies characters from one buffer to another. * * Copies the source string to the destination buffer with respect of the * terminating null-character and the maximum size of the destination * buffer. * * @note usage ttd_strlcpy(dst, src, lengthof(dst)); * @note lengthof() applies only to fixed size arrays * * @param dst The destination buffer * @param src The buffer containing the string to copy * @param size The maximum size of the destination buffer */ void ttd_strlcpy(char *dst, const char *src, size_t size); /** * Appends characters from one string to another. * * Appends the source string to the destination string with respect of the * terminating null-character and and the last pointer to the last element * in the destination buffer. If the last pointer is set to NULL no * boundary check is performed. * * @note usage: strecat(dst, src, lastof(dst)); * @note lastof() applies only to fixed size arrays * * @param dst The buffer containing the target string * @param src The buffer containing the string to append * @param last The pointer to the last element of the destination buffer * @return The pointer to the terminating null-character in the destination buffer */ char *strecat(char *dst, const char *src, const char *last); /** * Copies characters from one buffer to another. * * Copies the source string to the destination buffer with respect of the * terminating null-character and the last pointer to the last element in * the destination buffer. If the last pointer is set to NULL no boundary * check is performed. * * @note usage: strecpy(dst, src, lastof(dst)); * @note lastof() applies only to fixed size arrays * * @param dst The destination buffer * @param src The buffer containing the string to copy * @param last The pointer to the last element of the destination buffer * @return The pointer to the terminating null-character in the destination buffer */ char *strecpy(char *dst, const char *src, const char *last); int CDECL seprintf(char *str, const char *last, const char *format, ...); char *CDECL str_fmt(const char *str, ...); /** * Scans the string for valid characters and if it finds invalid ones, * replaces them with a question mark '?' (if not ignored) * @param str the string to validate * @param last the last valid character of str * @param allow_newlines whether newlines should be allowed or ignored * @param ignore whether to ignore or replace with a question mark */ void str_validate(char *str, const char *last, bool allow_newlines = false, bool ignore = false); /** Scans the string for colour codes and strips them */ void str_strip_colours(char *str); /** Convert the given string to lowercase, only works with ASCII! */ void strtolower(char *str); /** * Check if a string buffer is empty. * * @param s The pointer to the firste element of the buffer * @return true if the buffer starts with the terminating null-character or * if the given pointer points to NULL else return false */ static inline bool StrEmpty(const char *s) { return s == NULL || s[0] == '\0'; } /** * Get the length of a string, within a limited buffer. * * @param str The pointer to the firste element of the buffer * @param maxlen The maximum size of the buffer * @return The length of the string */ static inline size_t ttd_strnlen(const char *str, size_t maxlen) { const char *t; for (t = str; (size_t)(t - str) < maxlen && *t != '\0'; t++) {} return t - str; } /** Convert the md5sum number to a 'hexadecimal' string, return next pos in buffer */ char *md5sumToString(char *buf, const char *last, const uint8 md5sum[16]); /** * Only allow certain keys. You can define the filter to be used. This makes * sure no invalid keys can get into an editbox, like BELL. * @param key character to be checked * @param afilter the filter to use * @return true or false depending if the character is printable/valid or not */ bool IsValidChar(WChar key, CharSetFilter afilter); size_t Utf8Decode(WChar *c, const char *s); size_t Utf8Encode(char *buf, WChar c); size_t Utf8TrimString(char *s, size_t maxlen); static inline WChar Utf8Consume(const char **s) { WChar c; *s += Utf8Decode(&c, *s); return c; } /** Return the length of a UTF-8 encoded character. * @param c Unicode character. * @return Length of UTF-8 encoding for character. */ static inline int8 Utf8CharLen(WChar c) { if (c < 0x80) return 1; if (c < 0x800) return 2; if (c < 0x10000) return 3; if (c < 0x110000) return 4; /* Invalid valid, we encode as a '?' */ return 1; } /** * Return the length of an UTF-8 encoded value based on a single char. This * char should be the first byte of the UTF-8 encoding. If not, or encoding * is invalid, return value is 0 * @param c char to query length of * @return requested size */ static inline int8 Utf8EncodedCharLen(char c) { if (GB(c, 3, 5) == 0x1E) return 4; if (GB(c, 4, 4) == 0x0E) return 3; if (GB(c, 5, 3) == 0x06) return 2; if (GB(c, 7, 1) == 0x00) return 1; /* Invalid UTF8 start encoding */ return 0; } /* Check if the given character is part of a UTF8 sequence */ static inline bool IsUtf8Part(char c) { return GB(c, 6, 2) == 2; } /** * Retrieve the previous UNICODE character in an UTF-8 encoded string. * @param s char pointer pointing to (the first char of) the next character * @return a pointer in 's' to the previous UNICODE character's first byte * @note The function should not be used to determine the length of the previous * encoded char because it might be an invalid/corrupt start-sequence */ static inline char *Utf8PrevChar(const char *s) { const char *ret = s; while (IsUtf8Part(*--ret)) {} return (char*)ret; } static inline bool IsPrintable(WChar c) { if (c < 0x20) return false; if (c < 0xE000) return true; if (c < 0xE200) return false; return true; } /** * Check whether UNICODE character is whitespace or not, i.e. whether * this is a potential line-break character. * @param c UNICODE character to check * @return a boolean value whether 'c' is a whitespace character or not * @see http://www.fileformat.info/info/unicode/category/Zs/list.htm */ static inline bool IsWhitespace(WChar c) { return c == 0x0020 /* SPACE */ || c == 0x3000 /* IDEOGRAPHIC SPACE */ ; } #ifndef _GNU_SOURCE /* strndup is a GNU extension */ char *strndup(const char *s, size_t len); #endif /* !_GNU_SOURCE */ /* strcasestr is available for _GNU_SOURCE, BSD and some Apple */ #if defined(_GNU_SOURCE) || (defined(__BSD_VISIBLE) && __BSD_VISIBLE) || (defined(__APPLE__) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))) # undef DEFINE_STRCASESTR #else # define DEFINE_STRCASESTR const char *strcasestr(const char *haystack, const char *needle); #endif /* strcasestr is available */ #endif /* STRING_FUNC_H */
8,350
C++
.h
221
35.950226
153
0.729957
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,396
station_type.h
EnergeticBark_OpenTTD-3DS/src/station_type.h
/* $Id$ */ /** @file station_type.h Types related to stations. */ #ifndef STATION_TYPE_H #define STATION_TYPE_H typedef uint16 StationID; typedef uint16 RoadStopID; struct Station; struct RoadStop; struct StationSpec; static const StationID INVALID_STATION = 0xFFFF; /** Station types */ enum StationType { STATION_RAIL, STATION_AIRPORT, STATION_TRUCK, STATION_BUS, STATION_OILRIG, STATION_DOCK, STATION_BUOY }; /** Types of RoadStops */ enum RoadStopType { ROADSTOP_BUS, ///< A standard stop for buses ROADSTOP_TRUCK ///< A standard stop for trucks }; enum { FACIL_TRAIN = 0x01, FACIL_TRUCK_STOP = 0x02, FACIL_BUS_STOP = 0x04, FACIL_AIRPORT = 0x08, FACIL_DOCK = 0x10, }; enum { // HVOT_PENDING_DELETE = 1 << 0, // not needed anymore HVOT_TRAIN = 1 << 1, HVOT_BUS = 1 << 2, HVOT_TRUCK = 1 << 3, HVOT_AIRCRAFT = 1 << 4, HVOT_SHIP = 1 << 5, /* This bit is used to mark stations. No, it does not belong here, but what * can we do? ;-) */ HVOT_BUOY = 1 << 6 }; enum CatchmentArea { CA_NONE = 0, CA_BUS = 3, CA_TRUCK = 3, CA_TRAIN = 4, CA_DOCK = 5, CA_UNMODIFIED = 4, ///< Used when _settings_game.station.modified_catchment is false MAX_CATCHMENT = 10, ///< Airports have a catchment up to this number. }; enum { MAX_LENGTH_STATION_NAME_BYTES = 31, ///< The maximum length of a station name in bytes including '\0' MAX_LENGTH_STATION_NAME_PIXELS = 180, ///< The maximum length of a station name in pixels }; #endif /* STATION_TYPE_H */
1,590
C++
.h
57
26.087719
104
0.651086
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,397
cargopacket.h
EnergeticBark_OpenTTD-3DS/src/cargopacket.h
/* $Id$ */ /** @file cargopacket.h Base class for cargo packets. */ #ifndef CARGOPACKET_H #define CARGOPACKET_H #include "oldpool.h" #include "economy_type.h" #include "tile_type.h" #include "station_type.h" #include <list> typedef uint32 CargoPacketID; struct CargoPacket; /** We want to use a pool */ DECLARE_OLD_POOL(CargoPacket, CargoPacket, 10, 1000) /** * Container for cargo from the same location and time */ struct CargoPacket : PoolItem<CargoPacket, CargoPacketID, &_CargoPacket_pool> { Money feeder_share; ///< Value of feeder pickup to be paid for on delivery of cargo TileIndex source_xy; ///< The origin of the cargo (first station in feeder chain) TileIndex loaded_at_xy; ///< Location where this cargo has been loaded into the vehicle StationID source; ///< The station where the cargo came from first uint16 count; ///< The amount of cargo in this packet byte days_in_transit; ///< Amount of days this packet has been in transit bool paid_for; ///< Have we been paid for this cargo packet? /** * Creates a new cargo packet * @param source the source of the packet * @param count the number of cargo entities to put in this packet * @pre count != 0 || source == INVALID_STATION */ CargoPacket(StationID source = INVALID_STATION, uint16 count = 0); /** Destroy the packet */ virtual ~CargoPacket(); /** * Is this a valid cargo packet ? * @return true if and only it is valid */ inline bool IsValid() const { return this->count != 0; } /** * Checks whether the cargo packet is from (exactly) the same source * in time and location. * @param cp the cargo packet to compare to * @return true if and only if days_in_transit and source_xy are equal */ bool SameSource(const CargoPacket *cp) const; }; /** * Iterate over all _valid_ cargo packets from the given start * @param cp the variable used as "iterator" * @param start the cargo packet ID of the first packet to iterate over */ #define FOR_ALL_CARGOPACKETS_FROM(cp, start) for (cp = GetCargoPacket(start); cp != NULL; cp = (cp->index + 1U < GetCargoPacketPoolSize()) ? GetCargoPacket(cp->index + 1U) : NULL) if (cp->IsValid()) /** * Iterate over all _valid_ cargo packets from the begin of the pool * @param cp the variable used as "iterator" */ #define FOR_ALL_CARGOPACKETS(cp) FOR_ALL_CARGOPACKETS_FROM(cp, 0) extern void SaveLoad_STNS(Station *st); /** * Simple collection class for a list of cargo packets */ class CargoList { public: /** List of cargo packets */ typedef std::list<CargoPacket *> List; /** Kind of actions that could be done with packets on move */ enum MoveToAction { MTA_FINAL_DELIVERY, ///< "Deliver" the packet to the final destination, i.e. destroy the packet MTA_CARGO_LOAD, ///< Load the packet onto a vehicle, i.e. set the last loaded station ID MTA_OTHER ///< "Just" move the packet to another cargo list }; private: List packets; ///< The cargo packets in this list bool empty; ///< Cache for whether this list is empty or not uint count; ///< Cache for the number of cargo entities bool unpaid_cargo; ///< Cache for the unpaid cargo Money feeder_share; ///< Cache for the feeder share StationID source; ///< Cache for the source of the packet uint days_in_transit; ///< Cache for the number of days in transit public: friend void SaveLoad_STNS(Station *st); /** Create the cargo list */ CargoList() { this->InvalidateCache(); } /** And destroy it ("frees" all cargo packets) */ ~CargoList(); /** * Returns a pointer to the cargo packet list (so you can iterate over it etc). * @return pointer to the packet list */ const CargoList::List *Packets() const; /** * Ages the all cargo in this list */ void AgeCargo(); /** * Checks whether this list is empty * @return true if and only if the list is empty */ bool Empty() const; /** * Returns the number of cargo entities in this list * @return the before mentioned number */ uint Count() const; /** * Is there some cargo that has not been paid for? * @return true if and only if there is such a cargo */ bool UnpaidCargo() const; /** * Returns total sum of the feeder share for all packets * @return the before mentioned number */ Money FeederShare() const; /** * Returns source of the first cargo packet in this list * @return the before mentioned source */ StationID Source() const; /** * Returns average number of days in transit for a cargo entity * @return the before mentioned number */ uint DaysInTransit() const; /** * Appends the given cargo packet * @warning After appending this packet may not exist anymore! * @note Do not use the cargo packet anymore after it has been appended to this CargoList! * @param cp the cargo packet to add * @pre cp != NULL */ void Append(CargoPacket *cp); /** * Truncates the cargo in this list to the given amount. It leaves the * first count cargo entities and removes the rest. * @param count the maximum amount of entities to be in the list after the command */ void Truncate(uint count); /** * Moves the given amount of cargo to another list. * Depending on the value of mta the side effects of this function differ: * - MTA_FINAL_DELIVERY: destroys the packets that do not originate from a specific station * - MTA_CARGO_LOAD: sets the loaded_at_xy value of the moved packets * - MTA_OTHER: just move without side effects * @param dest the destination to move the cargo to * @param count the amount of cargo entities to move * @param mta how to handle the moving (side effects) * @param data Depending on mta the data of this variable differs: * - MTA_FINAL_DELIVERY - station ID of packet's origin not to remove * - MTA_CARGO_LOAD - station's tile index of load * - MTA_OTHER - unused * @param mta == MTA_FINAL_DELIVERY || dest != NULL * @return true if there are still packets that might be moved from this cargo list */ bool MoveTo(CargoList *dest, uint count, CargoList::MoveToAction mta = MTA_OTHER, uint data = 0); /** Invalidates the cached data and rebuild it */ void InvalidateCache(); }; #endif /* CARGOPACKET_H */
6,312
C++
.h
159
37.245283
198
0.702959
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,398
road_cmd.h
EnergeticBark_OpenTTD-3DS/src/road_cmd.h
/* $Id$ */ /** @file road_cmd.h Road related functions. */ #ifndef ROAD_CMD_H #define ROAD_CMD_H #include "direction_type.h" void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt); void UpdateNearestTownForRoadTiles(bool invalidate); #endif /* ROAD_CMD_H */
279
C++
.h
8
33.25
71
0.75188
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,399
date_func.h
EnergeticBark_OpenTTD-3DS/src/date_func.h
/* $Id$ */ /** @file date_func.h Functions related to dates. */ #ifndef DATE_FUNC_H #define DATE_FUNC_H #include "date_type.h" extern Year _cur_year; extern Month _cur_month; extern Date _date; extern DateFract _date_fract; void SetDate(Date date); void ConvertDateToYMD(Date date, YearMonthDay *ymd); Date ConvertYMDToDate(Year year, Month month, Day day); static inline bool IsLeapYear(Year yr) { return yr % 4 == 0 && (yr % 100 != 0 || yr % 400 == 0); } #endif /* DATE_FUNC_H */
504
C++
.h
17
28.176471
56
0.691667
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,400
tilehighlight_type.h
EnergeticBark_OpenTTD-3DS/src/tilehighlight_type.h
/* $Id$ */ /** @file tilehighlight_type.h Types related to highlighting tiles. */ #ifndef TILEHIGHLIGHT_TYPE_H #define TILEHIGHLIGHT_TYPE_H #include "core/geometry_type.hpp" #include "zoom_type.h" #include "window_type.h" #include "tile_type.h" /** Viewport highlight mode (for highlighting tiles below cursor) */ enum ViewportHighlightMode { VHM_NONE = 0, ///< default VHM_RECT = 1, ///< rectangle (stations, depots, ...) VHM_POINT = 2, ///< point (lower land, raise land, level land, ...) VHM_SPECIAL = 3, ///< special mode used for highlighting while dragging (and for tunnels/docks) VHM_DRAG = 4, ///< dragging items in the depot windows VHM_RAIL = 5, ///< rail pieces }; /** Highlighting draw styles */ enum HighLightStyle { HT_NONE = 0x00, HT_RECT = 0x80, HT_POINT = 0x40, HT_LINE = 0x20, ///< used for autorail highlighting (longer streches) ///< (uses lower bits to indicate direction) HT_RAIL = 0x10, ///< autorail (one piece) ///< (uses lower bits to indicate direction) HT_DRAG_MASK = 0xF0, ///< masks the drag-type /* lower bits (used with HT_LINE and HT_RAIL): * (see ASCII art in autorail.h for a visual interpretation) */ HT_DIR_X = 0, ///< X direction HT_DIR_Y = 1, ///< Y direction HT_DIR_HU = 2, ///< horizontal upper HT_DIR_HL = 3, ///< horizontal lower HT_DIR_VL = 4, ///< vertical left HT_DIR_VR = 5, ///< vertical right HT_DIR_MASK = 0x7 ///< masks the drag-direction }; DECLARE_ENUM_AS_BIT_SET(HighLightStyle); struct TileHighlightData { Point size; Point outersize; Point pos; Point offs; Point new_pos; Point new_size; Point new_outersize; Point selend, selstart; byte dirty; byte sizelimit; byte drawstyle; // lower bits 0-3 are reserved for detailed highlight information information byte new_drawstyle; // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new byte next_drawstyle; // queued, but not yet drawn style ViewportHighlightMode place_mode; bool make_square_red; WindowClass window_class; WindowNumber window_number; ViewportPlaceMethod select_method; ViewportDragDropSelectionProcess select_proc; TileIndex redsq; }; #endif /* TILEHIGHLIGHT_TYPE_H */
2,295
C++
.h
61
34.95082
127
0.695221
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,401
depot_type.h
EnergeticBark_OpenTTD-3DS/src/depot_type.h
/* $Id$ */ /** @file depot_type.h Header files for depots (not hangars) */ #ifndef DEPOT_TYPE_H #define DEPOT_TYPE_H typedef uint16 DepotID; struct Depot; #endif /* DEPOT_TYPE_H */
185
C++
.h
7
24.857143
63
0.712644
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,402
news_gui.h
EnergeticBark_OpenTTD-3DS/src/news_gui.h
/* $Id$ */ /** @file news_gui.h GUI functions related to the news. */ #ifndef NEWS_GUI_H #define NEWS_GUI_H void ShowLastNewsMessage(); void ShowMessageOptions(); void ShowMessageHistory(); #endif /* NEWS_GUI_H */
218
C++
.h
8
25.75
58
0.728155
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,403
heightmap.h
EnergeticBark_OpenTTD-3DS/src/heightmap.h
/* $Id$ */ /** @file heightmap.h Functions related to creating heightmaps from files. */ #ifndef HEIGHTMAP_H #define HEIGHTMAP_H /* * Order of these enums has to be the same as in lang/english.txt * Otherwise you will get inconsistent behaviour. */ enum { HM_COUNTER_CLOCKWISE, ///< Rotate the map counter clockwise 45 degrees HM_CLOCKWISE, ///< Rotate the map clockwise 45 degrees }; /** * Get the dimensions of a heightmap. * @param filename to query * @param x dimension x * @param y dimension y * @return Returns false if loading of the image failed. */ bool GetHeightmapDimensions(char *filename, uint *x, uint *y); /** * Load a heightmap from file and change the map in his current dimensions * to a landscape representing the heightmap. * It converts pixels to height. The brighter, the higher. * @param filename of the heighmap file to be imported */ void LoadHeightmap(char *filename); /** * Make an empty world where all tiles are of height 'tile_height'. * @param tile_height of the desired new empty world */ void FlatEmptyWorld(byte tile_height); /** * This function takes care of the fact that land in OpenTTD can never differ * more than 1 in height */ void FixSlopes(); #endif /* HEIGHTMAP_H */
1,250
C++
.h
38
31.105263
77
0.740033
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,404
road_func.h
EnergeticBark_OpenTTD-3DS/src/road_func.h
/* $Id$ */ /** @file road_func.h Functions related to roads. */ #ifndef ROAD_FUNC_H #define ROAD_FUNC_H #include "core/bitmath_func.hpp" #include "road_type.h" #include "direction_func.h" #include "company_type.h" /** * Whether the given roadtype is valid. * @param rt the roadtype to check for validness * @return true if and only if valid */ static inline bool IsValidRoadType(RoadType rt) { return rt == ROADTYPE_ROAD || rt == ROADTYPE_TRAM; } /** * Are the given bits pointing to valid roadtypes? * @param rts the roadtypes to check for validness * @return true if and only if valid */ static inline bool AreValidRoadTypes(RoadTypes rts) { return HasBit(rts, ROADTYPE_ROAD) || HasBit(rts, ROADTYPE_TRAM); } /** * Maps a RoadType to the corresponding RoadTypes value * * @param rt the roadtype to get the roadtypes from * @return the roadtypes with the given roadtype */ static inline RoadTypes RoadTypeToRoadTypes(RoadType rt) { return (RoadTypes)(1 << rt); } /** * Returns the RoadTypes which are not present in the given RoadTypes * * This function returns the complement of a given RoadTypes. * * @param r The given RoadTypes * @return The complement of the given RoadTypes * @note The unused value ROADTYPES_HWAY will be used, too. */ static inline RoadTypes ComplementRoadTypes(RoadTypes r) { return (RoadTypes)(ROADTYPES_ALL ^ r); } /** * Calculate the complement of a RoadBits value * * Simply flips all bits in the RoadBits value to get the complement * of the RoadBits. * * @param r The given RoadBits value * @return the complement */ static inline RoadBits ComplementRoadBits(RoadBits r) { return (RoadBits)(ROAD_ALL ^ r); } /** * Calculate the mirrored RoadBits * * Simply move the bits to their new position. * * @param r The given RoadBits value * @return the mirrored */ static inline RoadBits MirrorRoadBits(RoadBits r) { return (RoadBits)(GB(r, 0, 2) << 2 | GB(r, 2, 2)); } /** * Calculate rotated RoadBits * * Move the Roadbits clockwise til they are in their final position. * * @param r The given RoadBits value * @param rot The given Rotation angle * @return the rotated */ static inline RoadBits RotateRoadBits(RoadBits r, DiagDirDiff rot) { for (; rot > (DiagDirDiff)0; rot--){ r = (RoadBits)(GB(r, 0, 1) << 3 | GB(r, 1, 3)); } return r; } /** * Check if we've got a straight road * * @param r The given RoadBits * @return true if we've got a straight road */ static inline bool IsStraightRoad(RoadBits r) { return (r == ROAD_X || r == ROAD_Y); } /** * Create the road-part which belongs to the given DiagDirection * * This function returns a RoadBits value which belongs to * the given DiagDirection. * * @param d The DiagDirection * @return The result RoadBits which the selected road-part set */ static inline RoadBits DiagDirToRoadBits(DiagDirection d) { return (RoadBits)(ROAD_NW << (3 ^ d)); } /** * Create the road-part which belongs to the given Axis * * This function returns a RoadBits value which belongs to * the given Axis. * * @param a The Axis * @return The result RoadBits which the selected road-part set */ static inline RoadBits AxisToRoadBits(Axis a) { return a == AXIS_X ? ROAD_X : ROAD_Y; } /** * Finds out, whether given company has all given RoadTypes available * @param company ID of company * @param rts RoadTypes to test * @return true if company has all requested RoadTypes available */ bool HasRoadTypesAvail(const CompanyID company, const RoadTypes rts); /** * Validate functions for rail building. * @param rt road type to check. * @return true if the current company may build the road. */ bool ValParamRoadType(const RoadType rt); /** * Get the road types the given company can build. * @param company the company to get the roadtypes for. * @return the road types. */ RoadTypes GetCompanyRoadtypes(const CompanyID company); void UpdateLevelCrossing(TileIndex tile, bool sound = true); #endif /* ROAD_FUNC_H */
3,982
C++
.h
147
25.333333
69
0.740828
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,406
unmovable.h
EnergeticBark_OpenTTD-3DS/src/unmovable.h
/* $Id$ */ /** @file unmovable.h Functions related to unmovable objects. */ #ifndef UNMOVABLE_H #define UNMOVABLE_H #include "unmovable_map.h" #include "economy_type.h" #include "economy_func.h" void UpdateCompanyHQ(Company *c, uint score); struct UnmovableSpec { StringID name; uint8 buy_cost_multiplier; uint8 sell_cost_multiplier; Money GetRemovalCost() const { return (_price.clear_roughland * this->sell_cost_multiplier); } Money GetBuildingCost() const { return (_price.clear_roughland * this->buy_cost_multiplier); } }; #endif /* UNMOVABLE_H */
566
C++
.h
16
33.5
95
0.756007
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,407
stdafx.h
EnergeticBark_OpenTTD-3DS/src/stdafx.h
/* $Id$ */ /** @file stdafx.h Definition of base types and functions in a cross-platform compatible way. */ #ifndef STDAFX_H #define STDAFX_H #if defined(__NDS__) #include <nds/jtypes.h> /* NDS' types for uint32/int32 are based on longs, which causes * trouble all over the place in OpenTTD. */ #define uint32 uint32_ugly_hack #define int32 int32_ugly_hack typedef unsigned int uint32_ugly_hack; typedef signed int int32_ugly_hack; #endif /* __NDS__ */ /* It seems that we need to include stdint.h before anything else * We need INT64_MAX, which for most systems comes from stdint.h. However, MSVC * does not have stdint.h and apparently neither does MorphOS, so define * INT64_MAX for them ourselves. * Sometimes OSX headers manages to include stdint.h before this but without * __STDC_LIMIT_MACROS so it will be without INT64_*. We need to define those * too if this is the case. */ #if !defined(_MSC_VER) && !defined( __MORPHOS__) && !defined(_STDINT_H_) #if defined(SUNOS) /* SunOS/Solaris does not have stdint.h, but inttypes.h defines everything * stdint.h defines and we need. */ #include <inttypes.h> # else #define __STDC_LIMIT_MACROS #include <stdint.h> #endif #else #define UINT64_MAX (18446744073709551615ULL) #define INT64_MAX (9223372036854775807LL) #define INT64_MIN (-INT64_MAX - 1) #define UINT32_MAX (4294967295U) #define INT32_MAX (2147483647) #define INT32_MIN (-INT32_MAX - 1) #define UINT16_MAX (65535U) #define INT16_MAX (32767) #define INT16_MIN (-INT16_MAX - 1) #endif #include <cstdio> #include <cstddef> #include <cstring> #include <cstdlib> #include <climits> /* MacOS X will use an NSAlert to display failed assertaions since they're lost unless running from a terminal * strgen always runs from terminal and don't need a window for asserts */ #if !defined(__APPLE__) || defined(STRGEN) #include <cassert> #else #include "os/macosx/macos.h" #endif #if defined(UNIX) || defined(__MINGW32__) #include <sys/types.h> #endif #if defined(__OS2__) #include <types.h> #define strcasecmp stricmp #endif #if defined(PSP) #include <psptypes.h> #include <pspdebug.h> #include <pspthreadman.h> #endif #if defined(__BEOS__) #include <SupportDefs.h> #endif #if defined(SUNOS) || defined(HPUX) #include <alloca.h> #endif #if defined(__MORPHOS__) /* MorphOS defines certain Amiga defines per default, we undefine them * here to make the rest of source less messy and more clear what is * required for morphos and what for AmigaOS */ #if defined(amigaos) #undef amigaos #endif #if defined(__amigaos__) #undef __amigaos__ # endif #if defined(__AMIGA__) #undef __AMIGA__ #endif #if defined(AMIGA) #undef AMIGA #endif #if defined(amiga) #undef amiga #endif /* Act like we already included this file, as it somehow gives linkage problems * (mismatch linkage of C++ and C between this include and unistd.h). */ #define CLIB_USERGROUP_PROTOS_H #endif /* __MORPHOS__ */ #if defined(__APPLE__) #include "os/macosx/osx_stdafx.h" #endif /* __APPLE__ */ #if defined(PSP) /* PSP can only have 10 file-descriptors open at any given time, but this * switch only limits reads via the Fio system. So keep 2 fds free for things * like saving a game. */ #define LIMITED_FDS 8 #define printf pspDebugScreenPrintf #endif /* PSP */ /* by default we use [] var arrays */ #define VARARRAY_SIZE /* Stuff for GCC */ #if defined(__GNUC__) #define NORETURN __attribute__ ((noreturn)) #define FORCEINLINE inline #define CDECL #define __int64 long long #define GCC_PACK __attribute__((packed)) #if (__GNUC__ == 2) #undef VARARRAY_SIZE #define VARARRAY_SIZE 0 #endif #endif /* __GNUC__ */ #if defined(__WATCOMC__) #define NORETURN #define FORCEINLINE inline #define CDECL #define GCC_PACK #include <malloc.h> #endif /* __WATCOMC__ */ #if defined(__MINGW32__) || defined(__CYGWIN__) #include <malloc.h> // alloca() #endif #if defined(WIN32) #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #endif /* Stuff for MSVC */ #if defined(_MSC_VER) #pragma once /* Define a win32 target platform, to override defaults of the SDK * We need to define NTDDI version for Vista SDK, but win2k is minimum */ #define NTDDI_VERSION NTDDI_WIN2K // Windows 2000 #define _WIN32_WINNT 0x0500 // Windows 2000 #define _WIN32_WINDOWS 0x400 // Windows 95 #if !defined(WINCE) #define WINVER 0x0400 // Windows NT 4.0 / Windows 95 #endif #define _WIN32_IE_ 0x0401 // 4.01 (win98 and NT4SP5+) #pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data #pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied #pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union #if (_MSC_VER < 1400) // MSVC 2005 safety checks #error "Only MSVC 2005 or higher are supported. MSVC 2003 and earlier are not! Upgrade your compiler." #endif /* (_MSC_VER < 1400) */ #pragma warning(disable: 4996) // 'strdup' was declared deprecated #define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions #pragma warning(disable: 6308) // code analyzer: 'realloc' might return null pointer: assigning null pointer to 't_ptr', which is passed as an argument to 'realloc', will cause the original memory block to be leaked #pragma warning(disable: 6011) // code analyzer: Dereferencing NULL pointer 'pfGetAddrInfo': Lines: 995, 996, 998, 999, 1001 #pragma warning(disable: 6326) // code analyzer: potential comparison of a constant with another constant #pragma warning(disable: 6031) // code analyzer: Return value ignored: 'ReadFile' #pragma warning(disable: 6255) // code analyzer: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead #pragma warning(disable: 6246) // code analyzer: Local declaration of 'statspec' hides declaration of the same name in outer scope. For additional information, see previous declaration at ... #include <malloc.h> // alloca() #define NORETURN __declspec(noreturn) #define FORCEINLINE __forceinline #define inline _inline #if !defined(WINCE) #define CDECL _cdecl #endif int CDECL snprintf(char *str, size_t size, const char *format, ...); #if defined(WINCE) int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap); #endif #if defined(WIN32) && !defined(_WIN64) && !defined(WIN64) #if !defined(_W64) #define _W64 #endif typedef _W64 int INT_PTR, *PINT_PTR; typedef _W64 unsigned int UINT_PTR, *PUINT_PTR; #endif /* WIN32 && !_WIN64 && !WIN64 */ #if defined(_WIN64) || defined(WIN64) #define fseek _fseeki64 #endif /* _WIN64 || WIN64 */ #define GCC_PACK /* This is needed to zlib uses the stdcall calling convention on visual studio */ #if defined(WITH_ZLIB) || defined(WITH_PNG) #if !defined(ZLIB_WINAPI) #define ZLIB_WINAPI #endif #endif #if defined(WINCE) #define strcasecmp _stricmp #define strncasecmp _strnicmp #undef DEBUG #else #define strcasecmp stricmp #define strncasecmp strnicmp #endif void SetExceptionString(const char *s, ...); #if defined(NDEBUG) && defined(WITH_ASSERT) #undef assert #define assert(expression) if (!(expression)) { SetExceptionString("Assertion failed at %s:%d: %s", __FILE__, __LINE__, #expression); *(byte*)0 = 0; } #endif /* MSVC doesn't have these :( */ #define S_ISDIR(mode) (mode & S_IFDIR) #define S_ISREG(mode) (mode & S_IFREG) #endif /* defined(_MSC_VER) */ #if defined(WINCE) #define strdup _strdup #endif /* WINCE */ /* NOTE: the string returned by these functions is only valid until the next * call to the same function and is not thread- or reentrancy-safe */ #if !defined(STRGEN) #if defined(WIN32) || defined(WIN64) char *getcwd(char *buf, size_t size); #include <tchar.h> #include <io.h> /* XXX - WinCE without MSVCRT doesn't support wfopen, so it seems */ #if !defined(WINCE) #define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode)) #define unlink(file) _tunlink(OTTD2FS(file)) #endif /* WINCE */ const char *FS2OTTD(const TCHAR *name); const TCHAR *OTTD2FS(const char *name); #else #define fopen(file, mode) fopen(OTTD2FS(file), mode) const char *FS2OTTD(const char *name); const char *OTTD2FS(const char *name); #endif /* WIN32 */ #endif /* STRGEN */ #if defined(WIN32) || defined(WIN64) || defined(__OS2__) && !defined(__INNOTEK_LIBC__) #define PATHSEP "\\" #define PATHSEPCHAR '\\' #else #define PATHSEP "/" #define PATHSEPCHAR '/' #endif typedef unsigned char byte; /* This is already defined in unix, but not in QNX Neutrino (6.x)*/ #if (!defined(UNIX) && !defined(__CYGWIN__) && !defined(__BEOS__) && !defined(__MORPHOS__)) || defined(__QNXNTO__) typedef unsigned int uint; #endif #if !defined(__BEOS__) && !defined(__NDS__) /* Already defined on BEOS and NDS */ typedef unsigned char uint8; typedef signed char int8; typedef unsigned short uint16; typedef signed short int16; typedef unsigned int uint32; typedef signed int int32; typedef unsigned __int64 uint64; typedef signed __int64 int64; #endif /* !__BEOS__ && !__NDS__ */ #if !defined(WITH_PERSONAL_DIR) #define PERSONAL_DIR "" #endif /* Compile time assertions */ #if defined(__OS2__) #define assert_compile(expr) #else #define assert_compile(expr) extern const int __ct_assert__[1 - 2 * !(expr)] #endif /* __OS2__ */ /* Check if the types have the bitsizes like we are using them */ assert_compile(sizeof(uint64) == 8); assert_compile(sizeof(uint32) == 4); assert_compile(sizeof(uint16) == 2); assert_compile(sizeof(uint8) == 1); /** * Return the length of an fixed size array. * Unlike sizeof this function returns the number of elements * of the given type. * * @param x The pointer to the first element of the array * @return The number of elements */ #define lengthof(x) (sizeof(x) / sizeof(x[0])) /** * Get the end element of an fixed size array. * * @param x The pointer to the first element of the array * @return The pointer past to the last element of the array */ #define endof(x) (&x[lengthof(x)]) /** * Get the last element of an fixed size array. * * @param x The pointer to the first element of the array * @return The pointer to the last element of the array */ #define lastof(x) (&x[lengthof(x) - 1]) #define cpp_offsetof(s, m) (((size_t)&reinterpret_cast<const volatile char&>((((s*)(char*)8)->m))) - 8) #if !defined(offsetof) #define offsetof(s, m) cpp_offsetof(s, m) #endif /* offsetof */ /* take care of some name clashes on MacOS */ #if defined(__APPLE__) #define GetString OTTD_GetString #define DrawString OTTD_DrawString #define CloseConnection OTTD_CloseConnection #endif /* __APPLE__ */ void NORETURN CDECL usererror(const char *str, ...); void NORETURN CDECL error(const char *str, ...); #define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__) #if defined(MORPHOS) || defined(__NDS__) || defined(__DJGPP__) /* MorphOS and NDS don't have C++ conformant _stricmp... */ #define _stricmp stricmp #elif defined(OPENBSD) /* OpenBSD uses strcasecmp(3) */ #define _stricmp strcasecmp #endif #if !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__) && !defined(__DJGPP__) /* NDS, MorphOS & OpenBSD don't know wchars, the rest does :( */ #define HAS_WCHAR #endif /* !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__) */ #if !defined(MAX_PATH) #define MAX_PATH 260 #endif /** * The largest value that can be entered in a variable * @param type the type of the variable */ #define MAX_UVALUE(type) ((type)~(type)0) #endif /* STDAFX_H */
11,743
C++
.h
316
35.10443
218
0.710478
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,408
order_func.h
EnergeticBark_OpenTTD-3DS/src/order_func.h
/* $Id$ */ /** @file order_func.h Functions related to orders. */ #ifndef ORDER_FUNC_H #define ORDER_FUNC_H #include "order_type.h" #include "vehicle_type.h" #include "tile_type.h" #include "group_type.h" #include "date_type.h" struct BackuppedOrders { BackuppedOrders() : order(NULL), name(NULL) { } ~BackuppedOrders() { free(order); free(name); } VehicleID clone; VehicleOrderID orderindex; GroupID group; Order *order; uint16 service_interval; char *name; }; extern TileIndex _backup_orders_tile; extern BackuppedOrders _backup_orders_data; void BackupVehicleOrders(const Vehicle *v, BackuppedOrders *order = &_backup_orders_data); void RestoreVehicleOrders(const Vehicle *v, const BackuppedOrders *order = &_backup_orders_data); /* Functions */ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination); void InvalidateVehicleOrder(const Vehicle *v, int data); bool VehicleHasDepotOrders(const Vehicle *v); void CheckOrders(const Vehicle*); void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist = false); bool ProcessOrders(Vehicle *v); bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth = 0); VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v); void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int width); #define MIN_SERVINT_PERCENT 5 #define MAX_SERVINT_PERCENT 90 #define MIN_SERVINT_DAYS 30 #define MAX_SERVINT_DAYS 800 /** * Get the service interval domain. * Get the new proposed service interval for the vehicle is indeed, clamped * within the given bounds. @see MIN_SERVINT_PERCENT ,etc. * @param index proposed service interval * @return service interval */ Date GetServiceIntervalClamped(uint index); #endif /* ORDER_FUNC_H */
1,809
C++
.h
46
37.76087
125
0.781839
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,409
newgrf_engine.h
EnergeticBark_OpenTTD-3DS/src/newgrf_engine.h
/* $Id$ */ /** @file newgrf_engine.h Functions for NewGRF engines. */ #ifndef NEWGRF_ENGINE_H #define NEWGRF_ENGINE_H #include "newgrf.h" #include "direction_type.h" #include "newgrf_cargo.h" extern int _traininfo_vehicle_pitch; extern int _traininfo_vehicle_width; void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const struct SpriteGroup *group, EngineID *train_id, uint trains); const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, EngineID overriding_engine); void SetCustomEngineSprites(EngineID engine, byte cargo, const struct SpriteGroup *group); SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle *v, Direction direction); SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle *v, bool info_view); #define GetCustomRotorSprite(v, i) GetRotorOverrideSprite(v->engine_type, v, i) #define GetCustomRotorIcon(et) GetRotorOverrideSprite(et, NULL, true) /* Forward declaration of GRFFile, to avoid unnecessary inclusion of newgrf.h * elsewhere... */ struct GRFFile; void SetEngineGRF(EngineID engine, const struct GRFFile *file); const struct GRFFile *GetEngineGRF(EngineID engine); uint32 GetEngineGRFID(EngineID engine); uint16 GetVehicleCallback(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v); uint16 GetVehicleCallbackParent(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v, const Vehicle *parent); bool UsesWagonOverride(const Vehicle *v); #define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction) #define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction) /* Handler to Evaluate callback 36. If the callback fails (i.e. most of the * time) orig_value is returned */ uint GetVehicleProperty(const Vehicle *v, uint8 property, uint orig_value); uint GetEngineProperty(EngineID engine, uint8 property, uint orig_value); enum VehicleTrigger { VEHICLE_TRIGGER_NEW_CARGO = 0x01, /* Externally triggered only for the first vehicle in chain */ VEHICLE_TRIGGER_DEPOT = 0x02, /* Externally triggered only for the first vehicle in chain, only if whole chain is empty */ VEHICLE_TRIGGER_EMPTY = 0x04, /* Not triggered externally (called for the whole chain if we got NEW_CARGO) */ VEHICLE_TRIGGER_ANY_NEW_CARGO = 0x08, /* Externally triggered for each vehicle in chain */ VEHICLE_TRIGGER_CALLBACK_32 = 0x10, }; void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger); void UnloadWagonOverrides(Engine *e); uint ListPositionOfEngine(EngineID engine); void AlterVehicleListOrder(EngineID engine, EngineID target); void CommitVehicleListOrderChanges(); EngineID GetNewEngineID(const GRFFile *file, VehicleType type, uint16 internal_id); #endif /* NEWGRF_ENGINE_H */
2,807
C++
.h
49
55.755102
141
0.802406
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,410
newgrf_callbacks.h
EnergeticBark_OpenTTD-3DS/src/newgrf_callbacks.h
/* $Id$ */ /** @file newgrf_callbacks.h Callbacks that NewGRFs could implement. */ #ifndef NEWGRF_CALLBACKS_H #define NEWGRF_CALLBACKS_H /** * List of implemented NewGRF callbacks. * Most of these callbacks are only triggered when the corresponding * bit is set in the callback flags/trigger for a vehicle, house, * industry, etc. * Names are formatted as CBID_<CLASS>_<CALLBACK> * * @note Do not forget to add 15 bits callbacks to the switch in * newgrf_spritegroup.cpp (search for "15 bits callback"). */ enum CallbackID { /** Set when using the callback resolve system, but not to resolve a callback. */ CBID_NO_CALLBACK = 0x00, /** Set when calling a randomizing trigger (almost undocumented). */ CBID_RANDOM_TRIGGER = 0x01, /* There are no callbacks 0x02 - 0x0F. */ /** Powered wagons and visual effects. */ CBID_TRAIN_WAGON_POWER = 0x10, // 8 bit callback /** Vehicle length, returns the amount of 1/8's the vehicle is shorter for trains and RVs. */ CBID_VEHICLE_LENGTH = 0x11, /** Determine the amount of cargo to load per unit of time when using gradual loading. */ CBID_VEHICLE_LOAD_AMOUNT = 0x12, // 8 bit callback /** Determine whether a newstation should be made available to build. */ CBID_STATION_AVAILABILITY = 0x13, // 8 bit callback /** Choose a sprite layout to draw, instead of the standard 0-7 range. */ CBID_STATION_SPRITE_LAYOUT = 0x14, /** Refit capacity, the passed vehicle needs to have its ->cargo_type set to * the cargo we are refitting to, returns the new cargo capacity. */ CBID_VEHICLE_REFIT_CAPACITY = 0x15, // 15 bit callback /** Builds articulated engines for trains and RVs. */ CBID_VEHICLE_ARTIC_ENGINE = 0x16, // 8 bit callback /** Determine whether the house can be built on the specified tile. */ CBID_HOUSE_ALLOW_CONSTRUCTION = 0x17, // 8 bit callback /** AI construction/purchase selection */ CBID_GENERIC_AI_PURCHASE_SELECTION = 0x18, // 8 bit callback, not implemented /** Determine the cargo "suffixes" for each refit possibility of a cargo. */ CBID_VEHICLE_CARGO_SUFFIX = 0x19, /** Determine the next animation frame for a house. */ CBID_HOUSE_ANIMATION_NEXT_FRAME = 0x1A, // 15 bit callback /** Called for periodically starting or stopping the animation. */ CBID_HOUSE_ANIMATION_START_STOP = 0x1B, // 15 bit callback /** Called whenever the construction state of a house changes. */ CBID_HOUSE_CONSTRUCTION_STATE_CHANGE = 0x1C, // 15 bit callback /** Determine whether a wagon can be attached to an already existing train. */ CBID_TRAIN_ALLOW_WAGON_ATTACH = 0x1D, /** Called to determine the colour of a town building. */ CBID_HOUSE_COLOUR = 0x1E, // 15 bit callback /** Called to decide how much cargo a town building can accept. */ CBID_HOUSE_CARGO_ACCEPTANCE = 0x1F, // 15 bit callback /** Called to indicate how long the current animation frame should last. */ CBID_HOUSE_ANIMATION_SPEED = 0x20, // 8 bit callback /** Called periodically to determine if a house should be destroyed. */ CBID_HOUSE_DESTRUCTION = 0x21, // 8 bit callback /** Called to determine if the given industry type is available */ CBID_INDUSTRY_AVAILABLE = 0x22, // 15 bit callback /** This callback is called from vehicle purchase lists. It returns a value to be * used as a custom string ID in the 0xD000 range. */ CBID_VEHICLE_ADDITIONAL_TEXT = 0x23, /** Called when building a station to customize the tile layout */ CBID_STATION_TILE_LAYOUT = 0x24, // 15 bit callback /** Called for periodically starting or stopping the animation. */ CBID_INDTILE_ANIM_START_STOP = 0x25, // 15 bit callback /** Called to determine industry tile next animation frame. */ CBID_INDTILE_ANIM_NEXT_FRAME = 0x26, // 15 bit callback /** Called to indicate how long the current animation frame should last. */ CBID_INDTILE_ANIMATION_SPEED = 0x27, // 8 bit callback /** Called to determine if the given industry can be built on specific area. */ CBID_INDUSTRY_LOCATION = 0x28, // 15 bit callback /** Called on production changes, so it can be adjusted. */ CBID_INDUSTRY_PRODUCTION_CHANGE = 0x29, // 15 bit callback /** Called to determine which cargoes a town building should accept. */ CBID_HOUSE_ACCEPT_CARGO = 0x2A, // 15 bit callback /** Called to query the cargo acceptance of the industry tile */ CBID_INDTILE_CARGO_ACCEPTANCE = 0x2B, // 15 bit callback /** Called to determine which cargoes an industry should accept. */ CBID_INDTILE_ACCEPT_CARGO = 0x2C, // 15 bit callback /** Called to determine if a specific colour map should be used for a vehicle * instead of the default livery. */ CBID_VEHICLE_COLOUR_MAPPING = 0x2D, // 15 bit callback /** Called to determine how much cargo a town building produces. */ CBID_HOUSE_PRODUCE_CARGO = 0x2E, // 15 bit callback /** Called to determine if the given industry tile can be built on specific tile. */ CBID_INDTILE_SHAPE_CHECK = 0x2F, // 15 bit callback /** Called to determine the type (if any) of foundation to draw for industry tile. */ CBID_INDUSTRY_DRAW_FOUNDATIONS = 0x30, // 15 bit callback /** Called when the company (or AI) tries to start or stop a vehicle. Mainly * used for preventing a vehicle from leaving the depot. */ CBID_VEHICLE_START_STOP_CHECK = 0x31, // 15 bit callback, but 0xFF test is done with 8 bit /** Called for every vehicle every 32 days (not all on same date though). */ CBID_VEHICLE_32DAY_CALLBACK = 0x32, // 2 bit callback /** Called to play a special sound effect */ CBID_VEHICLE_SOUND_EFFECT = 0x33, // 15 bit callback /** Return the vehicles this given vehicle can be "upgraded" to. */ CBID_VEHICLE_AUTOREPLACE_SELECTION = 0x34, // 15 bit callback /** Called monthly on production changes, so it can be adjusted more frequently */ CBID_INDUSTRY_MONTHLYPROD_CHANGE = 0x35, // 15 bit callback /** Called to modify various vehicle properties. Callback parameter 1 * specifies the property index, as used in Action 0, to change. */ CBID_VEHICLE_MODIFY_PROPERTY = 0x36, // 8/15 bit depends on queried property /** Called to determine text to display after cargo name */ CBID_INDUSTRY_CARGO_SUFFIX = 0x37, // 15 bit callback, but 0xFF test is done with 8 bit /** Called to determine more text in the fund industry window */ CBID_INDUSTRY_FUND_MORE_TEXT = 0x38, // 15 bit callback /** Called to calculate the income of delivered cargo */ CBID_CARGO_PROFIT_CALC = 0x39, // 15 bit callback /** Called to determine more text in the industry window */ CBID_INDUSTRY_WINDOW_MORE_TEXT = 0x3A, // 15 bit callback /** Called to determine industry special effects */ CBID_INDUSTRY_SPECIAL_EFFECT = 0x3B, // 15 bit callback /** Called to determine if industry can alter the ground below industry tile */ CBID_INDUSTRY_AUTOSLOPE = 0x3C, // 15 bit callback /** Called to determine if the industry can still accept or refuse more cargo arrival */ CBID_INDUSTRY_REFUSE_CARGO = 0x3D, // 15 bit callback /* There are no callbacks 0x3E - 0x13F */ /** Called for periodically starting or stopping the animation. */ CBID_STATION_ANIM_START_STOP = 0x140, // 15 bit callback /** Called to determine station tile next animation frame. */ CBID_STATION_ANIM_NEXT_FRAME = 0x141, // 15 bit callback /** Called to indicate how long the current animation frame should last. */ CBID_STATION_ANIMATION_SPEED = 0x142, // 8 bit callback /** Called to determine whether a town building can be destroyed. */ CBID_HOUSE_DENY_DESTRUCTION = 0x143, // 15 bit callback /** Select an ambient sound to play for a given type of tile. */ CBID_SOUNDS_AMBIENT_EFFECT = 0x144, // 15 bit callback, not implemented /** Called to calculate part of a station rating. */ CBID_CARGO_STATION_RATING_CALC = 0x145, // 15 bit callback, not implemented /** Allow signal sprites to be replaced dynamically. */ CBID_NEW_SIGNALS_SPRITE_DRAW = 0x146, // 15 bit callback, not implemented /** Add an offset to the default sprite numbers to show another sprite. */ CBID_CANALS_SPRITE_OFFSET = 0x147, // 15 bit callback, not implemented /** Called when a cargo type specified in property 20 is accepted. */ CBID_HOUSE_WATCHED_CARGO_ACCEPTED = 0x148, // 15 bit callback, not implemented /** Callback done for each tile of a station to check the slope. */ CBID_STATION_LAND_SLOPE_CHECK = 0x149, // 15 bit callback, not implemented /** Called to determine the colour of an industry. */ CBID_INDUSTRY_DECIDE_COLOUR = 0x14A, // 4 bit callback /** Customize the input cargo types of a newly build industry. */ CBID_INDUSTRY_INPUT_CARGO_TYPES = 0x14B, // 8 bit callback /** Customize the output cargo types of a newly build industry. */ CBID_INDUSTRY_OUTPUT_CARGO_TYPES = 0x14C, // 8 bit callback /** Called on the Get Tile Description for an house tile. */ CBID_HOUSE_CUSTOM_NAME = 0x14D, // 15 bit callback }; /** * Callback masks for vehicles, indicates which callbacks are used by a vehicle. * Some callbacks are always used and don't have a mask. */ enum VehicleCallbackMask { CBM_TRAIN_WAGON_POWER = 0, ///< Powered wagons (trains only) CBM_VEHICLE_LENGTH = 1, ///< Vehicle length (trains and road vehicles) CBM_VEHICLE_LOAD_AMOUNT = 2, ///< Load amount CBM_VEHICLE_REFIT_CAPACITY = 3, ///< Cargo capacity after refit CBM_VEHICLE_ARTIC_ENGINE = 4, ///< Add articulated engines (trains only) CBM_VEHICLE_CARGO_SUFFIX = 5, ///< Show suffix after cargo name CBM_VEHICLE_COLOUR_REMAP = 6, ///< Change colour mapping of vehicle CBM_VEHICLE_SOUND_EFFECT = 7, ///< Vehicle uses custom sound effects }; /** * Callback masks for stations. */ enum StationCallbackMask { CBM_STATION_AVAIL = 0, ///< Availability of station in construction window CBM_STATION_SPRITE_LAYOUT = 1, ///< Use callback to select a sprite layout to use CBM_STATION_ANIMATION_NEXT_FRAME = 2, ///< Use a custom next frame callback CBM_STATION_ANIMATION_SPEED = 3, ///< Customize the animation speed of the station CBM_STATION_SLOPE_CHECK = 4, ///< Check slope of new station tiles }; /** * Callback masks for houses. */ enum HouseCallbackMask { CBM_HOUSE_ALLOW_CONSTRUCTION = 0, CBM_HOUSE_ANIMATION_NEXT_FRAME = 1, CBM_HOUSE_ANIMATION_START_STOP = 2, CBM_HOUSE_CONSTRUCTION_STATE_CHANGE = 3, CBM_HOUSE_COLOUR = 4, CBM_HOUSE_CARGO_ACCEPTANCE = 5, CBM_HOUSE_ANIMATION_SPEED = 6, CBM_HOUSE_DESTRUCTION = 7, CBM_HOUSE_ACCEPT_CARGO = 8, CBM_HOUSE_PRODUCE_CARGO = 9, CBM_HOUSE_DENY_DESTRUCTION = 10, }; /** * Callback masks for cargos. */ enum CargoCallbackMask { CBM_CARGO_PROFIT_CALC = 0, ///< custom profit calculation CBM_CARGO_STATION_RATING_CALC = 1, ///< custom station rating for this cargo type }; /** * Callback masks for Industries */ enum IndustryCallbackMask { CBM_IND_AVAILABLE = 0, ///< industry availability callback CBM_IND_PRODUCTION_CARGO_ARRIVAL = 1, ///< call production callback when cargo arrives at the industry CBM_IND_PRODUCTION_256_TICKS = 2, ///< call production callback every 256 ticks CBM_IND_LOCATION = 3, ///< check industry construction on given area CBM_IND_PRODUCTION_CHANGE = 4, ///< controls random production change CBM_IND_MONTHLYPROD_CHANGE = 5, ///< controls monthly random production change CBM_IND_CARGO_SUFFIX = 6, ///< cargo sub-type display CBM_IND_FUND_MORE_TEXT = 7, ///< additional text in fund window CBM_IND_WINDOW_MORE_TEXT = 8, ///< additional text in industry window CBM_IND_SPECIAL_EFFECT = 9, ///< control special effects CBM_IND_REFUSE_CARGO = 10, ///< option out of accepting cargo CBM_IND_DECIDE_COLOUR = 11, ///< give a custom colour to newly build industries CBM_IND_INPUT_CARGO_TYPES = 12, ///< customize the cargos the industry requires CBM_IND_OUTPUT_CARGO_TYPES = 13, ///< customize the cargos the industry produces }; /** * Callback masks for industry tiles */ enum IndustryTileCallbackMask { CBM_INDT_ANIM_NEXT_FRAME = 0, ///< decides next animation frame CBM_INDT_ANIM_SPEED = 1, ///< decides animation speed CBM_INDT_CARGO_ACCEPTANCE = 2, ///< decides amount of cargo acceptance CBM_INDT_ACCEPT_CARGO = 3, ///< decides accepted types CBM_INDT_SHAPE_CHECK = 4, ///< decides slope suitability CBM_INDT_DRAW_FOUNDATIONS = 5, ///< decides if default foundations need to be drawn CBM_INDT_AUTOSLOPE = 6, ///< decides allowance of autosloping }; /** * Different values for Callback result evaluations */ enum { CALLBACK_FAILED = 0xFFFF, ///< Result of a failed callback. CALLBACK_HOUSEPRODCARGO_END = 0x20FF, ///< Sentinel indicating that the loop for CBID_HOUSE_PRODUCE_CARGO has ended }; #endif /* NEWGRF_CALLBACKS_H */
13,556
C++
.h
233
55.961373
118
0.682065
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,411
autoreplace_func.h
EnergeticBark_OpenTTD-3DS/src/autoreplace_func.h
/* $Id$ */ /** @file autoreplace_func.h Functions related to autoreplacing. */ #ifndef AUTOREPLACE_FUNC_H #define AUTOREPLACE_FUNC_H #include "autoreplace_type.h" #include "company_base.h" /** * Remove all engine replacement settings for the company. * @param erl The renewlist for a given company. * @return The new renewlist for the company. */ void RemoveAllEngineReplacement(EngineRenewList *erl); /** * Retrieve the engine replacement in a given renewlist for an original engine type. * @param erl The renewlist to search in. * @param engine Engine type to be replaced. * @return The engine type to replace with, or INVALID_ENGINE if no * replacement is in the list. */ EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group); /** * Add an engine replacement to the given renewlist. * @param erl The renewlist to add to. * @param old_engine The original engine type. * @param new_engine The replacement engine type. * @param flags The calling command flags. * @return 0 on success, CMD_ERROR on failure. */ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, DoCommandFlag flags); /** * Remove an engine replacement from a given renewlist. * @param erl The renewlist from which to remove the replacement * @param engine The original engine type. * @param flags The calling command flags. * @return 0 on success, CMD_ERROR on failure. */ CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, DoCommandFlag flags); /** * Remove all engine replacement settings for the given company. * @param c the company. */ static inline void RemoveAllEngineReplacementForCompany(Company *c) { RemoveAllEngineReplacement(&c->engine_renew_list); } /** * Retrieve the engine replacement for the given company and original engine type. * @param c company. * @param engine Engine type. * @return The engine type to replace with, or INVALID_ENGINE if no * replacement is in the list. */ static inline EngineID EngineReplacementForCompany(const Company *c, EngineID engine, GroupID group) { return EngineReplacement(c->engine_renew_list, engine, group); } /** * Check if a company has a replacement set up for the given engine. * @param c Company. * @param engine Engine type to be replaced. * @return true if a replacement was set up, false otherwise. */ static inline bool EngineHasReplacementForCompany(const Company *c, EngineID engine, GroupID group) { return EngineReplacementForCompany(c, engine, group) != INVALID_ENGINE; } /** * Add an engine replacement for the company. * @param c Company. * @param old_engine The original engine type. * @param new_engine The replacement engine type. * @param flags The calling command flags. * @return 0 on success, CMD_ERROR on failure. */ static inline CommandCost AddEngineReplacementForCompany(Company *c, EngineID old_engine, EngineID new_engine, GroupID group, DoCommandFlag flags) { return AddEngineReplacement(&c->engine_renew_list, old_engine, new_engine, group, flags); } /** * Remove an engine replacement for the company. * @param c Company. * @param engine The original engine type. * @param flags The calling command flags. * @return 0 on success, CMD_ERROR on failure. */ static inline CommandCost RemoveEngineReplacementForCompany(Company *c, EngineID engine, GroupID group, DoCommandFlag flags) { return RemoveEngineReplacement(&c->engine_renew_list, engine, group, flags); } bool CheckAutoreplaceValidity(EngineID from, EngineID to, CompanyID company); #endif /* AUTOREPLACE_FUNC_H */
3,625
C++
.h
91
38.076923
146
0.777273
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,412
console_func.h
EnergeticBark_OpenTTD-3DS/src/console_func.h
/* $Id$ */ /** @file console_func.h Console functions used outside of the console code. */ #ifndef CONSOLE_FUNC_H #define CONSOLE_FUNC_H #include "console_type.h" /* console modes */ extern IConsoleModes _iconsole_mode; /* console functions */ void IConsoleInit(); void IConsoleFree(); void IConsoleClose(); /* console output */ void IConsolePrint(ConsoleColour colour_code, const char *string); void CDECL IConsolePrintF(ConsoleColour colour_code, const char *s, ...); void IConsoleDebug(const char *dbg, const char *string); void IConsoleWarning(const char *string); void IConsoleError(const char *string); /* Parser */ void IConsoleCmdExec(const char *cmdstr); #endif /* CONSOLE_FUNC_H */
700
C++
.h
20
33.6
79
0.766369
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,413
autoslope.h
EnergeticBark_OpenTTD-3DS/src/autoslope.h
/* $Id$ */ /** @file autoslope.h Functions related to autoslope. */ #ifndef AUTOSLOPE_H #define AUTOSLOPE_H #include "settings_type.h" #include "company_func.h" #include "depot_func.h" /** * Autoslope check for tiles with an entrance on an edge. * E.g. depots and non-drive-through-road-stops. * * The test succeeds if the slope is not steep and at least one corner of the entrance edge is on the TileMaxZ() level. * * @note The test does not check if autoslope is enabled at all. * * @param tile The tile. * @param z_new New TileZ. * @param tileh_new New TileSlope. * @param entrance Entrance edge. * @return true iff terraforming is allowed. */ static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, uint z_new, Slope tileh_new, DiagDirection entrance) { if (IsSteepSlope(tileh_new) || (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new))) return false; return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new)); } /** * Tests if autoslope is enabled for _current_company. * * Autoslope is disabled for town/industry construction. * * @return true iff autoslope is enabled. */ static inline bool AutoslopeEnabled() { return (_settings_game.construction.autoslope && (_current_company < MAX_COMPANIES || (_current_company == OWNER_NONE && _game_mode == GM_EDITOR))); } #endif /* AUTOSLOPE_H */
1,376
C++
.h
40
32.225
119
0.727068
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,414
engine_func.h
EnergeticBark_OpenTTD-3DS/src/engine_func.h
/* $Id$ */ /** @file engine_func.h Functions related to engines. */ #ifndef ENGINE_H #define ENGINE_H #include "engine_type.h" void SetupEngines(); void StartupEngines(); /* Original engine data counts and offsets */ extern const uint8 _engine_counts[4]; extern const uint8 _engine_offsets[4]; void DrawTrainEngine(int x, int y, EngineID engine, SpriteID pal); void DrawRoadVehEngine(int x, int y, EngineID engine, SpriteID pal); void DrawShipEngine(int x, int y, EngineID engine, SpriteID pal); void DrawAircraftEngine(int x, int y, EngineID engine, SpriteID pal); bool IsEngineBuildable(EngineID engine, VehicleType type, CompanyID company); bool IsEngineRefittable(EngineID engine); void SetCachedEngineCounts(); void SetYearEngineAgingStops(); void StartupOneEngine(Engine *e, Date aging_date); uint GetTotalCapacityOfArticulatedParts(EngineID engine, VehicleType type); #endif /* ENGINE_H */
906
C++
.h
21
41.714286
77
0.796804
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,415
engine_type.h
EnergeticBark_OpenTTD-3DS/src/engine_type.h
/* $Id$ */ /** @file engine_type.h Types related to engines. */ #ifndef ENGINE_TYPE_H #define ENGINE_TYPE_H #include "rail_type.h" #include "cargo_type.h" #include "vehicle_type.h" #include "gfx_type.h" #include "date_type.h" #include "sound_type.h" #include "company_type.h" #include "strings_type.h" typedef uint16 EngineID; struct Engine; enum RailVehicleTypes { RAILVEH_SINGLEHEAD, ///< indicates a "standalone" locomotive RAILVEH_MULTIHEAD, ///< indicates a combination of two locomotives RAILVEH_WAGON, ///< simple wagon, not motorized }; enum EngineClass { EC_STEAM, EC_DIESEL, EC_ELECTRIC, EC_MONORAIL, EC_MAGLEV, }; struct RailVehicleInfo { byte image_index; RailVehicleTypes railveh_type; byte cost_factor; ///< Purchase cost factor; For multiheaded engines the sum of both engine prices. RailTypeByte railtype; uint16 max_speed; uint16 power; ///< Power of engine; For multiheaded engines the sum of both engine powers. uint16 weight; ///< Weight of vehicle; For multiheaded engines the weight of each single engine. byte running_cost; ///< Running cost of engine; For multiheaded engines the sum of both running costs. byte running_cost_class; EngineClass engclass; ///< Class of engine for this vehicle byte capacity; ///< Cargo capacity of vehicle; For multiheaded engines the capacity of each single engine. CargoID cargo_type; byte ai_rank; byte ai_passenger_only; ///< Bit value to tell AI that this engine is for passenger use only uint16 pow_wag_power; byte pow_wag_weight; byte visual_effect; // NOTE: this is not 100% implemented yet, at the moment it is only used as a 'fallback' value // for when the 'powered wagon' callback fails. But it should really also determine what // kind of visual effect to generate for a vehicle (default, steam, diesel, electric). // Same goes for the callback result, which atm is only used to check if a wagon is powered. byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor byte tractive_effort; ///< Tractive effort coefficient byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles }; struct ShipVehicleInfo { byte image_index; byte cost_factor; uint16 max_speed; CargoID cargo_type; uint16 capacity; byte running_cost; SoundFxByte sfx; bool refittable; }; /* AircraftVehicleInfo subtypes, bitmask type. * If bit 0 is 0 then it is a helicopter, otherwise it is a plane * in which case bit 1 tells us whether it's a big(fast) plane or not */ enum { AIR_HELI = 0, AIR_CTOL = 1, ///< Conventional Take Off and Landing, i.e. planes AIR_FAST = 2 }; struct AircraftVehicleInfo { byte image_index; byte cost_factor; byte running_cost; byte subtype; SoundFxByte sfx; byte acceleration; uint16 max_speed; byte mail_capacity; uint16 passenger_capacity; }; struct RoadVehicleInfo { byte image_index; byte cost_factor; byte running_cost; byte running_cost_class; SoundFxByte sfx; uint16 max_speed; ///< Maximum speed in mph/3.2 units byte capacity; CargoID cargo_type; uint8 weight; ///< Weight in 1/4t units uint8 power; ///< Power in 10hp units uint8 tractive_effort; ///< Coefficient of tractive effort uint8 air_drag; ///< Coefficient of air drag }; /** Information about a vehicle * @see table/engines.h */ struct EngineInfo { Date base_intro; Year lifelength; Year base_life; byte decay_speed; byte load_amount; byte climates; uint32 refit_mask; byte refit_cost; byte misc_flags; byte callbackmask; int8 retire_early; ///< Number of years early to retire vehicle StringID string_id; ///< Default name of engine }; /** * EngineInfo.misc_flags is a bitmask, with the following values */ enum { EF_RAIL_TILTS = 0, ///< Rail vehicle tilts in curves EF_ROAD_TRAM = 0, ///< Road vehicle is a tram/light rail vehicle EF_USES_2CC = 1, ///< Vehicle uses two company colours EF_RAIL_IS_MU = 2, ///< Rail vehicle is a multiple-unit (DMU/EMU) }; /** * Engine.flags is a bitmask, with the following values. */ enum { ENGINE_AVAILABLE = 1, ///< This vehicle is available to everyone. ENGINE_EXCLUSIVE_PREVIEW = 2, ///< This vehicle is in the exclusive preview stage, either being used or being offered to a company. ENGINE_OFFER_WINDOW_OPEN = 4, ///< The exclusive offer window is currently open for a company. }; enum { NUM_VEHICLE_TYPES = 6, MAX_LENGTH_ENGINE_NAME_BYTES = 31, ///< The maximum length of an engine name in bytes including '\0' MAX_LENGTH_ENGINE_NAME_PIXELS = 160, ///< The maximum length of an engine name in pixels }; static const EngineID INVALID_ENGINE = 0xFFFF; #endif /* ENGINE_TYPE_H */
4,916
C++
.h
135
34.148148
132
0.706278
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,416
void_map.h
EnergeticBark_OpenTTD-3DS/src/void_map.h
/* $Id$ */ /** @file void_map.h Map accessors for void tiles. */ #ifndef VOID_MAP_H #define VOID_MAP_H #include "tile_map.h" /** * Make a nice void tile ;) * @param t the tile to make void */ static inline void MakeVoid(TileIndex t) { SetTileType(t, MP_VOID); SetTileHeight(t, 0); _m[t].m1 = 0; _m[t].m2 = 0; _m[t].m3 = 0; _m[t].m4 = 0; _m[t].m5 = 0; _m[t].m6 = 0; _me[t].m7 = 0; } #endif /* VOID_MAP_H */
423
C++
.h
22
17.454545
53
0.598485
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,417
station_base.h
EnergeticBark_OpenTTD-3DS/src/station_base.h
/* $Id$ */ /** @file station_base.h Base classes/functions for stations. */ #ifndef STATION_BASE_H #define STATION_BASE_H #include "station_type.h" #include "airport.h" #include "oldpool.h" #include "cargopacket.h" #include "cargo_type.h" #include "town_type.h" #include "strings_type.h" #include "date_type.h" #include "vehicle_type.h" #include "company_type.h" #include "industry_type.h" #include "core/geometry_type.hpp" #include "viewport_type.h" #include <list> DECLARE_OLD_POOL(Station, Station, 6, 1000) DECLARE_OLD_POOL(RoadStop, RoadStop, 5, 2000) static const byte INITIAL_STATION_RATING = 175; struct GoodsEntry { enum AcceptancePickup { ACCEPTANCE, PICKUP }; GoodsEntry() : acceptance_pickup(0), days_since_pickup(255), rating(INITIAL_STATION_RATING), last_speed(0), last_age(255) {} byte acceptance_pickup; byte days_since_pickup; byte rating; byte last_speed; byte last_age; CargoList cargo; ///< The cargo packets of cargo waiting in this station }; /** A Stop for a Road Vehicle */ struct RoadStop : PoolItem<RoadStop, RoadStopID, &_RoadStop_pool> { static const int cDebugCtorLevel = 5; ///< Debug level on which Contructor / Destructor messages are printed static const uint LIMIT = 16; ///< The maximum amount of roadstops that are allowed at a single station static const uint MAX_BAY_COUNT = 2; ///< The maximum number of loading bays static const uint MAX_VEHICLES = 64; ///< The maximum number of vehicles that can allocate a slot to this roadstop TileIndex xy; ///< Position on the map byte status; ///< Current status of the Stop. Like which spot is taken. Access using *Bay and *Busy functions. byte num_vehicles; ///< Number of vehicles currently slotted to this stop struct RoadStop *next; ///< Next stop of the given type at this station RoadStop(TileIndex tile = INVALID_TILE); virtual ~RoadStop(); /** * Determines whether a road stop exists * @return true if and only is the road stop exists */ inline bool IsValid() const { return this->xy != INVALID_TILE; } /* For accessing status */ bool HasFreeBay() const; bool IsFreeBay(uint nr) const; uint AllocateBay(); void AllocateDriveThroughBay(uint nr); void FreeBay(uint nr); bool IsEntranceBusy() const; void SetEntranceBusy(bool busy); RoadStop *GetNextRoadStop(const Vehicle *v) const; }; struct StationSpecList { const StationSpec *spec; uint32 grfid; ///< GRF ID of this custom station uint8 localidx; ///< Station ID within GRF of station }; /** StationRect - used to track station spread out rectangle - cheaper than scanning whole map */ struct StationRect : public Rect { enum StationRectMode { ADD_TEST = 0, ADD_TRY, ADD_FORCE }; StationRect(); void MakeEmpty(); bool PtInExtendedRect(int x, int y, int distance = 0) const; bool IsEmpty() const; bool BeforeAddTile(TileIndex tile, StationRectMode mode); bool BeforeAddRect(TileIndex tile, int w, int h, StationRectMode mode); bool AfterRemoveTile(Station *st, TileIndex tile); bool AfterRemoveRect(Station *st, TileIndex tile, int w, int h); static bool ScanForStationTiles(StationID st_id, int left_a, int top_a, int right_a, int bottom_a); StationRect& operator = (Rect src); }; /** Station data structure */ struct Station : PoolItem<Station, StationID, &_Station_pool> { public: RoadStop *GetPrimaryRoadStop(RoadStopType type) const { return type == ROADSTOP_BUS ? bus_stops : truck_stops; } RoadStop *GetPrimaryRoadStop(const Vehicle *v) const; const AirportFTAClass *Airport() const { if (airport_tile == INVALID_TILE) return GetAirport(AT_DUMMY); return GetAirport(airport_type); } TileIndex xy; RoadStop *bus_stops; RoadStop *truck_stops; TileIndex train_tile; TileIndex airport_tile; TileIndex dock_tile; Town *town; /* Place to get a name from, in order of importance: */ char *name; ///< Custom name IndustryType indtype; ///< Industry type to get the name from StringID string_id; ///< Default name (town area) of station ViewportSign sign; uint16 had_vehicle_of_type; byte time_since_load; byte time_since_unload; byte delete_ctr; OwnerByte owner; byte facilities; byte airport_type; /* trainstation width/height */ byte trainst_w, trainst_h; /** List of custom stations (StationSpecs) allocated to the station */ uint8 num_specs; StationSpecList *speclist; Date build_date; ///< Date of construction uint64 airport_flags; ///< stores which blocks on the airport are taken. was 16 bit earlier on, then 32 byte last_vehicle_type; std::list<Vehicle *> loading_vehicles; GoodsEntry goods[NUM_CARGO]; ///< Goods at this station uint16 random_bits; byte waiting_triggers; uint8 cached_anim_triggers; ///< Combined animation trigger bitmask, used to determine if trigger processing should happen. StationRect rect; ///< Station spread out rectangle (not saved) maintained by StationRect_xxx() functions static const int cDebugCtorLevel = 5; Station(TileIndex tile = INVALID_TILE); virtual ~Station(); void AddFacility(byte new_facility_bit, TileIndex facil_xy); /** * Mark the sign of a station dirty for repaint. * * @ingroup dirty */ void MarkDirty() const; /** * Marks the tiles of the station as dirty. * * @ingroup dirty */ void MarkTilesDirty(bool cargo_change) const; bool TileBelongsToRailStation(TileIndex tile) const; uint GetPlatformLength(TileIndex tile, DiagDirection dir) const; uint GetPlatformLength(TileIndex tile) const; bool IsBuoy() const; /** * Determines whether a station exists * @return true if and only is the station exists */ inline bool IsValid() const { return this->xy != INVALID_TILE; } uint GetCatchmentRadius() const; }; static inline StationID GetMaxStationIndex() { /* TODO - This isn't the real content of the function, but * with the new pool-system this will be replaced with one that * _really_ returns the highest index. Now it just returns * the next safe value we are sure about everything is below. */ return GetStationPoolSize() - 1; } static inline uint GetNumStations() { return GetStationPoolSize(); } static inline bool IsValidStationID(StationID index) { return index < GetStationPoolSize() && GetStation(index)->IsValid(); } #define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1U < GetStationPoolSize()) ? GetStation(st->index + 1U) : NULL) if (st->IsValid()) #define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0) /* Stuff for ROADSTOPS */ #define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) if (rs->IsValid()) #define FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0) /* End of stuff for ROADSTOPS */ #endif /* STATION_BASE_H */
6,963
C++
.h
188
34.87766
186
0.732788
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,418
landscape_type.h
EnergeticBark_OpenTTD-3DS/src/landscape_type.h
/* $Id$ */ /** @file landscape_type.h Types related to the landscape. */ #ifndef LANDSCAPE_TYPE_H #define LANDSCAPE_TYPE_H typedef byte LandscapeID; ///< Landscape type. @see LandscapeType /** Landscape types */ enum LandscapeType { LT_TEMPERATE = 0, LT_ARCTIC = 1, LT_TROPIC = 2, LT_TOYLAND = 3, NUM_LANDSCAPE = 4, }; /** * For storing the water borders which shall be retained. */ enum Borders { BORDER_NE = 0, BORDER_SE = 1, BORDER_SW = 2, BORDER_NW = 3, BORDERS_RANDOM = 16, }; #endif /* LANDSCAPE_TYPE_H */
543
C++
.h
24
20.833333
65
0.677734
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,421
signs_func.h
EnergeticBark_OpenTTD-3DS/src/signs_func.h
/* $Id$ */ /** @file signs_func.h Functions related to signs. */ #ifndef SIGNS_FUNC_H #define SIGNS_FUNC_H #include "signs_type.h" extern SignID _new_sign_id; void UpdateAllSignVirtCoords(); void PlaceProc_Sign(TileIndex tile); void MarkSignDirty(Sign *si); void UpdateSignVirtCoords(Sign *si); /* signs_gui.cpp */ void ShowRenameSignWindow(const Sign *si); void HandleClickOnSign(const Sign *si); void DeleteRenameSignWindow(SignID sign); void ShowSignList(); #endif /* SIGNS_FUNC_H */
495
C++
.h
16
29.4375
53
0.772824
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,422
newgrf.h
EnergeticBark_OpenTTD-3DS/src/newgrf.h
/* $Id$ */ /** @file newgrf.h Base for the NewGRF implementation. */ #ifndef NEWGRF_H #define NEWGRF_H #include "town_type.h" #include "newgrf_config.h" #include "cargotype.h" #include "industry_type.h" #include "station_type.h" #include "rail_type.h" enum GrfLoadingStage { GLS_FILESCAN, GLS_SAFETYSCAN, GLS_LABELSCAN, GLS_INIT, GLS_RESERVE, GLS_ACTIVATION, GLS_END, }; DECLARE_POSTFIX_INCREMENT(GrfLoadingStage); enum GrfMiscBit { GMB_DESERT_TREES_FIELDS = 0, // Unsupported. GMB_DESERT_PAVED_ROADS = 1, GMB_FIELD_BOUNDING_BOX = 2, // Unsupported. GMB_TRAIN_WIDTH_32_PIXELS = 3, GMB_AMBIENT_SOUND_CALLBACK = 4, // Unsupported. GMB_CATENARY_ON_3RD_TRACK = 5, // Unsupported. }; enum GrfSpecFeature { GSF_TRAIN, GSF_ROAD, GSF_SHIP, GSF_AIRCRAFT, GSF_STATION, GSF_CANAL, GSF_BRIDGE, GSF_TOWNHOUSE, GSF_GLOBALVAR, GSF_INDUSTRYTILES, GSF_INDUSTRIES, GSF_CARGOS, GSF_SOUNDFX, GSF_END, }; static const uint32 INVALID_GRFID = 0xFFFFFFFF; struct GRFLabel { byte label; uint32 nfo_line; size_t pos; struct GRFLabel *next; }; struct GRFFile { char *filename; bool is_ottdfile; uint32 grfid; uint16 sprite_offset; byte grf_version; GRFFile *next; /* A sprite group contains all sprites of a given vehicle (or multiple * vehicles) when carrying given cargo. It consists of several sprite * sets. Group ids are refered as "cargo id"s by TTDPatch * documentation, contributing to the global confusion. * * A sprite set contains all sprites of a given vehicle carrying given * cargo at a given *stage* - that is usually its load stage. Ie. you * can have a spriteset for an empty wagon, wagon full of coal, * half-filled wagon etc. Each spriteset contains eight sprites (one * per direction) or four sprites if the vehicle is symmetric. */ SpriteID spriteset_start; int spriteset_numsets; int spriteset_numents; int spriteset_feature; int spritegroups_count; struct SpriteGroup **spritegroups; uint sound_offset; StationSpec **stations; HouseSpec **housespec; IndustrySpec **industryspec; IndustryTileSpec **indtspec; uint32 param[0x80]; uint param_end; ///< one more than the highest set parameter GRFLabel *label; ///< Pointer to the first label. This is a linked list, not an array. uint8 cargo_max; CargoLabel *cargo_list; uint8 cargo_map[NUM_CARGO]; uint8 railtype_max; RailTypeLabel *railtype_list; }; extern GRFFile *_first_grffile; enum ShoreReplacement { SHORE_REPLACE_NONE, ///< No shore sprites were replaced. SHORE_REPLACE_ACTION_5, ///< Shore sprites were replaced by Action5. SHORE_REPLACE_ACTION_A, ///< Shore sprites were replaced by ActionA (using grass tiles for the corner-shores). SHORE_REPLACE_ONLY_NEW, ///< Only corner-shores were loaded by Action5 (openttd(w/d).grf only). }; struct GRFLoadedFeatures { bool has_2CC; ///< Set if any vehicle is loaded which uses 2cc (two company colours). bool has_newhouses; ///< Set if there are any newhouses loaded. bool has_newindustries; ///< Set if there are any newindustries loaded. ShoreReplacement shore; ///< It which way shore sprites were replaced. }; /* Indicates which are the newgrf features currently loaded ingame */ extern GRFLoadedFeatures _loaded_newgrf_features; void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage); void LoadNewGRF(uint load_index, uint file_index); void ReloadNewGRFData(); // in saveload/afterload.cpp void CDECL grfmsg(int severity, const char *str, ...); bool HasGrfMiscBit(GrfMiscBit bit); bool GetGlobalVariable(byte param, uint32 *value); StringID MapGRFStringID(uint32 grfid, StringID str); #endif /* NEWGRF_H */
3,692
C++
.h
111
31.261261
113
0.755418
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,423
gui.h
EnergeticBark_OpenTTD-3DS/src/gui.h
/* $Id$ */ /** @file gui.h GUI functions that shouldn't be here. */ #ifndef GUI_H #define GUI_H #include "window_type.h" #include "vehicle_type.h" #include "gfx_type.h" #include "economy_type.h" #include "tile_type.h" #include "strings_type.h" #include "transport_type.h" /* main_gui.cpp */ void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2); void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2); void HandleOnEditText(const char *str); void InitializeGUI(); /* settings_gui.cpp */ void ShowGameOptions(); void ShowGameDifficulty(); void ShowGameSettings(); void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right); /* graph_gui.cpp */ void ShowOperatingProfitGraph(); void ShowIncomeGraph(); void ShowDeliveredCargoGraph(); void ShowPerformanceHistoryGraph(); void ShowCompanyValueGraph(); void ShowCargoPaymentRates(); void ShowCompanyLeagueTable(); void ShowPerformanceRatingDetail(); /* train_gui.cpp */ void ShowOrdersWindow(const Vehicle *v); /* dock_gui.cpp */ void ShowBuildDocksToolbar(); void ShowBuildDocksScenToolbar(); /* aircraft_gui.cpp */ void ShowBuildAirToolbar(); /* tgp_gui.cpp */ void ShowGenerateLandscape(); void ShowHeightmapLoad(); /* misc_gui.cpp */ void PlaceLandBlockInfo(); void ShowAboutWindow(); void ShowBuildTreesToolbar(); void ShowTownDirectory(); void ShowIndustryDirectory(); void ShowSubsidiesList(); void ShowEstimatedCostOrIncome(Money cost, int x, int y); void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y); void ShowSmallMap(); void ShowExtraViewPortWindow(TileIndex tile = INVALID_TILE); void BuildFileList(); void SetFiosType(const byte fiostype); /* FIOS_TYPE_FILE, FIOS_TYPE_OLDFILE etc. different colours */ extern const TextColour _fios_colours[]; /* bridge_gui.cpp */ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte bridge_type); void ShowBuildIndustryWindow(); void ShowBuildTownWindow(); void ShowMusicWindow(); #endif /* GUI_H */
2,058
C++
.h
61
32.42623
114
0.790698
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,424
train.h
EnergeticBark_OpenTTD-3DS/src/train.h
/* $Id$ */ /** @file train.h Base for the train class. */ #ifndef TRAIN_H #define TRAIN_H #include "stdafx.h" #include "core/bitmath_func.hpp" #include "vehicle_base.h" /** enum to handle train subtypes * Do not access it directly unless you have to. Use the access functions below * This is an enum to tell what bit to access as it is a bitmask */ enum TrainSubtype { TS_FRONT = 0, ///< Leading engine of a train TS_ARTICULATED_PART = 1, ///< Articulated part of an engine TS_WAGON = 2, ///< Wagon TS_ENGINE = 3, ///< Engine, that can be front engines, but might be placed behind another engine TS_FREE_WAGON = 4, ///< First in a wagon chain (in depot) TS_MULTIHEADED = 5, ///< Engine is a multiheaded }; /** Check if a vehicle is front engine * @param v vehicle to check * @return Returns true if vehicle is a front engine */ static inline bool IsFrontEngine(const Vehicle *v) { assert(v->type == VEH_TRAIN); return HasBit(v->subtype, TS_FRONT); } /** Set front engine state * @param v vehicle to change */ static inline void SetFrontEngine(Vehicle *v) { assert(v->type == VEH_TRAIN); SetBit(v->subtype, TS_FRONT); } /** Remove the front engine state * @param v vehicle to change */ static inline void ClearFrontEngine(Vehicle *v) { assert(v->type == VEH_TRAIN); ClrBit(v->subtype, TS_FRONT); } /** Check if a vehicle is an articulated part of an engine * @param v vehicle to check * @return Returns true if vehicle is an articulated part */ static inline bool IsArticulatedPart(const Vehicle *v) { assert(v->type == VEH_TRAIN); return HasBit(v->subtype, TS_ARTICULATED_PART); } /** Set a vehicle to be an articulated part * @param v vehicle to change */ static inline void SetArticulatedPart(Vehicle *v) { assert(v->type == VEH_TRAIN); SetBit(v->subtype, TS_ARTICULATED_PART); } /** Clear a vehicle from being an articulated part * @param v vehicle to change */ static inline void ClearArticulatedPart(Vehicle *v) { assert(v->type == VEH_TRAIN); ClrBit(v->subtype, TS_ARTICULATED_PART); } /** Check if a vehicle is a wagon * @param v vehicle to check * @return Returns true if vehicle is a wagon */ static inline bool IsTrainWagon(const Vehicle *v) { assert(v->type == VEH_TRAIN); return HasBit(v->subtype, TS_WAGON); } /** Set a vehicle to be a wagon * @param v vehicle to change */ static inline void SetTrainWagon(Vehicle *v) { assert(v->type == VEH_TRAIN); SetBit(v->subtype, TS_WAGON); } /** Clear wagon property * @param v vehicle to change */ static inline void ClearTrainWagon(Vehicle *v) { assert(v->type == VEH_TRAIN); ClrBit(v->subtype, TS_WAGON); } /** Check if a vehicle is an engine (can be first in a train) * @param v vehicle to check * @return Returns true if vehicle is an engine */ static inline bool IsTrainEngine(const Vehicle *v) { assert(v->type == VEH_TRAIN); return HasBit(v->subtype, TS_ENGINE); } /** Set engine status * @param v vehicle to change */ static inline void SetTrainEngine(Vehicle *v) { assert(v->type == VEH_TRAIN); SetBit(v->subtype, TS_ENGINE); } /** Clear engine status * @param v vehicle to change */ static inline void ClearTrainEngine(Vehicle *v) { assert(v->type == VEH_TRAIN); ClrBit(v->subtype, TS_ENGINE); } /** Check if a vehicle is a free wagon (got no engine in front of it) * @param v vehicle to check * @return Returns true if vehicle is a free wagon */ static inline bool IsFreeWagon(const Vehicle *v) { assert(v->type == VEH_TRAIN); return HasBit(v->subtype, TS_FREE_WAGON); } /** Set if a vehicle is a free wagon * @param v vehicle to change */ static inline void SetFreeWagon(Vehicle *v) { assert(v->type == VEH_TRAIN); SetBit(v->subtype, TS_FREE_WAGON); } /** Clear a vehicle from being a free wagon * @param v vehicle to change */ static inline void ClearFreeWagon(Vehicle *v) { assert(v->type == VEH_TRAIN); ClrBit(v->subtype, TS_FREE_WAGON); } /** Check if a vehicle is a multiheaded engine * @param v vehicle to check * @return Returns true if vehicle is a multiheaded engine */ static inline bool IsMultiheaded(const Vehicle *v) { assert(v->type == VEH_TRAIN); return HasBit(v->subtype, TS_MULTIHEADED); } /** Set if a vehicle is a multiheaded engine * @param v vehicle to change */ static inline void SetMultiheaded(Vehicle *v) { assert(v->type == VEH_TRAIN); SetBit(v->subtype, TS_MULTIHEADED); } /** Clear multiheaded engine property * @param v vehicle to change */ static inline void ClearMultiheaded(Vehicle *v) { assert(v->type == VEH_TRAIN); ClrBit(v->subtype, TS_MULTIHEADED); } /** Check if an engine has an articulated part. * @param v Vehicle. * @return True if the engine has an articulated part. */ static inline bool EngineHasArticPart(const Vehicle *v) { assert(v->type == VEH_TRAIN); return (v->Next() != NULL && IsArticulatedPart(v->Next())); } /** * Get the next part of a multi-part engine. * Will only work on a multi-part engine (EngineHasArticPart(v) == true), * Result is undefined for normal engine. */ static inline Vehicle *GetNextArticPart(const Vehicle *v) { assert(EngineHasArticPart(v)); return v->Next(); } /** Get the last part of a multi-part engine. * @param v Vehicle. * @return Last part of the engine. */ static inline Vehicle *GetLastEnginePart(Vehicle *v) { assert(v->type == VEH_TRAIN); while (EngineHasArticPart(v)) v = GetNextArticPart(v); return v; } /** Tell if we are dealing with the rear end of a multiheaded engine. * @param v Vehicle. * @return True if the engine is the rear part of a dualheaded engine. */ static inline bool IsRearDualheaded(const Vehicle *v) { assert(v->type == VEH_TRAIN); return (IsMultiheaded(v) && !IsTrainEngine(v)); } /** Get the next real (non-articulated part) vehicle in the consist. * @param v Vehicle. * @return Next vehicle in the consist. */ static inline Vehicle *GetNextVehicle(const Vehicle *v) { assert(v->type == VEH_TRAIN); while (EngineHasArticPart(v)) v = GetNextArticPart(v); /* v now contains the last artic part in the engine */ return v->Next(); } /** Get the previous real (non-articulated part) vehicle in the consist. * @param w Vehicle. * @return Previous vehicle in the consist. */ static inline Vehicle *GetPrevVehicle(const Vehicle *w) { assert(w->type == VEH_TRAIN); Vehicle *v = w->Previous(); while (v != NULL && IsArticulatedPart(v)) v = v->Previous(); return v; } /** Get the next real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist. * @param v Vehicle. * @return Next vehicle in the consist. */ static inline Vehicle *GetNextUnit(const Vehicle *v) { assert(v->type == VEH_TRAIN); Vehicle *w = GetNextVehicle(v); if (w != NULL && IsRearDualheaded(w)) w = GetNextVehicle(w); return w; } /** Get the previous real (non-articulated part and non rear part of dualheaded engine) vehicle in the consist. * @param v Vehicle. * @return Previous vehicle in the consist. */ static inline Vehicle *GetPrevUnit(const Vehicle *v) { assert(v->type == VEH_TRAIN); Vehicle *w = GetPrevVehicle(v); if (w != NULL && IsRearDualheaded(w)) w = GetPrevVehicle(w); return w; } void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2); void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2); byte FreightWagonMult(CargoID cargo); int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped); int CheckTrainStoppedInDepot(const Vehicle *v); void UpdateTrainAcceleration(Vehicle *v); void CheckTrainsLengths(); void FreeTrainTrackReservation(const Vehicle *v, TileIndex origin = INVALID_TILE, Trackdir orig_td = INVALID_TRACKDIR); bool TryPathReserve(Vehicle *v, bool mark_as_stuck = false, bool first_tile_okay = false); /** * This class 'wraps' Vehicle; you do not actually instantiate this class. * You create a Vehicle using AllocateVehicle, so it is added to the pool * and you reinitialize that to a Train using: * v = new (v) Train(); * * As side-effect the vehicle type is set correctly. */ struct Train : public Vehicle { /** Initializes the Vehicle to a train */ Train() { this->type = VEH_TRAIN; } /** We want to 'destruct' the right class. */ virtual ~Train() { this->PreDestructor(); } const char *GetTypeString() const { return "train"; } void MarkDirty(); void UpdateDeltaXY(Direction direction); ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_TRAIN_INC : EXPENSES_TRAIN_RUN; } void PlayLeaveStationSound() const; bool IsPrimaryVehicle() const { return IsFrontEngine(this); } SpriteID GetImage(Direction direction) const; int GetDisplaySpeed() const { return this->u.rail.last_speed; } int GetDisplayMaxSpeed() const { return this->u.rail.cached_max_speed; } Money GetRunningCost() const; bool IsInDepot() const { return CheckTrainInDepot(this, false) != -1; } bool IsStoppedInDepot() const { return CheckTrainStoppedInDepot(this) >= 0; } void Tick(); void OnNewDay(); TileIndex GetOrderStationLocation(StationID station); bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse); }; #endif /* TRAIN_H */
9,154
C++
.h
291
29.738832
119
0.728963
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,425
cheat_type.h
EnergeticBark_OpenTTD-3DS/src/cheat_type.h
/* $Id$ */ /** @file cheat_type.h Types related to cheating. */ #ifndef CHEAT_TYPE_H #define CHEAT_TYPE_H /** * Info about each of the cheats. */ struct Cheat { bool been_used; ///< has this cheat been used before? bool value; ///< tells if the bool cheat is active or not }; /** * WARNING! Do _not_ remove entries in Cheats struct or change the order * of the existing ones! Would break downward compatibility. * Only add new entries at the end of the struct! */ struct Cheats { Cheat magic_bulldozer; ///< dynamite industries, unmovables Cheat switch_company; ///< change to another company Cheat money; ///< get rich or poor Cheat crossing_tunnels; ///< allow tunnels that cross each other Cheat build_in_pause; ///< build while in pause mode Cheat no_jetcrash; ///< no jet will crash on small airports anymore Cheat switch_climate; ///< change the climate of the map Cheat change_date; ///< changes date ingame Cheat setup_prod; ///< setup raw-material production in game Cheat dummy; ///< empty cheat (enable running el-engines on normal rail) }; extern Cheats _cheats; #endif /* CHEAT_TYPE_H */
1,174
C++
.h
30
37.333333
84
0.695079
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,426
transport_type.h
EnergeticBark_OpenTTD-3DS/src/transport_type.h
/* $Id$ */ /** @file transport_type.h Base types related to transport. */ #ifndef TRANSPORT_TYPE_H #define TRANSPORT_TYPE_H typedef uint16 UnitID; /** Available types of transport */ enum TransportType { /* These constants are for now linked to the representation of bridges * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge. * In an ideal world, these constants would be used everywhere when * accessing tunnels and bridges. For now, you should just not change * the values for road and rail. */ TRANSPORT_BEGIN = 0, TRANSPORT_RAIL = TRANSPORT_BEGIN, ///< Transport by train TRANSPORT_ROAD, ///< Transport by road vehicle TRANSPORT_WATER, ///< Transport over water TRANSPORT_AIR, ///< Transport through air TRANSPORT_END, INVALID_TRANSPORT = 0xff, }; #endif /* TRANSPORT_TYPE_H */
828
C++
.h
22
35.590909
72
0.747815
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,427
npf.h
EnergeticBark_OpenTTD-3DS/src/npf.h
/* $Id$ */ /** @file npf.h New A* pathfinder. */ #ifndef NPF_H #define NPF_H #include "aystar.h" #include "station_type.h" #include "rail_type.h" #include "company_type.h" #include "vehicle_type.h" #include "tile_type.h" #include "track_type.h" #include "core/bitmath_func.hpp" #include "transport_type.h" /* mowing grass */ enum { NPF_HASH_BITS = 12, ///< The size of the hash used in pathfinding. Just changing this value should be sufficient to change the hash size. Should be an even value. /* Do no change below values */ NPF_HASH_SIZE = 1 << NPF_HASH_BITS, NPF_HASH_HALFBITS = NPF_HASH_BITS / 2, NPF_HASH_HALFMASK = (1 << NPF_HASH_HALFBITS) - 1 }; /* For new pathfinding. Define here so it is globally available without having * to include npf.h */ enum { NPF_TILE_LENGTH = 100 }; enum { /** This penalty is the equivalent of "inifite", which means that paths that * get this penalty will be chosen, but only if there is no other route * without it. Be careful with not applying this penalty to often, or the * total path cost might overflow.. * For now, this is just a Very Big Penalty, we might actually implement * this in a nicer way :-) */ NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH }; /* Meant to be stored in AyStar.targetdata */ struct NPFFindStationOrTileData { TileIndex dest_coords; ///< An indication of where the station is, for heuristic purposes, or the target tile StationID station_index; ///< station index we're heading for, or INVALID_STATION when we're heading for a tile bool reserve_path; ///< Indicates whether the found path should be reserved const Vehicle *v; ///< The vehicle we are pathfinding for }; /* Indices into AyStar.userdata[] */ enum { NPF_TYPE = 0, ///< Contains a TransportTypes value NPF_SUB_TYPE, ///< Contains the sub transport type NPF_OWNER, ///< Contains an Owner value NPF_RAILTYPES, ///< Contains a bitmask the compatible RailTypes of the engine when NPF_TYPE == TRANSPORT_RAIL. Unused otherwise. }; /* Indices into AyStarNode.userdata[] */ enum { NPF_TRACKDIR_CHOICE = 0, ///< The trackdir chosen to get here NPF_NODE_FLAGS, }; /* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit() and NPFGetBit() to use them. */ enum NPFNodeFlag { NPF_FLAG_SEEN_SIGNAL, ///< Used to mark that a signal was seen on the way, for rail only NPF_FLAG_2ND_SIGNAL, ///< Used to mark that two signals were seen, rail only NPF_FLAG_3RD_SIGNAL, ///< Used to mark that three signals were seen, rail only NPF_FLAG_REVERSE, ///< Used to mark that this node was reached from the second start node, if applicable NPF_FLAG_LAST_SIGNAL_RED, ///< Used to mark that the last signal on this path was red NPF_FLAG_IGNORE_START_TILE, ///< Used to mark that the start tile is invalid, and searching should start from the second tile on NPF_FLAG_TARGET_RESERVED, ///< Used to mark that the possible reservation target is already reserved NPF_FLAG_IGNORE_RESERVED, ///< Used to mark that reserved tiles should be considered impassable }; /* Meant to be stored in AyStar.userpath */ struct NPFFoundTargetData { uint best_bird_dist; ///< The best heuristic found. Is 0 if the target was found uint best_path_dist; ///< The shortest path. Is UINT_MAX if no path is found Trackdir best_trackdir; ///< The trackdir that leads to the shortest path/closest birds dist AyStarNode node; ///< The node within the target the search led us to bool res_okay; ///< True if a path reservation could be made }; /* These functions below are _not_ re-entrant, in favor of speed! */ /* Will search from the given tile and direction, for a route to the given * station for the given transport type. See the declaration of * NPFFoundTargetData above for the meaning of the result. */ NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, NPFFindStationOrTileData *target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes); /* Will search as above, but with two start nodes, the second being the * reverse. Look at the NPF_FLAG_REVERSE flag in the result node to see which * direction was taken (NPFGetBit(result.node, NPF_FLAG_REVERSE)) */ NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, Trackdir trackdir1, bool ignore_start_tile1, TileIndex tile2, Trackdir trackdir2, bool ignore_start_tile2, NPFFindStationOrTileData *target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes); /* Will search a route to the closest depot. */ /* Search using breadth first. Good for little track choice and inaccurate * heuristic, such as railway/road.*/ NPFFoundTargetData NPFRouteToDepotBreadthFirst(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, TransportType type, uint sub_type, Owner owner, RailTypes railtypes); /* Same as above but with two start nodes, the second being the reverse. Call * NPFGetBit(result.node, NPF_FLAG_REVERSE) to see from which node the path * orginated. All pathfs from the second node will have the given * reverse_penalty applied (NPF_TILE_LENGTH is the equivalent of one full * tile). */ NPFFoundTargetData NPFRouteToDepotBreadthFirstTwoWay(TileIndex tile1, Trackdir trackdir1, bool ignore_start_tile1, TileIndex tile2, Trackdir trackdir2, bool ignore_start_tile2, TransportType type, uint sub_type, Owner owner, RailTypes railtypes, uint reverse_penalty); /* Search by trying each depot in order of Manhattan Distance. Good for lots * of choices and accurate heuristics, such as water. */ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir, bool ignore_start_tile, TransportType type, uint sub_type, Owner owner, RailTypes railtypes); /** * Search for any safe tile using a breadth first search and try to reserve a path. */ NPFFoundTargetData NPFRouteToSafeTile(const Vehicle *v, TileIndex tile, Trackdir trackdir,bool override_railtype); void NPFFillWithOrderData(NPFFindStationOrTileData *fstd, Vehicle *v, bool reserve_path = false); /* * Functions to manipulate the various NPF related flags on an AyStarNode. */ /** * Returns the current value of the given flag on the given AyStarNode. */ static inline bool NPFGetFlag(const AyStarNode *node, NPFNodeFlag flag) { return HasBit(node->user_data[NPF_NODE_FLAGS], flag); } /** * Sets the given flag on the given AyStarNode to the given value. */ static inline void NPFSetFlag(AyStarNode *node, NPFNodeFlag flag, bool value) { if (value) SetBit(node->user_data[NPF_NODE_FLAGS], flag); else ClrBit(node->user_data[NPF_NODE_FLAGS], flag); } #endif /* NPF_H */
6,656
C++
.h
123
52.349593
276
0.754801
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,429
group_gui.h
EnergeticBark_OpenTTD-3DS/src/group_gui.h
/* $Id$ */ /** @file group_gui.h Functions/definitions that have something to do with groups. */ #ifndef GROUP_GUI_H #define GROUP_GUI_H #include "vehicle_type.h" void ShowCompanyGroup(CompanyID company, VehicleType veh); void DeleteGroupHighlightOfVehicle(const Vehicle *v); #endif /* GROUP_GUI_H */
306
C++
.h
8
36.625
85
0.767918
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,430
variables.h
EnergeticBark_OpenTTD-3DS/src/variables.h
/* $Id$ */ /** @file variables.h Messing file that will cease to exist some time in the future. */ #ifndef VARIABLES_H #define VARIABLES_H #ifndef VARDEF #define VARDEF extern #endif /* Amount of game ticks */ VARDEF uint16 _tick_counter; /* Skip aging of cargo? */ VARDEF byte _age_cargo_skip_counter; /* Also save scrollpos_x, scrollpos_y and zoom */ VARDEF uint16 _disaster_delay; /* Determines what station to operate on in the * tick handler. */ VARDEF uint16 _station_tick_ctr; /* Determines how often to run the tree loop */ VARDEF byte _trees_tick_ctr; /* NOSAVE: Used in palette animations only, not really important. */ VARDEF int _palette_animation_counter; VARDEF uint32 _realtime_tick; VARDEF bool _do_autosave; VARDEF int _autosave_ctr; VARDEF byte _display_opt; VARDEF bool _rightclick_emulate; /* IN/OUT parameters to commands */ VARDEF bool _generating_world; VARDEF char *_config_file; VARDEF char *_highscore_file; VARDEF char *_log_file; /* landscape.cpp */ extern const byte _tileh_to_sprite[32]; /* Forking stuff */ VARDEF bool _dedicated_forks; #endif /* VARIABLES_H */
1,113
C++
.h
35
30.257143
87
0.759434
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,431
company_func.h
EnergeticBark_OpenTTD-3DS/src/company_func.h
/* $Id$ */ /** @file company_func.h Functions related to companies. */ #ifndef COMPANY_FUNC_H #define COMPANY_FUNC_H #include "core/math_func.hpp" #include "company_type.h" #include "tile_type.h" #include "strings_type.h" #include "gfx_type.h" void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner); void GetNameOfOwner(Owner owner, TileIndex tile); void SetLocalCompany(CompanyID new_company); extern CompanyByte _local_company; extern CompanyByte _current_company; extern Colours _company_colours[MAX_COMPANIES]; ///< NOSAVE: can be determined from company structs extern CompanyManagerFace _company_manager_face; ///< for company manager face storage in openttd.cfg bool IsHumanCompany(CompanyID company); static inline bool IsLocalCompany() { return _local_company == _current_company; } static inline bool IsInteractiveCompany(CompanyID company) { return company == _local_company; } #endif /* COMPANY_FUNC_H */
944
C++
.h
26
34.846154
101
0.792952
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,539,432
strings_func.h
EnergeticBark_OpenTTD-3DS/src/strings_func.h
/* $Id$ */ /** @file strings_func.h Functions related to OTTD's strings. */ #ifndef STRINGS_FUNC_H #define STRINGS_FUNC_H #include "strings_type.h" char *InlineString(char *buf, StringID string); char *GetString(char *buffr, StringID string, const char *last); const char *GetStringPtr(StringID string); void InjectDParam(uint amount); static inline void SetDParamX(uint64 *s, uint n, uint64 v) { s[n] = v; } static inline void SetDParam(uint n, uint64 v) { extern uint64 _decode_parameters[20]; assert(n < lengthof(_decode_parameters)); _decode_parameters[n] = v; } void SetDParamStr(uint n, const char *str); static inline uint64 GetDParamX(const uint64 *s, uint n) { return s[n]; } static inline uint64 GetDParam(uint n) { extern uint64 _decode_parameters[20]; assert(n < lengthof(_decode_parameters)); return _decode_parameters[n]; } static inline void CopyInDParam(int offs, const uint64 *src, int num) { extern uint64 _decode_parameters[20]; memcpy(_decode_parameters + offs, src, sizeof(uint64) * (num)); } static inline void CopyOutDParam(uint64 *dst, int offs, int num) { extern uint64 _decode_parameters[20]; memcpy(dst, _decode_parameters + offs, sizeof(uint64) * (num)); } extern DynamicLanguages _dynlang; // defined in strings.cpp bool ReadLanguagePack(int index); void InitializeLanguagePacks(); int CDECL StringIDSorter(const void *a, const void *b); /** Key comparison function for std::map */ struct StringIDCompare { bool operator()(StringID s1, StringID s2) const { return StringIDSorter(&s1, &s2) < 0; } }; void CheckForMissingGlyphsInLoadedLanguagePack(); #endif /* STRINGS_TYPE_H */
1,639
C++
.h
51
30.490196
89
0.758929
EnergeticBark/OpenTTD-3DS
34
1
4
GPL-2.0
9/20/2024, 10:44:59 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false