Changeset - r2634:a3ccca486bdf
[Not reviewed]
master
0 7 0
tron - 19 years ago 2005-11-13 21:16:34
tron@openttd.org
(svn r3176) Use proper types, not some variants of int
7 files changed with 13 insertions and 11 deletions:
0 comments (0 inline, 0 general)
gfx.c
Show inline comments
 
@@ -421,25 +421,25 @@ static uint32 FormatStringLinebreaks(cha
 
				if (c == ASCII_SETX) str++;
 
				else if (c == ASCII_SETXY) str += 2;
 
				else if (c == ASCII_TINYFONT) base = 224;
 
				else if (c == ASCII_BIGFONT) base = 448;
 
			}
 
		}
 

	
 
		num++;
 
		str[-1] = '\0';
 
	}
 
}
 

	
 
void DrawStringMultiCenter(int x, int y, uint16 str, int maxw)
 
void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
 
{
 
	char buffer[512];
 
	uint32 tmp;
 
	int num, w, mt;
 
	const char *src;
 
	byte c;
 

	
 
	GetString(buffer, str);
 

	
 
	tmp = FormatStringLinebreaks(buffer, maxw);
 
	num = (uint16)tmp;
 

	
 
@@ -467,25 +467,25 @@ void DrawStringMultiCenter(int x, int y,
 
					return;
 
				}
 
				break;
 
			} else if (c == ASCII_SETX) {
 
				src++;
 
			} else if (c == ASCII_SETXY) {
 
				src+=2;
 
			}
 
		}
 
	}
 
}
 

	
 
void DrawStringMultiLine(int x, int y, uint16 str, int maxw)
 
void DrawStringMultiLine(int x, int y, StringID str, int maxw)
 
{
 
	char buffer[512];
 
	uint32 tmp;
 
	int num, w, mt;
 
	const char *src;
 
	byte c;
 

	
 
	GetString(buffer, str);
 

	
 
	tmp = FormatStringLinebreaks(buffer, maxw);
 
	num = (uint16)tmp;
 

	
gfx.h
Show inline comments
 
@@ -59,26 +59,26 @@ void DrawStringCenterUnderline(int x, in
 
void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, uint16 color);
 

	
 
void DrawStringRightAligned(int x, int y, StringID str, uint16 color);
 
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw);
 

	
 
void GfxFillRect(int left, int top, int right, int bottom, int color);
 
void GfxDrawLine(int left, int top, int right, int bottom, int color);
 
void DrawFrameRect(int left, int top, int right, int bottom, int color, int flags);
 
uint16 GetDrawStringPlayerColor(PlayerID player);
 

	
 
int GetStringWidth(const char *str);
 
void LoadStringWidthTable(void);
 
void DrawStringMultiCenter(int x, int y, uint16 str, int maxw);
 
void DrawStringMultiLine(int x, int y, uint16 str, int maxw);
 
void DrawStringMultiCenter(int x, int y, StringID str, int maxw);
 
void DrawStringMultiLine(int x, int y, StringID str, int maxw);
 
void DrawDirtyBlocks(void);
 
void SetDirtyBlocks(int left, int top, int right, int bottom);
 
void MarkWholeScreenDirty(void);
 

	
 
void GfxInitPalettes(void);
 

	
 
bool FillDrawPixelInfo(DrawPixelInfo* n, const DrawPixelInfo* o, int left, int top, int width, int height);
 

	
 
/* window.c */
 
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
 

	
 
void SetMouseCursor(uint cursor);
openttd.c
Show inline comments
 
@@ -780,27 +780,27 @@ void SwitchMode(int new_mode)
 
		} else {
 
			_local_player = 0;
 
			DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // decrease pause counter (was increased from opening load dialog)
 
#ifdef ENABLE_NETWORK
 
			if (_network_server)
 
				snprintf(_network_game_info.map_name, NETWORK_NAME_LENGTH, "%s (Loaded game)", _file_to_saveload.title);
 
#endif /* ENABLE_NETWORK */
 
		}
 
		break;
 
	}
 

	
 
	case SM_LOAD_SCENARIO: { /* Load scenario from scenario editor */
 
		int i;
 
		if (SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_EDITOR)) {
 
			PlayerID i;
 

	
 
		if (SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_EDITOR)) {
 
			_opt_ptr = &_opt;
 

	
 
			_local_player = OWNER_NONE;
 
			_generating_world = true;
 
			// delete all players.
 
			for (i = 0; i != MAX_PLAYERS; i++) {
 
				ChangeOwnershipOfPlayerItems(i, OWNER_SPECTATOR);
 
				_players[i].is_active = false;
 
			}
 
			_generating_world = false;
 
			// delete all stations owned by a player
 
			DeleteAllPlayerStations();
 
@@ -1274,26 +1274,27 @@ bool AfterLoadGame(uint version)
 
		BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) {
 
			if (IsTileType(tile, MP_RAILWAY) && HasSignals(tile) && HASBIT(_m[tile].m4, 2)) {
 
				CLRBIT(_m[tile].m4, 2);
 
				SETBIT(_m[tile].m4, 3);
 
			}
 
			// Clear possible junk data in PBS bits.
 
			if (IsTileType(tile, MP_RAILWAY) && !HASBIT(_m[tile].m5, 7))
 
				SB(_m[tile].m4, 4, 4, 0);
 
		} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
 
	}
 

	
 
	if (version < 0x1000) {
 
		int i;
 
		FOR_ALL_PLAYERS(p) {
 
			EngineID i;
 

	
 
			for (i = 0; i < TOTAL_NUM_ENGINES; i++) {
 
				p->engine_replacement[i] = INVALID_ENGINE;
 
			}
 
			p->engine_renew = false;
 
			p->engine_renew_months = -6;
 
			p->engine_renew_money = 100000;
 
		}
 
		if (_local_player < MAX_PLAYERS) {
 
			// Set the human controlled player to the patch settings
 
			// Scenario editor do not have any companies
 
			p = GetPlayer(_local_player);
 
			p->engine_renew = _patches.autorenew;
players.c
Show inline comments
 
@@ -610,25 +610,25 @@ void DeletePlayerWindows(PlayerID pi)
 
	DeleteWindowById(WC_FINANCES, pi);
 
	DeleteWindowById(WC_STATION_LIST, pi);
 
	DeleteWindowById(WC_TRAINS_LIST,   (INVALID_STATION << 16) | pi);
 
	DeleteWindowById(WC_ROADVEH_LIST,  (INVALID_STATION << 16) | pi);
 
	DeleteWindowById(WC_SHIPS_LIST,    (INVALID_STATION << 16) | pi);
 
	DeleteWindowById(WC_AIRCRAFT_LIST, (INVALID_STATION << 16) | pi);
 
	DeleteWindowById(WC_BUY_COMPANY, pi);
 
}
 

	
 
byte GetPlayerRailtypes(PlayerID p)
 
{
 
	byte rt = 0;
 
	uint i;
 
	EngineID i;
 

	
 
	for (i = 0; i != TOTAL_NUM_ENGINES; i++) {
 
		const Engine* e = GetEngine(i);
 

	
 
		if (e->type == VEH_Train &&
 
				HASBIT(e->player_avail, p) &&
 
				!(RailVehInfo(i)->flags & RVI_WAGON)) {
 
			assert(e->railtype < RAILTYPE_END);
 
			SETBIT(rt, e->railtype);
 
		}
 
	}
 

	
train_cmd.c
Show inline comments
 
@@ -1949,25 +1949,26 @@ static void TrainPlayLeaveStationSound(c
 
}
 

	
 
static bool CheckTrainStayInDepot(Vehicle *v)
 
{
 
	Vehicle *u;
 

	
 
	// bail out if not all wagons are in the same depot or not in a depot at all
 
	for (u = v; u != NULL; u = u->next)
 
		if (u->u.rail.track != 0x80 || u->tile != v->tile)
 
			return false;
 

	
 
	if (v->u.rail.force_proceed == 0) {
 
		byte trackdir = GetVehicleTrackdir(v);
 
		Trackdir trackdir = GetVehicleTrackdir(v);
 

	
 
		if (++v->load_unload_time_rem < 37) {
 
			InvalidateWindowClasses(WC_TRAINS_LIST);
 
			return true;
 
		}
 

	
 
		v->load_unload_time_rem = 0;
 

	
 
		if (PBSIsPbsSegment(v->tile, trackdir)) {
 
			NPFFindStationOrTileData fstd;
 
			NPFFoundTargetData ftd;
 

	
 
			if (PBSTileUnavail(v->tile) & (1 << trackdir))
vehicle.h
Show inline comments
 
@@ -231,25 +231,25 @@ struct Vehicle {
 
	OrderID num_orders;      //! How many orders there are in the list
 

	
 
	Vehicle *next_shared;    //! If not NULL, this points to the next vehicle that shared the order
 
	Vehicle *prev_shared;    //! If not NULL, this points to the prev vehicle that shared the order
 
	/* End Order-stuff */
 

	
 
	// Boundaries for the current position in the world and a next hash link.
 
	// NOSAVE: All of those can be updated with VehiclePositionChanged()
 
	int32 left_coord;
 
	int32 top_coord;
 
	int32 right_coord;
 
	int32 bottom_coord;
 
	uint16 next_hash;
 
	VehicleID next_hash;
 

	
 
	// Related to age and service time
 
	uint16 age;				// Age in days
 
	uint16 max_age;		// Maximum age
 
	uint16 date_of_last_service;
 
	uint16 service_interval;
 
	uint16 reliability;
 
	uint16 reliability_spd_dec;
 
	byte breakdown_ctr;
 
	byte breakdown_delay;
 
	byte breakdowns_since_last_service;
 
	byte breakdown_chance;
window.h
Show inline comments
 
@@ -47,25 +47,25 @@ enum {
 
	RESIZE_TB     = RESIZE_TOP   | RESIZE_BOTTOM,
 
	RESIZE_LRB    = RESIZE_LEFT  | RESIZE_RIGHT  | RESIZE_BOTTOM,
 
	RESIZE_LRTB   = RESIZE_LEFT  | RESIZE_RIGHT  | RESIZE_TOP | RESIZE_BOTTOM,
 
	RESIZE_RTB    = RESIZE_RIGHT | RESIZE_TOP    | RESIZE_BOTTOM,
 
};
 

	
 
typedef struct Widget {
 
	byte type;
 
	byte resize_flag;
 
	byte color;
 
	uint16 left, right, top, bottom;
 
	uint16 unkA;
 
	uint16 tooltips;
 
	StringID tooltips;
 
} Widget;
 

	
 
enum FrameFlags {
 
	FR_TRANSPARENT  = 0x01,  ///< Makes the background transparent if set
 
	FR_NOBORDER     = 0x08,  ///< Hide border (draws just a solid box)
 
	FR_BORDERONLY   = 0x10,  ///< Draw border only, no background
 
	FR_LOWERED      = 0x20,  ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed)
 
	FR_DARKENED     = 0x40,  ///< If set the background is darker, allows for lowered frames with normal background color when used with FR_LOWERED (ie. dropdown boxes)
 
};
 

	
 
/* XXX - outside "byte event" so you can set event directly without going into
 
 * the union elements at first. Because of this every first element of the union
0 comments (0 inline, 0 general)