mirror of https://github.com/OpenTTD/OpenTTD
(svn r11939) -Codechange: some type fixes and very initial steps into supporting NDS by default. Based on work by Dominik.
parent
ca1b3e7b4e
commit
9444eb4484
|
@ -106,7 +106,7 @@ void SetFiosType(const byte fiostype);
|
||||||
extern const TextColour _fios_colors[];
|
extern const TextColour _fios_colors[];
|
||||||
|
|
||||||
/* bridge_gui.cpp */
|
/* bridge_gui.cpp */
|
||||||
void ShowBuildBridgeWindow(uint start, uint end, byte type);
|
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte type);
|
||||||
|
|
||||||
void ShowBuildIndustryWindow();
|
void ShowBuildIndustryWindow();
|
||||||
void ShowMusicWindow();
|
void ShowMusicWindow();
|
||||||
|
|
|
@ -1330,10 +1330,8 @@ static void Load_ORDR()
|
||||||
if (CheckSavegameVersion(5)) {
|
if (CheckSavegameVersion(5)) {
|
||||||
/* Pre-version 5 had an other layout for orders
|
/* Pre-version 5 had an other layout for orders
|
||||||
(uint16 instead of uint32) */
|
(uint16 instead of uint32) */
|
||||||
uint16 orders[5000];
|
|
||||||
|
|
||||||
len /= sizeof(uint16);
|
len /= sizeof(uint16);
|
||||||
assert (len <= lengthof(orders));
|
uint16 *orders = MallocT<uint16>(len + 1);
|
||||||
|
|
||||||
SlArray(orders, len, SLE_UINT16);
|
SlArray(orders, len, SLE_UINT16);
|
||||||
|
|
||||||
|
@ -1341,11 +1339,11 @@ static void Load_ORDR()
|
||||||
Order *order = new (i) Order();
|
Order *order = new (i) Order();
|
||||||
AssignOrder(order, UnpackVersion4Order(orders[i]));
|
AssignOrder(order, UnpackVersion4Order(orders[i]));
|
||||||
}
|
}
|
||||||
} else if (CheckSavegameVersionOldStyle(5, 2)) {
|
|
||||||
uint32 orders[5000];
|
|
||||||
|
|
||||||
len /= sizeof(uint32);
|
free(orders);
|
||||||
assert (len <= lengthof(orders));
|
} else if (CheckSavegameVersionOldStyle(5, 2)) {
|
||||||
|
len /= sizeof(uint16);
|
||||||
|
uint16 *orders = MallocT<uint16>(len + 1);
|
||||||
|
|
||||||
SlArray(orders, len, SLE_UINT32);
|
SlArray(orders, len, SLE_UINT32);
|
||||||
|
|
||||||
|
@ -1353,6 +1351,8 @@ static void Load_ORDR()
|
||||||
Order *order = new (i) Order();
|
Order *order = new (i) Order();
|
||||||
AssignOrder(order, UnpackOrder(orders[i]));
|
AssignOrder(order, UnpackOrder(orders[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update all the next pointer */
|
/* Update all the next pointer */
|
||||||
|
|
|
@ -24,11 +24,11 @@ uint _sprite_cache_size = 4;
|
||||||
|
|
||||||
struct SpriteCache {
|
struct SpriteCache {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
uint8 file_slot;
|
|
||||||
uint32 file_pos;
|
|
||||||
int16 lru;
|
|
||||||
uint32 id;
|
|
||||||
const char *grf_name;
|
const char *grf_name;
|
||||||
|
uint32 id;
|
||||||
|
uint32 file_pos;
|
||||||
|
uint16 file_slot;
|
||||||
|
int16 lru;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
24
src/stdafx.h
24
src/stdafx.h
|
@ -5,6 +5,16 @@
|
||||||
#ifndef STDAFX_H
|
#ifndef STDAFX_H
|
||||||
#define 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
|
/* 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
|
* 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
|
* does not have stdint.h and apparently neither does MorphOS, so define
|
||||||
|
@ -249,7 +259,7 @@ typedef unsigned char byte;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__BEOS__) /* Already defined on BEOS */
|
#if !defined(__BEOS__) && !defined(__NDS__) /* Already defined on BEOS and NDS */
|
||||||
typedef unsigned char uint8;
|
typedef unsigned char uint8;
|
||||||
typedef signed char int8;
|
typedef signed char int8;
|
||||||
typedef unsigned short uint16;
|
typedef unsigned short uint16;
|
||||||
|
@ -258,7 +268,7 @@ typedef unsigned char byte;
|
||||||
typedef signed int int32;
|
typedef signed int int32;
|
||||||
typedef unsigned __int64 uint64;
|
typedef unsigned __int64 uint64;
|
||||||
typedef signed __int64 int64;
|
typedef signed __int64 int64;
|
||||||
#endif
|
#endif /* !__BEOS__ && !__NDS__ */
|
||||||
|
|
||||||
#if !defined(WITH_PERSONAL_DIR)
|
#if !defined(WITH_PERSONAL_DIR)
|
||||||
#define PERSONAL_DIR ""
|
#define PERSONAL_DIR ""
|
||||||
|
@ -301,18 +311,18 @@ assert_compile(sizeof(uint8) == 1);
|
||||||
|
|
||||||
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__)
|
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__)
|
||||||
|
|
||||||
#if defined(MORPHOS)
|
#if defined(MORPHOS) || defined(__NDS__)
|
||||||
/* MorphOS doesn't have C++ conformant _stricmp... */
|
/* MorphOS and NDS don't have C++ conformant _stricmp... */
|
||||||
#define _stricmp stricmp
|
#define _stricmp stricmp
|
||||||
#elif defined(OPENBSD)
|
#elif defined(OPENBSD)
|
||||||
/* OpenBSD uses strcasecmp(3) */
|
/* OpenBSD uses strcasecmp(3) */
|
||||||
#define _stricmp strcasecmp
|
#define _stricmp strcasecmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MORPHOS) && !defined(OPENBSD)
|
#if !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__)
|
||||||
/* MorphOS & OpenBSD don't know wchars, the rest does :( */
|
/* NDS, MorphOS & OpenBSD don't know wchars, the rest does :( */
|
||||||
#define HAS_WCHAR
|
#define HAS_WCHAR
|
||||||
#endif /* !defined(MORPHOS) && !defined(OPENBSD) */
|
#endif /* !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__) */
|
||||||
|
|
||||||
#if !defined(MAX_PATH)
|
#if !defined(MAX_PATH)
|
||||||
#define MAX_PATH 260
|
#define MAX_PATH 260
|
||||||
|
|
|
@ -26,6 +26,7 @@ enum VehicleEnterTileStatus {
|
||||||
* VETS_ENTERED_STATION is set
|
* VETS_ENTERED_STATION is set
|
||||||
*/
|
*/
|
||||||
VETS_STATION_ID_OFFSET = 8,
|
VETS_STATION_ID_OFFSET = 8,
|
||||||
|
VETS_STATION_MASK = 0xFFFF << VETS_STATION_ID_OFFSET,
|
||||||
|
|
||||||
/** Bit sets of the above specified bits */
|
/** Bit sets of the above specified bits */
|
||||||
VETSB_CONTINUE = 0, ///< The vehicle can continue normally
|
VETSB_CONTINUE = 0, ///< The vehicle can continue normally
|
||||||
|
|
|
@ -51,7 +51,7 @@ Vehicle *CheckMouseOverVehicle();
|
||||||
|
|
||||||
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
|
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
|
||||||
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process);
|
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process);
|
||||||
void VpSetPresizeRange(uint from, uint to);
|
void VpSetPresizeRange(TileIndex from, TileIndex to);
|
||||||
void VpSetPlaceSizingLimit(int limit);
|
void VpSetPlaceSizingLimit(int limit);
|
||||||
|
|
||||||
typedef void PlaceProc(TileIndex tile);
|
typedef void PlaceProc(TileIndex tile);
|
||||||
|
|
Loading…
Reference in New Issue