Changeset - r11085:c87a330fb4c2
[Not reviewed]
master
! ! !
rubidium - 16 years ago 2009-02-09 02:57:15
rubidium@openttd.org
(svn r15428) -Codechange: consistently use colour instead of having both color and colour.
82 files changed:
Changeset was too big and was cut off... Show full diff anyway
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -249,25 +249,25 @@ struct AISettingsWindow : public Window 
 

	
 
		AIConfig *config = this->ai_config;
 
		AIConfigItemList::const_iterator it = config->GetConfigList()->begin();
 
		int i = 0;
 
		for (; i < this->vscroll.pos; i++) it++;
 

	
 
		int y = this->widget[AIS_WIDGET_BACKGROUND].top;
 
		for (; i < this->vscroll.pos + this->vscroll.cap && it != config->GetConfigList()->end(); i++, it++) {
 
			int current_value = config->GetSetting((*it).name);
 

	
 
			int x = 0;
 
			if (((*it).flags & AICONFIG_BOOLEAN) != 0) {
 
				DrawFrameRect(4, y  + 2, 23, y + 10, (current_value != 0) ? 6 : 4, (current_value != 0) ? FR_LOWERED : FR_NONE);
 
				DrawFrameRect(4, y  + 2, 23, y + 10, (current_value != 0) ? COLOUR_GREEN : COLOUR_RED, (current_value != 0) ? FR_LOWERED : FR_NONE);
 
			} else {
 
				DrawArrowButtons(4, y + 2, COLOUR_YELLOW, (this->clicked_button == i) ? 1 + !!this->clicked_increase : 0, current_value > (*it).min_value, current_value < (*it).max_value);
 
				if (it->labels != NULL && it->labels->Find(current_value) != it->labels->End()) {
 
					x = DoDrawStringTruncated(it->labels->Find(current_value)->second, 28, y + 3, TC_ORANGE, this->width - 32);
 
				} else {
 
					SetDParam(0, current_value);
 
					x = DrawStringTruncated(28, y + 3, STR_JUST_INT, TC_ORANGE, this->width - 32);
 
				}
 
			}
 

	
 
			DoDrawStringTruncated((*it).description, max(x + 3, 54), y + 3, TC_LIGHT_BLUE, this->width - (4 + max(x + 3, 54)));
 
			y += 14;
src/aircraft_cmd.cpp
Show inline comments
 
@@ -575,25 +575,25 @@ CommandCost CmdRefitAircraft(TileIndex t
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		v->cargo_cap = pass;
 

	
 
		Vehicle *u = v->Next();
 
		uint mail = IsCargoInClass(new_cid, CC_PASSENGERS) ? avi->mail_capacity : 0;
 
		u->cargo_cap = mail;
 
		v->cargo.Truncate(v->cargo_type == new_cid ? pass : 0);
 
		u->cargo.Truncate(v->cargo_type == new_cid ? mail : 0);
 
		v->cargo_type = new_cid;
 
		v->cargo_subtype = new_subtype;
 
		v->colormap = PAL_NONE; // invalidate vehicle colour map
 
		v->colourmap = PAL_NONE; // invalidate vehicle colour map
 
		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 
		InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
 
	}
 

	
 
	return cost;
 
}
 

	
 

	
 
static void CheckIfAircraftNeedsService(Vehicle *v)
 
{
 
	if (_settings_game.vehicle.servint_aircraft == 0 || !v->NeedsAutomaticServicing()) return;
src/blitter/32bpp_anim.cpp
Show inline comments
 
@@ -120,29 +120,29 @@ inline void Blitter_32bppAnim::Draw(cons
 
								*anim = r;
 
								if (r != 0) *dst = ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, *dst);
 
							}
 
							anim++;
 
							dst++;
 
							src_px++;
 
							src_n++;
 
						} while (--n != 0);
 
					}
 
					break;
 

	
 
				case BM_TRANSPARENT:
 
					/* TODO -- We make an assumption here that the remap in fact is transparency, not some color.
 
					/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
 
					 *  This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
 
					 *  we produce a result the newgrf maker didn't expect ;) */
 

	
 
					/* Make the current color a bit more black, so it looks like this image is transparent */
 
					/* Make the current colour a bit more black, so it looks like this image is transparent */
 
					src_n += n;
 
					if (src_px->a == 255) {
 
						src_px += n;
 
						do {
 
							*dst = MakeTransparent(*dst, 3, 4);
 
							*anim = remap[*anim];
 
							anim++;
 
							dst++;
 
						} while (--n != 0);
 
					} else {
 
						do {
 
							*dst = MakeTransparent(*dst, (256 * 4 - src_px->a), 256 * 4);
 
@@ -203,29 +203,29 @@ void Blitter_32bppAnim::Draw(Blitter::Bl
 
		this->anim_buf_width = _screen.width;
 
		this->anim_buf_height = _screen.height;
 
	}
 

	
 
	switch (mode) {
 
		default: NOT_REACHED();
 
		case BM_NORMAL:       Draw<BM_NORMAL>      (bp, zoom); return;
 
		case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
 
		case BM_TRANSPARENT:  Draw<BM_TRANSPARENT> (bp, zoom); return;
 
	}
 
}
 

	
 
void Blitter_32bppAnim::DrawColorMappingRect(void *dst, int width, int height, int pal)
 
void Blitter_32bppAnim::DrawColourMappingRect(void *dst, int width, int height, int pal)
 
{
 
	if (_screen_disable_anim) {
 
		/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawColorMappingRect() */
 
		Blitter_32bppOptimized::DrawColorMappingRect(dst, width, height, pal);
 
		/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawColourMappingRect() */
 
		Blitter_32bppOptimized::DrawColourMappingRect(dst, width, height, pal);
 
		return;
 
	}
 

	
 
	uint32 *udst = (uint32 *)dst;
 
	uint8 *anim;
 

	
 
	anim = this->anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr);
 

	
 
	if (pal == PALETTE_TO_TRANSPARENT) {
 
		do {
 
			for (int i = 0; i != width; i++) {
 
				*udst = MakeTransparent(*udst, 154);
 
@@ -243,68 +243,68 @@ void Blitter_32bppAnim::DrawColorMapping
 
			for (int i = 0; i != width; i++) {
 
				*udst = MakeGrey(*udst);
 
				*anim = 0;
 
				udst++;
 
				anim++;
 
			}
 
			udst = udst - width + _screen.pitch;
 
			anim = anim - width + this->anim_buf_width;
 
		} while (--height);
 
		return;
 
	}
 

	
 
	DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this color table ('%d')", pal);
 
	DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
 
}
 

	
 
void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 color)
 
void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
 
{
 
	*((uint32 *)video + x + y * _screen.pitch) = LookupColourInPalette(color);
 
	*((uint32 *)video + x + y * _screen.pitch) = LookupColourInPalette(colour);
 

	
 
	/* Set the color in the anim-buffer too, if we are rendering to the screen */
 
	/* Set the colour in the anim-buffer too, if we are rendering to the screen */
 
	if (_screen_disable_anim) return;
 
	this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = color;
 
	this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = colour;
 
}
 

	
 
void Blitter_32bppAnim::SetPixelIfEmpty(void *video, int x, int y, uint8 color)
 
void Blitter_32bppAnim::SetPixelIfEmpty(void *video, int x, int y, uint8 colour)
 
{
 
	uint32 *dst = (uint32 *)video + x + y * _screen.pitch;
 
	if (*dst == 0) {
 
		*dst = LookupColourInPalette(color);
 
		/* Set the color in the anim-buffer too, if we are rendering to the screen */
 
		*dst = LookupColourInPalette(colour);
 
		/* Set the colour in the anim-buffer too, if we are rendering to the screen */
 
		if (_screen_disable_anim) return;
 
		this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = color;
 
		this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = colour;
 
	}
 
}
 

	
 
void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 color)
 
void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 colour)
 
{
 
	if (_screen_disable_anim) {
 
		/* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
 
		Blitter_32bppOptimized::DrawRect(video, width, height, color);
 
		Blitter_32bppOptimized::DrawRect(video, width, height, colour);
 
		return;
 
	}
 

	
 
	uint32 color32 = LookupColourInPalette(color);
 
	uint32 colour32 = LookupColourInPalette(colour);
 
	uint8 *anim_line;
 

	
 
	anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
 

	
 
	do {
 
		uint32 *dst = (uint32 *)video;
 
		uint8 *anim = anim_line;
 

	
 
		for (int i = width; i > 0; i--) {
 
			*dst = color32;
 
			/* Set the color in the anim-buffer too */
 
			*anim = color;
 
			*dst = colour32;
 
			/* Set the colour in the anim-buffer too */
 
			*anim = colour;
 
			dst++;
 
			anim++;
 
		}
 
		video = (uint32 *)video + _screen.pitch;
 
		anim_line += this->anim_buf_width;
 
	} while (--height);
 
}
 

	
 
void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width, int height)
 
{
 
	assert(!_screen_disable_anim);
 
	assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
src/blitter/32bpp_anim.hpp
Show inline comments
 
@@ -13,28 +13,28 @@ private:
 
	uint8 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
 
	int anim_buf_width;
 
	int anim_buf_height;
 

	
 
public:
 
	Blitter_32bppAnim() :
 
		anim_buf(NULL),
 
		anim_buf_width(0),
 
		anim_buf_height(0)
 
	{}
 

	
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	/* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal);
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 color);
 
	/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 color);
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 color);
 
	/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, int pal);
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
 
	/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 colour);
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
 
	/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
 
	/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);
 
	/* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y);
 
	/* virtual */ int BufferSize(int width, int height);
 
	/* virtual */ void PaletteAnimate(uint start, uint count);
 
	/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
 

	
 
	/* virtual */ const char *GetName() { return "32bpp-anim"; }
 
	/* virtual */ int GetBytesPerPixel() { return 5; }
 

	
 
	template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
 
};
src/blitter/32bpp_base.cpp
Show inline comments
 
@@ -2,95 +2,95 @@
 

	
 
/** @file 32bpp_base.cpp Implementation of base for 32 bpp blitters. */
 

	
 
#include "../stdafx.h"
 
#include "../gfx_func.h"
 
#include "32bpp_base.hpp"
 

	
 
void *Blitter_32bppBase::MoveTo(const void *video, int x, int y)
 
{
 
	return (uint32 *)video + x + y * _screen.pitch;
 
}
 

	
 
void Blitter_32bppBase::SetPixel(void *video, int x, int y, uint8 color)
 
void Blitter_32bppBase::SetPixel(void *video, int x, int y, uint8 colour)
 
{
 
	*((uint32 *)video + x + y * _screen.pitch) = LookupColourInPalette(color);
 
	*((uint32 *)video + x + y * _screen.pitch) = LookupColourInPalette(colour);
 
}
 

	
 
void Blitter_32bppBase::SetPixelIfEmpty(void *video, int x, int y, uint8 color)
 
void Blitter_32bppBase::SetPixelIfEmpty(void *video, int x, int y, uint8 colour)
 
{
 
	uint32 *dst = (uint32 *)video + x + y * _screen.pitch;
 
	if (*dst == 0) *dst = LookupColourInPalette(color);
 
	if (*dst == 0) *dst = LookupColourInPalette(colour);
 
}
 

	
 
void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8 color)
 
void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8 colour)
 
{
 
	uint32 color32 = LookupColourInPalette(color);
 
	uint32 colour32 = LookupColourInPalette(colour);
 

	
 
	do {
 
		uint32 *dst = (uint32 *)video;
 
		for (int i = width; i > 0; i--) {
 
			*dst = color32;
 
			*dst = colour32;
 
			dst++;
 
		}
 
		video = (uint32 *)video + _screen.pitch;
 
	} while (--height);
 
}
 

	
 
void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 color)
 
void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour)
 
{
 
	int dy;
 
	int dx;
 
	int stepx;
 
	int stepy;
 
	int frac;
 

	
 
	dy = (y2 - y) * 2;
 
	if (dy < 0) {
 
		dy = -dy;
 
		stepy = -1;
 
	} else {
 
		stepy = 1;
 
	}
 

	
 
	dx = (x2 - x) * 2;
 
	if (dx < 0) {
 
		dx = -dx;
 
		stepx = -1;
 
	} else {
 
		stepx = 1;
 
	}
 

	
 
	if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
 
	if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
 
	if (dx > dy) {
 
		frac = dy - (dx / 2);
 
		while (x != x2) {
 
			if (frac >= 0) {
 
				y += stepy;
 
				frac -= dx;
 
			}
 
			x += stepx;
 
			frac += dy;
 
			if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
 
			if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
 
		}
 
	} else {
 
		frac = dx - (dy / 2);
 
		while (y != y2) {
 
			if (frac >= 0) {
 
				x += stepx;
 
				frac -= dy;
 
			}
 
			y += stepy;
 
			frac += dx;
 
			if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
 
			if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
 
		}
 
	}
 
}
 

	
 
void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width, int height)
 
{
 
	uint32 *dst = (uint32 *)video;
 
	uint32 *usrc = (uint32 *)src;
 

	
 
	for (; height > 0; height--) {
 
		memcpy(dst, usrc, width * sizeof(uint32));
 
		usrc += width;
src/blitter/32bpp_base.hpp
Show inline comments
 
@@ -3,31 +3,31 @@
 
/** @file 32bpp_base.hpp Base for all 32 bits blitters. */
 

	
 
#ifndef BLITTER_32BPP_BASE_HPP
 
#define BLITTER_32BPP_BASE_HPP
 

	
 
#include "base.hpp"
 
#include "../core/bitmath_func.hpp"
 

	
 
class Blitter_32bppBase : public Blitter {
 
public:
 
	/* virtual */ uint8 GetScreenDepth() { return 32; }
 
//	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
//	/* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal);
 
//	/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, int pal);
 
//	/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
 
	/* virtual */ void *MoveTo(const void *video, int x, int y);
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 color);
 
	/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 color);
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 color);
 
	/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 color);
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
 
	/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 colour);
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
 
	/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour);
 
	/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
 
	/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);
 
	/* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch);
 
	/* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y);
 
	/* virtual */ int BufferSize(int width, int height);
 
	/* virtual */ void PaletteAnimate(uint start, uint count);
 
	/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
 
	/* virtual */ int GetBytesPerPixel() { return 4; }
 

	
 
	/**
 
	 * Compose a colour based on RGB values.
 
	 */
src/blitter/32bpp_optimized.cpp
Show inline comments
 
@@ -127,29 +127,29 @@ inline void Blitter_32bppOptimized::Draw
 
							} else {
 
								uint r = remap[m];
 
								if (r != 0) *dst = ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, *dst);
 
							}
 
							dst++;
 
							src_px++;
 
							src_n++;
 
						} while (--n != 0);
 
					}
 
					break;
 

	
 
				case BM_TRANSPARENT:
 
					/* TODO -- We make an assumption here that the remap in fact is transparency, not some color.
 
					/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
 
					 *  This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
 
					 *  we produce a result the newgrf maker didn't expect ;) */
 

	
 
					/* Make the current color a bit more black, so it looks like this image is transparent */
 
					/* Make the current colour a bit more black, so it looks like this image is transparent */
 
					src_n += n;
 
					if (src_px->a == 255) {
 
						src_px += n;
 
						do {
 
							*dst = MakeTransparent(*dst, 3, 4);
 
							dst++;
 
						} while (--n != 0);
 
					} else {
 
						do {
 
							*dst = MakeTransparent(*dst, (256 * 4 - src_px->a), 256 * 4);
 
							dst++;
 
							src_px++;
src/blitter/32bpp_simple.cpp
Show inline comments
 
@@ -30,84 +30,84 @@ void Blitter_32bppSimple::Draw(Blitter::
 
		for (int x = 0; x < bp->width; x++) {
 
			switch (mode) {
 
				case BM_COLOUR_REMAP:
 
					/* In case the m-channel is zero, do not remap this pixel in any way */
 
					if (src->m == 0) {
 
						if (src->a != 0) *dst = ComposeColourRGBA(src->r, src->g, src->b, src->a, *dst);
 
					} else {
 
						if (bp->remap[src->m] != 0) *dst = ComposeColourPA(this->LookupColourInPalette(bp->remap[src->m]), src->a, *dst);
 
					}
 
					break;
 

	
 
				case BM_TRANSPARENT:
 
					/* TODO -- We make an assumption here that the remap in fact is transparency, not some color.
 
					/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
 
					 *  This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
 
					 *  we produce a result the newgrf maker didn't expect ;) */
 

	
 
					/* Make the current color a bit more black, so it looks like this image is transparent */
 
					/* Make the current colour a bit more black, so it looks like this image is transparent */
 
					if (src->a != 0) *dst = MakeTransparent(*dst, 192);
 
					break;
 

	
 
				default:
 
					if (src->a != 0) *dst = ComposeColourRGBA(src->r, src->g, src->b, src->a, *dst);
 
					break;
 
			}
 
			dst++;
 
			src += ScaleByZoom(1, zoom);
 
		}
 
	}
 
}
 

	
 
void Blitter_32bppSimple::DrawColorMappingRect(void *dst, int width, int height, int pal)
 
void Blitter_32bppSimple::DrawColourMappingRect(void *dst, int width, int height, int pal)
 
{
 
	uint32 *udst = (uint32 *)dst;
 

	
 
	if (pal == PALETTE_TO_TRANSPARENT) {
 
		do {
 
			for (int i = 0; i != width; i++) {
 
				*udst = MakeTransparent(*udst, 154);
 
				udst++;
 
			}
 
			udst = udst - width + _screen.pitch;
 
		} while (--height);
 
		return;
 
	}
 
	if (pal == PALETTE_TO_STRUCT_GREY) {
 
		do {
 
			for (int i = 0; i != width; i++) {
 
				*udst = MakeGrey(*udst);
 
				udst++;
 
			}
 
			udst = udst - width + _screen.pitch;
 
		} while (--height);
 
		return;
 
	}
 

	
 
	DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this color table ('%d')", pal);
 
	DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
 
}
 

	
 
Sprite *Blitter_32bppSimple::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
 
{
 
	Sprite *dest_sprite;
 
	SpriteLoader::CommonPixel *dst;
 
	dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width * sizeof(SpriteLoader::CommonPixel));
 

	
 
	dest_sprite->height = sprite->height;
 
	dest_sprite->width  = sprite->width;
 
	dest_sprite->x_offs = sprite->x_offs;
 
	dest_sprite->y_offs = sprite->y_offs;
 

	
 
	dst = (SpriteLoader::CommonPixel *)dest_sprite->data;
 

	
 
	memcpy(dst, sprite->data, sprite->height * sprite->width * sizeof(SpriteLoader::CommonPixel));
 
	for (int i = 0; i < sprite->height * sprite->width; i++) {
 
		if (dst[i].m != 0) {
 
			/* Pre-convert the mapping channel to a RGB value */
 
			uint color = this->LookupColourInPalette(dst[i].m);
 
			dst[i].r = GB(color, 16, 8);
 
			dst[i].g = GB(color, 8,  8);
 
			dst[i].b = GB(color, 0,  8);
 
			uint colour = this->LookupColourInPalette(dst[i].m);
 
			dst[i].r = GB(colour, 16, 8);
 
			dst[i].g = GB(colour, 8,  8);
 
			dst[i].b = GB(colour, 0,  8);
 
		}
 
	}
 

	
 
	return dest_sprite;
 
}
src/blitter/32bpp_simple.hpp
Show inline comments
 
@@ -2,25 +2,25 @@
 

	
 
/** @file 32bpp_simple.hpp Simple 32 bpp blitter. */
 

	
 
#ifndef BLITTER_32BPP_SIMPLE_HPP
 
#define BLITTER_32BPP_SIMPLE_HPP
 

	
 
#include "32bpp_base.hpp"
 
#include "factory.hpp"
 

	
 
class Blitter_32bppSimple : public Blitter_32bppBase {
 
public:
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	/* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal);
 
	/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, int pal);
 
	/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
 

	
 
	/* virtual */ const char *GetName() { return "32bpp-simple"; }
 
};
 

	
 
class FBlitter_32bppSimple: public BlitterFactory<FBlitter_32bppSimple> {
 
public:
 
	/* virtual */ const char *GetName() { return "32bpp-simple"; }
 
	/* virtual */ const char *GetDescription() { return "32bpp Simple Blitter (no palette animation)"; }
 
	/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSimple(); }
 
};
 

	
src/blitter/8bpp_base.cpp
Show inline comments
 
/* $Id$ */
 

	
 
/** @file 8bpp_base.cpp Implementation of the base for all 8 bpp blitters. */
 

	
 
#include "../stdafx.h"
 
#include "../gfx_func.h"
 
#include "8bpp_base.hpp"
 

	
 
void Blitter_8bppBase::DrawColorMappingRect(void *dst, int width, int height, int pal)
 
void Blitter_8bppBase::DrawColourMappingRect(void *dst, int width, int height, int pal)
 
{
 
	const uint8 *ctab = GetNonSprite(pal, ST_RECOLOUR) + 1;
 

	
 
	do {
 
		for (int i = 0; i != width; i++) *((uint8 *)dst + i) = ctab[((uint8 *)dst)[i]];
 
		dst = (uint8 *)dst + _screen.pitch;
 
	} while (--height);
 
}
 

	
 
void *Blitter_8bppBase::MoveTo(const void *video, int x, int y)
 
{
 
	return (uint8 *)video + x + y * _screen.pitch;
 
}
 

	
 
void Blitter_8bppBase::SetPixel(void *video, int x, int y, uint8 color)
 
void Blitter_8bppBase::SetPixel(void *video, int x, int y, uint8 colour)
 
{
 
	*((uint8 *)video + x + y * _screen.pitch) = color;
 
	*((uint8 *)video + x + y * _screen.pitch) = colour;
 
}
 

	
 
void Blitter_8bppBase::SetPixelIfEmpty(void *video, int x, int y, uint8 color)
 
void Blitter_8bppBase::SetPixelIfEmpty(void *video, int x, int y, uint8 colour)
 
{
 
	uint8 *dst = (uint8 *)video + x + y * _screen.pitch;
 
	if (*dst == 0) *dst = color;
 
	if (*dst == 0) *dst = colour;
 
}
 

	
 
void Blitter_8bppBase::DrawRect(void *video, int width, int height, uint8 color)
 
void Blitter_8bppBase::DrawRect(void *video, int width, int height, uint8 colour)
 
{
 
	do {
 
		memset(video, color, width);
 
		memset(video, colour, width);
 
		video = (uint8 *)video + _screen.pitch;
 
	} while (--height);
 
}
 

	
 
void Blitter_8bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 color)
 
void Blitter_8bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour)
 
{
 
	int dy;
 
	int dx;
 
	int stepx;
 
	int stepy;
 
	int frac;
 

	
 
	dy = (y2 - y) * 2;
 
	if (dy < 0) {
 
		dy = -dy;
 
		stepy = -1;
 
	} else {
 
		stepy = 1;
 
	}
 

	
 
	dx = (x2 - x) * 2;
 
	if (dx < 0) {
 
		dx = -dx;
 
		stepx = -1;
 
	} else {
 
		stepx = 1;
 
	}
 

	
 
	if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
 
	if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
 
	if (dx > dy) {
 
		frac = dy - (dx / 2);
 
		while (x != x2) {
 
			if (frac >= 0) {
 
				y += stepy;
 
				frac -= dx;
 
			}
 
			x += stepx;
 
			frac += dy;
 
			if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
 
			if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
 
		}
 
	} else {
 
		frac = dx - (dy / 2);
 
		while (y != y2) {
 
			if (frac >= 0) {
 
				x += stepx;
 
				frac -= dy;
 
			}
 
			y += stepy;
 
			frac += dx;
 
			if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color);
 
			if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
 
		}
 
	}
 
}
 

	
 
void Blitter_8bppBase::CopyFromBuffer(void *video, const void *src, int width, int height)
 
{
 
	uint8 *dst = (uint8 *)video;
 
	uint8 *usrc = (uint8 *)src;
 

	
 
	for (; height > 0; height--) {
 
		memcpy(dst, usrc, width * sizeof(uint8));
 
		usrc += width;
src/blitter/8bpp_base.hpp
Show inline comments
 
@@ -2,30 +2,30 @@
 

	
 
/** @file 8bpp_base.hpp Base for all 8 bpp blitters. */
 

	
 
#ifndef BLITTER_8BPP_BASE_HPP
 
#define BLITTER_8BPP_BASE_HPP
 

	
 
#include "base.hpp"
 

	
 
class Blitter_8bppBase : public Blitter {
 
public:
 
	/* virtual */ uint8 GetScreenDepth() { return 8; }
 
//	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
 
	/* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal);
 
	/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, int pal);
 
//	/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
 
	/* virtual */ void *MoveTo(const void *video, int x, int y);
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 color);
 
	/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 color);
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 color);
 
	/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 color);
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
 
	/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 colour);
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
 
	/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour);
 
	/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
 
	/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);
 
	/* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch);
 
	/* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y);
 
	/* virtual */ int BufferSize(int width, int height);
 
	/* virtual */ void PaletteAnimate(uint start, uint count);
 
	/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
 
	/* virtual */ int GetBytesPerPixel() { return 1; }
 
};
 

	
 
#endif /* BLITTER_8BPP_BASE_HPP */
src/blitter/8bpp_debug.cpp
Show inline comments
 
@@ -35,20 +35,20 @@ void Blitter_8bppDebug::Draw(Blitter::Bl
 
}
 

	
 
Sprite *Blitter_8bppDebug::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
 
{
 
	Sprite *dest_sprite;
 
	dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);
 

	
 
	dest_sprite->height = sprite->height;
 
	dest_sprite->width  = sprite->width;
 
	dest_sprite->x_offs = sprite->x_offs;
 
	dest_sprite->y_offs = sprite->y_offs;
 

	
 
	/* Write a random color as sprite; this makes debugging really easy */
 
	uint color = InteractiveRandom() % 150 + 2;
 
	/* Write a random colour as sprite; this makes debugging really easy */
 
	uint colour = InteractiveRandom() % 150 + 2;
 
	for (int i = 0; i < sprite->height * sprite->width; i++) {
 
		dest_sprite->data[i] = (sprite->data[i].m == 0) ? 0 : color;
 
		dest_sprite->data[i] = (sprite->data[i].m == 0) ? 0 : colour;
 
	}
 

	
 
	return dest_sprite;
 
}
src/blitter/8bpp_optimized.cpp
Show inline comments
 
@@ -131,25 +131,25 @@ Sprite *Blitter_8bppOptimized::Encode(Sp
 
			uint trans = 0;
 
			uint pixels = 0;
 
			uint last_colour = 0;
 
			byte *count_dst = NULL;
 

	
 
			/* Store the scaled image */
 
			const SpriteLoader::CommonPixel *src = &sprite->data[ScaleByZoom(y, i) * sprite->width];
 
			const SpriteLoader::CommonPixel *src_end = &src[sprite->width];
 

	
 
			for (int x = 0; x < scaled_width; x++) {
 
				uint colour = 0;
 

	
 
				/* Get the color keeping in mind the zoom-level */
 
				/* Get the colour keeping in mind the zoom-level */
 
				for (int j = 0; j < scaled_1; j++) {
 
					if (src->m != 0) colour = src->m;
 
					/* Because of the scaling it might happen we read outside the buffer. Avoid that. */
 
					if (++src == src_end) break;
 
				}
 

	
 
				if (last_colour == 0 || colour == 0 || pixels == 255) {
 
					if (count_dst != NULL) {
 
						/* Write how many non-transparent bytes we get */
 
						*count_dst = pixels;
 
						pixels = 0;
 
						count_dst = NULL;
src/blitter/8bpp_simple.cpp
Show inline comments
 
@@ -16,40 +16,40 @@ void Blitter_8bppSimple::Draw(Blitter::B
 
	/* Find where to start reading in the source sprite */
 
	src_line = (const uint8 *)bp->sprite + (bp->skip_top * bp->sprite_width + bp->skip_left) * ScaleByZoom(1, zoom);
 
	dst_line = (uint8 *)bp->dst + bp->top * bp->pitch + bp->left;
 

	
 
	for (int y = 0; y < bp->height; y++) {
 
		dst = dst_line;
 
		dst_line += bp->pitch;
 

	
 
		src = src_line;
 
		src_line += bp->sprite_width * ScaleByZoom(1, zoom);
 

	
 
		for (int x = 0; x < bp->width; x++) {
 
			uint color = 0;
 
			uint colour = 0;
 

	
 
			switch (mode) {
 
				case BM_COLOUR_REMAP:
 
					color = bp->remap[*src];
 
					colour = bp->remap[*src];
 
					break;
 

	
 
				case BM_TRANSPARENT:
 
					if (*src != 0) color = bp->remap[*dst];
 
					if (*src != 0) colour = bp->remap[*dst];
 
					break;
 

	
 
				default:
 
					color = *src;
 
					colour = *src;
 
					break;
 
			}
 
			if (color != 0) *dst = color;
 
			if (colour != 0) *dst = colour;
 
			dst++;
 
			src += ScaleByZoom(1, zoom);
 
		}
 
	}
 
}
 

	
 
Sprite *Blitter_8bppSimple::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
 
{
 
	Sprite *dest_sprite;
 
	dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);;
 

	
 
	dest_sprite->height = sprite->height;
src/blitter/base.hpp
Show inline comments
 
@@ -45,87 +45,87 @@ public:
 
	/**
 
	 * Get the screen depth this blitter works for.
 
	 *  This is either: 8, 16, 24 or 32.
 
	 */
 
	virtual uint8 GetScreenDepth() = 0;
 

	
 
	/**
 
	 * Draw an image to the screen, given an amount of params defined above.
 
	 */
 
	virtual void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) = 0;
 

	
 
	/**
 
	 * Draw a colortable to the screen. This is: the color of the screen is read
 
	 *  and is looked-up in the palette to match a new color, which then is put
 
	 * Draw a colourtable to the screen. This is: the colour of the screen is read
 
	 *  and is looked-up in the palette to match a new colour, which then is put
 
	 *  on the screen again.
 
	 * @param dst the destination pointer (video-buffer).
 
	 * @param width the width of the buffer.
 
	 * @param height the height of the buffer.
 
	 * @param pal the palette to use.
 
	 */
 
	virtual void DrawColorMappingRect(void *dst, int width, int height, int pal) = 0;
 
	virtual void DrawColourMappingRect(void *dst, int width, int height, int pal) = 0;
 

	
 
	/**
 
	 * Convert a sprite from the loader to our own format.
 
	 */
 
	virtual Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator) = 0;
 

	
 
	/**
 
	 * Move the destination pointer the requested amount x and y, keeping in mind
 
	 *  any pitch and bpp of the renderer.
 
	 * @param video The destination pointer (video-buffer) to scroll.
 
	 * @param x How much you want to scroll to the right.
 
	 * @param y How much you want to scroll to the bottom.
 
	 * @return A new destination pointer moved the the requested place.
 
	 */
 
	virtual void *MoveTo(const void *video, int x, int y) = 0;
 

	
 
	/**
 
	 * Draw a pixel with a given color on the video-buffer.
 
	 * Draw a pixel with a given colour on the video-buffer.
 
	 * @param video The destination pointer (video-buffer).
 
	 * @param x The x position within video-buffer.
 
	 * @param y The y position within video-buffer.
 
	 * @param color A 8bpp mapping color.
 
	 * @param colour A 8bpp mapping colour.
 
	 */
 
	virtual void SetPixel(void *video, int x, int y, uint8 color) = 0;
 
	virtual void SetPixel(void *video, int x, int y, uint8 colour) = 0;
 

	
 
	/**
 
	 * Draw a pixel with a given color on the video-buffer if there is currently a black pixel.
 
	 * Draw a pixel with a given colour on the video-buffer if there is currently a black pixel.
 
	 * @param video The destination pointer (video-buffer).
 
	 * @param x The x position within video-buffer.
 
	 * @param y The y position within video-buffer.
 
	 * @param color A 8bpp mapping color.
 
	 * @param colour A 8bpp mapping colour.
 
	 */
 
	virtual void SetPixelIfEmpty(void *video, int x, int y, uint8 color) = 0;
 
	virtual void SetPixelIfEmpty(void *video, int x, int y, uint8 colour) = 0;
 

	
 
	/**
 
	 * Make a single horizontal line in a single color on the video-buffer.
 
	 * Make a single horizontal line in a single colour on the video-buffer.
 
	 * @param video The destination pointer (video-buffer).
 
	 * @param width The lenght of the line.
 
	 * @param color A 8bpp mapping color.
 
	 * @param colour A 8bpp mapping colour.
 
	 */
 
	virtual void DrawRect(void *video, int width, int height, uint8 color) = 0;
 
	virtual void DrawRect(void *video, int width, int height, uint8 colour) = 0;
 

	
 
	/**
 
	 * Draw a line with a given color.
 
	 * Draw a line with a given colour.
 
	 * @param video The destination pointer (video-buffer).
 
	 * @param x The x coordinate from where the line starts.
 
	 * @param y The y coordinate from where the line starts.
 
	 * @param x2 The x coordinate to where the line goes.
 
	 * @param y2 The y coordinate to where the lines goes.
 
	 * @param screen_width The width of the screen you are drawing in (to avoid buffer-overflows).
 
	 * @param screen_height The height of the screen you are drawing in (to avoid buffer-overflows).
 
	 * @param color A 8bpp mapping color.
 
	 * @param colour A 8bpp mapping colour.
 
	 */
 
	virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 color) = 0;
 
	virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour) = 0;
 

	
 
	/**
 
	 * Copy from a buffer to the screen.
 
	 * @param video The destionation pointer (video-buffer).
 
	 * @param src The buffer from which the data will be read.
 
	 * @param width The width of the buffer.
 
	 * @param height The height of the buffer.
 
	 * @note You can not do anything with the content of the buffer, as the blitter can store non-pixel data in it too!
 
	 */
 
	virtual void CopyFromBuffer(void *video, const void *src, int width, int height) = 0;
 

	
 
	/**
src/blitter/null.hpp
Show inline comments
 
@@ -3,31 +3,31 @@
 
/** @file null.hpp The blitter that doesn't blit. */
 

	
 
#ifndef BLITTER_NULL_HPP
 
#define BLITTER_NULL_HPP
 

	
 
#include "base.hpp"
 
#include "factory.hpp"
 

	
 
class Blitter_Null : public Blitter {
 
public:
 
	/* virtual */ uint8 GetScreenDepth() { return 0; }
 
	/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) {};
 
	/* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal) {};
 
	/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, int pal) {};
 
	/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
 
	/* virtual */ void *MoveTo(const void *video, int x, int y) { return NULL; };
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 color) {};
 
	/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 color) {};
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 color) {};
 
	/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 color) {};
 
	/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {};
 
	/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 colour) {};
 
	/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {};
 
	/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour) {};
 
	/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height) {};
 
	/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height) {};
 
	/* virtual */ void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) {};
 
	/* virtual */ void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) {};
 
	/* virtual */ int BufferSize(int width, int height) { return 0; };
 
	/* virtual */ void PaletteAnimate(uint start, uint count) { };
 
	/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation() { return Blitter::PALETTE_ANIMATION_NONE; };
 

	
 
	/* virtual */ const char *GetName() { return "null"; }
 
	/* virtual */ int GetBytesPerPixel() { return 0; }
 
};
 

	
src/bmp.cpp
Show inline comments
 
@@ -313,28 +313,28 @@ bool BmpReadHeader(BmpBuffer *buffer, Bm
 
	/* Reads compression method if available in info header*/
 
	if ((header_size -= 4) >= 4) {
 
		info->compression = ReadDword(buffer);
 
		header_size -= 4;
 
	}
 

	
 
	/* Only 4-bit and 8-bit rle compression is supported */
 
	if (info->compression > 2 || (info->compression > 0 && !(info->bpp == 4 || info->bpp == 8))) return false;
 

	
 
	if (info->bpp <= 8) {
 
		uint i;
 

	
 
		/* Reads number of colors if available in info header */
 
		/* Reads number of colours if available in info header */
 
		if (header_size >= 16) {
 
			SkipBytes(buffer, 12);                  // skip image size and resolution
 
			info->palette_size = ReadDword(buffer); // number of colors in palette
 
			info->palette_size = ReadDword(buffer); // number of colours in palette
 
			SkipBytes(buffer, header_size - 16);    // skip the end of info header
 
		}
 
		if (info->palette_size == 0) info->palette_size = 1 << info->bpp;
 

	
 
		data->palette = CallocT<Colour>(info->palette_size);
 
		if (data->palette == NULL) return false;
 

	
 
		for (i = 0; i < info->palette_size; i++) {
 
			data->palette[i].b = ReadByte(buffer);
 
			data->palette[i].g = ReadByte(buffer);
 
			data->palette[i].r = ReadByte(buffer);
 
			if (!info->os2_bmp) SkipBytes(buffer, 1); // unused
src/bmp.h
Show inline comments
 
@@ -5,25 +5,25 @@
 
#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 colors in palette
 
	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;
src/cheat_gui.cpp
Show inline comments
 
@@ -151,25 +151,25 @@ struct CheatWindow : Window {
 

	
 
				default: {
 
					int32 val = (int32)ReadValue(ce->variable, ce->type);
 
					char buf[512];
 

	
 
					/* Draw [<][>] boxes for settings of an integer-type */
 
					DrawArrowButtons(x + 20, y, COLOUR_YELLOW, clicked - (i * 2), true, true);
 

	
 
					switch (ce->str) {
 
						/* Display date for change date cheat */
 
						case STR_CHEAT_CHANGE_DATE: SetDParam(0, _date); break;
 

	
 
						/* Draw colored flag for change company cheat */
 
						/* Draw coloured flag for change company cheat */
 
						case STR_CHEAT_CHANGE_COMPANY:
 
							SetDParam(0, val + 1);
 
							GetString(buf, STR_CHEAT_CHANGE_COMPANY, lastof(buf));
 
							DrawCompanyIcon(_local_company, 60 + GetStringBoundingBox(buf).width, y + 2);
 
							break;
 

	
 
						/* Set correct string for switch climate cheat */
 
						case STR_CHEAT_SWITCH_CLIMATE: val += STR_TEMPERATE_LANDSCAPE;
 

	
 
						/* Fallthrough */
 
						default: SetDParam(0, val);
 
					}
src/command.cpp
Show inline comments
 
@@ -95,25 +95,25 @@ DEF_COMMAND(CmdReverseTrainDirection);
 

	
 
DEF_COMMAND(CmdModifyOrder);
 
DEF_COMMAND(CmdSkipToOrder);
 
DEF_COMMAND(CmdDeleteOrder);
 
DEF_COMMAND(CmdInsertOrder);
 
DEF_COMMAND(CmdChangeServiceInt);
 
DEF_COMMAND(CmdRestoreOrderIndex);
 

	
 
DEF_COMMAND(CmdBuildIndustry);
 

	
 
DEF_COMMAND(CmdBuildCompanyHQ);
 
DEF_COMMAND(CmdSetCompanyManagerFace);
 
DEF_COMMAND(CmdSetCompanyColor);
 
DEF_COMMAND(CmdSetCompanyColour);
 

	
 
DEF_COMMAND(CmdIncreaseLoan);
 
DEF_COMMAND(CmdDecreaseLoan);
 

	
 
DEF_COMMAND(CmdWantEnginePreview);
 

	
 
DEF_COMMAND(CmdRenameVehicle);
 
DEF_COMMAND(CmdRenameEngine);
 

	
 
DEF_COMMAND(CmdRenameCompany);
 
DEF_COMMAND(CmdRenamePresident);
 

	
 
@@ -243,25 +243,25 @@ static const Command _command_proc_table
 
	{CmdReverseTrainDirection,                      0}, /* CMD_REVERSE_TRAIN_DIRECTION */
 

	
 
	{CmdModifyOrder,                                0}, /* CMD_MODIFY_ORDER */
 
	{CmdSkipToOrder,                                0}, /* CMD_SKIP_TO_ORDER */
 
	{CmdDeleteOrder,                                0}, /* CMD_DELETE_ORDER */
 
	{CmdInsertOrder,                                0}, /* CMD_INSERT_ORDER */
 

	
 
	{CmdChangeServiceInt,                           0}, /* CMD_CHANGE_SERVICE_INT */
 

	
 
	{CmdBuildIndustry,                              0}, /* CMD_BUILD_INDUSTRY */
 
	{CmdBuildCompanyHQ,       CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_COMPANY_HQ */
 
	{CmdSetCompanyManagerFace,                      0}, /* CMD_SET_COMPANY_MANAGER_FACE */
 
	{CmdSetCompanyColor,                            0}, /* CMD_SET_COMPANY_COLOR */
 
	{CmdSetCompanyColour,                           0}, /* CMD_SET_COMPANY_COLOUR */
 

	
 
	{CmdIncreaseLoan,                               0}, /* CMD_INCREASE_LOAN */
 
	{CmdDecreaseLoan,                               0}, /* CMD_DECREASE_LOAN */
 

	
 
	{CmdWantEnginePreview,                          0}, /* CMD_WANT_ENGINE_PREVIEW */
 

	
 
	{CmdRenameVehicle,                              0}, /* CMD_RENAME_VEHICLE */
 
	{CmdRenameEngine,                               0}, /* CMD_RENAME_ENGINE */
 

	
 
	{CmdRenameCompany,                              0}, /* CMD_RENAME_COMPANY */
 
	{CmdRenamePresident,                            0}, /* CMD_RENAME_PRESIDENT */
 

	
src/command_type.h
Show inline comments
 
@@ -193,25 +193,25 @@ enum {
 

	
 
	CMD_MODIFY_ORDER,                 ///< modify an order (like set full-load)
 
	CMD_SKIP_TO_ORDER,                ///< skip an order to the next of specific one
 
	CMD_DELETE_ORDER,                 ///< delete an order
 
	CMD_INSERT_ORDER,                 ///< insert a new order
 

	
 
	CMD_CHANGE_SERVICE_INT,           ///< change the server interval of a vehicle
 

	
 
	CMD_BUILD_INDUSTRY,               ///< build a new industry
 

	
 
	CMD_BUILD_COMPANY_HQ,             ///< build the company headquarter
 
	CMD_SET_COMPANY_MANAGER_FACE,     ///< set the manager's face of the company
 
	CMD_SET_COMPANY_COLOR,            ///< set the color of the company
 
	CMD_SET_COMPANY_COLOUR,            ///< set the colour of the company
 

	
 
	CMD_INCREASE_LOAN,                ///< increase the loan from the bank
 
	CMD_DECREASE_LOAN,                ///< decrease the loan from the bank
 

	
 
	CMD_WANT_ENGINE_PREVIEW,          ///< confirm the preview of an engine
 

	
 
	CMD_RENAME_VEHICLE,               ///< rename a whole vehicle
 
	CMD_RENAME_ENGINE,                ///< rename a engine (in the engine list)
 
	CMD_RENAME_COMPANY,               ///< change the company name
 
	CMD_RENAME_PRESIDENT,             ///< change the president name
 
	CMD_RENAME_STATION,               ///< rename a station
 

	
src/company_cmd.cpp
Show inline comments
 
@@ -88,35 +88,35 @@ void SetLocalCompany(CompanyID new_compa
 
	DeleteConstructionWindows();
 

	
 
	/* ... and redraw the whole screen. */
 
	MarkWholeScreenDirty();
 
}
 

	
 
bool IsHumanCompany(CompanyID company)
 
{
 
	return !GetCompany(company)->is_ai;
 
}
 

	
 

	
 
uint16 GetDrawStringCompanyColor(CompanyID company)
 
uint16 GetDrawStringCompanyColour(CompanyID company)
 
{
 
	/* Get the color for DrawString-subroutines which matches the color
 
	/* Get the colour for DrawString-subroutines which matches the colour
 
	 * of the company */
 
	if (!IsValidCompanyID(company)) return _colour_gradient[COLOUR_WHITE][4] | IS_PALETTE_COLOR;
 
	return (_colour_gradient[_company_colours[company]][4]) | IS_PALETTE_COLOR;
 
	if (!IsValidCompanyID(company)) return _colour_gradient[COLOUR_WHITE][4] | IS_PALETTE_COLOUR;
 
	return (_colour_gradient[_company_colours[company]][4]) | IS_PALETTE_COLOUR;
 
}
 

	
 
void DrawCompanyIcon(CompanyID c, int x, int y)
 
{
 
	DrawSprite(SPR_PLAYER_ICON, COMPANY_SPRITE_COLOR(c), x, y);
 
	DrawSprite(SPR_PLAYER_ICON, COMPANY_SPRITE_COLOUR(c), x, y);
 
}
 

	
 
/**
 
 * Checks whether a company manager's face is a valid encoding.
 
 * Unused bits are not enforced to be 0.
 
 * @param cmf the fact to check
 
 * @return true if and only if the face is valid
 
 */
 
bool IsValidCompanyManagerFace(CompanyManagerFace cmf)
 
{
 
	if (!AreCompanyManagerFaceBitsValid(cmf, CMFV_GEN_ETHN, GE_WM)) return false;
 

	
 
@@ -343,47 +343,47 @@ static Colours GenerateCompanyColour()
 
		Swap(colours[GB(r, 0, 4)], colours[GB(r, 4, 4)]);
 
	}
 

	
 
	/* Bubble sort it according to the values in table 1 */
 
	for (uint i = 0; i < COLOUR_END; i++) {
 
		for (uint j = 1; j < COLOUR_END; j++) {
 
			if (_colour_sort[colours[j - 1]] < _colour_sort[colours[j]]) {
 
				Swap(colours[j - 1], colours[j]);
 
			}
 
		}
 
	};
 

	
 
	/* Move the colors that look similar to each company's color to the side */
 
	/* Move the colours that look similar to each company's colour to the side */
 
	Company *c;
 
	FOR_ALL_COMPANIES(c) {
 
		Colours pcolour = (Colours)c->colour;
 

	
 
		for (uint i = 0; i < COLOUR_END; i++) {
 
			if (colours[i] == pcolour) {
 
				colours[i] = INVALID_COLOUR;
 
				break;
 
			}
 
		}
 

	
 
		for (uint j = 0; j < 2; j++) {
 
			Colours similar = _similar_colour[pcolour][j];
 
			if (similar == INVALID_COLOUR) break;
 

	
 
			for (uint i = 1; i < COLOUR_END; i++) {
 
				if (colours[i - 1] == similar) Swap(colours[i - 1], colours[i]);
 
			}
 
		}
 
	}
 

	
 
	/* Return the first available color */
 
	/* Return the first available colour */
 
	for (uint i = 0; i < COLOUR_END; i++) {
 
		if (colours[i] != INVALID_COLOUR) return colours[i];
 
	}
 

	
 
	NOT_REACHED();
 
}
 

	
 
static void GeneratePresidentName(Company *c)
 
{
 
	for (;;) {
 
restart:;
 
		c->president_name_2 = Random();
src/company_gui.cpp
Show inline comments
 
@@ -392,25 +392,25 @@ public:
 
	uint Height(uint width) const
 
	{
 
		return 14;
 
	}
 

	
 
	bool Selectable() const
 
	{
 
		return true;
 
	}
 

	
 
	void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const
 
	{
 
		DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOR_START + this->result, x + 16, y + 7);
 
		DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + this->result, x + 16, y + 7);
 
		DrawStringTruncated(x + 32, y + 3, this->String(), sel ? TC_WHITE : TC_BLACK, width - 30);
 
	}
 
};
 

	
 
struct SelectCompanyLiveryWindow : public Window {
 
private:
 
	uint32 sel;
 
	LiveryClass livery_class;
 

	
 
	enum SelectCompanyLiveryWindowWidgets {
 
		SCLW_WIDGET_CLOSE,
 
		SCLW_WIDGET_CAPTION,
 
@@ -489,29 +489,29 @@ public:
 
		this->DrawWidgets();
 

	
 
		for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
			if (_livery_class[scheme] == this->livery_class) {
 
				bool sel = HasBit(this->sel, scheme) != 0;
 

	
 
				if (scheme != LS_DEFAULT) {
 
					DrawSprite(c->livery[scheme].in_use ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, PAL_NONE, 2, y);
 
				}
 

	
 
				DrawString(15, y, STR_LIVERY_DEFAULT + scheme, sel ? TC_WHITE : TC_BLACK);
 

	
 
				DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(c->livery[scheme].colour1), 152, y);
 
				DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOUR(c->livery[scheme].colour1), 152, y);
 
				DrawString(165, y, STR_00D1_DARK_BLUE + c->livery[scheme].colour1, sel ? TC_WHITE : TC_GOLD);
 

	
 
				if (!this->IsWidgetHidden(SCLW_WIDGET_SEC_COL_DROPDOWN)) {
 
					DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOR(c->livery[scheme].colour2), 277, y);
 
					DrawSprite(SPR_SQUARE, GENERAL_SPRITE_COLOUR(c->livery[scheme].colour2), 277, y);
 
					DrawString(290, y, STR_00D1_DARK_BLUE + c->livery[scheme].colour2, sel ? TC_WHITE : TC_GOLD);
 
				}
 

	
 
				y += 14;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		/* Number of liveries in each class, used to determine the height of the livery window */
 
		static const byte livery_height[] = {
 
@@ -561,43 +561,43 @@ public:
 
			case SCLW_WIDGET_MATRIX: {
 
				LiveryScheme scheme;
 
				LiveryScheme j = (LiveryScheme)((pt.y - 48) / 14);
 

	
 
				for (scheme = LS_BEGIN; scheme <= j; scheme++) {
 
					if (_livery_class[scheme] != this->livery_class) j++;
 
					if (scheme >= LS_END) return;
 
				}
 
				if (j >= LS_END) return;
 

	
 
				/* If clicking on the left edge, toggle using the livery */
 
				if (pt.x < 10) {
 
					DoCommandP(0, j | (2 << 8), !GetCompany((CompanyID)this->window_number)->livery[j].in_use, CMD_SET_COMPANY_COLOR);
 
					DoCommandP(0, j | (2 << 8), !GetCompany((CompanyID)this->window_number)->livery[j].in_use, CMD_SET_COMPANY_COLOUR);
 
				}
 

	
 
				if (_ctrl_pressed) {
 
					ToggleBit(this->sel, j);
 
				} else {
 
					this->sel = 1 << j;
 
				}
 
				this->SetDirty();
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
		for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
			if (HasBit(this->sel, scheme)) {
 
				DoCommandP(0, scheme | (widget == SCLW_WIDGET_PRI_COL_DROPDOWN ? 0 : 256), index, CMD_SET_COMPANY_COLOR);
 
				DoCommandP(0, scheme | (widget == SCLW_WIDGET_PRI_COL_DROPDOWN ? 0 : 256), index, CMD_SET_COMPANY_COLOUR);
 
			}
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	{
 
		static bool has2cc = true;
 

	
 
		if (has2cc == !!data) return;
 

	
 
		has2cc = !!data;
 

	
 
@@ -619,59 +619,59 @@ static const Widget _select_company_live
 
{   WWT_IMGBTN, RESIZE_NONE,  COLOUR_GREY,  66,  87,  14,  35, SPR_IMG_SHIPLIST,          STR_LIVERY_SHIP_TIP },
 
{   WWT_IMGBTN, RESIZE_NONE,  COLOUR_GREY,  88, 109,  14,  35, SPR_IMG_AIRPLANESLIST,     STR_LIVERY_AIRCRAFT_TIP },
 
{    WWT_PANEL, RESIZE_NONE,  COLOUR_GREY, 110, 399,  14,  35, 0x0,                       STR_NULL },
 
{    WWT_PANEL, RESIZE_NONE,  COLOUR_GREY,   0, 149,  36,  47, 0x0,                       STR_NULL },
 
{ WWT_DROPDOWN, RESIZE_NONE,  COLOUR_GREY, 150, 274,  36,  47, STR_02BD,                  STR_LIVERY_PRIMARY_TIP },
 
{ WWT_DROPDOWN, RESIZE_NONE,  COLOUR_GREY, 275, 399,  36,  47, STR_02E1,                  STR_LIVERY_SECONDARY_TIP },
 
{   WWT_MATRIX, RESIZE_NONE,  COLOUR_GREY,   0, 399,  48,  48 + 1 * 14, (1 << 8) | 1,     STR_LIVERY_PANEL_TIP },
 
{ WIDGETS_END },
 
};
 

	
 
static const WindowDesc _select_company_livery_desc = {
 
	WDP_AUTO, WDP_AUTO, 400, 49 + 1 * 14, 400, 49 + 1 * 14,
 
	WC_COMPANY_COLOR, WC_NONE,
 
	WC_COMPANY_COLOUR, WC_NONE,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
 
	_select_company_livery_widgets,
 
};
 

	
 
/**
 
 * Draws the face of a company manager's face.
 
 * @param cmf   the company manager's face
 
 * @param color the (background) color of the gradient
 
 * @param colour the (background) colour of the gradient
 
 * @param x     x-position to draw the face
 
 * @param y     y-position to draw the face
 
 */
 
void DrawCompanyManagerFace(CompanyManagerFace cmf, int color, int x, int y)
 
void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, int x, int y)
 
{
 
	GenderEthnicity ge = (GenderEthnicity)GetCompanyManagerFaceBits(cmf, CMFV_GEN_ETHN, GE_WM);
 

	
 
	bool has_moustache   = !HasBit(ge, GENDER_FEMALE) && GetCompanyManagerFaceBits(cmf, CMFV_HAS_MOUSTACHE,   ge) != 0;
 
	bool has_tie_earring = !HasBit(ge, GENDER_FEMALE) || GetCompanyManagerFaceBits(cmf, CMFV_HAS_TIE_EARRING, ge) != 0;
 
	bool has_glasses     = GetCompanyManagerFaceBits(cmf, CMFV_HAS_GLASSES, ge) != 0;
 
	SpriteID pal;
 

	
 
	/* Modify eye colour palette only if 2 or more valid values exist */
 
	if (_cmf_info[CMFV_EYE_COLOUR].valid_values[ge] < 2) {
 
		pal = PAL_NONE;
 
	} else {
 
		switch (GetCompanyManagerFaceBits(cmf, CMFV_EYE_COLOUR, ge)) {
 
			default: NOT_REACHED();
 
			case 0: pal = PALETTE_TO_BROWN; break;
 
			case 1: pal = PALETTE_TO_BLUE;  break;
 
			case 2: pal = PALETTE_TO_GREEN; break;
 
		}
 
	}
 

	
 
	/* Draw the gradient (background) */
 
	DrawSprite(SPR_GRADIENT, GENERAL_SPRITE_COLOR(color), x, y);
 
	DrawSprite(SPR_GRADIENT, GENERAL_SPRITE_COLOUR(colour), x, y);
 

	
 
	for (CompanyManagerFaceVariable cmfv = CMFV_CHEEKS; cmfv < CMFV_END; cmfv++) {
 
		switch (cmfv) {
 
			case CMFV_MOUSTACHE:   if (!has_moustache)   continue; break;
 
			case CMFV_LIPS:        /* FALL THROUGH */
 
			case CMFV_NOSE:        if (has_moustache)    continue; break;
 
			case CMFV_TIE_EARRING: if (!has_tie_earring) continue; break;
 
			case CMFV_GLASSES:     if (!has_glasses)     continue; break;
 
			default: break;
 
		}
 
		DrawSprite(GetCompanyManagerFaceSprite(cmf, cmfv, ge), (cmfv == CMFV_EYEBROWS) ? pal : PAL_NONE, x, y);
 
	}
 
@@ -1122,25 +1122,25 @@ static void DoSelectCompanyManagerFace(W
 

	
 
	if (BringWindowToFrontById(WC_COMPANY_MANAGER_FACE, parent->window_number)) return;
 
	new SelectCompanyManagerFaceWindow(adv ? &_select_company_manager_face_adv_desc : &_select_company_manager_face_desc, parent, adv, top, left); // simple or advanced window
 
}
 

	
 

	
 
/* Names of the widgets. Keep them in the same order as in the widget array */
 
enum CompanyWindowWidgets {
 
	CW_WIDGET_CLOSEBOX = 0,
 
	CW_WIDGET_CAPTION,
 
	CW_WIDGET_FACE,
 
	CW_WIDGET_NEW_FACE,
 
	CW_WIDGET_COLOR_SCHEME,
 
	CW_WIDGET_COLOUR_SCHEME,
 
	CW_WIDGET_PRESIDENT_NAME,
 
	CW_WIDGET_COMPANY_NAME,
 
	CW_WIDGET_BUILD_VIEW_HQ,
 
	CW_WIDGET_RELOCATE_HQ,
 
	CW_WIDGET_BUY_SHARE,
 
	CW_WIDGET_SELL_SHARE,
 
	CW_WIDGET_COMPANY_PASSWORD,
 
	CW_WIDGET_COMPANY_JOIN,
 
};
 

	
 
static const Widget _company_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_00C5,                          STR_018B_CLOSE_WINDOW},
 
@@ -1255,25 +1255,25 @@ struct CompanyWindow : Window
 
	CompanyWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
 
	{
 
		this->owner = (Owner)this->window_number;
 
		this->FindWindowPlacementAndResize(desc);
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		const Company *c = GetCompany((CompanyID)this->window_number);
 
		bool local = this->window_number == _local_company;
 

	
 
		this->SetWidgetHiddenState(CW_WIDGET_NEW_FACE,       !local);
 
		this->SetWidgetHiddenState(CW_WIDGET_COLOR_SCHEME,   !local);
 
		this->SetWidgetHiddenState(CW_WIDGET_COLOUR_SCHEME,   !local);
 
		this->SetWidgetHiddenState(CW_WIDGET_PRESIDENT_NAME, !local);
 
		this->SetWidgetHiddenState(CW_WIDGET_COMPANY_NAME,   !local);
 
		this->widget[CW_WIDGET_BUILD_VIEW_HQ].data = (local && c->location_of_HQ == INVALID_TILE) ? STR_706F_BUILD_HQ : STR_7072_VIEW_HQ;
 
		if (local && c->location_of_HQ != INVALID_TILE) this->widget[CW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; //HQ is already built.
 
		this->SetWidgetDisabledState(CW_WIDGET_BUILD_VIEW_HQ, !local && c->location_of_HQ == INVALID_TILE);
 
		this->SetWidgetHiddenState(CW_WIDGET_RELOCATE_HQ,      !local || c->location_of_HQ == INVALID_TILE);
 
		this->SetWidgetHiddenState(CW_WIDGET_BUY_SHARE,        local);
 
		this->SetWidgetHiddenState(CW_WIDGET_SELL_SHARE,       local);
 
		this->SetWidgetHiddenState(CW_WIDGET_COMPANY_PASSWORD, !local || !_networking);
 
		this->SetWidgetHiddenState(CW_WIDGET_COMPANY_JOIN,     local || !_networking);
 
		this->SetWidgetDisabledState(CW_WIDGET_COMPANY_JOIN,   !IsHumanCompany(c->index));
 

	
 
@@ -1312,44 +1312,44 @@ struct CompanyWindow : Window
 

	
 
		/* "xxx (Manager)" */
 
		SetDParam(0, c->index);
 
		DrawStringMultiCenter(48, 141, STR_7037_PRESIDENT, MAX_LENGTH_PRESIDENT_NAME_PIXELS);
 

	
 
		/* "Inaugurated:" */
 
		SetDParam(0, c->inaugurated_year);
 
		DrawString(110, 23, STR_7038_INAUGURATED, TC_FROMSTRING);
 

	
 
		/* "Colour scheme:" */
 
		DrawString(110, 43, STR_7006_COLOR_SCHEME, TC_FROMSTRING);
 
		/* Draw company-colour bus */
 
		DrawSprite(SPR_VEH_BUS_SW_VIEW, COMPANY_SPRITE_COLOR(c->index), 215, 44);
 
		DrawSprite(SPR_VEH_BUS_SW_VIEW, COMPANY_SPRITE_COLOUR(c->index), 215, 44);
 

	
 
		/* "Vehicles:" */
 
		DrawCompanyVehiclesAmount((CompanyID)this->window_number);
 

	
 
		/* "Company value:" */
 
		SetDParam(0, CalculateCompanyValue(c));
 
		DrawString(110, 106, STR_7076_COMPANY_VALUE, TC_FROMSTRING);
 

	
 
		/* Shares list */
 
		DrawCompanyOwnerText(c);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		switch (widget) {
 
			case CW_WIDGET_NEW_FACE: DoSelectCompanyManagerFace(this, false); break;
 

	
 
			case CW_WIDGET_COLOR_SCHEME:
 
				if (BringWindowToFrontById(WC_COMPANY_COLOR, this->window_number)) break;
 
			case CW_WIDGET_COLOUR_SCHEME:
 
				if (BringWindowToFrontById(WC_COMPANY_COLOUR, this->window_number)) break;
 
				new SelectCompanyLiveryWindow(&_select_company_livery_desc, (CompanyID)this->window_number);
 
				break;
 

	
 
			case CW_WIDGET_PRESIDENT_NAME:
 
				this->query_widget = CW_WIDGET_PRESIDENT_NAME;
 
				SetDParam(0, this->window_number);
 
				ShowQueryString(STR_PRESIDENT_NAME, STR_700B_PRESIDENT_S_NAME, MAX_LENGTH_PRESIDENT_NAME_BYTES, MAX_LENGTH_PRESIDENT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
 
				break;
 

	
 
			case CW_WIDGET_COMPANY_NAME:
 
				this->query_widget = CW_WIDGET_COMPANY_NAME;
 
				SetDParam(0, this->window_number);
src/company_gui.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @file company_gui.h GUI Functions related to companies. */
 

	
 
#ifndef COMPANY_GUI_H
 
#define COMPANY_GUI_H
 

	
 
#include "company_type.h"
 

	
 
uint16 GetDrawStringCompanyColor(CompanyID company);
 
uint16 GetDrawStringCompanyColour(CompanyID company);
 
void DrawCompanyIcon(CompanyID c, int x, int y);
 

	
 
void ShowCompanyStations(CompanyID company);
 
void ShowCompanyFinances(CompanyID company);
 
void ShowCompany(CompanyID company);
 

	
 
void InvalidateCompanyWindows(const Company *c);
 
void DeleteCompanyWindows(CompanyID company);
 

	
 
#endif /* COMPANY_GUI_H */
src/company_manager_face.h
Show inline comments
 
@@ -220,16 +220,16 @@ static inline void RandomCompanyManagerF
 
 * @param cmfv the face variable to get the sprite of
 
 * @param ge   the gender and ethnicity of the face
 
 * @pre _cmf_info[cmfv].valid_values[ge] != 0
 
 * @return sprite to draw
 
 */
 
static inline SpriteID GetCompanyManagerFaceSprite(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge)
 
{
 
	assert(_cmf_info[cmfv].valid_values[ge] != 0);
 

	
 
	return _cmf_info[cmfv].first_sprite[ge] + GB(cmf, _cmf_info[cmfv].offset, _cmf_info[cmfv].length);
 
}
 

	
 
void DrawCompanyManagerFace(CompanyManagerFace face, int color, int x, int y);
 
void DrawCompanyManagerFace(CompanyManagerFace face, int colour, int x, int y);
 
bool IsValidCompanyManagerFace(CompanyManagerFace cmf);
 

	
 
#endif /* COMPANY_MANAGER_FACE_H */
src/console.cpp
Show inline comments
 
@@ -70,71 +70,71 @@ bool CloseConsoleLogIfActive()
 
void IConsoleFree()
 
{
 
	IConsoleGUIFree();
 
	CloseConsoleLogIfActive();
 
}
 

	
 
/**
 
 * Handle the printing of text entered into the console or redirected there
 
 * by any other means. Text can be redirected to other clients in a network game
 
 * as well as to a logfile. If the network server is a dedicated server, all activities
 
 * are also logged. All lines to print are added to a temporary buffer which can be
 
 * used as a history to print them onscreen
 
 * @param color_code the colour of the command. Red in case of errors, etc.
 
 * @param colour_code the colour of the command. Red in case of errors, etc.
 
 * @param string the message entered or output on the console (notice, error, etc.)
 
 */
 
void IConsolePrint(ConsoleColour color_code, const char *string)
 
void IConsolePrint(ConsoleColour colour_code, const char *string)
 
{
 
	char *str;
 
#ifdef ENABLE_NETWORK
 
	if (_redirect_console_to_client != INVALID_CLIENT_ID) {
 
		/* Redirect the string to the client */
 
		NetworkServerSendRcon(_redirect_console_to_client, color_code, string);
 
		NetworkServerSendRcon(_redirect_console_to_client, colour_code, string);
 
		return;
 
	}
 
#endif
 

	
 
	/* Create a copy of the string, strip if of colours and invalid
 
	 * characters and (when applicable) assign it to the console buffer */
 
	str = strdup(string);
 
	str_strip_colours(str);
 
	str_validate(str);
 

	
 
	if (_network_dedicated) {
 
		fprintf(stdout, "%s\n", str);
 
		fflush(stdout);
 
		IConsoleWriteToLogFile(str);
 
		free(str); // free duplicated string since it's not used anymore
 
		return;
 
	}
 

	
 
	IConsoleWriteToLogFile(str);
 
	IConsoleGUIPrint(color_code, str);
 
	IConsoleGUIPrint(colour_code, str);
 
}
 

	
 
/**
 
 * Handle the printing of text entered into the console or redirected there
 
 * by any other means. Uses printf() style format, for more information look
 
 * at IConsolePrint()
 
 */
 
void CDECL IConsolePrintF(ConsoleColour color_code, const char *s, ...)
 
void CDECL IConsolePrintF(ConsoleColour colour_code, const char *s, ...)
 
{
 
	va_list va;
 
	char buf[ICON_MAX_STREAMSIZE];
 

	
 
	va_start(va, s);
 
	vsnprintf(buf, sizeof(buf), s, va);
 
	va_end(va);
 

	
 
	IConsolePrint(color_code, buf);
 
	IConsolePrint(colour_code, buf);
 
}
 

	
 
/**
 
 * It is possible to print debugging information to the console,
 
 * which is achieved by using this function. Can only be used by
 
 * debug() in debug.cpp. You need at least a level 2 (developer) for debugging
 
 * messages to show up
 
 * @param dbg debugging category
 
 * @param string debugging message
 
 */
 
void IConsoleDebug(const char *dbg, const char *string)
 
{
src/console_func.h
Show inline comments
 
@@ -7,22 +7,22 @@
 

	
 
#include "console_type.h"
 

	
 
/* console modes */
 
extern IConsoleModes _iconsole_mode;
 

	
 
/* console functions */
 
void IConsoleInit();
 
void IConsoleFree();
 
void IConsoleClose();
 

	
 
/* console output */
 
void IConsolePrint(ConsoleColour color_code, const char *string);
 
void CDECL IConsolePrintF(ConsoleColour color_code, const char *s, ...);
 
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 */
src/console_gui.cpp
Show inline comments
 
@@ -428,20 +428,20 @@ static void IConsoleHistoryNavigate(int 
 
	/* copy history to 'command prompt / bash' */
 
	assert(_iconsole_history[i] != NULL && IsInsideMM(i, 0, ICON_HISTORY_SIZE));
 
	ttd_strlcpy(_iconsole_cmdline.buf, _iconsole_history[i], _iconsole_cmdline.maxsize);
 
	UpdateTextBufferSize(&_iconsole_cmdline);
 
}
 

	
 
/**
 
 * Handle the printing of text entered into the console or redirected there
 
 * by any other means. Text can be redirected to other clients in a network game
 
 * as well as to a logfile. If the network server is a dedicated server, all activities
 
 * are also logged. All lines to print are added to a temporary buffer which can be
 
 * used as a history to print them onscreen
 
 * @param color_code the colour of the command. Red in case of errors, etc.
 
 * @param colour_code the colour of the command. Red in case of errors, etc.
 
 * @param string the message entered or output on the console (notice, error, etc.)
 
 */
 
void IConsoleGUIPrint(ConsoleColour color_code, char *str)
 
void IConsoleGUIPrint(ConsoleColour colour_code, char *str)
 
{
 
	new IConsoleLine(str, (TextColour)color_code);
 
	new IConsoleLine(str, (TextColour)colour_code);
 
	SetWindowDirty(FindWindowById(WC_CONSOLE, 0));
 
}
src/console_internal.h
Show inline comments
 
@@ -125,15 +125,15 @@ void IConsoleVarExec(const IConsoleVar *
 
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 color_code, char *string);
 
void IConsoleGUIPrint(ConsoleColour colour_code, char *string);
 

	
 
#endif /* CONSOLE_INTERNAL_H */
src/economy.cpp
Show inline comments
 
@@ -350,25 +350,25 @@ void ChangeOwnershipOfCompanyItems(Owner
 
		FreeUnitIDGenerator unitidgen[] = {
 
			FreeUnitIDGenerator(VEH_TRAIN, new_owner), FreeUnitIDGenerator(VEH_ROAD,     new_owner),
 
			FreeUnitIDGenerator(VEH_SHIP,  new_owner), FreeUnitIDGenerator(VEH_AIRCRAFT, new_owner)
 
		};
 

	
 
		Vehicle *v;
 
		FOR_ALL_VEHICLES(v) {
 
			if (v->owner == old_owner && IsCompanyBuildableVehicleType(v->type)) {
 
				if (new_owner == INVALID_OWNER) {
 
					if (v->Previous() == NULL) delete v;
 
				} else {
 
					v->owner = new_owner;
 
					v->colormap = PAL_NONE;
 
					v->colourmap = PAL_NONE;
 
					if (IsEngineCountable(v)) GetCompany(new_owner)->num_engines[v->engine_type]++;
 
					if (v->IsPrimaryVehicle()) v->unitnumber = unitidgen[v->type].NextID();
 
				}
 
			}
 
		}
 
	}
 

	
 
	/*  Change ownership of tiles */
 
	{
 
		TileIndex tile = 0;
 
		do {
 
			ChangeTileOwner(tile, old_owner, new_owner);
 
@@ -407,25 +407,25 @@ void ChangeOwnershipOfCompanyItems(Owner
 
	} else {
 
		Group *g;
 
		FOR_ALL_GROUPS(g) {
 
			if (g->owner == old_owner) g->owner = new_owner;
 
		}
 
	}
 

	
 
	Sign *si;
 
	FOR_ALL_SIGNS(si) {
 
		if (si->owner == old_owner) si->owner = new_owner == INVALID_OWNER ? OWNER_NONE : new_owner;
 
	}
 

	
 
	/* Change color of existing windows */
 
	/* Change colour of existing windows */
 
	if (new_owner != INVALID_OWNER) ChangeWindowOwner(old_owner, new_owner);
 

	
 
	_current_company = old;
 

	
 
	MarkWholeScreenDirty();
 
}
 

	
 
static void ChangeNetworkOwner(Owner current_owner, Owner new_owner)
 
{
 
#ifdef ENABLE_NETWORK
 
	if (!_networking) return;
 

	
src/engine_gui.cpp
Show inline comments
 
@@ -189,25 +189,25 @@ void DrawNewsNewVehicleAvail(Window *w, 
 
	EngineID engine = ni->data_a;
 
	const DrawEngineInfo *dei = &_draw_engine_list[GetEngine(engine)->type];
 

	
 
	SetDParam(0, GetEngineCategoryName(engine));
 
	DrawStringMultiCenter(w->width >> 1, 20, STR_NEW_VEHICLE_NOW_AVAILABLE, w->width - 2);
 

	
 
	GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
 

	
 
	SetDParam(0, engine);
 
	DrawStringMultiCenter(w->width >> 1, 57, STR_NEW_VEHICLE_TYPE, w->width - 2);
 

	
 
	dei->engine_proc(w->width >> 1, 88, engine, 0);
 
	GfxFillRect(25, 56, w->width - 56, 112, PALETTE_TO_STRUCT_GREY, FILLRECT_RECOLOR);
 
	GfxFillRect(25, 56, w->width - 56, 112, PALETTE_TO_STRUCT_GREY, FILLRECT_RECOLOUR);
 
	dei->info_proc(engine, w->width >> 1, 129, w->width - 52);
 
}
 

	
 

	
 
/** Sort all items using qsort() and given 'CompareItems' function
 
 * @param el list to be sorted
 
 * @param compare function for evaluation of the quicksort
 
 */
 
void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare)
 
{
 
	uint size = el->Length();
 
	/* out-of-bounds access at the next line for size == 0 (even with operator[] at some systems)
src/genworld.cpp
Show inline comments
 
@@ -286,25 +286,25 @@ void GenerateWorld(GenerateWorldMode mod
 

	
 
	InitializeGame(_gw.size_x, _gw.size_y, false);
 
	PrepareGenerateWorldProgress();
 

	
 
	/* Load the right landscape stuff */
 
	GfxLoadSprites();
 
	LoadStringWidthTable();
 

	
 
	/* Re-init the windowing system */
 
	ResetWindowSystem();
 

	
 
	/* Create toolbars */
 
	SetupColorsAndInitialWindow();
 
	SetupColoursAndInitialWindow();
 

	
 
	if (_gw.thread != NULL) {
 
		_gw.thread->Join();
 
		delete _gw.thread;
 
		_gw.thread = NULL;
 
	}
 

	
 
	if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 0 ||
 
	    !ThreadObject::New(&_GenerateWorld, NULL, &_gw.thread)) {
 
		DEBUG(misc, 1, "Cannot create genworld thread, reverting to single-threaded mode");
 
		_gw.threaded = false;
 
		_GenerateWorld(NULL);
src/gfx.cpp
Show inline comments
 
@@ -88,29 +88,29 @@ void GfxScroll(int left, int top, int wi
 
	_video_driver->MakeDirty(left, top, width, height);
 
}
 

	
 

	
 
/**
 
 * Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
 
 *
 
 * @pre dpi->zoom == ZOOM_LVL_NORMAL, right >= left, bottom >= top
 
 * @param left Minimum X (inclusive)
 
 * @param top Minimum Y (inclusive)
 
 * @param right Maximum X (inclusive)
 
 * @param bottom Maximum Y (inclusive)
 
 * @param colour A 8 bit palette index (FILLRECT_OPAQUE and FILLRECT_CHECKER) or a recolour spritenumber (FILLRECT_RECOLOR)
 
 * @param colour A 8 bit palette index (FILLRECT_OPAQUE and FILLRECT_CHECKER) or a recolour spritenumber (FILLRECT_RECOLOUR)
 
 * @param mode
 
 *         FILLRECT_OPAQUE:   Fill the rectangle with the specified colour
 
 *         FILLRECT_CHECKER:  Like FILLRECT_OPAQUE, but only draw every second pixel (used to grey out things)
 
 *         FILLRECT_RECOLOR:  Apply a recolour sprite to every pixel in the rectangle currently on screen
 
 *         FILLRECT_RECOLOUR:  Apply a recolour sprite to every pixel in the rectangle currently on screen
 
 */
 
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
 
{
 
	Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
 
	const DrawPixelInfo *dpi = _cur_dpi;
 
	void *dst;
 
	const int otop = top;
 
	const int oleft = left;
 

	
 
	if (dpi->zoom != ZOOM_LVL_NORMAL) return;
 
	if (left > right || top > bottom) return;
 
	if (right < dpi->left || left >= dpi->left + dpi->width) return;
 
@@ -126,26 +126,26 @@ void GfxFillRect(int left, int top, int 
 
	bottom = bottom - dpi->top + 1;
 
	if (bottom > dpi->height) bottom = dpi->height;
 
	bottom -= top;
 
	assert(bottom > 0);
 

	
 
	dst = blitter->MoveTo(dpi->dst_ptr, left, top);
 

	
 
	switch (mode) {
 
		default: // FILLRECT_OPAQUE
 
			blitter->DrawRect(dst, right, bottom, (uint8)colour);
 
			break;
 

	
 
		case FILLRECT_RECOLOR:
 
			blitter->DrawColorMappingRect(dst, right, bottom, GB(colour, 0, PALETTE_WIDTH));
 
		case FILLRECT_RECOLOUR:
 
			blitter->DrawColourMappingRect(dst, right, bottom, GB(colour, 0, PALETTE_WIDTH));
 
			break;
 

	
 
		case FILLRECT_CHECKER: {
 
			byte bo = (oleft - left + dpi->left + otop - top + dpi->top) & 1;
 
			do {
 
				for (int i = (bo ^= 1); i < right; i += 2) blitter->SetPixel(dst, i, 0, (uint8)colour);
 
				dst = blitter->MoveTo(dst, 0, 1);
 
			} while (--bottom > 0);
 
			break;
 
		}
 
	}
 
}
 
@@ -829,26 +829,26 @@ Dimension GetStringBoundingBox(const cha
 
}
 

	
 
/**
 
 * Draw single character horizontally centered around (x,y)
 
 * @param c           Character (glyph) to draw
 
 * @param x           X position to draw character
 
 * @param y           Y position to draw character
 
 * @param real_colour Colour to use, see DoDrawString() for details
 
 */
 
void DrawCharCentered(WChar c, int x, int y, TextColour colour)
 
{
 
	FontSize size = FS_NORMAL;
 
	assert(colour & IS_PALETTE_COLOR);
 
	colour &= ~IS_PALETTE_COLOR;
 
	assert(colour & IS_PALETTE_COLOUR);
 
	colour &= ~IS_PALETTE_COLOUR;
 
	int w = GetCharacterWidth(size, c);
 

	
 
	_string_colourremap[1] = _string_colourmap[_use_palette][colour].text;
 
	_string_colourremap[2] = _string_colourmap[_use_palette][colour].shadow;
 
	_colour_remap_ptr = _string_colourremap;
 

	
 
	GfxMainBlitter(GetGlyph(size, c), x - w / 2, y, BM_COLOUR_REMAP);
 
}
 

	
 
/** Draw a string at the given coordinates with the given colour.
 
 *  While drawing the string, parse it in case some formatting is specified,
 
 *  like new colour, new size or even positionning.
 
@@ -899,26 +899,26 @@ static int ReallyDoDrawString(const char
 
	WChar c;
 
	int xo = x, yo = y;
 

	
 
	TextColour previous_colour = colour;
 

	
 
	if (!parse_string_also_when_clipped) {
 
		/* in "mode multiline", the available space have been verified. Not in regular one.
 
		 * So if the string cannot be drawn, return the original start to say so.*/
 
		if (x >= dpi->left + dpi->width || y >= dpi->top + dpi->height) return x;
 

	
 
		if (colour != TC_INVALID) { // the invalid colour flag test should not  really occur.  But better be safe
 
switch_colour:;
 
			if (colour & IS_PALETTE_COLOR) {
 
				_string_colourremap[1] = colour & ~IS_PALETTE_COLOR;
 
			if (colour & IS_PALETTE_COLOUR) {
 
				_string_colourremap[1] = colour & ~IS_PALETTE_COLOUR;
 
				_string_colourremap[2] = (_use_palette == PAL_DOS) ? 1 : 215;
 
			} else {
 
				_string_colourremap[1] = _string_colourmap[_use_palette][colour].text;
 
				_string_colourremap[2] = _string_colourmap[_use_palette][colour].shadow;
 
			}
 
			_colour_remap_ptr = _string_colourremap;
 
		}
 
	}
 

	
 
check_bounds:
 
	if (y + 19 <= dpi->top || dpi->top + dpi->height <= y) {
 
skip_char:;
 
@@ -1102,26 +1102,26 @@ void GfxInitPalettes()
 
	_pal_first_dirty = 0;
 
	_pal_count_dirty = 256;
 
}
 

	
 
#define EXTR(p, q) (((uint16)(_palette_animation_counter * (p)) * (q)) >> 16)
 
#define EXTR2(p, q) (((uint16)(~_palette_animation_counter * (p)) * (q)) >> 16)
 

	
 
void DoPaletteAnimations()
 
{
 
	Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
 
	const Colour *s;
 
	const ExtraPaletteValues *ev = &_extra_palette_values;
 
	/* Amount of colors to be rotated.
 
	 * A few more for the DOS palette, because the water colors are
 
	/* Amount of colours to be rotated.
 
	 * A few more for the DOS palette, because the water colours are
 
	 * 245-254 for DOS and 217-226 for Windows.  */
 
	const int colour_rotation_amount = (_use_palette == PAL_DOS) ? PALETTE_ANIM_SIZE_DOS : PALETTE_ANIM_SIZE_WIN;
 
	Colour old_val[PALETTE_ANIM_SIZE_DOS];
 
	const int oldval_size = colour_rotation_amount * sizeof(*old_val);
 
	const uint old_tc = _palette_animation_counter;
 
	uint i;
 
	uint j;
 

	
 
	if (blitter != NULL && blitter->UsePaletteAnimation() == Blitter::PALETTE_ANIMATION_NONE) {
 
		_palette_animation_counter = 0;
 
	}
 

	
src/gfx_type.h
Show inline comments
 
/* $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 colortables
 
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,
 
@@ -176,62 +176,62 @@ enum Colours {
 
	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_colormap in table/palettes.h or docs/ottd-colourtext-palette.png */
 
/** 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_COLOR = 0x100, ///< colour value is already a real palette colour index, not an index of a StringColour
 
	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 color
 
	FILLRECT_OPAQUE,  ///< Fill rectangle with a single colour
 
	FILLRECT_CHECKER, ///< Draw only every second pixel, used for greying-out
 
	FILLRECT_RECOLOR, ///< Apply a recolor sprite to the screen content
 
	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 {
src/graph_gui.cpp
Show inline comments
 
@@ -140,34 +140,34 @@ protected:
 
	 * 0xFF, use x_values_start and x_values_increment below instead. */
 
	byte month;
 
	Year year;
 

	
 
	/* These values are used if the graph is being plotted against values
 
	 * rather than the dates specified by month and year. */
 
	uint16 x_values_start;
 
	uint16 x_values_increment;
 

	
 
	int gd_left, gd_top;  ///< Where to start drawing the graph, in pixels.
 
	uint gd_height;    ///< The height of the graph in pixels.
 
	StringID format_str_y_axis;
 
	byte colors[GRAPH_MAX_DATASETS];
 
	byte colours[GRAPH_MAX_DATASETS];
 
	OverflowSafeInt64 cost[GRAPH_MAX_DATASETS][24]; ///< last 2 years
 

	
 
	void DrawGraph() const
 
	{
 
		uint x, y;                       ///< Reused whenever x and y coordinates are needed.
 
		OverflowSafeInt64 highest_value; ///< Highest value to be drawn.
 
		int x_axis_offset;               ///< Distance from the top of the graph to the x axis.
 

	
 
		/* the colors and cost array of GraphDrawer must accomodate
 
		/* the colours and cost array of GraphDrawer must accomodate
 
		* both values for cargo and companies. So if any are higher, quit */
 
		assert(GRAPH_MAX_DATASETS >= (int)NUM_CARGO && GRAPH_MAX_DATASETS >= (int)MAX_COMPANIES);
 
		assert(this->num_vert_lines > 0);
 

	
 
		byte grid_colour = _colour_gradient[COLOUR_GREY][4];
 

	
 
		/* The coordinates of the opposite edges of the graph. */
 
		int bottom = this->gd_top + this->gd_height - 1;
 
		int right  = this->gd_left + GRAPH_X_POSITION_BEGINNING + this->num_vert_lines * GRAPH_X_POSITION_SEPARATION - 1;
 

	
 
		/* Draw the vertical grid lines. */
 

	
 
@@ -285,25 +285,25 @@ protected:
 

	
 
				label += this->x_values_increment;
 
				x += GRAPH_X_POSITION_SEPARATION;
 
			}
 
		}
 

	
 
		/* draw lines and dots */
 
		for (int i = 0; i < this->num_dataset; i++) {
 
			if (!HasBit(this->excluded_data, i)) {
 
				/* Centre the dot between the grid lines. */
 
				x = this->gd_left + GRAPH_X_POSITION_BEGINNING + (GRAPH_X_POSITION_SEPARATION / 2);
 

	
 
				byte color  = this->colors[i];
 
				byte colour  = this->colours[i];
 
				uint prev_x = INVALID_DATAPOINT_POS;
 
				uint prev_y = INVALID_DATAPOINT_POS;
 

	
 
				for (int j = 0; j < this->num_on_x_axis; j++) {
 
					OverflowSafeInt64 datapoint = this->cost[i][j];
 

	
 
					if (datapoint != INVALID_DATAPOINT) {
 
						/*
 
						* Check whether we need to reduce the 'accuracy' of the
 
						* datapoint value and the highest value to splut overflows.
 
						* And when 'drawing' 'one million' or 'one million and one'
 
						* there is no significant difference, so the least
 
@@ -317,28 +317,28 @@ protected:
 
						int reduce_range = max(mult_range - 31, 0);
 

	
 
						/* Handle negative values differently (don't shift sign) */
 
						if (datapoint < 0) {
 
							datapoint = -(abs(datapoint) >> reduce_range);
 
						} else {
 
							datapoint >>= reduce_range;
 
						}
 

	
 
						y = this->gd_top + x_axis_offset - (x_axis_offset * datapoint) / (highest_value >> reduce_range);
 

	
 
						/* Draw the point. */
 
						GfxFillRect(x - 1, y - 1, x + 1, y + 1, color);
 
						GfxFillRect(x - 1, y - 1, x + 1, y + 1, colour);
 

	
 
						/* Draw the line connected to the previous point. */
 
						if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, color);
 
						if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, colour);
 

	
 
						prev_x = x;
 
						prev_y = y;
 
					} else {
 
						prev_x = INVALID_DATAPOINT_POS;
 
						prev_y = INVALID_DATAPOINT_POS;
 
					}
 

	
 
					x += GRAPH_X_POSITION_SEPARATION;
 
				}
 
			}
 
		}
 
@@ -379,25 +379,25 @@ public:
 
		while (mo < 0) {
 
			yr--;
 
			mo += 12;
 
		}
 

	
 
		this->year = yr;
 
		this->month = mo;
 

	
 
		int numd = 0;
 
		for (CompanyID k = COMPANY_FIRST; k < MAX_COMPANIES; k++) {
 
			if (IsValidCompanyID(k)) {
 
				c = GetCompany(k);
 
				this->colors[numd] = _colour_gradient[c->colour][6];
 
				this->colours[numd] = _colour_gradient[c->colour][6];
 
				for (int j = this->num_on_x_axis, i = 0; --j >= 0;) {
 
					this->cost[numd][i] = (j >= c->num_valid_stat_ent) ? INVALID_DATAPOINT : GetGraphData(c, j);
 
					i++;
 
				}
 
			}
 
			numd++;
 
		}
 

	
 
		this->num_dataset = numd;
 

	
 
		this->DrawGraph();
 
	}
 
@@ -667,37 +667,37 @@ struct PaymentRatesGraphWindow : BaseGra
 
		int y = 24;
 

	
 
		uint i = 0;
 
		for (CargoID c = 0; c < NUM_CARGO; c++) {
 
			const CargoSpec *cs = GetCargo(c);
 
			if (!cs->IsValid()) continue;
 

	
 
			/* Only draw labels for widgets that exist. If the widget doesn't
 
			 * exist then the local company has used the climate cheat or
 
			 * changed the NewGRF configuration with this window open. */
 
			if (i + 3 < this->widget_count) {
 
				/* Since the buttons have no text, no images,
 
				 * both the text and the colored box have to be manually painted.
 
				 * both the text and the coloured box have to be manually painted.
 
				 * clk_dif will move one pixel down and one pixel to the right
 
				 * when the button is clicked */
 
				byte clk_dif = this->IsWidgetLowered(i + 3) ? 1 : 0;
 

	
 
				GfxFillRect(x + clk_dif, y + clk_dif, x + 8 + clk_dif, y + 5 + clk_dif, 0);
 
				GfxFillRect(x + 1 + clk_dif, y + 1 + clk_dif, x + 7 + clk_dif, y + 4 + clk_dif, cs->legend_colour);
 
				SetDParam(0, cs->name);
 
				DrawString(x + 14 + clk_dif, y + clk_dif, STR_7065, TC_FROMSTRING);
 
				y += 8;
 
			}
 

	
 
			this->colors[i] = cs->legend_colour;
 
			this->colours[i] = cs->legend_colour;
 
			for (uint j = 0; j != 20; j++) {
 
				this->cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 4 + 4, c);
 
			}
 

	
 
			i++;
 
		}
 
		this->num_dataset = i;
 

	
 
		this->DrawGraph();
 

	
 
		DrawString(2 + 46, 24 + this->gd_height + 7, STR_7062_DAYS_IN_TRANSIT, TC_FROMSTRING);
 
		DrawString(2 + 84, 24 - 9, STR_7063_PAYMENT_FOR_DELIVERING, TC_FROMSTRING);
 
@@ -893,25 +893,25 @@ public:
 
			UpdateCompanyRatingAndValue(c, false);
 
		}
 

	
 
		this->timeout = DAY_TICKS * 5;
 

	
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		byte x;
 
		uint16 y = 27;
 
		int total_score = 0;
 
		int color_done, color_notdone;
 
		int colour_done, colour_notdone;
 

	
 
		/* Draw standard stuff */
 
		this->DrawWidgets();
 

	
 
		/* Check if the currently selected company is still active. */
 
		if (company == INVALID_COMPANY || !IsValidCompanyID(company)) {
 
			if (company != INVALID_COMPANY) {
 
				/* Raise and disable the widget for the previous selection. */
 
				this->RaiseWidget(company + PRW_COMPANY_FIRST);
 
				this->DisableWidget(company + PRW_COMPANY_FIRST);
 
				this->SetDirty();
 

	
 
@@ -950,27 +950,27 @@ public:
 
			/* Check if we have the company marked as inactive */
 
			if (this->IsWidgetDisabled(i + PRW_COMPANY_FIRST)) {
 
				/* New company! Yippie :p */
 
				this->EnableWidget(i + PRW_COMPANY_FIRST);
 
				/* We need a repaint */
 
				this->SetDirty();
 
			}
 

	
 
			x = (i == company) ? 1 : 0;
 
			DrawCompanyIcon(i, (i % 8) * 37 + 13 + x, (i < 8 ? 0 : 13) + 16 + x);
 
		}
 

	
 
		/* The colors used to show how the progress is going */
 
		color_done = _colour_gradient[COLOUR_GREEN][4];
 
		color_notdone = _colour_gradient[COLOUR_RED][4];
 
		/* The colours used to show how the progress is going */
 
		colour_done = _colour_gradient[COLOUR_GREEN][4];
 
		colour_notdone = _colour_gradient[COLOUR_RED][4];
 

	
 
		/* Draw all the score parts */
 
		for (ScoreID i = SCORE_BEGIN; i < SCORE_END; i++) {
 
			int val    = _score_part[company][i];
 
			int needed = _score_info[i].needed;
 
			int score  = _score_info[i].score;
 

	
 
			y += 20;
 
			/* SCORE_TOTAL has his own rulez ;) */
 
			if (i == SCORE_TOTAL) {
 
				needed = total_score;
 
				score = SCORE_MAX;
 
@@ -982,26 +982,26 @@ public:
 

	
 
			/* Draw the score */
 
			SetDParam(0, score);
 
			DrawStringRightAligned(107, y, SET_PERFORMANCE_DETAIL_INT, TC_FROMSTRING);
 

	
 
			/* Calculate the %-bar */
 
			x = Clamp(val, 0, needed) * 50 / needed;
 

	
 
			/* SCORE_LOAN is inversed */
 
			if (val < 0 && i == SCORE_LOAN) x = 0;
 

	
 
			/* Draw the bar */
 
			if (x !=  0) GfxFillRect(112,     y - 2, 112 + x,  y + 10, color_done);
 
			if (x != 50) GfxFillRect(112 + x, y - 2, 112 + 50, y + 10, color_notdone);
 
			if (x !=  0) GfxFillRect(112,     y - 2, 112 + x,  y + 10, colour_done);
 
			if (x != 50) GfxFillRect(112 + x, y - 2, 112 + 50, y + 10, colour_notdone);
 

	
 
			/* Calculate the % */
 
			x = Clamp(val, 0, needed) * 100 / needed;
 

	
 
			/* SCORE_LOAN is inversed */
 
			if (val < 0 && i == SCORE_LOAN) x = 0;
 

	
 
			/* Draw it */
 
			SetDParam(0, x);
 
			DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, TC_FROMSTRING);
 

	
 
			/* SCORE_LOAN is inversed */
src/gui.h
Show inline comments
 
@@ -58,23 +58,23 @@ 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_colors[];
 
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 */
src/heightmap.cpp
Show inline comments
 
@@ -7,27 +7,27 @@
 
#include "clear_map.h"
 
#include "void_map.h"
 
#include "gui.h"
 
#include "saveload/saveload.h"
 
#include "bmp.h"
 
#include "gfx_func.h"
 
#include "fios.h"
 
#include "settings_type.h"
 

	
 
#include "table/strings.h"
 

	
 
/**
 
 * Convert RGB colors to Grayscale using 29.9% Red, 58.7% Green, 11.4% Blue
 
 * Convert RGB colours to Grayscale using 29.9% Red, 58.7% Green, 11.4% Blue
 
 *  (average luminosity formula) -- Dalestan
 
 * This in fact is the NTSC Color Space -- TrueLight
 
 * This in fact is the NTSC Colour Space -- TrueLight
 
 */
 
static inline byte RGBToGrayscale(byte red, byte green, byte blue)
 
{
 
	/* To avoid doubles and stuff, multiple it with a total of 65536 (16bits), then
 
	 *  divide by it to normalize the value to a byte again. */
 
	return ((red * 19595) + (green * 38470) + (blue * 7471)) / 65536;
 
}
 

	
 

	
 
#ifdef WITH_PNG
 

	
 
#include <png.h>
 
@@ -117,25 +117,25 @@ static bool ReadHeightmapPNG(char *filen
 
		fclose(fp);
 
		png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
 
		return false;
 
	}
 

	
 
	png_init_io(png_ptr, fp);
 

	
 
	/* Allocate memory and read image, without alpha or 16-bit samples
 
	 * (result is either 8-bit indexed/grayscale or 24-bit RGB) */
 
	png_set_packing(png_ptr);
 
	png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_PACKING | PNG_TRANSFORM_STRIP_ALPHA | PNG_TRANSFORM_STRIP_16, NULL);
 

	
 
	/* Maps of wrong color-depth are not used.
 
	/* Maps of wrong colour-depth are not used.
 
	 * (this should have been taken care of by stripping alpha and 16-bit samples on load) */
 
	if ((info_ptr->channels != 1) && (info_ptr->channels != 3) && (info_ptr->bit_depth != 8)) {
 
		ShowErrorMessage(STR_PNGMAP_ERR_IMAGE_TYPE, STR_PNGMAP_ERROR, 0, 0);
 
		fclose(fp);
 
		png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
 
		return false;
 
	}
 

	
 
	if (map != NULL) {
 
		*map = MallocT<byte>(info_ptr->width * info_ptr->height);
 

	
 
		if (*map == NULL) {
 
@@ -342,25 +342,25 @@ static void GrayscaleToMapHeights(uint i
 
					default: NOT_REACHED();
 
					case HM_COUNTER_CLOCKWISE:
 
						img_col = (((width - 1 - col - col_pad) * num_div) / img_scale);
 
						break;
 
					case HM_CLOCKWISE:
 
						img_col = (((col - col_pad) * num_div) / img_scale);
 
						break;
 
				}
 

	
 
				assert(img_row < img_height);
 
				assert(img_col < img_width);
 

	
 
				/* Color scales from 0 to 255, OpenTTD height scales from 0 to 15 */
 
				/* Colour scales from 0 to 255, OpenTTD height scales from 0 to 15 */
 
				SetTileHeight(tile, map[img_row * img_width + img_col] / 16);
 
			}
 
			/* Only clear the tiles within the map area. */
 
			if (TileX(tile) != MapMaxX() && TileY(tile) != MapMaxY() &&
 
					(!_settings_game.construction.freeform_edges || (TileX(tile) != 0 && TileY(tile) != 0))) {
 
				MakeClear(tile, CLEAR_GRASS, 3);
 
			}
 
		}
 
	}
 
}
 

	
 
/**
src/industry.h
Show inline comments
 
@@ -108,25 +108,25 @@ struct Industry : PoolItem<Industry, Ind
 
	byte production_rate[2];            ///< production rate for each cargo
 
	byte prod_level;                    ///< general production level
 
	CargoID accepts_cargo[3];           ///< 3 input cargo slots
 
	uint16 this_month_production[2];    ///< stats of this month's production per cargo
 
	uint16 this_month_transported[2];   ///< stats of this month's transport per cargo
 
	byte last_month_pct_transported[2]; ///< percentage transported per cargo in the last full month
 
	uint16 last_month_production[2];    ///< total units produced per cargo in the last full month
 
	uint16 last_month_transported[2];   ///< total units transported per cargo in the last full month
 
	uint16 counter;                     ///< used for animation and/or production (if available cargo)
 

	
 
	IndustryType type;                  ///< type of industry.
 
	OwnerByte owner;                    ///< owner of the industry.  Which SHOULD always be (imho) OWNER_NONE
 
	byte random_color;                  ///< randomized colour of the industry, for display purpose
 
	byte random_colour;                 ///< randomized colour of the industry, for display purpose
 
	Year last_prod_year;                ///< last year of production
 
	byte was_cargo_delivered;           ///< flag that indicate this has been the closest industry chosen for cargo delivery by a station. see DeliverGoodsToIndustry
 

	
 
	OwnerByte founder;                  ///< Founder of the industry
 
	Date construction_date;             ///< Date of the construction of the industry
 
	uint8 construction_type;            ///< Way the industry was constructed (@see IndustryConstructionType)
 
	Date last_cargo_accepted_at;        ///< Last day cargo was accepted by this industry
 
	byte selected_layout;               ///< Which tile layout was used when creating the industry
 

	
 
	byte random_triggers;               ///< Triggers for the random
 
	uint16 random;                      ///< Random value used for randomisation of all kinds of things
 

	
src/industry_cmd.cpp
Show inline comments
 
@@ -279,49 +279,49 @@ static void DrawTile_Industry(TileInfo *
 
				gfx = indts->grf_prop.subst_id;
 
				/* And point the industrytile spec accordingly */
 
				indts = GetIndustryTileSpec(gfx);
 
			}
 
		}
 
	}
 

	
 
	dits = &_industry_draw_tile_data[gfx << 2 | (indts->anim_state ?
 
			GetIndustryAnimationState(ti->tile) & INDUSTRY_COMPLETED :
 
			GetIndustryConstructionStage(ti->tile))];
 

	
 
	image = dits->ground.sprite;
 
	if (HasBit(image, PALETTE_MODIFIER_COLOR) && dits->ground.pal == PAL_NONE) {
 
		pal = GENERAL_SPRITE_COLOR(ind->random_color);
 
	if (HasBit(image, PALETTE_MODIFIER_COLOUR) && dits->ground.pal == PAL_NONE) {
 
		pal = GENERAL_SPRITE_COLOUR(ind->random_colour);
 
	} else {
 
		pal = dits->ground.pal;
 
	}
 

	
 
	/* DrawFoundation() modifes ti->z and ti->tileh */
 
	if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
 

	
 
	/* If the ground sprite is the default flat water sprite, draw also canal/river borders.
 
	 * Do not do this if the tile's WaterClass is 'land'. */
 
	if (image == SPR_FLAT_WATER_TILE && IsIndustryTileOnWater(ti->tile)) {
 
		DrawWaterClassGround(ti);
 
	} else {
 
		DrawGroundSprite(image, pal);
 
	}
 

	
 
	/* If industries are transparent and invisible, do not draw the upper part */
 
	if (IsInvisibilitySet(TO_INDUSTRIES)) return;
 

	
 
	/* Add industry on top of the ground? */
 
	image = dits->building.sprite;
 
	if (image != 0) {
 
		AddSortableSpriteToDraw(image,
 
			(HasBit(image, PALETTE_MODIFIER_COLOR) && dits->building.pal == PAL_NONE) ? GENERAL_SPRITE_COLOR(ind->random_color) : dits->building.pal,
 
			(HasBit(image, PALETTE_MODIFIER_COLOUR) && dits->building.pal == PAL_NONE) ? GENERAL_SPRITE_COLOUR(ind->random_colour) : dits->building.pal,
 
			ti->x + dits->subtile_x,
 
			ti->y + dits->subtile_y,
 
			dits->width,
 
			dits->height,
 
			dits->dz,
 
			ti->z,
 
			IsTransparencySet(TO_INDUSTRIES));
 

	
 
		if (IsTransparencySet(TO_INDUSTRIES)) return;
 
	}
 

	
 
	{
 
@@ -1479,49 +1479,49 @@ static void DoCreateNewIndustry(Industry
 
	if (_settings_game.economy.smooth_economy &&
 
	    !(HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 
	    !(HasBit(indspec->callback_flags, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CHANGE))             // production change callbacks
 
	) {
 
		i->production_rate[0] = min((RandomRange(256) + 128) * i->production_rate[0] >> 8 , 255);
 
		i->production_rate[1] = min((RandomRange(256) + 128) * i->production_rate[1] >> 8 , 255);
 
	}
 

	
 
	i->town = t;
 
	i->owner = owner;
 

	
 
	r = Random();
 
	i->random_color = GB(r, 0, 4);
 
	i->random_colour = GB(r, 0, 4);
 
	i->counter = GB(r, 4, 12);
 
	i->random = GB(r, 16, 16);
 
	i->produced_cargo_waiting[0] = 0;
 
	i->produced_cargo_waiting[1] = 0;
 
	i->incoming_cargo_waiting[0] = 0;
 
	i->incoming_cargo_waiting[1] = 0;
 
	i->incoming_cargo_waiting[2] = 0;
 
	i->this_month_production[0] = 0;
 
	i->this_month_production[1] = 0;
 
	i->this_month_transported[0] = 0;
 
	i->this_month_transported[1] = 0;
 
	i->last_month_pct_transported[0] = 0;
 
	i->last_month_pct_transported[1] = 0;
 
	i->last_month_transported[0] = 0;
 
	i->last_month_transported[1] = 0;
 
	i->was_cargo_delivered = false;
 
	i->last_prod_year = _cur_year;
 
	i->last_month_production[0] = i->production_rate[0] * 8;
 
	i->last_month_production[1] = i->production_rate[1] * 8;
 
	i->founder = _current_company;
 

	
 
	if (HasBit(indspec->callback_flags, CBM_IND_DECIDE_COLOUR)) {
 
		uint16 res = GetIndustryCallback(CBID_INDUSTRY_DECIDE_COLOUR, 0, 0, i, type, INVALID_TILE);
 
		if (res != CALLBACK_FAILED) i->random_color = GB(res, 0, 4);
 
		if (res != CALLBACK_FAILED) i->random_colour = GB(res, 0, 4);
 
	}
 

	
 
	if (HasBit(indspec->callback_flags, CBM_IND_INPUT_CARGO_TYPES)) {
 
		for (j = 0; j < lengthof(i->accepts_cargo); j++) i->accepts_cargo[j] = CT_INVALID;
 
		for (j = 0; j < lengthof(i->accepts_cargo); j++) {
 
			uint16 res = GetIndustryCallback(CBID_INDUSTRY_INPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
 
			if (res == CALLBACK_FAILED || GB(res, 0, 8) == CT_INVALID) break;
 
			i->accepts_cargo[j] = GetCargoTranslation(GB(res, 0, 8), indspec->grf_prop.grffile);
 
		}
 
	}
 

	
 
	if (HasBit(indspec->callback_flags, CBM_IND_OUTPUT_CARGO_TYPES)) {
src/main_gui.cpp
Show inline comments
 
@@ -357,28 +357,28 @@ struct MainWindow : Window
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
 
		/* Forward the message to the appropiate toolbar (ingame or scenario editor) */
 
		InvalidateWindowData(WC_MAIN_TOOLBAR, 0, data);
 
	}
 
};
 

	
 

	
 
void ShowSelectGameWindow();
 

	
 
void SetupColorsAndInitialWindow()
 
void SetupColoursAndInitialWindow()
 
{
 
	for (uint i = 0; i != 16; i++) {
 
		const byte *b = GetNonSprite(PALETTE_RECOLOR_START + i, ST_RECOLOUR);
 
		const byte *b = GetNonSprite(PALETTE_RECOLOUR_START + i, ST_RECOLOUR);
 

	
 
		assert(b);
 
		memcpy(_colour_gradient[i], b + 0xC6, sizeof(_colour_gradient[i]));
 
	}
 

	
 
	new MainWindow(_screen.width, _screen.height);
 

	
 
	/* XXX: these are not done */
 
	switch (_game_mode) {
 
		default: NOT_REACHED();
 
		case GM_MENU:
 
			ShowSelectGameWindow();
src/misc_cmd.cpp
Show inline comments
 
@@ -40,25 +40,25 @@ CommandCost CmdSetCompanyManagerFace(Til
 
	}
 
	return CommandCost();
 
}
 

	
 
/** Change the company's company-colour
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 bitstuffed:
 
 * p1 bits 0-7 scheme to set
 
 * p1 bits 8-9 set in use state or first/second colour
 
 * @param p2 new colour for vehicles, property, etc.
 
 */
 
CommandCost CmdSetCompanyColor(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
 
CommandCost CmdSetCompanyColour(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	if (p2 >= 16) return CMD_ERROR; // max 16 colours
 

	
 
	Colours colour = (Colours)p2;
 

	
 
	LiveryScheme scheme = (LiveryScheme)GB(p1, 0, 8);
 
	byte state = GB(p1, 8, 2);
 

	
 
	if (scheme >= LS_END || state >= 3) return CMD_ERROR;
 

	
 
	Company *c = GetCompany(_current_company);
 

	
 
@@ -107,25 +107,25 @@ CommandCost CmdSetCompanyColor(TileIndex
 
				c->livery[LS_DEFAULT].in_use = false;
 
				for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
					if (c->livery[scheme].in_use) {
 
						c->livery[LS_DEFAULT].in_use = true;
 
						break;
 
					}
 
				}
 
				break;
 

	
 
			default:
 
				break;
 
		}
 
		ResetVehicleColorMap();
 
		ResetVehicleColourMap();
 
		MarkWholeScreenDirty();
 
	}
 
	return CommandCost();
 
}
 

	
 
/** Increase the loan of your company.
 
 * @param tile unused
 
 * @param flags operation to perform
 
 * @param p1 amount to increase the loan with, multitude of LOAN_INTERVAL. Only used when p2 == 2.
 
 * @param p2 when 0: loans LOAN_INTERVAL
 
 *           when 1: loans the maximum loan permitting money (press CTRL),
 
 *           when 2: loans the amount specified in p1
src/misc_gui.cpp
Show inline comments
 
@@ -1358,26 +1358,26 @@ static const Widget _save_dialog_widgets
 
{      WWT_PANEL,     RESIZE_RB,  COLOUR_GREY,     0,   256,    48,   151, 0x0,              STR_NULL},
 
{ WWT_PUSHIMGBTN,     RESIZE_LR,  COLOUR_GREY,   245,   256,    48,    59, SPR_HOUSE_ICON,   STR_SAVELOAD_HOME_BUTTON},
 
{      WWT_INSET,     RESIZE_RB,  COLOUR_GREY,     2,   243,    50,   150, 0x0,              STR_400A_LIST_OF_DRIVES_DIRECTORIES},
 
{  WWT_SCROLLBAR,    RESIZE_LRB,  COLOUR_GREY,   245,   256,    60,   151, 0x0,              STR_0190_SCROLL_BAR_SCROLLS_LIST},
 
{      WWT_PANEL,    RESIZE_RTB,  COLOUR_GREY,     0,   256,   152,   167, 0x0,              STR_NULL},
 
{    WWT_EDITBOX,    RESIZE_RTB,  COLOUR_GREY,     2,   254,   154,   165, STR_SAVE_OSKTITLE, STR_400B_CURRENTLY_SELECTED_NAME},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,  COLOUR_GREY,     0,   127,   168,   179, STR_4003_DELETE,  STR_400C_DELETE_THE_CURRENTLY_SELECTED},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,  COLOUR_GREY,   128,   244,   168,   179, STR_4002_SAVE,    STR_400D_SAVE_THE_CURRENT_GAME_USING},
 
{  WWT_RESIZEBOX,   RESIZE_LRTB,  COLOUR_GREY,   245,   256,   168,   179, 0x0,              STR_RESIZE_BUTTON},
 
{   WIDGETS_END},
 
};
 

	
 
/* Colors for fios types */
 
const TextColour _fios_colors[] = {
 
/* Colours for fios types */
 
const TextColour _fios_colours[] = {
 
	TC_LIGHT_BLUE, TC_DARK_GREEN,  TC_DARK_GREEN, TC_ORANGE, TC_LIGHT_BROWN,
 
	TC_ORANGE,     TC_LIGHT_BROWN, TC_ORANGE,     TC_ORANGE, TC_YELLOW
 
};
 

	
 
void BuildFileList()
 
{
 
	_fios_path_changed = true;
 
	FiosFreeSavegameList();
 

	
 
	switch (_saveload_mode) {
 
		case SLD_NEW_GAME:
 
		case SLD_LOAD_SCENARIO:
 
@@ -1545,25 +1545,25 @@ public:
 
			_savegame_sort_dirty = false;
 
			MakeSortedSaveGameList();
 
		}
 

	
 
		const Widget *widg = &this->widget[SLWW_DRIVES_DIRECTORIES_LIST];
 
		GfxFillRect(widg->left + 1, widg->top + 1, widg->right, widg->bottom, 0xD7);
 
		this->DrawSortButtonState(_savegame_sort_order & SORT_BY_NAME ? SLWW_SORT_BYNAME : SLWW_SORT_BYDATE, _savegame_sort_order & SORT_DESCENDING ? SBS_DOWN : SBS_UP);
 

	
 
		y = widg->top + 1;
 
		for (uint pos = this->vscroll.pos; pos < _fios_items.Length(); pos++) {
 
			const FiosItem *item = _fios_items.Get(pos);
 

	
 
			DoDrawStringTruncated(item->title, 4, y, _fios_colors[item->type], this->width - 18);
 
			DoDrawStringTruncated(item->title, 4, y, _fios_colours[item->type], this->width - 18);
 
			y += 10;
 
			if (y >= this->vscroll.cap * 10 + widg->top + 1) break;
 
		}
 

	
 
		if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
 
			this->DrawEditBox(SLWW_SAVE_OSK_TITLE);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		switch (widget) {
src/music_gui.cpp
Show inline comments
 
@@ -389,32 +389,32 @@ public:
 
	virtual void OnPaint()
 
	{
 
		uint i;
 
		StringID str;
 

	
 
		this->RaiseWidget(MW_GAUGE);
 
		this->RaiseWidget(MW_INFO);
 
		this->DrawWidgets();
 

	
 
		GfxFillRect(187, 16, 200, 33, 0);
 

	
 
		for (i = 0; i != 8; i++) {
 
			int color = 0xD0;
 
			int colour = 0xD0;
 
			if (i > 4) {
 
				color = 0xBF;
 
				colour = 0xBF;
 
				if (i > 6) {
 
					color = 0xB8;
 
					colour = 0xB8;
 
				}
 
			}
 
			GfxFillRect(187, NUM_SONGS_PLAYLIST - i * 2, 200, NUM_SONGS_PLAYLIST - i * 2, color);
 
			GfxFillRect(187, NUM_SONGS_PLAYLIST - i * 2, 200, NUM_SONGS_PLAYLIST - i * 2, colour);
 
		}
 

	
 
		GfxFillRect(60, 46, 239, 52, 0);
 

	
 
		if (_song_is_active == 0 || _music_wnd_cursong == 0) {
 
			str = STR_01E3;
 
		} else {
 
			SetDParam(0, _music_wnd_cursong);
 
			str = (_music_wnd_cursong < 10) ? STR_01E4_0 : STR_01E5;
 
		}
 
		DrawString(62, 46, str, TC_FROMSTRING);
 

	
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -51,25 +51,25 @@ static uint8 *_chatmessage_backup = NULL
 
static inline uint GetChatMessageCount()
 
{
 
	uint i = 0;
 
	for (; i < MAX_CHAT_MESSAGES; i++) {
 
		if (_chatmsg_list[i].message[0] == '\0') break;
 
	}
 

	
 
	return i;
 
}
 

	
 
/**
 
 * Add a text message to the 'chat window' to be shown
 
 * @param color The colour this message is to be shown in
 
 * @param colour The colour this message is to be shown in
 
 * @param duration The duration of the chat message in game-days
 
 * @param message message itself in printf() style
 
 */
 
void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *message, ...)
 
{
 
	char buf[DRAW_STRING_BUFFER];
 
	const char *bufp;
 
	va_list va;
 
	uint msg_count;
 
	uint16 lines;
 

	
 
	va_start(va, message);
 
@@ -87,25 +87,25 @@ void CDECL NetworkAddChatMessage(TextCol
 
	if (lines > MAX_CHAT_MESSAGES - msg_count) {
 
		int i = lines - (MAX_CHAT_MESSAGES - msg_count);
 
		memmove(&_chatmsg_list[0], &_chatmsg_list[i], sizeof(_chatmsg_list[0]) * (msg_count - i));
 
		msg_count = MAX_CHAT_MESSAGES - lines;
 
	}
 

	
 
	for (bufp = buf; lines != 0; lines--) {
 
		ChatMessage *cmsg = &_chatmsg_list[msg_count++];
 
		strecpy(cmsg->message, bufp, lastof(cmsg->message));
 

	
 
		/* The default colour for a message is company colour. Replace this with
 
		 * white for any additional lines */
 
		cmsg->colour = (bufp == buf && colour & IS_PALETTE_COLOR) ? colour : (TextColour)(0x1D - 15) | IS_PALETTE_COLOR;
 
		cmsg->colour = (bufp == buf && colour & IS_PALETTE_COLOUR) ? colour : (TextColour)(0x1D - 15) | IS_PALETTE_COLOUR;
 
		cmsg->end_date = _date + duration;
 

	
 
		bufp += strlen(bufp) + 1; // jump to 'next line' in the formatted string
 
	}
 

	
 
	_chatmessage_dirty = true;
 
}
 

	
 
void NetworkInitChatMessage()
 
{
 
	MAX_CHAT_MESSAGES   = _settings_client.gui.network_chat_box_height;
 

	
 
@@ -223,25 +223,25 @@ void NetworkDrawChatMessage()
 

	
 
	/* Make a copy of the screen as it is before painting (for undraw) */
 
	blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup, width, height);
 

	
 
	_cur_dpi = &_screen; // switch to _screen painting
 

	
 
	/* Paint a half-transparent box behind the chat messages */
 
	GfxFillRect(
 
			_chatmsg_box.x,
 
			_screen.height - _chatmsg_box.y - count * NETWORK_CHAT_LINE_HEIGHT - 2,
 
			_chatmsg_box.x + _chatmsg_box.width - 1,
 
			_screen.height - _chatmsg_box.y - 2,
 
			PALETTE_TO_TRANSPARENT, FILLRECT_RECOLOR // black, but with some alpha for background
 
			PALETTE_TO_TRANSPARENT, FILLRECT_RECOLOUR // black, but with some alpha for background
 
		);
 

	
 
	/* Paint the chat messages starting with the lowest at the bottom */
 
	for (uint y = NETWORK_CHAT_LINE_HEIGHT; count-- != 0; y += NETWORK_CHAT_LINE_HEIGHT) {
 
		DoDrawString(_chatmsg_list[count].message, _chatmsg_box.x + 3, _screen.height - _chatmsg_box.y - y + 1, _chatmsg_list[count].colour);
 
	}
 

	
 
	/* Make sure the data is updated next flush */
 
	_video_driver->MakeDirty(x, y, width, height);
 

	
 
	_chatmessage_visible = true;
 
	_chatmessage_dirty = false;
src/network/network_client.cpp
Show inline comments
 
@@ -732,25 +732,25 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER
 
				ci = NetworkFindClientInfoFromClientID(_network_own_client_id);
 
			} break;
 

	
 
			default: return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 
		}
 
	} else {
 
		/* Display message from somebody else */
 
		snprintf(name, sizeof(name), "%s", ci_to->client_name);
 
		ci = ci_to;
 
	}
 

	
 
	if (ci != NULL)
 
		NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColor(ci->client_playas), self_send, name, msg, data);
 
		NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), self_send, name, msg, data);
 
	return NETWORK_RECV_STATUS_OKAY;
 
}
 

	
 
DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_ERROR_QUIT)
 
{
 
	ClientID client_id = (ClientID)p->Recv_uint32();
 

	
 
	NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(client_id);
 
	if (ci != NULL) {
 
		NetworkTextMessage(NETWORK_ACTION_LEAVE, CC_DEFAULT, false, ci->client_name, NULL, GetNetworkErrorMsg((NetworkErrorCode)p->Recv_uint8()));
 
		delete ci;
 
	}
 
@@ -807,28 +807,28 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER
 
	// COMPANY_SPECTATOR is currently 255, so to avoid long wait periods
 
	//  set the max to 10.
 
	_network_reconnect = min(_local_company + 1, 10);
 
	_switch_mode_errorstr = STR_NETWORK_SERVER_REBOOT;
 

	
 
	return NETWORK_RECV_STATUS_SERVER_ERROR;
 
}
 

	
 
DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_RCON)
 
{
 
	char rcon_out[NETWORK_RCONCOMMAND_LENGTH];
 

	
 
	ConsoleColour color_code = (ConsoleColour)p->Recv_uint16();
 
	ConsoleColour colour_code = (ConsoleColour)p->Recv_uint16();
 
	p->Recv_string(rcon_out, sizeof(rcon_out));
 

	
 
	IConsolePrint(color_code, rcon_out);
 
	IConsolePrint(colour_code, rcon_out);
 

	
 
	return NETWORK_RECV_STATUS_OKAY;
 
}
 

	
 
DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MOVE)
 
{
 
	/* Nothing more in this packet... */
 
	ClientID client_id   = (ClientID)p->Recv_uint32();
 
	CompanyID company_id = (CompanyID)p->Recv_uint8();
 

	
 
	if (client_id == 0) {
 
		/* definitely an invalid client id, debug message and do nothing. */
src/network/network_gui.cpp
Show inline comments
 
@@ -908,25 +908,25 @@ struct NetworkStartServerWindow : public
 

	
 
		/* draw list of maps */
 
		GfxFillRect(11, 63, 258, 215, 0xD7);  // black background of maps list
 

	
 
		for (uint pos = this->vscroll.pos; pos < _fios_items.Length() + 1; pos++) {
 
			item = _fios_items.Get(pos - 1);
 
			if (item == this->map || (pos == 0 && this->map == NULL))
 
				GfxFillRect(11, y - 1, 258, y + 10, 155); // show highlighted item with a different colour
 

	
 
			if (pos == 0) {
 
				DrawString(14, y, STR_4010_GENERATE_RANDOM_NEW_GAME, TC_DARK_GREEN);
 
			} else {
 
				DoDrawString(item->title, 14, y, _fios_colors[item->type] );
 
				DoDrawString(item->title, 14, y, _fios_colours[item->type] );
 
			}
 
			y += NSSWND_ROWSIZE;
 

	
 
			if (y >= this->vscroll.cap * NSSWND_ROWSIZE + NSSWND_START) break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		this->field = widget;
 
		switch (widget) {
 
			case NSSW_CLOSE:  // Close 'X'
src/network/network_internal.h
Show inline comments
 
@@ -139,25 +139,25 @@ struct CommandPacket : CommandContainer 
 
	CommandPacket *next; ///< the next command packet (if in queue)
 
	CompanyByte company; ///< company that is executing the command
 
	uint32 frame;        ///< the frame in which this packet is executed
 
	bool my_cmd;         ///< did the command originate from "me"
 
};
 

	
 
void NetworkAddCommandQueue(CommandPacket cp, NetworkClientSocket *cs = NULL);
 
void NetworkExecuteLocalCommandQueue();
 
void NetworkFreeLocalCommandQueue();
 

	
 
// from network.c
 
void NetworkCloseClient(NetworkClientSocket *cs);
 
void NetworkTextMessage(NetworkAction action, ConsoleColour color, bool self_send, const char *name, const char *str = "", int64 data = 0);
 
void NetworkTextMessage(NetworkAction action, ConsoleColour colour, bool self_send, const char *name, const char *str = "", int64 data = 0);
 
void NetworkGetClientName(char *clientname, size_t size, const NetworkClientSocket *cs);
 
uint NetworkCalculateLag(const NetworkClientSocket *cs);
 
byte NetworkGetCurrentLanguageIndex();
 
NetworkClientSocket *NetworkFindClientStateFromClientID(ClientID client_id);
 
StringID GetNetworkErrorMsg(NetworkErrorCode err);
 
bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]);
 

	
 
// Macros to make life a bit more easier
 
#define DEF_CLIENT_RECEIVE_COMMAND(type) NetworkRecvStatus NetworkPacketReceive_ ## type ## _command(Packet *p)
 
#define DEF_CLIENT_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command()
 
#define DEF_CLIENT_SEND_COMMAND_PARAM(type) void NetworkPacketSend_ ## type ## _command
 
#define DEF_SERVER_RECEIVE_COMMAND(type) void NetworkPacketReceive_ ## type ## _command(NetworkClientSocket *cs, Packet *p)
src/network/network_server.cpp
Show inline comments
 
@@ -563,29 +563,29 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_NE
 
{
 
	//
 
	// Packet: PACKET_SERVER_NEWGAME
 
	// Function: Let the clients know that the server is loading a new map
 
	// Data:
 
	//     <none>
 
	//
 

	
 
	Packet *p = NetworkSend_Init(PACKET_SERVER_NEWGAME);
 
	cs->Send_Packet(p);
 
}
 

	
 
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkClientSocket *cs, uint16 color, const char *command)
 
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkClientSocket *cs, uint16 colour, const char *command)
 
{
 
	Packet *p = NetworkSend_Init(PACKET_SERVER_RCON);
 

	
 
	p->Send_uint16(color);
 
	p->Send_uint16(colour);
 
	p->Send_string(command);
 
	cs->Send_Packet(p);
 
}
 

	
 
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_MOVE)(NetworkClientSocket *cs, ClientID client_id, CompanyID company_id)
 
{
 
	Packet *p = NetworkSend_Init(PACKET_SERVER_MOVE);
 

	
 
	p->Send_uint32(client_id);
 
	p->Send_uint8(company_id);
 
	cs->Send_Packet(p);
 
}
 
@@ -1035,42 +1035,42 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT
 
void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, const char *msg, ClientID from_id, int64 data)
 
{
 
	NetworkClientSocket *cs;
 
	const NetworkClientInfo *ci, *ci_own, *ci_to;
 

	
 
	switch (desttype) {
 
	case DESTTYPE_CLIENT:
 
		/* Are we sending to the server? */
 
		if ((ClientID)dest == CLIENT_ID_SERVER) {
 
			ci = NetworkFindClientInfoFromClientID(from_id);
 
			/* Display the text locally, and that is it */
 
			if (ci != NULL)
 
				NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColor(ci->client_playas), false, ci->client_name, msg, data);
 
				NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
 
		} else {
 
			/* Else find the client to send the message to */
 
			FOR_ALL_CLIENT_SOCKETS(cs) {
 
				if (cs->client_id == (ClientID)dest) {
 
					SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, from_id, false, msg, data);
 
					break;
 
				}
 
			}
 
		}
 

	
 
		// Display the message locally (so you know you have sent it)
 
		if (from_id != (ClientID)dest) {
 
			if (from_id == CLIENT_ID_SERVER) {
 
				ci = NetworkFindClientInfoFromClientID(from_id);
 
				ci_to = NetworkFindClientInfoFromClientID((ClientID)dest);
 
				if (ci != NULL && ci_to != NULL)
 
					NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColor(ci->client_playas), true, ci_to->client_name, msg, data);
 
					NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), true, ci_to->client_name, msg, data);
 
			} else {
 
				FOR_ALL_CLIENT_SOCKETS(cs) {
 
					if (cs->client_id == from_id) {
 
						SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, (ClientID)dest, true, msg, data);
 
						break;
 
					}
 
				}
 
			}
 
		}
 
		break;
 
	case DESTTYPE_TEAM: {
 
		bool show_local = true; // If this is false, the message is already displayed
 
@@ -1080,60 +1080,60 @@ void NetworkServerSendChat(NetworkAction
 
		FOR_ALL_CLIENT_SOCKETS(cs) {
 
			ci = cs->GetInfo();
 
			if (ci->client_playas == (CompanyID)dest) {
 
				SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, from_id, false, msg, data);
 
				if (cs->client_id == from_id) show_local = false;
 
				ci_to = ci; // Remember a client that is in the company for company-name
 
			}
 
		}
 

	
 
		ci = NetworkFindClientInfoFromClientID(from_id);
 
		ci_own = NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER);
 
		if (ci != NULL && ci_own != NULL && ci_own->client_playas == dest) {
 
			NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColor(ci->client_playas), false, ci->client_name, msg, data);
 
			NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
 
			if (from_id == CLIENT_ID_SERVER) show_local = false;
 
			ci_to = ci_own;
 
		}
 

	
 
		/* There is no such client */
 
		if (ci_to == NULL) break;
 

	
 
		// Display the message locally (so you know you have sent it)
 
		if (ci != NULL && show_local) {
 
			if (from_id == CLIENT_ID_SERVER) {
 
				char name[NETWORK_NAME_LENGTH];
 
				StringID str = IsValidCompanyID(ci_to->client_playas) ? STR_COMPANY_NAME : STR_NETWORK_SPECTATORS;
 
				SetDParam(0, ci_to->client_playas);
 
				GetString(name, str, lastof(name));
 
				NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColor(ci_own->client_playas), true, name, msg, data);
 
				NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci_own->client_playas), true, name, msg, data);
 
			} else {
 
				FOR_ALL_CLIENT_SOCKETS(cs) {
 
					if (cs->client_id == from_id) {
 
						SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, ci_to->client_id, true, msg, data);
 
					}
 
				}
 
			}
 
		}
 
		}
 
		break;
 
	default:
 
		DEBUG(net, 0, "[server] received unknown chat destination type %d. Doing broadcast instead", desttype);
 
		/* fall-through to next case */
 
	case DESTTYPE_BROADCAST:
 
		FOR_ALL_CLIENT_SOCKETS(cs) {
 
			SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, from_id, false, msg, data);
 
		}
 
		ci = NetworkFindClientInfoFromClientID(from_id);
 
		if (ci != NULL)
 
			NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColor(ci->client_playas), false, ci->client_name, msg, data);
 
			NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
 
		break;
 
	}
 
}
 

	
 
DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_CHAT)
 
{
 
	if (cs->status < STATUS_AUTH) {
 
		/* Illegal call, return error and ignore the packet */
 
		SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_AUTHORIZED);
 
		return;
 
	}
 

	
src/network/network_server.h
Show inline comments
 
@@ -3,25 +3,25 @@
 
/** @file network_server.h Server part of the network protocol. */
 

	
 
#ifndef NETWORK_SERVER_H
 
#define NETWORK_SERVER_H
 

	
 
#ifdef ENABLE_NETWORK
 

	
 
DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MAP);
 
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR_QUIT)(NetworkClientSocket *cs, ClientID client_id, NetworkErrorCode errorno);
 
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkClientSocket *cs, NetworkErrorCode error);
 
DEF_SERVER_SEND_COMMAND(PACKET_SERVER_SHUTDOWN);
 
DEF_SERVER_SEND_COMMAND(PACKET_SERVER_NEWGAME);
 
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkClientSocket *cs, uint16 color, const char *command);
 
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkClientSocket *cs, uint16 colour, const char *command);
 
DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_MOVE)(NetworkClientSocket *cs, uint16 client_id, CompanyID company_id);
 

	
 
bool NetworkServer_ReadPackets(NetworkClientSocket *cs);
 
void NetworkServer_Tick(bool send_frame);
 

	
 
#else /* ENABLE_NETWORK */
 
/* Network function stubs when networking is disabled */
 

	
 
static inline void NetworkServerMonthlyLoop() {}
 
static inline void NetworkServerYearlyLoop() {}
 

	
 
#endif /* ENABLE_NETWORK */
src/newgrf.cpp
Show inline comments
 
@@ -405,25 +405,25 @@ static void MapSpriteMappingRecolour(Pal
 
	if (HasBit(grf_sprite->pal, 14)) {
 
		ClrBit(grf_sprite->pal, 14);
 
		SetBit(grf_sprite->sprite, SPRITE_MODIFIER_OPAQUE);
 
	}
 

	
 
	if (HasBit(grf_sprite->sprite, 14)) {
 
		ClrBit(grf_sprite->sprite, 14);
 
		SetBit(grf_sprite->sprite, PALETTE_MODIFIER_TRANSPARENT);
 
	}
 

	
 
	if (HasBit(grf_sprite->sprite, 15)) {
 
		ClrBit(grf_sprite->sprite, 15);
 
		SetBit(grf_sprite->sprite, PALETTE_MODIFIER_COLOR);
 
		SetBit(grf_sprite->sprite, PALETTE_MODIFIER_COLOUR);
 
	}
 
}
 

	
 
enum ChangeInfoResult {
 
	CIR_SUCCESS,    ///< Variable was parsed and read
 
	CIR_UNHANDLED,  ///< Variable was parsed but unread
 
	CIR_UNKNOWN,    ///< Variable is unknown
 
	CIR_INVALID_ID, ///< Attempt to modify an invalid ID
 
};
 

	
 
typedef ChangeInfoResult (*VCI_Handler)(uint engine, int numinfo, int prop, byte **buf, int len);
 

	
 
@@ -2344,25 +2344,25 @@ static ChangeInfoResult IndustriesChange
 
			case 0x16: // Conflicting industry types
 
				for (byte j = 0; j < 3; j++) indsp->conflicting[j] = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x17: // Probability in random game
 
				indsp->appear_creation[_settings_game.game_creation.landscape] = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x18: // Probability during gameplay
 
				indsp->appear_ingame[_settings_game.game_creation.landscape] = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x19: // Map color
 
			case 0x19: // Map colour
 
				indsp->map_colour = MapDOSColour(grf_load_byte(&buf));
 
				break;
 

	
 
			case 0x1A: // Special industry flags to define special behavior
 
				indsp->behaviour = (IndustryBehaviour)grf_load_dword(&buf);
 
				break;
 

	
 
			case 0x1B: // New industry text ID
 
				indsp->new_industry_text = grf_load_word(&buf);
 
				_string_to_grf_mapping[&indsp->new_industry_text] = _cur_grffile->grfid;
 
				break;
 

	
 
@@ -4404,25 +4404,25 @@ static uint32 GetPatchVariable(uint8 par
 
		 * the following is good for 1x, 2x and 4x (most common?) and...
 
		 * well not really for 3x. */
 
		case 0x10:
 
			switch (_settings_game.vehicle.plane_speed) {
 
				default:
 
				case 4: return 1;
 
				case 3: return 2;
 
				case 2: return 2;
 
				case 1: return 4;
 
			}
 

	
 

	
 
		/* 2CC colormap base sprite */
 
		/* 2CC colourmap base sprite */
 
		case 0x11: return SPR_2CCMAP_BASE;
 

	
 
		/* map size: format = -MABXYSS
 
		 * M  : the type of map
 
		 *       bit 0 : set   : squared map. Bit 1 is now not relevant
 
		 *               clear : rectangle map. Bit 1 will indicate the bigger edge of the map
 
		 *       bit 1 : set   : Y is the bigger edge. Bit 0 is clear
 
		 *               clear : X is the bigger edge.
 
		 * A  : minimum edge(log2) of the map
 
		 * B  : maximum edge(log2) of the map
 
		 * XY : edges(log2) of each side of the map.
 
		 * SS : combination of both X and Y, thus giving the size(log2) of the map
src/newgrf_callbacks.h
Show inline comments
 
@@ -190,25 +190,25 @@ enum CallbackID {
 
	/** 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 color of an industry. */
 
	/** 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
 
};
 

	
src/newgrf_commons.h
Show inline comments
 
@@ -92,51 +92,51 @@ public:
 
	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_COLOR to a palette entry of a sprite layout entry
 
 * 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 color resp. random industry/house color)
 
 * @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_COLOR)) {
 
	if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOUR)) {
 
		return (pal != 0 ? pal : default_pal);
 
	} else {
 
		return PAL_NONE;
 
	}
 
}
 

	
 
/**
 
 * Applies PALETTE_MODIFIER_COLOR to a palette entry of a ground sprite
 
 * 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 color resp. random industry/house color)
 
 * @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_COLOR)) {
 
	if (HasBit(image, PALETTE_MODIFIER_COLOUR)) {
 
		return (pal != 0 ? pal : default_pal);
 
	} else {
 
		return PAL_NONE;
 
	}
 
}
 

	
 
#endif /* NEWGRF_COMMONS_H */
src/newgrf_house.cpp
Show inline comments
 
@@ -364,25 +364,25 @@ uint16 GetHouseCallback(CallbackID callb
 
	group = Resolve(GetHouseSpecs(house_id)->spritegroup, &object);
 
	if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED;
 

	
 
	return group->g.callback.result;
 
}
 

	
 
static void DrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte stage, HouseID house_id)
 
{
 
	const DrawTileSprites *dts = group->g.layout.dts;
 
	const DrawTileSeqStruct *dtss;
 

	
 
	const HouseSpec *hs = GetHouseSpecs(house_id);
 
	SpriteID palette = hs->random_colour[TileHash2Bit(ti->x, ti->y)] + PALETTE_RECOLOR_START;
 
	SpriteID palette = hs->random_colour[TileHash2Bit(ti->x, ti->y)] + PALETTE_RECOLOUR_START;
 
	if (HasBit(hs->callback_mask, CBM_HOUSE_COLOUR)) {
 
		uint16 callback = GetHouseCallback(CBID_HOUSE_COLOUR, 0, 0, house_id, GetTownByTile(ti->tile), ti->tile);
 
		if (callback != CALLBACK_FAILED) {
 
			/* If bit 14 is set, we should use a 2cc colour map, else use the callback value. */
 
			palette = HasBit(callback, 14) ? GB(callback, 0, 8) + SPR_2CCMAP_BASE : callback;
 
		}
 
	}
 

	
 
	SpriteID image = dts->ground.sprite;
 
	SpriteID pal   = dts->ground.pal;
 

	
 
	if (IS_CUSTOM_SPRITE(image)) image += stage;
src/newgrf_industries.cpp
Show inline comments
 
@@ -357,25 +357,25 @@ uint32 IndustryGetVariable(const Resolve
 
		case 0x9E: return industry->last_month_production[0];
 
		case 0x9F: return GB(industry->last_month_production[0], 8, 8);
 
		case 0xA0: return industry->last_month_production[1];
 
		case 0xA1: return GB(industry->last_month_production[1], 8, 8);
 
		/* amount of cargo transported last month. */
 
		case 0xA2: return industry->last_month_transported[0];
 
		case 0xA3: return GB(industry->last_month_transported[0], 8, 8);
 
		case 0xA4: return industry->last_month_transported[1];
 
		case 0xA5: return GB(industry->last_month_transported[0], 8, 8);
 

	
 
		case 0xA6: return industry->type;
 
		case 0xA7: return industry->founder;
 
		case 0xA8: return industry->random_color;
 
		case 0xA8: return industry->random_colour;
 
		case 0xA9: return Clamp(industry->last_prod_year - ORIGINAL_BASE_YEAR, 0, 255);
 
		case 0xAA: return industry->counter;
 
		case 0xAB: return GB(industry->counter, 8, 8);
 
		case 0xAC: return industry->was_cargo_delivered;
 

	
 
		case 0xB0: return Clamp(industry->construction_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535); // Date when built since 1920 (in days)
 
		case 0xB3: return industry->construction_type; // Construction type
 
		case 0xB4: return Clamp(industry->last_cargo_accepted_at - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535); // Date last cargo accepted since 1920 (in days)
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled industry property 0x%X", variable);
 

	
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -154,56 +154,56 @@ static void NewIndustryTileResolver(Reso
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 

	
 
	const IndustryTileSpec *its = GetIndustryTileSpec(gfx);
 
	res->grffile         = (its != NULL ? its->grf_prop.grffile : NULL);
 
}
 

	
 
static void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte rnd_color, byte stage, IndustryGfx gfx)
 
static void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte rnd_colour, byte stage, IndustryGfx gfx)
 
{
 
	const DrawTileSprites *dts = group->g.layout.dts;
 
	const DrawTileSeqStruct *dtss;
 

	
 
	SpriteID image = dts->ground.sprite;
 
	SpriteID pal   = dts->ground.pal;
 

	
 
	if (IS_CUSTOM_SPRITE(image)) image += stage;
 

	
 
	if (GB(image, 0, SPRITE_WIDTH) != 0) {
 
		/* If the ground sprite is the default flat water sprite, draw also canal/river borders
 
		 * Do not do this if the tile's WaterClass is 'land'. */
 
		if (image == SPR_FLAT_WATER_TILE && IsIndustryTileOnWater(ti->tile)) {
 
			DrawWaterClassGround(ti);
 
		} else {
 
			DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, GENERAL_SPRITE_COLOR(rnd_color)));
 
			DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, GENERAL_SPRITE_COLOUR(rnd_colour)));
 
		}
 
	}
 

	
 
	foreach_draw_tile_seq(dtss, dts->seq) {
 
		if (GB(dtss->image.sprite, 0, SPRITE_WIDTH) == 0) continue;
 

	
 
		image = dtss->image.sprite;
 
		pal   = dtss->image.pal;
 

	
 
		/* Stop drawing sprite sequence once we meet a sprite that doesn't have to be opaque */
 
		if (IsInvisibilitySet(TO_INDUSTRIES) && !HasBit(image, SPRITE_MODIFIER_OPAQUE)) return;
 

	
 
		if (IS_CUSTOM_SPRITE(image)) image += stage;
 

	
 
		pal = SpriteLayoutPaletteTransform(image, pal, GENERAL_SPRITE_COLOR(rnd_color));
 
		pal = SpriteLayoutPaletteTransform(image, pal, GENERAL_SPRITE_COLOUR(rnd_colour));
 

	
 
		if ((byte)dtss->delta_z != 0x80) {
 
			AddSortableSpriteToDraw(
 
				image, pal,
 
				ti->x + dtss->delta_x, ti->y + dtss->delta_y,
 
				dtss->size_x, dtss->size_y,
 
				dtss->size_z, ti->z + dtss->delta_z,
 
				!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_INDUSTRIES)
 
			);
 
		} else {
 
			/* For industries and houses delta_x and delta_y are unsigned */
 
			AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_INDUSTRIES));
 
@@ -243,25 +243,25 @@ bool DrawNewIndustryTile(TileInfo *ti, I
 
		if (draw_old_one) DrawFoundation(ti, FOUNDATION_LEVELED);
 
	}
 

	
 
	NewIndustryTileResolver(&object, gfx, ti->tile, i);
 

	
 
	group = Resolve(inds->grf_prop.spritegroup, &object);
 
	if (group == NULL || group->type != SGT_TILELAYOUT) {
 
		return false;
 
	} else {
 
		/* Limit the building stage to the number of stages supplied. */
 
		byte stage = GetIndustryConstructionStage(ti->tile);
 
		stage = Clamp(stage - 4 + group->g.layout.num_sprites, 0, group->g.layout.num_sprites - 1);
 
		IndustryDrawTileLayout(ti, group, i->random_color, stage, gfx);
 
		IndustryDrawTileLayout(ti, group, i->random_colour, stage, gfx);
 
		return true;
 
	}
 
}
 

	
 
extern bool IsSlopeRefused(Slope current, Slope refused);
 

	
 
bool PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, uint itspec_index)
 
{
 
	Industry ind;
 
	ind.index = INVALID_INDUSTRY;
 
	ind.xy = ind_base_tile;
 
	ind.width = 0;
src/newgrf_station.cpp
Show inline comments
 
@@ -771,25 +771,25 @@ void DeallocateSpecFromStation(Station *
 
 * @param sclass, station Type of station.
 
 * @param station station ID
 
 * @return True if the tile was drawn (allows for fallback to default graphic)
 
 */
 
bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID sclass, uint station)
 
{
 
	const StationSpec *statspec;
 
	const DrawTileSprites *sprites;
 
	const DrawTileSeqStruct *seq;
 
	const RailtypeInfo *rti = GetRailTypeInfo(railtype);
 
	SpriteID relocation;
 
	SpriteID image;
 
	SpriteID palette = COMPANY_SPRITE_COLOR(_local_company);
 
	SpriteID palette = COMPANY_SPRITE_COLOUR(_local_company);
 
	uint tile = 2;
 

	
 
	statspec = GetCustomStationSpec(sclass, station);
 
	if (statspec == NULL) return false;
 

	
 
	relocation = GetCustomStationRelocation(statspec, NULL, INVALID_TILE);
 

	
 
	if (HasBit(statspec->callbackmask, CBM_STATION_SPRITE_LAYOUT)) {
 
		uint16 callback = GetStationCallback(CBID_STATION_SPRITE_LAYOUT, 0x2110000, 0, statspec, NULL, INVALID_TILE);
 
		if (callback != CALLBACK_FAILED) tile = callback;
 
	}
 

	
src/news_gui.cpp
Show inline comments
 
@@ -41,25 +41,25 @@ static NewsItem *_forced_news = NULL;   
 
/** Current news item (last item shown regularly). */
 
static NewsItem *_current_news = NULL;
 

	
 

	
 
typedef void DrawNewsCallbackProc(struct Window *w, const NewsItem *ni);
 
void DrawNewsNewVehicleAvail(Window *w, const NewsItem *ni);
 

	
 
static void DrawNewsBankrupcy(Window *w, const NewsItem *ni)
 
{
 
	const CompanyNewsInformation *cni = (const CompanyNewsInformation*)ni->free_data;
 

	
 
	DrawCompanyManagerFace(cni->face, cni->colour, 2, 23);
 
	GfxFillRect(3, 23, 3 + 91, 23 + 118, PALETTE_TO_STRUCT_GREY, FILLRECT_RECOLOR);
 
	GfxFillRect(3, 23, 3 + 91, 23 + 118, PALETTE_TO_STRUCT_GREY, FILLRECT_RECOLOUR);
 

	
 
	SetDParamStr(0, cni->president_name);
 
	DrawStringMultiCenter(49, 148, STR_JUST_RAW_STRING, 94);
 

	
 
	switch (ni->subtype) {
 
		case NS_COMPANY_TROUBLE:
 
			DrawStringCentered(w->width >> 1, 1, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE, TC_FROMSTRING);
 

	
 
			SetDParam(0, ni->params[2]);
 

	
 
			DrawStringMultiCenter(
 
				((w->width - 101) >> 1) + 98,
 
@@ -220,29 +220,29 @@ struct NewsWindow : Window {
 

	
 
				if (!(this->ni->flags & NF_VIEWPORT)) {
 
					CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
 
					DrawStringMultiCenter(215, display_mode == NM_NORMAL ? 76 : 56,
 
						this->ni->string_id, this->width - 4);
 
				} else {
 
					/* Back up transparency options to draw news view */
 
					TransparencyOptionBits to_backup = _transparency_opt;
 
					_transparency_opt = 0;
 
					this->DrawViewport();
 
					_transparency_opt = to_backup;
 

	
 
					/* Shade the viewport into gray, or color*/
 
					/* Shade the viewport into gray, or colour*/
 
					ViewPort *vp = this->viewport;
 
					GfxFillRect(vp->left - this->left, vp->top - this->top,
 
						vp->left - this->left + vp->width - 1, vp->top - this->top + vp->height - 1,
 
						(this->ni->flags & NF_INCOLOR ? PALETTE_TO_TRANSPARENT : PALETTE_TO_STRUCT_GREY), FILLRECT_RECOLOR
 
						(this->ni->flags & NF_INCOLOUR ? PALETTE_TO_TRANSPARENT : PALETTE_TO_STRUCT_GREY), FILLRECT_RECOLOUR
 
					);
 

	
 
					CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
 
					DrawStringMultiCenter(this->width / 2, 20, this->ni->string_id, this->width - 4);
 
				}
 
				break;
 
			}
 

	
 
			default:
 
				this->DrawWidgets();
 
				if (!(this->ni->flags & NF_VIEWPORT)) {
 
					CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
 
@@ -488,26 +488,26 @@ static void MoveToNextItem()
 
 */
 
void AddNewsItem(StringID string, NewsSubtype subtype, uint data_a, uint data_b, void *free_data)
 
{
 
	if (_game_mode == GM_MENU) return;
 

	
 
	/* Create new news item node */
 
	NewsItem *ni = new NewsItem;
 

	
 
	ni->string_id = string;
 
	ni->subtype = subtype;
 
	ni->flags = _news_subtype_data[subtype].flags;
 

	
 
	/* show this news message in color? */
 
	if (_cur_year >= _settings_client.gui.colored_news_year) ni->flags |= NF_INCOLOR;
 
	/* show this news message in colour? */
 
	if (_cur_year >= _settings_client.gui.coloured_news_year) ni->flags |= NF_INCOLOUR;
 

	
 
	ni->data_a = data_a;
 
	ni->data_b = data_b;
 
	ni->free_data = free_data;
 
	ni->date = _date;
 
	CopyOutDParam(ni->params, 0, lengthof(ni->params));
 

	
 
	if (_total_news++ == 0) {
 
		assert(_oldest_news == NULL);
 
		_oldest_news = ni;
 
		ni->prev = NULL;
 
	} else {
src/news_type.h
Show inline comments
 
@@ -59,32 +59,32 @@ enum NewsSubtype {
 

	
 
/**
 
 * 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_INCOLOR is set automatically if needed
 
 * 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_INCOLOR   = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white
 
	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
src/openttd.cpp
Show inline comments
 
@@ -329,25 +329,25 @@ static void ShutdownGame()
 
	/* Close all and any open filehandles */
 
	FioCloseAll();
 
}
 

	
 
static void LoadIntroGame()
 
{
 
	_game_mode = GM_MENU;
 

	
 
	ResetGRFConfig(false);
 

	
 
	/* Setup main window */
 
	ResetWindowSystem();
 
	SetupColorsAndInitialWindow();
 
	SetupColoursAndInitialWindow();
 

	
 
	/* Load the default opening screen savegame */
 
	if (SaveOrLoad("opntitle.dat", SL_LOAD, DATA_DIR) != SL_OK) {
 
		GenerateWorld(GW_EMPTY, 64, 64); // if failed loading, make empty world.
 
		WaitTillGeneratedWorld();
 
		SetLocalCompany(COMPANY_SPECTATOR);
 
	} else {
 
		SetLocalCompany(COMPANY_FIRST);
 
	}
 

	
 
	_pause_game = 0;
 
	_cursor.fix_at = false;
 
@@ -802,25 +802,25 @@ static void StartScenario()
 
	/* invalid type */
 
	if (_file_to_saveload.mode == SL_INVALID) {
 
		DEBUG(sl, 0, "Savegame is obsolete or invalid format: '%s'", _file_to_saveload.name);
 
		SetDParamStr(0, GetSaveLoadErrorString());
 
		ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
 
		_game_mode = GM_MENU;
 
		return;
 
	}
 

	
 
	/* Reinitialize windows */
 
	ResetWindowSystem();
 

	
 
	SetupColorsAndInitialWindow();
 
	SetupColoursAndInitialWindow();
 

	
 
	ResetGRFConfig(true);
 

	
 
	/* Load game */
 
	if (SaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, SCENARIO_DIR) != SL_OK) {
 
		LoadIntroGame();
 
		SetDParamStr(0, GetSaveLoadErrorString());
 
		ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
 
	}
 

	
 
	_settings_game.difficulty = _settings_newgame.difficulty;
 

	
src/rail_cmd.cpp
Show inline comments
 
@@ -1874,25 +1874,25 @@ static void DrawSignals(TileIndex tile, 
 
		}
 
	} else {
 
		MAYBE_DRAW_SIGNAL(3, SIGNAL_TO_SOUTHEAST, 10, TRACK_Y);
 
		MAYBE_DRAW_SIGNAL(2, SIGNAL_TO_NORTHWEST, 11, TRACK_Y);
 
	}
 
}
 

	
 
static void DrawTile_Track(TileInfo *ti)
 
{
 
	const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
 
	SpriteID image;
 

	
 
	_drawtile_track_palette = COMPANY_SPRITE_COLOR(GetTileOwner(ti->tile));
 
	_drawtile_track_palette = COMPANY_SPRITE_COLOUR(GetTileOwner(ti->tile));
 

	
 
	if (IsPlainRailTile(ti->tile)) {
 
		TrackBits rails = GetTrackBits(ti->tile);
 

	
 
		DrawTrackBits(ti, rails);
 

	
 
		if (HasBit(_display_opt, DO_FULL_DETAIL)) DrawTrackDetails(ti);
 

	
 
		if (HasCatenaryDrawn(GetRailType(ti->tile))) DrawCatenary(ti);
 

	
 
		if (HasSignals(ti->tile)) DrawSignals(ti->tile, rails);
 
	} else {
 
@@ -2011,32 +2011,32 @@ default_waypoint:
 
			} else {
 
				/* For stations and original spritelayouts delta_x and delta_y are signed */
 
				AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS));
 
			}
 
		}
 
	}
 
	DrawBridgeMiddle(ti);
 
}
 

	
 

	
 
static void DrawTileSequence(int x, int y, SpriteID ground, const DrawTileSeqStruct *dtss, uint32 offset)
 
{
 
	SpriteID palette = COMPANY_SPRITE_COLOR(_local_company);
 
	SpriteID palette = COMPANY_SPRITE_COLOUR(_local_company);
 

	
 
	DrawSprite(ground, PAL_NONE, x, y);
 
	for (; dtss->image.sprite != 0; dtss++) {
 
		Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
 
		SpriteID image = dtss->image.sprite + offset;
 

	
 
		DrawSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE, x + pt.x, y + pt.y);
 
		DrawSprite(image, HasBit(image, PALETTE_MODIFIER_COLOUR) ? palette : PAL_NONE, x + pt.x, y + pt.y);
 
	}
 
}
 

	
 
void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
 
{
 
	const DrawTileSprites *dts = &_depot_gfx_table[dir];
 
	SpriteID image = dts->ground.sprite;
 
	uint32 offset = GetRailTypeInfo(railtype)->total_offset;
 

	
 
	if (image != SPR_FLAT_GRASS_TILE) image += offset;
 
	DrawTileSequence(x + 33, y + 17, image, dts->seq, offset);
 
}
src/road_cmd.cpp
Show inline comments
 
@@ -1169,77 +1169,77 @@ static void DrawTile_Road(TileInfo *ti)
 
			if (HasTileRoadType(ti->tile, ROADTYPE_TRAM)) {
 
				DrawGroundSprite(SPR_TRAMWAY_OVERLAY + (GetCrossingRoadAxis(ti->tile) ^ 1), pal);
 
				DrawTramCatenary(ti, GetCrossingRoadBits(ti->tile));
 
			}
 
			if (HasCatenaryDrawn(GetRailType(ti->tile))) DrawCatenary(ti);
 
			break;
 
		}
 

	
 
		default:
 
		case ROAD_TILE_DEPOT: {
 
			if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
 

	
 
			SpriteID palette = COMPANY_SPRITE_COLOR(GetTileOwner(ti->tile));
 
			SpriteID palette = COMPANY_SPRITE_COLOUR(GetTileOwner(ti->tile));
 

	
 
			const DrawTileSprites *dts;
 
			if (HasTileRoadType(ti->tile, ROADTYPE_TRAM)) {
 
				dts =  &_tram_depot[GetRoadDepotDirection(ti->tile)];
 
			} else {
 
				dts =  &_road_depot[GetRoadDepotDirection(ti->tile)];
 
			}
 

	
 
			DrawGroundSprite(dts->ground.sprite, PAL_NONE);
 

	
 
			/* End now if buildings are invisible */
 
			if (IsInvisibilitySet(TO_BUILDINGS)) break;
 

	
 
			for (const DrawTileSeqStruct *dtss = dts->seq; dtss->image.sprite != 0; dtss++) {
 
				SpriteID image = dtss->image.sprite;
 
				SpriteID pal;
 

	
 
				if (!IsTransparencySet(TO_BUILDINGS) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
 
				if (!IsTransparencySet(TO_BUILDINGS) && HasBit(image, PALETTE_MODIFIER_COLOUR)) {
 
					pal = palette;
 
				} else {
 
					pal = PAL_NONE;
 
				}
 

	
 
				AddSortableSpriteToDraw(
 
					image, pal,
 
					ti->x + dtss->delta_x, ti->y + dtss->delta_y,
 
					dtss->size_x, dtss->size_y,
 
					dtss->size_z, ti->z,
 
					IsTransparencySet(TO_BUILDINGS)
 
				);
 
			}
 
			break;
 
		}
 
	}
 
	DrawBridgeMiddle(ti);
 
}
 

	
 
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
 
{
 
	SpriteID palette = COMPANY_SPRITE_COLOR(_local_company);
 
	SpriteID palette = COMPANY_SPRITE_COLOUR(_local_company);
 
	const DrawTileSprites *dts = (rt == ROADTYPE_TRAM) ? &_tram_depot[dir] : &_road_depot[dir];
 

	
 
	x += 33;
 
	y += 17;
 

	
 
	DrawSprite(dts->ground.sprite, PAL_NONE, x, y);
 

	
 
	for (const DrawTileSeqStruct *dtss = dts->seq; dtss->image.sprite != 0; dtss++) {
 
		Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
 
		SpriteID image = dtss->image.sprite;
 

	
 
		DrawSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE, x + pt.x, y + pt.y);
 
		DrawSprite(image, HasBit(image, PALETTE_MODIFIER_COLOUR) ? palette : PAL_NONE, x + pt.x, y + pt.y);
 
	}
 
}
 

	
 
/** Updates cached nearest town for all road tiles
 
 * @param invalidate are we just invalidating cached data?
 
 * @pre invalidate == true implies _generating_world == true
 
 */
 
void UpdateNearestTownForRoadTiles(bool invalidate)
 
{
 
	assert(!invalidate || _generating_world);
 

	
 
	for (TileIndex t = 0; t < MapSize(); t++) {
src/roadveh_cmd.cpp
Show inline comments
 
@@ -139,25 +139,25 @@ void RoadVehUpdateCache(Vehicle *v)
 

	
 
	for (Vehicle *u = v; u != NULL; u = u->Next()) {
 
		/* Check the v->first cache. */
 
		assert(u->First() == v);
 

	
 
		/* Update the 'first engine' */
 
		u->u.road.first_engine = (v == u) ? INVALID_ENGINE : v->engine_type;
 

	
 
		/* Update the length of the vehicle. */
 
		u->u.road.cached_veh_length = GetRoadVehLength(u);
 

	
 
		/* Invalidate the vehicle colour map */
 
		u->colormap = PAL_NONE;
 
		u->colourmap = PAL_NONE;
 
	}
 
}
 

	
 
/** Build a road vehicle.
 
 * @param tile tile of depot where road vehicle is built
 
 * @param flags operation to perform
 
 * @param p1 bus/truck type being built (engine)
 
 * @param p2 unused
 
 */
 
CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	Vehicle *v;
src/saveload/afterload.cpp
Show inline comments
 
@@ -194,25 +194,25 @@ static inline RailType UpdateRailType(Ra
 
 * functions require that all saveload conversions have been
 
 * done. As people tend to add savegame conversion stuff after
 
 * the intialization of the windows and caches quite some bugs
 
 * had been made.
 
 * Moving this out of there is both cleaner and less bug-prone.
 
 *
 
 * @return true if everything went according to plan, otherwise false.
 
 */
 
static bool InitializeWindowsAndCaches()
 
{
 
	/* Initialize windows */
 
	ResetWindowSystem();
 
	SetupColorsAndInitialWindow();
 
	SetupColoursAndInitialWindow();
 

	
 
	ResetViewportAfterLoadGame();
 

	
 
	/* Update coordinates of the signs. */
 
	UpdateAllStationVirtCoord();
 
	UpdateAllSignVirtCoords();
 
	UpdateAllTownVirtCoords();
 
	UpdateAllWaypointSigns();
 

	
 
	Company *c;
 
	FOR_ALL_COMPANIES(c) {
 
		/* For each company, verify (while loading a scenario) that the inauguration date is the current year and set it
 
@@ -1745,17 +1745,17 @@ void ReloadNewGRFData()
 
	ResetEconomy();
 
	/* reload vehicles */
 
	ResetVehiclePosHash();
 
	AfterLoadVehicles(false);
 
	StartupEngines();
 
	SetCachedEngineCounts();
 
	/* update station and waypoint graphics */
 
	AfterLoadWaypoints();
 
	AfterLoadStations();
 
	/* Check and update house and town values */
 
	UpdateHousesAndTowns();
 
	/* Update livery selection windows */
 
	for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) InvalidateWindowData(WC_COMPANY_COLOR, i, _loaded_newgrf_features.has_2CC);
 
	for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) InvalidateWindowData(WC_COMPANY_COLOUR, i, _loaded_newgrf_features.has_2CC);
 
	/* redraw the whole screen */
 
	MarkWholeScreenDirty();
 
	CheckTrainsLengths();
 
}
src/saveload/company_sl.cpp
Show inline comments
 
@@ -9,25 +9,25 @@
 

	
 
#include "saveload.h"
 

	
 
/**
 
 * Converts an old company manager's face format to the new company manager's face format
 
 *
 
 * Meaning of the bits in the old face (some bits are used in several times):
 
 * - 4 and 5: chin
 
 * - 6 to 9: eyebrows
 
 * - 10 to 13: nose
 
 * - 13 to 15: lips (also moustache for males)
 
 * - 16 to 19: hair
 
 * - 20 to 22: eye color
 
 * - 20 to 22: eye colour
 
 * - 20 to 27: tie, ear rings etc.
 
 * - 28 to 30: glasses
 
 * - 19, 26 and 27: race (bit 27 set and bit 19 equal to bit 26 = black, otherwise white)
 
 * - 31: gender (0 = male, 1 = female)
 
 *
 
 * @param face the face in the old format
 
 * @return the face in the new format
 
 */
 
CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32 face)
 
{
 
	CompanyManagerFace cmf = 0;
 
	GenderEthnicity ge = GE_WM;
src/saveload/industry_sl.cpp
Show inline comments
 
@@ -26,25 +26,25 @@ static const SaveLoad _industry_desc[] =
 
	SLE_CONDARR(Industry, accepts_cargo,              SLE_UINT8,  3,              78, SL_MAX_VERSION),
 
	    SLE_VAR(Industry, prod_level,                 SLE_UINT8),
 
	    SLE_ARR(Industry, this_month_production,      SLE_UINT16, 2),
 
	    SLE_ARR(Industry, this_month_transported,     SLE_UINT16, 2),
 
	    SLE_ARR(Industry, last_month_pct_transported, SLE_UINT8,  2),
 
	    SLE_ARR(Industry, last_month_production,      SLE_UINT16, 2),
 
	    SLE_ARR(Industry, last_month_transported,     SLE_UINT16, 2),
 

	
 
	    SLE_VAR(Industry, counter,                    SLE_UINT16),
 

	
 
	    SLE_VAR(Industry, type,                       SLE_UINT8),
 
	    SLE_VAR(Industry, owner,                      SLE_UINT8),
 
	    SLE_VAR(Industry, random_color,               SLE_UINT8),
 
	    SLE_VAR(Industry, random_colour,              SLE_UINT8),
 
	SLE_CONDVAR(Industry, last_prod_year,             SLE_FILE_U8 | SLE_VAR_I32,  0, 30),
 
	SLE_CONDVAR(Industry, last_prod_year,             SLE_INT32,                 31, SL_MAX_VERSION),
 
	    SLE_VAR(Industry, was_cargo_delivered,        SLE_UINT8),
 

	
 
	SLE_CONDVAR(Industry, founder,                    SLE_UINT8,                 70, SL_MAX_VERSION),
 
	SLE_CONDVAR(Industry, construction_date,          SLE_INT32,                 70, SL_MAX_VERSION),
 
	SLE_CONDVAR(Industry, construction_type,          SLE_UINT8,                 70, SL_MAX_VERSION),
 
	SLE_CONDVAR(Industry, last_cargo_accepted_at,     SLE_INT32,                 70, SL_MAX_VERSION),
 
	SLE_CONDVAR(Industry, selected_layout,            SLE_UINT8,                 73, SL_MAX_VERSION),
 

	
 
	SLE_CONDARRX(cpp_offsetof(Industry, psa) + cpp_offsetof(Industry::PersistentStorage, storage), SLE_UINT32, 16, 76, SL_MAX_VERSION),
 

	
src/saveload/oldloader_sl.cpp
Show inline comments
 
@@ -844,25 +844,25 @@ static const OldChunks industry_chunk[] 
 

	
 
	OCL_SVAR(  OC_UINT8, Industry, last_month_pct_transported[0] ),
 
	OCL_SVAR(  OC_UINT8, Industry, last_month_pct_transported[1] ),
 

	
 
	OCL_SVAR( OC_UINT16, Industry, last_month_production[0] ),
 
	OCL_SVAR( OC_UINT16, Industry, last_month_production[1] ),
 
	OCL_SVAR( OC_UINT16, Industry, last_month_transported[0] ),
 
	OCL_SVAR( OC_UINT16, Industry, last_month_transported[1] ),
 

	
 
	OCL_SVAR(  OC_UINT8, Industry, type ),
 
	OCL_SVAR( OC_TTO | OC_FILE_U8 | OC_VAR_U16, Industry, counter ),
 
	OCL_SVAR(  OC_UINT8, Industry, owner ),
 
	OCL_SVAR(  OC_UINT8, Industry, random_color ),
 
	OCL_SVAR(  OC_UINT8, Industry, random_colour ),
 
	OCL_SVAR( OC_TTD | OC_FILE_U8 | OC_VAR_I32, Industry, last_prod_year ),
 
	OCL_SVAR( OC_TTD | OC_UINT16, Industry, counter ),
 
	OCL_SVAR( OC_TTD | OC_UINT8, Industry, was_cargo_delivered ),
 

	
 
	OCL_CNULL( OC_TTD, 9 ), ///< Random junk at the end of this chunk
 

	
 
	OCL_END()
 
};
 

	
 
static bool LoadOldIndustry(LoadgameState *ls, int num)
 
{
 
	Industry *i = new (num) Industry();
 
@@ -870,25 +870,25 @@ static bool LoadOldIndustry(LoadgameStat
 

	
 
	if (i->xy != 0) {
 
		i->town = GetTown(RemapTownIndex(_old_town_index));
 

	
 
		if (_savegame_type == SGT_TTO) {
 
			if (i->type > 0x06) i->type++; // Printing Works were added
 
			if (i->type == 0x0A) i->type = 0x12; // Iron Ore Mine has different ID
 

	
 
			YearMonthDay ymd;
 
			ConvertDateToYMD(_date, &ymd);
 
			i->last_prod_year = ymd.year;
 

	
 
			i->random_color = RemapTTOColour(i->random_color);
 
			i->random_colour = RemapTTOColour(i->random_colour);
 
		}
 

	
 
		IncIndustryTypeCount(i->type);
 
	} else {
 
		i->xy = INVALID_TILE;
 
	}
 

	
 
	return true;
 
}
 

	
 
static CompanyID _current_company_id;
 
static int32 _old_yearly;
 
@@ -995,25 +995,25 @@ static bool LoadOldCompany(LoadgameState
 
	_current_company_id = (CompanyID)num;
 

	
 
	if (!LoadChunk(ls, c, _company_chunk)) return false;
 

	
 
	if (_old_string_id == 0) {
 
		delete c;
 
		return true;
 
	}
 

	
 
	if (_savegame_type == SGT_TTO) {
 
		/* adjust manager's face */
 
		if (HasBit(c->face, 27) && GB(c->face, 26, 1) == GB(c->face, 19, 1)) {
 
			/* if face would be black in TTD, adjust tie color and thereby face color */
 
			/* if face would be black in TTD, adjust tie colour and thereby face colour */
 
			ClrBit(c->face, 27);
 
		}
 

	
 
		/* Company name */
 
		if (_old_string_id == 0 || _old_string_id == 0x4C00) {
 
			_old_string_id = STR_SV_UNNAMED; // "Unnamed"
 
		} else if (GB(_old_string_id, 8, 8) == 0x52) {
 
			_old_string_id += 0x2A00; // Custom name
 
		} else {
 
			_old_string_id = RemapOldStringID(_old_string_id += 0x240D); // Automatic name
 
		}
 
		c->name_1 = _old_string_id;
 
@@ -1706,25 +1706,25 @@ static const OldChunks main_chunk[] = {
 
	OCL_CCHUNK( OC_TTD, 256, LoadOldEngineName ),
 

	
 
	OCL_CNULL( OC_TTD, 144 ),             ///< AI cargo-stuff, calculated in InitializeLandscapeVariables
 
	OCL_NULL( 2 ),               ///< Company indexes of companies, no longer in use
 

	
 
	OCL_VAR ( OC_FILE_U8 | OC_VAR_U16,    1, &_station_tick_ctr ),
 

	
 
	OCL_VAR (  OC_UINT8,    1, &_settings_game.locale.currency ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings_game.locale.units ),
 
	OCL_VAR ( OC_FILE_U8 | OC_VAR_U32,    1, &_cur_company_tick_index ),
 

	
 
	OCL_NULL( 2 ),               ///< Date stuff, calculated automatically
 
	OCL_NULL( 8 ),               ///< Company colors, calculated automatically
 
	OCL_NULL( 8 ),               ///< Company colours, calculated automatically
 

	
 
	OCL_VAR (  OC_UINT8,    1, &_economy.infl_amount ),
 
	OCL_VAR (  OC_UINT8,    1, &_economy.infl_amount_pr ),
 
	OCL_VAR (  OC_UINT8,    1, &_economy.interest_rate ),
 
	OCL_NULL( 1 ), // available airports
 
	OCL_VAR (  OC_UINT8,    1, &_settings_game.vehicle.road_side ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings_game.game_creation.town_name ),
 

	
 
	OCL_CHUNK( 1, LoadOldGameDifficulty ),
 

	
 
	OCL_ASSERT( OC_TTD, 0x77130 ),
 

	
src/saveload/saveload.cpp
Show inline comments
 
@@ -1613,25 +1613,25 @@ static SaveOrLoadResult SaveFileToDisk(b
 
		if (_ts.count != _sl.offs_base) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Unexpected size of chunk");
 
		GetSavegameFormat("memory")->uninit_write(); // clean the memorypool
 
		fclose(_sl.fh);
 

	
 
		if (threaded) SetAsyncSaveFinish(SaveFileDone);
 

	
 
		return SL_OK;
 
	}
 
	catch (...) {
 
		AbortSaveLoad();
 
		if (_sl.excpt_uninit != NULL) _sl.excpt_uninit();
 

	
 
		/* Skip the "color" character */
 
		/* Skip the "colour" character */
 
		DEBUG(sl, 0, GetSaveLoadErrorString() + 3);
 

	
 
		if (threaded) {
 
			SetAsyncSaveFinish(SaveFileError);
 
		} else {
 
			SaveFileError();
 
		}
 
		return SL_ERROR;
 
	}
 
}
 

	
 
static void SaveFileToDiskThread(void *arg)
 
@@ -1813,25 +1813,25 @@ SaveOrLoadResult SaveOrLoad(const char *
 

	
 
			GamelogStopAction();
 
		}
 

	
 
		return SL_OK;
 
	}
 
	catch (...) {
 
		AbortSaveLoad();
 

	
 
		/* deinitialize compressor. */
 
		if (_sl.excpt_uninit != NULL) _sl.excpt_uninit();
 

	
 
		/* Skip the "color" character */
 
		/* Skip the "colour" character */
 
		DEBUG(sl, 0, GetSaveLoadErrorString() + 3);
 

	
 
		/* A saver/loader exception!! reinitialize all variables to prevent crash! */
 
		return (mode == SL_LOAD) ? SL_REINIT : SL_ERROR;
 
	}
 
}
 

	
 
/** Do a save when exiting the game (_settings_client.gui.autosave_on_exit) */
 
void DoExitSave()
 
{
 
	SaveOrLoad("exit.sav", SL_SAVE, AUTOSAVE_DIR);
 
}
src/screenshot.cpp
Show inline comments
 
@@ -225,25 +225,25 @@ static bool MakePNGImage(const char *nam
 
			rq[i].blue  = palette[i].b;
 
		}
 

	
 
		png_set_PLTE(png_ptr, info_ptr, rq, 256);
 
	}
 

	
 
	png_write_info(png_ptr, info_ptr);
 
	png_set_flush(png_ptr, 512);
 

	
 
	if (pixelformat == 32) {
 
		png_color_8 sig_bit;
 

	
 
		/* Save exact color/alpha resolution */
 
		/* Save exact colour/alpha resolution */
 
		sig_bit.alpha = 0;
 
		sig_bit.blue  = 8;
 
		sig_bit.green = 8;
 
		sig_bit.red   = 8;
 
		sig_bit.gray  = 8;
 
		png_set_sBIT(png_ptr, info_ptr, &sig_bit);
 

	
 
#if TTD_ENDIAN == TTD_LITTLE_ENDIAN
 
		png_set_bgr(png_ptr);
 
		png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
 
#else
 
		png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
 
@@ -408,25 +408,25 @@ static bool MakePCXImage(const char *nam
 
					return false;
 
				}
 
			if (fputc(runchar, f) == EOF) {
 
				free(buff);
 
				fclose(f);
 
				return false;
 
			}
 
		}
 
	} while (y != h);
 

	
 
	free(buff);
 

	
 
	/* write 8-bit color palette */
 
	/* write 8-bit colour palette */
 
	if (fputc(12, f) == EOF) {
 
		fclose(f);
 
		return false;
 
	}
 

	
 
	/* Palette is word-aligned, copy it to a temporary byte array */
 
	byte tmp[256 * 3];
 

	
 
	for (uint i = 0; i < 256; i++) {
 
		tmp[i * 3 + 0] = palette[i].r;
 
		tmp[i * 3 + 1] = palette[i].g;
 
		tmp[i * 3 + 2] = palette[i].b;
src/settings.cpp
Show inline comments
 
@@ -1361,25 +1361,25 @@ const SettingDesc _settings[] = {
 
	SDT_CONDBOOL(GameSettings, station.adjacent_stations,                       62, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_SETTING_ADJACENT_STATIONS,      NULL),
 
	SDT_CONDBOOL(GameSettings, economy.station_noise_level,                     96, SL_MAX_VERSION, 0, 0, false,                    STR_CONFIG_SETTING_NOISE_LEVEL,            InvalidateTownViewWindow),
 
	SDT_CONDBOOL(GameSettings, station.distant_join_stations,                  106, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS,  DeleteSelectStationWindow),
 

	
 
	    SDT_BOOL(GameSettings, economy.inflation,                                                   0, 0,  true,                    STR_CONFIG_SETTING_INFLATION,              NULL),
 
	     SDT_VAR(GameSettings, construction.raw_industry_construction, SLE_UINT8,                   0,MS,     0,     0,       2, 0, STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD, InvalidateBuildIndustryWindow),
 
	    SDT_BOOL(GameSettings, economy.multiple_industry_per_town,                                  0, 0, false,                    STR_CONFIG_SETTING_MULTIPINDTOWN,          NULL),
 
	    SDT_BOOL(GameSettings, economy.same_industry_close,                                         0, 0, false,                    STR_CONFIG_SETTING_SAMEINDCLOSE,           NULL),
 
	    SDT_BOOL(GameSettings, economy.bribe,                                                       0, 0,  true,                    STR_CONFIG_SETTING_BRIBE,                  NULL),
 
	SDT_CONDBOOL(GameSettings, economy.exclusive_rights,                        79, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_SETTING_ALLOW_EXCLUSIVE,        NULL),
 
	SDT_CONDBOOL(GameSettings, economy.give_money,                              79, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_SETTING_ALLOW_GIVE_MONEY,       NULL),
 
	     SDT_VAR(GameSettings, game_creation.snow_line_height,       SLE_UINT8,                     0, 0,     7,     2,      13, 0, STR_CONFIG_SETTING_SNOWLINE_HEIGHT,        NULL),
 
	    SDTC_VAR(              gui.colored_news_year,                SLE_INT32,                     0,NC,  2000,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_SETTING_COLORED_NEWS_YEAR,      NULL),
 
	    SDTC_VAR(              gui.coloured_news_year,               SLE_INT32,                     0,NC,  2000,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_SETTING_COLORED_NEWS_YEAR,      NULL),
 
	     SDT_VAR(GameSettings, game_creation.starting_year,          SLE_INT32,                     0,NC,  1950,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_SETTING_STARTING_YEAR,          NULL),
 
	SDT_CONDNULL(                                                            4,  0, 104),
 
	    SDT_BOOL(GameSettings, economy.smooth_economy,                                              0, 0,  true,                    STR_CONFIG_SETTING_SMOOTH_ECONOMY,         NULL),
 
	    SDT_BOOL(GameSettings, economy.allow_shares,                                                0, 0, false,                    STR_CONFIG_SETTING_ALLOW_SHARES,           NULL),
 
	 SDT_CONDVAR(GameSettings, economy.town_growth_rate,             SLE_UINT8, 54, SL_MAX_VERSION, 0, MS,    2,     0,       4, 0, STR_CONFIG_SETTING_TOWN_GROWTH,            NULL),
 
	 SDT_CONDVAR(GameSettings, economy.larger_towns,                 SLE_UINT8, 54, SL_MAX_VERSION, 0, D0,    4,     0,     255, 1, STR_CONFIG_SETTING_LARGER_TOWNS,           NULL),
 
	 SDT_CONDVAR(GameSettings, economy.initial_city_size,            SLE_UINT8, 56, SL_MAX_VERSION, 0, 0,     2,     1,      10, 1, STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER,   NULL),
 
	SDT_CONDBOOL(GameSettings, economy.mod_road_rebuild,                        77, SL_MAX_VERSION, 0, 0, false,                    STR_CONFIG_SETTING_MODIFIED_ROAD_REBUILD,  NULL),
 

	
 
	SDT_CONDNULL(1, 0, 106), // previously ai-new setting.
 
	    SDT_BOOL(GameSettings, ai.ai_in_multiplayer,                                                0, 0, true,                     STR_CONFIG_SETTING_AI_IN_MULTIPLAYER,      NULL),
 
	    SDT_BOOL(GameSettings, ai.ai_disable_veh_train,                                             0, 0, false,                    STR_CONFIG_SETTING_AI_BUILDS_TRAINS,       NULL),
src/settings_gui.cpp
Show inline comments
 
@@ -877,25 +877,25 @@ void SettingEntry::DrawSetting(GameSetti
 
{
 
	const SettingDescBase *sdb = &sd->desc;
 
	const void *var = GetVariableAddress(settings_ptr, &sd->save);
 
	bool editable = true;
 
	bool disabled = false;
 

	
 
	/* We do not allow changes of some items when we are a client in a networkgame */
 
	if (!(sd->save.conv & SLF_NETWORK_NO) && _networking && !_network_server) editable = false;
 
	if ((sdb->flags & SGF_NETWORK_ONLY) && !_networking) editable = false;
 
	if ((sdb->flags & SGF_NO_NETWORK) && _networking) editable = false;
 

	
 
	if (sdb->cmd == SDT_BOOLX) {
 
		static const int _bool_ctabs[2][2] = {{9, 4}, {7, 6}};
 
		static const Colours _bool_ctabs[2][2] = {{COLOUR_CREAM, COLOUR_RED}, {COLOUR_DARK_GREEN, COLOUR_GREEN}};
 
		/* Draw checkbox for boolean-value either on/off */
 
		bool on = (*(bool*)var);
 

	
 
		DrawFrameRect(x, y, x + 19, y + 8, _bool_ctabs[!!on][!!editable], on ? FR_LOWERED : FR_NONE);
 
		SetDParam(0, on ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
 
	} else {
 
		int32 value;
 

	
 
		value = (int32)ReadValue(var, sd->save.conv);
 

	
 
		/* Draw [<][>] boxes for settings of an integer-type */
 
		DrawArrowButtons(x, y, COLOUR_YELLOW, state, editable && value != (sdb->flags & SGF_0ISDISABLED ? 0 : sdb->min), editable && value != sdb->max);
 
@@ -1038,25 +1038,25 @@ static SettingEntry _settings_ui[] = {
 
	SettingEntry(&_settings_ui_display_page, STR_CONFIG_SETTING_DISPLAY_OPTIONS),
 
	SettingEntry(&_settings_ui_interaction_page, STR_CONFIG_SETTING_INTERACTION),
 
	SettingEntry("gui.show_finances"),
 
	SettingEntry("gui.errmsg_duration"),
 
	SettingEntry("gui.toolbar_pos"),
 
	SettingEntry("gui.pause_on_newgame"),
 
	SettingEntry("gui.advanced_vehicle_list"),
 
	SettingEntry("gui.timetable_in_ticks"),
 
	SettingEntry("gui.quick_goto"),
 
	SettingEntry("gui.default_rail_type"),
 
	SettingEntry("gui.always_build_infrastructure"),
 
	SettingEntry("gui.persistent_buildingtools"),
 
	SettingEntry("gui.colored_news_year"),
 
	SettingEntry("gui.coloured_news_year"),
 
};
 
/** Interface subpage */
 
static SettingsPage _settings_ui_page = {_settings_ui, lengthof(_settings_ui)};
 

	
 
static SettingEntry _settings_construction_signals[] = {
 
	SettingEntry("construction.signal_side"),
 
	SettingEntry("gui.enable_signal_gui"),
 
	SettingEntry("gui.drag_signals_density"),
 
	SettingEntry("gui.semaphore_build_before"),
 
	SettingEntry("gui.default_signal_type"),
 
	SettingEntry("gui.cycle_signal_types"),
 
};
src/settings_type.h
Show inline comments
 
@@ -61,25 +61,25 @@ struct GUISettings {
 
	byte   autosave;                         ///< how often should we do autosaves?
 
	bool   keep_all_autosave;                ///< name the autosave in a different way
 
	bool   autosave_on_exit;                 ///< save an autosave when you quit the game, but do not ask "Do you really want to quit?"
 
	uint8  date_format_in_default_names;     ///< should the default savegame/screenshot name use long dates (31th Dec 2008), short dates (31-12-2008) or ISO dates (2008-12-31)
 
	byte   max_num_autosaves;                ///< controls how many autosavegames are made before the game starts to overwrite (names them 0 to max_num_autosaves - 1)
 
	bool   population_in_label;              ///< show the population of a town in his label?
 
	uint8  right_mouse_btn_emulation;        ///< should we emulate right mouse clicking?
 
	uint8  scrollwheel_scrolling;            ///< scrolling using the scroll wheel?
 
	uint8  scrollwheel_multiplier;           ///< how much 'wheel' per incoming event from the OS?
 
	bool   left_mouse_btn_scrolling;         ///< left mouse button scroll
 
	bool   pause_on_newgame;                 ///< whether to start new games paused or not
 
	bool   enable_signal_gui;                ///< show the signal GUI when the signal button is pressed
 
	Year   colored_news_year;                ///< when does newspaper become colored?
 
	Year   coloured_news_year;               ///< when does newspaper become coloured?
 
	bool   timetable_in_ticks;               ///< whether to show the timetable in ticks rather than days
 
	bool   quick_goto;                       ///< Allow quick access to 'goto button' in vehicle orders window
 
	bool   bridge_pillars;                   ///< show bridge pillars for high bridges
 
	bool   auto_euro;                        ///< automatically switch to euro in 2002
 
	byte   drag_signals_density;             ///< many signals density
 
	Year   semaphore_build_before;           ///< build semaphore signals automatically before this year
 
	bool   autorenew;                        ///< should autorenew be enabled for new companies?
 
	int16  autorenew_months;                 ///< how many months from EOL of vehicles should autorenew trigger for new companies?
 
	int32  autorenew_money;                  ///< how much money before autorenewing for new companies?
 
	byte   news_message_timeout;             ///< how much longer than the news message "age" should we keep the message in the history
 
	bool   show_track_reservation;           ///< highlight reserved tracks.
 
	uint8  default_signal_type;              ///< the signal type to build by default.
src/ship_cmd.cpp
Show inline comments
 
@@ -933,21 +933,21 @@ CommandCost CmdRefitShip(TileIndex tile,
 
	}
 
	_returned_refit_capacity = capacity;
 

	
 
	if (new_cid != v->cargo_type) {
 
		cost = GetRefitCost(v->engine_type);
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		v->cargo_cap = capacity;
 
		v->cargo.Truncate((v->cargo_type == new_cid) ? capacity : 0);
 
		v->cargo_type = new_cid;
 
		v->cargo_subtype = new_subtype;
 
		v->colormap = PAL_NONE; // invalidate vehicle colour map
 
		v->colourmap = PAL_NONE; // invalidate vehicle colour map
 
		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 
		InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
 
	}
 

	
 
	return cost;
 

	
 
}
src/smallmap_gui.cpp
Show inline comments
 
@@ -41,38 +41,38 @@ static const Widget _smallmap_widgets[] 
 
{    WWT_IMGBTN,   RESIZE_LRTB,  COLOUR_BROWN,   262,   283,   158,   179, SPR_IMG_SMALLMAP,        STR_SMALLMAP_CENTER},
 
{    WWT_IMGBTN,   RESIZE_LRTB,  COLOUR_BROWN,   262,   283,   180,   201, SPR_IMG_TOWN,            STR_0197_TOGGLE_TOWN_NAMES_ON_OFF},
 
{     WWT_PANEL,    RESIZE_RTB,  COLOUR_BROWN,     0,   337,   202,   213, 0x0,                     STR_NULL},
 
{   WWT_TEXTBTN,     RESIZE_TB,  COLOUR_BROWN,     0,    99,   202,   213, STR_MESSAGES_ENABLE_ALL, STR_NULL},
 
{   WWT_TEXTBTN,     RESIZE_TB,  COLOUR_BROWN,   100,   201,   202,   213, STR_MESSAGES_DISABLE_ALL,STR_NULL},
 
{ WWT_RESIZEBOX,   RESIZE_LRTB,  COLOUR_BROWN,   338,   349,   202,   213, 0x0,                     STR_RESIZE_BUTTON},
 
{  WIDGETS_END},
 
};
 

	
 
/* number of used industries */
 
static int _smallmap_industry_count;
 

	
 
/** Macro for ordinary entry of LegendAndColor */
 
/** Macro for ordinary entry of LegendAndColour */
 
#define MK(a, b) {a, b, INVALID_INDUSTRYTYPE, true, false, false}
 
/** Macro for end of list marker in arrays of LegendAndColor */
 
/** Macro for end of list marker in arrays of LegendAndColour */
 
#define MKEND() {0, STR_NULL, INVALID_INDUSTRYTYPE, true, true, false}
 
/** Macro for break marker in arrays of LegendAndColor.
 
/** Macro for break marker in arrays of LegendAndColour.
 
 * It will have valid data, though */
 
#define MS(a, b) {a, b, INVALID_INDUSTRYTYPE, true, false, true}
 

	
 
/** Structure for holding relevant data for legends in small map */
 
struct LegendAndColour {
 
	uint16 colour;     ///< color of the item on the map
 
	StringID legend;   ///< string corresponding to the colored item
 
	uint16 colour;     ///< colour of the item on the map
 
	StringID legend;   ///< string corresponding to the coloured item
 
	IndustryType type; ///< type of industry
 
	bool show_on_map;  ///< for filtering industries, if true is shown on map in color
 
	bool show_on_map;  ///< for filtering industries, if true is shown on map in colour
 
	bool end;          ///< this is the end of the list
 
	bool col_break;    ///< perform a break and go one collumn further
 
};
 

	
 
/** Legend text giving the colours to look for on the minimap */
 
static const LegendAndColour _legend_land_contours[] = {
 
	MK(0x5A, STR_00F0_100M),
 
	MK(0x5C, STR_00F1_200M),
 
	MK(0x5E, STR_00F2_300M),
 
	MK(0x1F, STR_00F3_400M),
 
	MK(0x27, STR_00F4_500M),
 

	
 
@@ -171,103 +171,103 @@ void BuildIndustriesLegend()
 
	_smallmap_industry_count = j;
 
}
 

	
 
static const LegendAndColour * const _legend_table[] = {
 
	_legend_land_contours,
 
	_legend_vehicles,
 
	_legend_from_industries,
 
	_legend_routes,
 
	_legend_vegetation,
 
	_legend_land_owners,
 
};
 

	
 
#define MKCOLOR(x) TO_LE32X(x)
 
#define MKCOLOUR(x) TO_LE32X(x)
 

	
 
/**
 
 * Height encodings; MAX_TILE_HEIGHT + 1 levels, from 0 to MAX_TILE_HEIGHT
 
 */
 
static const uint32 _map_height_bits[] = {
 
	MKCOLOR(0x5A5A5A5A),
 
	MKCOLOR(0x5A5B5A5B),
 
	MKCOLOR(0x5B5B5B5B),
 
	MKCOLOR(0x5B5C5B5C),
 
	MKCOLOR(0x5C5C5C5C),
 
	MKCOLOR(0x5C5D5C5D),
 
	MKCOLOR(0x5D5D5D5D),
 
	MKCOLOR(0x5D5E5D5E),
 
	MKCOLOR(0x5E5E5E5E),
 
	MKCOLOR(0x5E5F5E5F),
 
	MKCOLOR(0x5F5F5F5F),
 
	MKCOLOR(0x5F1F5F1F),
 
	MKCOLOR(0x1F1F1F1F),
 
	MKCOLOR(0x1F271F27),
 
	MKCOLOR(0x27272727),
 
	MKCOLOR(0x27272727),
 
	MKCOLOUR(0x5A5A5A5A),
 
	MKCOLOUR(0x5A5B5A5B),
 
	MKCOLOUR(0x5B5B5B5B),
 
	MKCOLOUR(0x5B5C5B5C),
 
	MKCOLOUR(0x5C5C5C5C),
 
	MKCOLOUR(0x5C5D5C5D),
 
	MKCOLOUR(0x5D5D5D5D),
 
	MKCOLOUR(0x5D5E5D5E),
 
	MKCOLOUR(0x5E5E5E5E),
 
	MKCOLOUR(0x5E5F5E5F),
 
	MKCOLOUR(0x5F5F5F5F),
 
	MKCOLOUR(0x5F1F5F1F),
 
	MKCOLOUR(0x1F1F1F1F),
 
	MKCOLOUR(0x1F271F27),
 
	MKCOLOUR(0x27272727),
 
	MKCOLOUR(0x27272727),
 
};
 
assert_compile(lengthof(_map_height_bits) == MAX_TILE_HEIGHT + 1);
 

	
 
struct AndOr {
 
	uint32 mor;
 
	uint32 mand;
 
};
 

	
 
static inline uint32 ApplyMask(uint32 colour, const AndOr *mask)
 
{
 
	return (colour & mask->mand) | mask->mor;
 
}
 

	
 

	
 
static const AndOr _smallmap_contours_andor[] = {
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0x000A0A00), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0x98989898), MKCOLOR(0x00000000)},
 
	{MKCOLOR(0xCACACACA), MKCOLOR(0x00000000)},
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0xB5B5B5B5), MKCOLOR(0x00000000)},
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x000A0A00), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0x000A0A00), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00D7D700), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00B5B500), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0x98989898), MKCOLOUR(0x00000000)},
 
	{MKCOLOUR(0xCACACACA), MKCOLOUR(0x00000000)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0xB5B5B5B5), MKCOLOUR(0x00000000)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0x00B5B500), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x000A0A00), MKCOLOUR(0xFF0000FF)},
 
};
 

	
 
static const AndOr _smallmap_vehicles_andor[] = {
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0xCACACACA), MKCOLOR(0x00000000)},
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0xB5B5B5B5), MKCOLOR(0x00000000)},
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0x00D7D700), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00D7D700), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00B5B500), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0x00D7D700), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0xCACACACA), MKCOLOUR(0x00000000)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0xB5B5B5B5), MKCOLOUR(0x00000000)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0x00B5B500), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00D7D700), MKCOLOUR(0xFF0000FF)},
 
};
 

	
 
static const AndOr _smallmap_vegetation_andor[] = {
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00575700), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0xCACACACA), MKCOLOR(0x00000000)},
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0xB5B5B5B5), MKCOLOR(0x00000000)},
 
	{MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)},
 
	{MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0x00D7D700), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00D7D700), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00B5B500), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00575700), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00D7D700), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0xCACACACA), MKCOLOUR(0x00000000)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0xB5B5B5B5), MKCOLOUR(0x00000000)},
 
	{MKCOLOUR(0x00000000), MKCOLOUR(0xFFFFFFFF)},
 
	{MKCOLOUR(0x00B5B500), MKCOLOUR(0xFF0000FF)},
 
	{MKCOLOUR(0x00D7D700), MKCOLOUR(0xFF0000FF)},
 
};
 

	
 
typedef uint32 GetSmallMapPixels(TileIndex tile); // typedef callthrough function
 

	
 
/**
 
 * Draws one column of the small map in a certain mode onto the screen buffer. This
 
 * function looks exactly the same for all types
 
 *
 
 * @param dst Pointer to a part of the screen buffer to write to.
 
 * @param xc The X coordinate of the first tile in the column.
 
 * @param yc The Y coordinate of the first tile in the column
 
 * @param pitch Number of pixels to advance in the screen buffer each time a pixel is written.
 
@@ -319,196 +319,196 @@ static inline TileType GetEffectiveTileT
 
		TransportType tt = GetTunnelBridgeTransportType(tile);
 

	
 
		switch (tt) {
 
			case TRANSPORT_RAIL: t = MP_RAILWAY; break;
 
			case TRANSPORT_ROAD: t = MP_ROAD;    break;
 
			default:             t = MP_WATER;   break;
 
		}
 
	}
 
	return t;
 
}
 

	
 
/**
 
 * Return the color a tile would be displayed with in the small map in mode "Contour".
 
 * @param tile The tile of which we would like to get the color.
 
 * @return The color of tile in the small map in mode "Contour"
 
 * Return the colour a tile would be displayed with in the small map in mode "Contour".
 
 * @param tile The tile of which we would like to get the colour.
 
 * @return The colour of tile in the small map in mode "Contour"
 
 */
 
static inline uint32 GetSmallMapContoursPixels(TileIndex tile)
 
{
 
	TileType t = GetEffectiveTileType(tile);
 

	
 
	return
 
		ApplyMask(_map_height_bits[TileHeight(tile)], &_smallmap_contours_andor[t]);
 
}
 

	
 
/**
 
 * Return the color a tile would be displayed with in the small map in mode "Vehicles".
 
 * Return the colour a tile would be displayed with in the small map in mode "Vehicles".
 
 *
 
 * @param tile The tile of which we would like to get the color.
 
 * @return The color of tile in the small map in mode "Vehicles"
 
 * @param tile The tile of which we would like to get the colour.
 
 * @return The colour of tile in the small map in mode "Vehicles"
 
 */
 
static inline uint32 GetSmallMapVehiclesPixels(TileIndex tile)
 
{
 
	TileType t = GetEffectiveTileType(tile);
 

	
 
	return ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[t]);
 
	return ApplyMask(MKCOLOUR(0x54545454), &_smallmap_vehicles_andor[t]);
 
}
 

	
 
/**
 
 * Return the color a tile would be displayed with in the small map in mode "Industries".
 
 * Return the colour a tile would be displayed with in the small map in mode "Industries".
 
 *
 
 * @param tile The tile of which we would like to get the color.
 
 * @return The color of tile in the small map in mode "Industries"
 
 * @param tile The tile of which we would like to get the colour.
 
 * @return The colour of tile in the small map in mode "Industries"
 
 */
 
static inline uint32 GetSmallMapIndustriesPixels(TileIndex tile)
 
{
 
	TileType t = GetEffectiveTileType(tile);
 

	
 
	if (t == MP_INDUSTRY) {
 
		/* If industry is allowed to be seen, use its color on the map */
 
		/* If industry is allowed to be seen, use its colour on the map */
 
		if (_legend_from_industries[_industry_to_list_pos[GetIndustryByTile(tile)->type]].show_on_map) {
 
			return GetIndustrySpec(GetIndustryByTile(tile)->type)->map_colour * 0x01010101;
 
		} else {
 
			/* otherwise, return the color of the clear tiles, which will make it disappear */
 
			return ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[MP_CLEAR]);
 
			/* otherwise, return the colour of the clear tiles, which will make it disappear */
 
			return ApplyMask(MKCOLOUR(0x54545454), &_smallmap_vehicles_andor[MP_CLEAR]);
 
		}
 
	}
 

	
 
	return ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[t]);
 
	return ApplyMask(MKCOLOUR(0x54545454), &_smallmap_vehicles_andor[t]);
 
}
 

	
 
/**
 
 * Return the color a tile would be displayed with in the small map in mode "Routes".
 
 * Return the colour a tile would be displayed with in the small map in mode "Routes".
 
 *
 
 * @param tile The tile of which we would like to get the color.
 
 * @return The color of tile  in the small map in mode "Routes"
 
 * @param tile The tile of which we would like to get the colour.
 
 * @return The colour of tile  in the small map in mode "Routes"
 
 */
 
static inline uint32 GetSmallMapRoutesPixels(TileIndex tile)
 
{
 
	TileType t = GetEffectiveTileType(tile);
 
	uint32 bits;
 

	
 
	if (t == MP_STATION) {
 
		switch (GetStationType(tile)) {
 
			case STATION_RAIL:    bits = MKCOLOR(0x56565656); break;
 
			case STATION_AIRPORT: bits = MKCOLOR(0xB8B8B8B8); break;
 
			case STATION_TRUCK:   bits = MKCOLOR(0xC2C2C2C2); break;
 
			case STATION_BUS:     bits = MKCOLOR(0xBFBFBFBF); break;
 
			case STATION_DOCK:    bits = MKCOLOR(0x98989898); break;
 
			default:              bits = MKCOLOR(0xFFFFFFFF); break;
 
			case STATION_RAIL:    bits = MKCOLOUR(0x56565656); break;
 
			case STATION_AIRPORT: bits = MKCOLOUR(0xB8B8B8B8); break;
 
			case STATION_TRUCK:   bits = MKCOLOUR(0xC2C2C2C2); break;
 
			case STATION_BUS:     bits = MKCOLOUR(0xBFBFBFBF); break;
 
			case STATION_DOCK:    bits = MKCOLOUR(0x98989898); break;
 
			default:              bits = MKCOLOUR(0xFFFFFFFF); break;
 
		}
 
	} else {
 
		/* ground color */
 
		bits = ApplyMask(MKCOLOR(0x54545454), &_smallmap_contours_andor[t]);
 
		/* ground colour */
 
		bits = ApplyMask(MKCOLOUR(0x54545454), &_smallmap_contours_andor[t]);
 
	}
 
	return bits;
 
}
 

	
 

	
 
static const uint32 _vegetation_clear_bits[] = {
 
	MKCOLOR(0x54545454), ///< full grass
 
	MKCOLOR(0x52525252), ///< rough land
 
	MKCOLOR(0x0A0A0A0A), ///< rocks
 
	MKCOLOR(0x25252525), ///< fields
 
	MKCOLOR(0x98989898), ///< snow
 
	MKCOLOR(0xC2C2C2C2), ///< desert
 
	MKCOLOR(0x54545454), ///< unused
 
	MKCOLOR(0x54545454), ///< unused
 
	MKCOLOUR(0x54545454), ///< full grass
 
	MKCOLOUR(0x52525252), ///< rough land
 
	MKCOLOUR(0x0A0A0A0A), ///< rocks
 
	MKCOLOUR(0x25252525), ///< fields
 
	MKCOLOUR(0x98989898), ///< snow
 
	MKCOLOUR(0xC2C2C2C2), ///< desert
 
	MKCOLOUR(0x54545454), ///< unused
 
	MKCOLOUR(0x54545454), ///< unused
 
};
 

	
 
static inline uint32 GetSmallMapVegetationPixels(TileIndex tile)
 
{
 
	TileType t = GetEffectiveTileType(tile);
 
	uint32 bits;
 

	
 
	switch (t) {
 
		case MP_CLEAR:
 
			if (IsClearGround(tile, CLEAR_GRASS) && GetClearDensity(tile) < 3) {
 
				bits = MKCOLOR(0x37373737);
 
				bits = MKCOLOUR(0x37373737);
 
			} else {
 
				bits = _vegetation_clear_bits[GetClearGround(tile)];
 
			}
 
			break;
 

	
 
		case MP_INDUSTRY:
 
			bits = GetIndustrySpec(GetIndustryByTile(tile)->type)->check_proc == CHECK_FOREST ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5);
 
			bits = GetIndustrySpec(GetIndustryByTile(tile)->type)->check_proc == CHECK_FOREST ? MKCOLOUR(0xD0D0D0D0) : MKCOLOUR(0xB5B5B5B5);
 
			break;
 

	
 
		case MP_TREES:
 
			if (GetTreeGround(tile) == TREE_GROUND_SNOW_DESERT) {
 
				bits = (_settings_game.game_creation.landscape == LT_ARCTIC) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2);
 
				bits = (_settings_game.game_creation.landscape == LT_ARCTIC) ? MKCOLOUR(0x98575798) : MKCOLOUR(0xC25757C2);
 
			} else {
 
				bits = MKCOLOR(0x54575754);
 
				bits = MKCOLOUR(0x54575754);
 
			}
 
			break;
 

	
 
		default:
 
			bits = ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[t]);
 
			bits = ApplyMask(MKCOLOUR(0x54545454), &_smallmap_vehicles_andor[t]);
 
			break;
 
	}
 

	
 
	return bits;
 
}
 

	
 

	
 
static uint32 _owner_colors[OWNER_END + 1];
 
static uint32 _owner_colours[OWNER_END + 1];
 

	
 
/**
 
 * Return the color a tile would be displayed with in the small map in mode "Owner".
 
 * Return the colour a tile would be displayed with in the small map in mode "Owner".
 
 *
 
 * @param tile The tile of which we would like to get the color.
 
 * @return The color of tile in the small map in mode "Owner"
 
 * @param tile The tile of which we would like to get the colour.
 
 * @return The colour of tile in the small map in mode "Owner"
 
 */
 
static inline uint32 GetSmallMapOwnerPixels(TileIndex tile)
 
{
 
	Owner o;
 

	
 
	switch (GetTileType(tile)) {
 
		case MP_INDUSTRY: o = OWNER_END;          break;
 
		case MP_HOUSE:    o = OWNER_TOWN;         break;
 
		default:          o = GetTileOwner(tile); break;
 
		/* FIXME: For MP_ROAD there are multiple owners.
 
		 * GetTileOwner returns the rail owner (level crossing) resp. the owner of ROADTYPE_ROAD (normal road),
 
		 * even if there are no ROADTYPE_ROAD bits on the tile.
 
		 */
 
	}
 

	
 
	return _owner_colors[o];
 
	return _owner_colours[o];
 
}
 

	
 

	
 
static const uint32 _smallmap_mask_left[3] = {
 
	MKCOLOR(0xFF000000),
 
	MKCOLOR(0xFFFF0000),
 
	MKCOLOR(0xFFFFFF00),
 
	MKCOLOUR(0xFF000000),
 
	MKCOLOUR(0xFFFF0000),
 
	MKCOLOUR(0xFFFFFF00),
 
};
 

	
 
static const uint32 _smallmap_mask_right[] = {
 
	MKCOLOR(0x000000FF),
 
	MKCOLOR(0x0000FFFF),
 
	MKCOLOR(0x00FFFFFF),
 
	MKCOLOUR(0x000000FF),
 
	MKCOLOUR(0x0000FFFF),
 
	MKCOLOUR(0x00FFFFFF),
 
};
 

	
 
/* each tile has 4 x pixels and 1 y pixel */
 

	
 
static GetSmallMapPixels *_smallmap_draw_procs[] = {
 
	GetSmallMapContoursPixels,
 
	GetSmallMapVehiclesPixels,
 
	GetSmallMapIndustriesPixels,
 
	GetSmallMapRoutesPixels,
 
	GetSmallMapVegetationPixels,
 
	GetSmallMapOwnerPixels,
 
};
 

	
 
static const byte _vehicle_type_colors[6] = {
 
static const byte _vehicle_type_colours[6] = {
 
	184, 191, 152, 15, 215, 184
 
};
 

	
 

	
 
static void DrawVertMapIndicator(int x, int y, int x2, int y2)
 
{
 
	GfxFillRect(x, y,      x2, y + 3, 69);
 
	GfxFillRect(x, y2 - 3, x2, y2,    69);
 
}
 

	
 
static void DrawHorizMapIndicator(int x, int y, int x2, int y2)
 
{
 
@@ -555,25 +555,25 @@ class SmallMapWindow : public Window
 
	uint8 refresh;
 

	
 
	static const int COLUMN_WIDTH = 119;
 
	static const int MIN_LEGEND_HEIGHT = 6 * 7;
 

	
 
public:
 
	/**
 
	 * Draws the small map.
 
	 *
 
	 * Basically, the small map is draw column of pixels by column of pixels. The pixels
 
	 * are drawn directly into the screen buffer. The final map is drawn in multiple passes.
 
	 * The passes are:
 
	 * <ol><li>The colors of tiles in the different modes.</li>
 
	 * <ol><li>The colours of tiles in the different modes.</li>
 
	 * <li>Town names (optional)</li></ol>
 
	 *
 
	 * @param dpi pointer to pixel to write onto
 
	 * @param w pointer to Window struct
 
	 * @param type type of map requested (vegetation, owners, routes, etc)
 
	 * @param show_towns true if the town names should be displayed, false if not.
 
	 */
 
	void DrawSmallMap(DrawPixelInfo *dpi)
 
	{
 
		Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
 
		DrawPixelInfo *old_dpi;
 
		int dx, dy, x, y, x2, y2;
 
@@ -583,33 +583,33 @@ public:
 
		ViewPort *vp;
 

	
 
		old_dpi = _cur_dpi;
 
		_cur_dpi = dpi;
 

	
 
		/* clear it */
 
		GfxFillRect(dpi->left, dpi->top, dpi->left + dpi->width - 1, dpi->top + dpi->height - 1, 0);
 

	
 
		/* setup owner table */
 
		if (this->map_type == SMT_OWNER) {
 
			const Company *c;
 

	
 
			/* fill with some special colors */
 
			_owner_colors[OWNER_TOWN] = MKCOLOR(0xB4B4B4B4);
 
			_owner_colors[OWNER_NONE] = MKCOLOR(0x54545454);
 
			_owner_colors[OWNER_WATER] = MKCOLOR(0xCACACACA);
 
			_owner_colors[OWNER_END]   = MKCOLOR(0x20202020); /* industry */
 
			/* fill with some special colours */
 
			_owner_colours[OWNER_TOWN] = MKCOLOUR(0xB4B4B4B4);
 
			_owner_colours[OWNER_NONE] = MKCOLOUR(0x54545454);
 
			_owner_colours[OWNER_WATER] = MKCOLOUR(0xCACACACA);
 
			_owner_colours[OWNER_END]   = MKCOLOUR(0x20202020); /* industry */
 

	
 
			/* now fill with the company colours */
 
			FOR_ALL_COMPANIES(c) {
 
				_owner_colors[c->index] =
 
				_owner_colours[c->index] =
 
					_colour_gradient[c->colour][5] * 0x01010101;
 
			}
 
		}
 

	
 
		tile_x = this->scroll_x / TILE_SIZE;
 
		tile_y = this->scroll_y / TILE_SIZE;
 

	
 
		dx = dpi->left + this->subscroll;
 
		tile_x -= dx / 4;
 
		tile_y += dx / 4;
 
		dx &= 3;
 

	
 
@@ -666,25 +666,25 @@ public:
 
				tile_x--;
 
				y--;
 
				ptr = blitter->MoveTo(ptr, 0, -1);
 
			}
 
			ptr = blitter->MoveTo(ptr, 2, 0);
 
			x += 2;
 
		}
 

	
 
		/* draw vehicles? */
 
		if (this->map_type == SMT_CONTOUR || this->map_type == SMT_VEHICLES) {
 
			Vehicle *v;
 
			bool skip;
 
			byte color;
 
			byte colour;
 

	
 
			FOR_ALL_VEHICLES(v) {
 
				if (v->type != VEH_EFFECT &&
 
						(v->vehstatus & (VS_HIDDEN | VS_UNCLICKABLE)) == 0) {
 
					/* Remap into flat coordinates. */
 
					Point pt = RemapCoords(
 
						v->x_pos / TILE_SIZE - this->scroll_x / TILE_SIZE, // divide each one separately because (a-b)/c != a/c-b/c in integer world
 
						v->y_pos / TILE_SIZE - this->scroll_y / TILE_SIZE, //    dtto
 
						0);
 
					x = pt.x;
 
					y = pt.y;
 

	
 
@@ -700,30 +700,30 @@ public:
 

	
 
					if (x < 0) {
 
						/* if x+1 is 0, that means we're on the very left edge,
 
						 *  and should thus only draw a single pixel */
 
						if (++x != 0) continue;
 
						skip = true;
 
					} else if (x >= dpi->width - 1) {
 
						/* Check if we're at the very right edge, and if so draw only a single pixel */
 
						if (x != dpi->width - 1) continue;
 
						skip = true;
 
					}
 

	
 
					/* Calculate pointer to pixel and the color */
 
					color = (this->map_type == SMT_VEHICLES) ? _vehicle_type_colors[v->type] : 0xF;
 
					/* Calculate pointer to pixel and the colour */
 
					colour = (this->map_type == SMT_VEHICLES) ? _vehicle_type_colours[v->type] : 0xF;
 

	
 
					/* And draw either one or two pixels depending on clipping */
 
					blitter->SetPixel(dpi->dst_ptr, x, y, color);
 
					if (!skip) blitter->SetPixel(dpi->dst_ptr, x + 1, y, color);
 
					blitter->SetPixel(dpi->dst_ptr, x, y, colour);
 
					if (!skip) blitter->SetPixel(dpi->dst_ptr, x + 1, y, colour);
 
				}
 
			}
 
		}
 

	
 
		if (this->show_towns) {
 
			const Town *t;
 

	
 
			FOR_ALL_TOWNS(t) {
 
				/* Remap the town coordinate */
 
				Point pt = RemapCoords(
 
					(int)(TileX(t->xy) * TILE_SIZE - this->scroll_x) / TILE_SIZE,
 
					(int)(TileY(t->xy) * TILE_SIZE - this->scroll_y) / TILE_SIZE,
 
@@ -846,37 +846,37 @@ public:
 
				 * (one "row") to the right. */
 
				x += COLUMN_WIDTH;
 
				y = y_org;
 
			}
 

	
 
			if (this->map_type == SMT_INDUSTRY) {
 
				/* Industry name must be formated, since it's not in tiny font in the specs.
 
				 * So, draw with a parameter and use the STR_SMALLMAP_INDUSTRY string, which is tiny font.*/
 
				SetDParam(0, tbl->legend);
 
				assert(tbl->type < NUM_INDUSTRYTYPES);
 
				SetDParam(1, _industry_counts[tbl->type]);
 
				if (!tbl->show_on_map) {
 
					/* Simply draw the string, not the black border of the legend color.
 
					/* Simply draw the string, not the black border of the legend colour.
 
					 * This will enforce the idea of the disabled item */
 
					DrawString(x + 11, y, STR_SMALLMAP_INDUSTRY, TC_GREY);
 
				} else {
 
					DrawString(x + 11, y, STR_SMALLMAP_INDUSTRY, TC_BLACK);
 
					GfxFillRect(x, y + 1, x + 8, y + 5, 0); // outer border of the legend color
 
					GfxFillRect(x, y + 1, x + 8, y + 5, 0); // outer border of the legend colour
 
				}
 
			} else {
 
				/* Anything that is not an industry is using normal process */
 
				GfxFillRect(x, y + 1, x + 8, y + 5, 0);
 
				DrawString(x + 11, y, tbl->legend, TC_FROMSTRING);
 
			}
 
			GfxFillRect(x + 1, y + 2, x + 7, y + 4, tbl->colour); // legend color
 
			GfxFillRect(x + 1, y + 2, x + 7, y + 4, tbl->colour); // legend colour
 

	
 
			y += 6;
 
		}
 

	
 
		const Widget *wi = &this->widget[SM_WIDGET_MAP];
 
		if (!FillDrawPixelInfo(&new_dpi, wi->left + 1, wi->top + 1, wi->right - wi->left - 1, wi->bottom - wi->top - 1)) return;
 

	
 
		this->DrawSmallMap(&new_dpi);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
src/sprite.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @file sprite.h Base for drawing complex sprites. */
 

	
 
#ifndef SPRITE_H
 
#define SPRITE_H
 

	
 
#include "gfx_type.h"
 

	
 
#define GENERAL_SPRITE_COLOR(color) ((color) + PALETTE_RECOLOR_START)
 
#define COMPANY_SPRITE_COLOR(owner) (GENERAL_SPRITE_COLOR(_company_colours[owner]))
 
#define GENERAL_SPRITE_COLOUR(colour) ((colour) + PALETTE_RECOLOUR_START)
 
#define COMPANY_SPRITE_COLOUR(owner) (GENERAL_SPRITE_COLOUR(_company_colours[owner]))
 

	
 
/**
 
 * Whether a sprite comes from the original graphics files or a new grf file
 
 * (either supplied by OpenTTD or supplied by the user).
 
 *
 
 * @param sprite The sprite to check
 
 * @return True if it is a new sprite, or false if it is original.
 
 */
 
#define IS_CUSTOM_SPRITE(sprite) ((sprite) >= SPR_SIGNALS_BASE)
 

	
 
/* The following describes bunch of sprites to be drawn together in a single 3D
 
 * bounding box. Used especially for various multi-sprite buildings (like
src/spritecache.cpp
Show inline comments
 
@@ -165,25 +165,25 @@ static void *ReadSprite(SpriteCache *sc,
 
			DEBUG(misc, 0, "You are running a 32bpp blitter, but this build is without libpng support; falling back to 8bpp graphics");
 
			show_once = false;
 
		}
 
#endif /* WITH_PNG */
 
	}
 

	
 
	FioSeekToFile(file_slot, file_pos);
 

	
 
	/* Read the size and type */
 
	int num  = FioReadWord();
 
	byte type = FioReadByte();
 

	
 
	/* Type 0xFF indicates either a colormap or some other non-sprite info */
 
	/* Type 0xFF indicates either a colourmap or some other non-sprite info */
 
	assert((type == 0xFF) == (sprite_type == ST_RECOLOUR));
 
	if (type == 0xFF) {
 
		/* "Normal" recolour sprites are ALWAYS 257 bytes. Then there is a small
 
		 * number of recolour sprites that are 17 bytes that only exist in DOS
 
		 * GRFs which are the same as 257 byte recolour sprites, but with the last
 
		 * 240 bytes zeroed.  */
 
		static const int RECOLOUR_SPRITE_SIZE = 257;
 
		byte *dest = (byte *)AllocSprite(max(RECOLOUR_SPRITE_SIZE, num));
 

	
 
		sc->ptr = dest;
 

	
 
		if (_palette_remap_grf[sc->file_slot]) {
src/spriteloader/grf.cpp
Show inline comments
 
@@ -32,25 +32,25 @@ static bool WarnCorruptSprite(uint8 file
 
	return false;
 
}
 

	
 
bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos, SpriteType sprite_type)
 
{
 
	/* Open the right file and go to the correct position */
 
	FioSeekToFile(file_slot, file_pos);
 

	
 
	/* Read the size and type */
 
	int num = FioReadWord();
 
	byte type = FioReadByte();
 

	
 
	/* Type 0xFF indicates either a colormap or some other non-sprite info; we do not handle them here */
 
	/* Type 0xFF indicates either a colourmap or some other non-sprite info; we do not handle them here */
 
	if (type == 0xFF) return false;
 

	
 
	sprite->height = FioReadByte();
 
	sprite->width  = FioReadWord();
 
	sprite->x_offs = FioReadWord();
 
	sprite->y_offs = FioReadWord();
 

	
 
	/* 0x02 indicates it is a compressed sprite, so we can't rely on 'num' to be valid.
 
	 *  In case it is uncompressed, the size is 'num' - 8 (header-size). */
 
	num = (type & 0x02) ? sprite->width * sprite->height : num - 8;
 

	
 
	byte *dest_orig = AllocaM(byte, num);
src/spriteloader/png.cpp
Show inline comments
 
@@ -40,25 +40,25 @@ static bool OpenPNGFile(const char *file
 
		return true;
 
	}
 

	
 
	/* TODO -- Add TAR support */
 
	return false;
 
}
 

	
 
static bool LoadPNG(SpriteLoader::Sprite *sprite, const char *filename, uint32 id, volatile bool mask)
 
{
 
	png_byte header[8];
 
	png_structp png_ptr;
 
	png_infop info_ptr, end_info;
 
	uint bit_depth, color_type;
 
	uint bit_depth, colour_type;
 
	uint i, pixelsize;
 
	png_bytep row_pointer;
 
	SpriteLoader::CommonPixel *dst;
 

	
 
	if (!OpenPNGFile(filename, id, mask)) return mask; // If mask is true, and file not found, continue true anyway, as it isn't a show-stopper
 

	
 
	/* Check the header */
 
	FioReadBlock(header, 8);
 
	if (png_sig_cmp(header, 0, 8) != 0) return false;
 

	
 
	/* Create the reader */
 
	png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, (png_voidp)NULL, png_my_error, png_my_warning);
 
@@ -97,44 +97,44 @@ static bool LoadPNG(SpriteLoader::Sprite
 
		for (int i = 0; i < num_text; i++) {
 
			/* x_offs and y_offs are in the text-chunk of PNG */
 
			if (strcmp("x_offs", text_ptr[i].key) == 0) sprite->x_offs = strtol(text_ptr[i].text, NULL, 0);
 
			if (strcmp("y_offs", text_ptr[i].key) == 0) sprite->y_offs = strtol(text_ptr[i].text, NULL, 0);
 
		}
 

	
 
		sprite->height = info_ptr->height;
 
		sprite->width  = info_ptr->width;
 
		sprite->data = CallocT<SpriteLoader::CommonPixel>(sprite->width * sprite->height);
 
	}
 

	
 
	bit_depth  = png_get_bit_depth(png_ptr, info_ptr);
 
	color_type = png_get_color_type(png_ptr, info_ptr);
 
	colour_type = png_get_color_type(png_ptr, info_ptr);
 

	
 
	if (mask && (bit_depth != 8 || color_type != PNG_COLOR_TYPE_PALETTE)) {
 
	if (mask && (bit_depth != 8 || colour_type != PNG_COLOR_TYPE_PALETTE)) {
 
		DEBUG(misc, 0, "Ignoring mask for SpriteID %d as it isn't a 8 bit palette image", id);
 
		return true;
 
	}
 

	
 
	if (!mask) {
 
		if (bit_depth == 16) png_set_strip_16(png_ptr);
 

	
 
		if (color_type == PNG_COLOR_TYPE_PALETTE) {
 
		if (colour_type == PNG_COLOR_TYPE_PALETTE) {
 
			png_set_palette_to_rgb(png_ptr);
 
			color_type = PNG_COLOR_TYPE_RGB;
 
			colour_type = PNG_COLOR_TYPE_RGB;
 
		}
 
		if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
 
		if (colour_type == PNG_COLOR_TYPE_GRAY || colour_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
 
			png_set_gray_to_rgb(png_ptr);
 
			color_type = PNG_COLOR_TYPE_RGB;
 
			colour_type = PNG_COLOR_TYPE_RGB;
 
		}
 

	
 
		if (color_type == PNG_COLOR_TYPE_RGB) {
 
		if (colour_type == PNG_COLOR_TYPE_RGB) {
 
			png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
 
		}
 

	
 
		pixelsize = sizeof(uint32);
 
	} else {
 
		pixelsize = sizeof(uint8);
 
	}
 

	
 
	row_pointer = (png_byte *)MallocT<byte>(info_ptr->width * pixelsize);
 
	if (row_pointer == NULL) {
 
		png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
 
		return false;
 
@@ -142,25 +142,25 @@ static bool LoadPNG(SpriteLoader::Sprite
 

	
 
	for (i = 0; i < info_ptr->height; i++) {
 
		png_read_row(png_ptr, row_pointer, NULL);
 

	
 
		dst = sprite->data + i * info_ptr->width;
 

	
 
		for (uint x = 0; x < info_ptr->width; x++) {
 
			if (mask) {
 
				if (row_pointer[x * sizeof(uint8)] != 0) {
 
					dst[x].r = 0;
 
					dst[x].g = 0;
 
					dst[x].b = 0;
 
					/* Alpha channel is used from the original image (to allow transparency in remap colors) */
 
					/* Alpha channel is used from the original image (to allow transparency in remap colours) */
 
					dst[x].m = row_pointer[x * sizeof(uint8)];
 
				}
 
			} else {
 
				dst[x].r = row_pointer[x * sizeof(uint32) + 0];
 
				dst[x].g = row_pointer[x * sizeof(uint32) + 1];
 
				dst[x].b = row_pointer[x * sizeof(uint32) + 2];
 
				dst[x].a = row_pointer[x * sizeof(uint32) + 3];
 
				dst[x].m = 0;
 
			}
 
		}
 
	}
 

	
src/station_cmd.cpp
Show inline comments
 
@@ -2321,25 +2321,25 @@ static void DrawTile_Station(TileInfo *t
 
	} else {
 
		roadtypes = IsRoadStop(ti->tile) ? GetRoadTypes(ti->tile) : ROADTYPES_NONE;
 
		total_offset = 0;
 
		custom_ground_offset = 0;
 
	}
 
	uint32 relocation = 0;
 
	const Station *st = NULL;
 
	const StationSpec *statspec = NULL;
 
	Owner owner = GetTileOwner(ti->tile);
 

	
 
	SpriteID palette;
 
	if (IsValidCompanyID(owner)) {
 
		palette = COMPANY_SPRITE_COLOR(owner);
 
		palette = COMPANY_SPRITE_COLOUR(owner);
 
	} else {
 
		/* Some stations are not owner by a company, namely oil rigs */
 
		palette = PALETTE_TO_GREY;
 
	}
 

	
 
	/* don't show foundation for docks */
 
	if (ti->tileh != SLOPE_FLAT && !IsDock(ti->tile))
 
		DrawFoundation(ti, FOUNDATION_LEVELED);
 

	
 
	if (IsCustomStationSpecIndex(ti->tile)) {
 
		/* look for customization */
 
		st = GetStationByTile(ti->tile);
 
@@ -2428,34 +2428,34 @@ static void DrawTile_Station(TileInfo *t
 
				!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)
 
			);
 
		} else {
 
			/* For stations and original spritelayouts delta_x and delta_y are signed */
 
			AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS));
 
		}
 
	}
 
}
 

	
 
void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image)
 
{
 
	int32 total_offset = 0;
 
	SpriteID pal = COMPANY_SPRITE_COLOR(_local_company);
 
	SpriteID pal = COMPANY_SPRITE_COLOUR(_local_company);
 
	const DrawTileSprites *t = &_station_display_datas[st][image];
 

	
 
	if (railtype != INVALID_RAILTYPE) {
 
		const RailtypeInfo *rti = GetRailTypeInfo(railtype);
 
		total_offset = rti->total_offset;
 
	}
 

	
 
	SpriteID img = t->ground.sprite;
 
	DrawSprite(img + total_offset, HasBit(img, PALETTE_MODIFIER_COLOR) ? pal : PAL_NONE, x, y);
 
	DrawSprite(img + total_offset, HasBit(img, PALETTE_MODIFIER_COLOUR) ? pal : PAL_NONE, x, y);
 

	
 
	if (roadtype == ROADTYPE_TRAM) {
 
		DrawSprite(SPR_TRAMWAY_TRAM + (t->ground.sprite == SPR_ROAD_PAVED_STRAIGHT_X ? 1 : 0), PAL_NONE, x, y);
 
	}
 

	
 
	const DrawTileSeqStruct *dtss;
 
	foreach_draw_tile_seq(dtss, t->seq) {
 
		Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
 
		DrawSprite(dtss->image.sprite + total_offset, pal, x + pt.x, y + pt.y);
 
	}
 
}
 

	
src/strings.cpp
Show inline comments
 
@@ -1568,53 +1568,53 @@ void CheckForMissingGlyphsInLoadedLangua
 
							 * user chosen font as that is more likely to be any good than
 
							 * the wild guess we made */
 
							UninitFreeType();
 
							InitFreeType();
 
						}
 
#endif
 
						/*
 
						 * The character is printable, but not in the normal font.
 
						 * This is the case we were testing for. In this case we
 
						 * have to show the error. As we do not want the string to
 
						 * be translated by the translators, we 'force' it into the
 
						 * binary and 'load' it via a BindCString. To do this
 
						 * properly we have to set the color of the string,
 
						 * otherwise we end up with a lot of artefacts. The color
 
						 * properly we have to set the colour of the string,
 
						 * otherwise we end up with a lot of artefacts. The colour
 
						 * 'character' might change in the future, so for safety
 
						 * we just Utf8 Encode it into the string, which takes
 
						 * exactly three characters, so it replaces the "XXX" with
 
						 * the color marker.
 
						 * the colour marker.
 
						 */
 
						static char *err_str = strdup("XXXThe current font is missing some of the characters used in the texts for this language. Read the readme to see how to solve this.");
 
						Utf8Encode(err_str, SCC_YELLOW);
 
						SetDParamStr(0, err_str);
 
						ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
 
						return;
 
					}
 
				}
 
			}
 
		}
 
		break;
 
	}
 

	
 
#if !defined(WITH_ICU)
 
	/*
 
	 * For right-to-left languages we need the ICU library. If
 
	 * we do not have support for that library we warn the user
 
	 * about it with a message. As we do not want the string to
 
	 * be translated by the translators, we 'force' it into the
 
	 * binary and 'load' it via a BindCString. To do this
 
	 * properly we have to set the color of the string,
 
	 * otherwise we end up with a lot of artefacts. The color
 
	 * properly we have to set the colour of the string,
 
	 * otherwise we end up with a lot of artefacts. The colour
 
	 * 'character' might change in the future, so for safety
 
	 * we just Utf8 Encode it into the string, which takes
 
	 * exactly three characters, so it replaces the "XXX" with
 
	 * the color marker.
 
	 * the colour marker.
 
	 */
 
	if (_dynlang.text_dir != TD_LTR) {
 
		static char *err_str = strdup("XXXThis version of OpenTTD does not support right-to-left languages. Recompile with icu enabled.");
 
		Utf8Encode(err_str, SCC_YELLOW);
 
		SetDParamStr(0, err_str);
 
		ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
 
	}
 
#endif
 
}
src/table/industry_land.h
Show inline comments
 
@@ -106,44 +106,44 @@ static const DrawBuildingsTileStruct _in
 
	M(     0xf54, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xf54, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xf54, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xf54, PAL_NONE,      0x817, PAL_NONE,  0,  1, 16, 13,  19, 0),
 
	M(     0x81d, PAL_NONE,      0x818, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,      0x819, PAL_NONE,  0,  0, 16, 16,  15, 0),
 
	M(     0x81d, PAL_NONE,      0x81a, PAL_NONE,  0,  0, 16, 16,  31, 0),
 
	M(     0x81d, PAL_NONE,      0x81b, PAL_NONE,  0,  0, 16, 16,  39, 0),
 
	M(     0x81d, PAL_NONE,      0x81c, PAL_NONE,  0,  0, 16, 16,   7, 0),
 
	M(     0x81d, PAL_NONE,      0x81c, PAL_NONE,  0,  0, 16, 16,   7, 0),
 
	M(     0x81d, PAL_NONE,      0x81c, PAL_NONE,  0,  0, 16, 16,   7, 0),
 
	M(     0x81d, PAL_NONE,      0x81c, PAL_NONE,  0,  0, 16, 16,   7, 0),
 
	M(     0xf54, PAL_NONE,     0x81e | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  1,  1, 14, 14,   4, 0),
 
	M(     0xf54, PAL_NONE,     0x81f | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  1,  1, 14, 14,  24, 0),
 
	M(     0xf54, PAL_NONE,     0x820 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  1,  1, 14, 14,  27, 0),
 
	M(     0x58c, PAL_NONE,     0x820 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  1,  1, 14, 14,  27, 0),
 
	M(     0xf54, PAL_NONE,     0x821 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  3,  3, 10,  9,   3, 0),
 
	M(     0xf54, PAL_NONE,     0x822 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  3,  3, 10,  9,  63, 0),
 
	M(     0xf54, PAL_NONE,     0x823 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  3,  3, 10,  9,  62, 0),
 
	M(     0x58c, PAL_NONE,     0x823 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  3,  3, 10,  9,  62, 0),
 
	M(     0xf54, PAL_NONE,     0x824 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  4,  4,  7,  7,   3, 0),
 
	M(     0xf54, PAL_NONE,     0x825 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  4,  4,  7,  7,  72, 0),
 
	M(     0xf54, PAL_NONE,     0x825 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  4,  4,  7,  7,  72, 0),
 
	M(     0x58c, PAL_NONE,     0x826 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  4,  4,  7,  7,  80, 0),
 
	M(     0xf54, PAL_NONE,     0x827 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  2,  0, 12, 16,  51, 0),
 
	M(     0xf54, PAL_NONE,     0x828 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  2,  0, 12, 16,  51, 0),
 
	M(     0xf54, PAL_NONE,     0x829 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  2,  0, 12, 16,  51, 0),
 
	M(     0x58c, PAL_NONE,     0x829 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  2,  0, 12, 16,  51, 0),
 
	M(     0xf54, PAL_NONE,     0x82a | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  26, 0),
 
	M(     0xf54, PAL_NONE,     0x82b | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  44, 0),
 
	M(     0xf54, PAL_NONE,     0x82c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  46, 0),
 
	M(     0x58c, PAL_NONE,     0x82c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  46, 0),
 
	M(     0xf54, PAL_NONE,     0x81e | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  1,  1, 14, 14,   4, 0),
 
	M(     0xf54, PAL_NONE,     0x81f | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  1,  1, 14, 14,  24, 0),
 
	M(     0xf54, PAL_NONE,     0x820 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  1,  1, 14, 14,  27, 0),
 
	M(     0x58c, PAL_NONE,     0x820 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  1,  1, 14, 14,  27, 0),
 
	M(     0xf54, PAL_NONE,     0x821 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  3,  3, 10,  9,   3, 0),
 
	M(     0xf54, PAL_NONE,     0x822 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  3,  3, 10,  9,  63, 0),
 
	M(     0xf54, PAL_NONE,     0x823 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  3,  3, 10,  9,  62, 0),
 
	M(     0x58c, PAL_NONE,     0x823 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  3,  3, 10,  9,  62, 0),
 
	M(     0xf54, PAL_NONE,     0x824 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  4,  4,  7,  7,   3, 0),
 
	M(     0xf54, PAL_NONE,     0x825 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  4,  4,  7,  7,  72, 0),
 
	M(     0xf54, PAL_NONE,     0x825 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  4,  4,  7,  7,  72, 0),
 
	M(     0x58c, PAL_NONE,     0x826 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  4,  4,  7,  7,  80, 0),
 
	M(     0xf54, PAL_NONE,     0x827 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  2,  0, 12, 16,  51, 0),
 
	M(     0xf54, PAL_NONE,     0x828 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  2,  0, 12, 16,  51, 0),
 
	M(     0xf54, PAL_NONE,     0x829 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  2,  0, 12, 16,  51, 0),
 
	M(     0x58c, PAL_NONE,     0x829 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  2,  0, 12, 16,  51, 0),
 
	M(     0xf54, PAL_NONE,     0x82a | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  26, 0),
 
	M(     0xf54, PAL_NONE,     0x82b | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  44, 0),
 
	M(     0xf54, PAL_NONE,     0x82c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  46, 0),
 
	M(     0x58c, PAL_NONE,     0x82c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  46, 0),
 
	M(     0xf54, PAL_NONE,      0x82d, PAL_NONE,  3,  1, 10, 13,   2, 0),
 
	M(     0xf54, PAL_NONE,      0x82e, PAL_NONE,  3,  1, 10, 13,  11, 0),
 
	M(     0xf54, PAL_NONE,      0x82f, PAL_NONE,  3,  1, 10, 13,  11, 0),
 
	M(     0x58c, PAL_NONE,      0x82f, PAL_NONE,  3,  1, 10, 13,  11, 0),
 
	M(     0xfdd, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xfdd, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xfdd, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xfdd, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xfdd, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xfdd, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xfdd, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xfdd, PAL_NONE,      0x833, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
@@ -166,148 +166,148 @@ static const DrawBuildingsTileStruct _in
 
	M(     0x87d, PAL_NONE,      0x87e, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x87f, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x880, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x881, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x882, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x883, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x883, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x882, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x881, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x880, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x87f, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x87d, PAL_NONE,      0x87e, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x83a, PAL_NONE,     0x83c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83a, PAL_NONE,     0x83c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83a, PAL_NONE,     0x83c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83a, PAL_NONE,     0x83c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83b, PAL_NONE,     0x83d | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83b, PAL_NONE,     0x83d | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83b, PAL_NONE,     0x83d | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83b, PAL_NONE,     0x83d | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83a, PAL_NONE,     0x83c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83a, PAL_NONE,     0x83c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83a, PAL_NONE,     0x83c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83a, PAL_NONE,     0x83c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83b, PAL_NONE,     0x83d | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83b, PAL_NONE,     0x83d | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83b, PAL_NONE,     0x83d | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83b, PAL_NONE,     0x83d | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0x83e, PAL_NONE,     0x83f | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83e, PAL_NONE,     0x83f | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83e, PAL_NONE,     0x83f | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83e, PAL_NONE,     0x83f | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83e, PAL_NONE,     0x83f | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x83e, PAL_NONE,     0x83f | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0x840, PAL_NONE,      0x841, PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x840, PAL_NONE,      0x841, PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x840, PAL_NONE,      0x841, PAL_NONE,  0,  0, 16, 16,  18, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0x842, PAL_NONE,      0x843, PAL_NONE,  0,  0, 16, 16,  30, 0),
 
	M(     0x842, PAL_NONE,      0x843, PAL_NONE,  0,  0, 16, 16,  30, 0),
 
	M(     0x842, PAL_NONE,      0x843, PAL_NONE,  0,  0, 16, 16,  30, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0x844, PAL_NONE,      0x845, PAL_NONE,  0,  0, 16, 16,  16, 0),
 
	M(     0x844, PAL_NONE,      0x845, PAL_NONE,  0,  0, 16, 16,  16, 0),
 
	M(     0x844, PAL_NONE,      0x845, PAL_NONE,  0,  0, 16, 16,  16, 0),
 
	M(     0x7e6, PAL_NONE,      0x869, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86d, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86d, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x862 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x866 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x862 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x866 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86a, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86e, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86e, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x863 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x867 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x863 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x867 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86b, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86f, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86f, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x864 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x868 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x864 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x868 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86c, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x870, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x870, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x865 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xf54, PAL_NONE,     0x871 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x875 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x875 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x879 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x872 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x876 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x876 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x87a | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x873 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x877 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x877 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x87b | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x874 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x878 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x878 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x87c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x865 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0xf54, PAL_NONE,     0x871 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x875 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x875 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x879 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x872 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x876 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x876 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x87a | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x873 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x877 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x877 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x87b | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x874 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x878 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x878 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,     0x87c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf54, PAL_NONE,      0x7ea, PAL_NONE,  3,  2,  8,  8,  18, 0),
 
	M(     0xf54, PAL_NONE,      0x7eb, PAL_NONE,  3,  2,  8,  8,  37, 0),
 
	M(     0xf54, PAL_NONE,      0x7ec, PAL_NONE,  3,  2,  8,  8,  49, 0),
 
	M(     0x7e6, PAL_NONE,      0x7ec, PAL_NONE,  3,  2,  8,  8,  49, 0),
 
	M(     0x7e6, PAL_NONE,      0x7ec, PAL_NONE,  3,  2,  8,  8,  49, 0),
 
	M(     0x7e6, PAL_NONE,      0x7ed, PAL_NONE,  3,  2,  8,  8,  49, 0),
 
	M(     0x7e6, PAL_NONE,      0x7ee, PAL_NONE,  3,  2,  8,  8,  49, 0),
 
	M(     0x7e6, PAL_NONE,      0x7ee, PAL_NONE,  3,  2,  8,  8,  49, 0),
 
	M(     0xf54, PAL_NONE,      0x7ef, PAL_NONE,  3,  2, 10,  7,  20, 0),
 
	M(     0xf54, PAL_NONE,      0x7f0, PAL_NONE,  3,  2, 10,  7,  40, 0),
 
	M(     0xf54, PAL_NONE,      0x7f1, PAL_NONE,  3,  2, 10,  7,  40, 0),
 
	M(     0x7e6, PAL_NONE,      0x7f1, PAL_NONE,  3,  2, 10,  7,  40, 0),
 
	M(     0xf54, PAL_NONE,      0x7f2, PAL_NONE,  4,  4,  7,  8,  22, 0),
 
	M(     0xf54, PAL_NONE,      0x7f3, PAL_NONE,  4,  4,  7,  8,  22, 0),
 
	M(     0xf54, PAL_NONE,      0x7f4, PAL_NONE,  4,  4,  7,  8,  22, 0),
 
	M(     0x7e6, PAL_NONE,      0x7f4, PAL_NONE,  4,  4,  7,  8,  22, 0),
 
	M(     0xf54, PAL_NONE,      0x7f5, PAL_NONE,  2,  1, 11, 13,  12, 0),
 
	M(     0xf54, PAL_NONE,      0x7f6, PAL_NONE,  2,  1, 11, 13,  12, 0),
 
	M(     0xf54, PAL_NONE,      0x7f7, PAL_NONE,  2,  1, 11, 13,  12, 0),
 
	M(     0x7e6, PAL_NONE,      0x7f7, PAL_NONE,  2,  1, 11, 13,  12, 0),
 
	M(     0x7e6, PAL_NONE,      0x85c, PAL_NONE,  0,  0,  1,  1,   1, 0),
 
	M(     0x851, PAL_NONE,      0x852, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x851, PAL_NONE,      0x852, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(    0x846 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x847 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(    0x846 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x847 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x7e6, PAL_NONE,      0x85d, PAL_NONE,  0,  0,  1,  1,   1, 0),
 
	M(     0x853, PAL_NONE,      0x854, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x853, PAL_NONE,      0x854, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(    0x848 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x849 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(    0x848 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x849 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x7e6, PAL_NONE,      0x85e, PAL_NONE,  0,  0,  1,  1,   1, 0),
 
	M(     0x855, PAL_NONE,      0x856, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x855, PAL_NONE,      0x856, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(    0x84a | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x84b | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(    0x84a | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x84b | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x7e6, PAL_NONE,      0x85f, PAL_NONE,  0,  0,  1,  1,   1, 0),
 
	M(     0x857, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0x857, PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(    0x84c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(    0x84c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0x7e6, PAL_NONE,      0x860, PAL_NONE,  0,  0,  1,  1,   1, 0),
 
	M(     0x858, PAL_NONE,      0x859, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x858, PAL_NONE,      0x859, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(    0x84d | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x84e | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(    0x84d | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x84e | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x7e6, PAL_NONE,      0x861, PAL_NONE,  0,  0,  1,  1,   1, 0),
 
	M(     0x85a, PAL_NONE,      0x85b, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x85a, PAL_NONE,      0x85b, PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(    0x84f | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x850 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(    0x84f | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x850 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  20, 0),
 
	M(     0x7e6, PAL_NONE,      0x884, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x884, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x884, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x886, PAL_NONE,      0x884, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x885, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x885, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x885, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x887, PAL_NONE,      0x885, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x88c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x88d | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x88d | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x88e | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x88f | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x890 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x890 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x891 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x892 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x893 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x893 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x894 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x895 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x896 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x896 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x897 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x88c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x88d | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x88d | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x88e | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x88f | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x890 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x890 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x891 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x892 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x893 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x893 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x894 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x895 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x896 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x896 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,     0x897 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x898, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x899, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x899, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x89a, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x8a6, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x89b, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x89c, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x89c, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x89d, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
@@ -506,52 +506,52 @@ static const DrawBuildingsTileStruct _in
 
	M(     0x904, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x914, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x914, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x924, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x925, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x925, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x925, PAL_NONE,      0x926, PAL_NONE,  0,  0, 16, 16,  30, 0),
 
	M(     0x925, PAL_NONE,      0x926, PAL_NONE,  0,  0, 16, 16,  30, 0),
 
	M(     0x925, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x925, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x925, PAL_NONE,      0x927, PAL_NONE,  0,  0, 16, 16,  30, 0),
 
	M(     0x925, PAL_NONE,      0x927, PAL_NONE,  0,  0, 16, 16,  30, 0),
 
	M(    0x11c6, PAL_NONE,     0x92b | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92d | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92e | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92f | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92f | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x930 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x928 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x929 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x929 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92a | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92b | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92d | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92e | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92f | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92f | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x930 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x928 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x929 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x929 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(    0x11c6, PAL_NONE,     0x92a | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  25, 0),
 
	M(     0x7e6, PAL_NONE,      0x869, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86d, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86d, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x862 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x866 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x862 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x866 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86a, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86e, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86e, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x863 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x867 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x863 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x867 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86b, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86f, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86f, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x864 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,     0x868 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x864 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,     0x868 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x86c, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x870, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x870, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x865 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(    0x865 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0,  1,  1,   0, 0),
 
	M(     0x7e6, PAL_NONE,      0x931, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x935, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x935, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x939, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x932, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x936, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x936, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x93a, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x933, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x937, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x937, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,      0x93b, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
@@ -562,36 +562,36 @@ static const DrawBuildingsTileStruct _in
 
	M(     0x81d, PAL_NONE,      0x818, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,      0x819, PAL_NONE,  0,  0, 16, 16,  15, 0),
 
	M(     0x81d, PAL_NONE,      0x81a, PAL_NONE,  0,  0, 16, 16,  31, 0),
 
	M(     0x81d, PAL_NONE,      0x81b, PAL_NONE,  0,  0, 16, 16,  39, 0),
 
	M(     0x81d, PAL_NONE,      0x81c, PAL_NONE,  0,  0, 16, 16,   7, 0),
 
	M(     0x81d, PAL_NONE,      0x81c, PAL_NONE,  0,  0, 16, 16,   7, 0),
 
	M(     0x81d, PAL_NONE,      0x81c, PAL_NONE,  0,  0, 16, 16,   7, 0),
 
	M(     0x81d, PAL_NONE,      0x81c, PAL_NONE,  0,  0, 16, 16,   7, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1245 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1248 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1248 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x124b | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1247 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x124a | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x124a | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x124d | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1246 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1249 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1249 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x124c | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1245 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1248 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1248 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x124b | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1247 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x124a | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x124a | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x124d | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1246 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1249 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x1249 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x7e6, PAL_NONE,     0x124c | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0x81d, PAL_NONE,     0x124e, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x124f, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x1250, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x1251, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x1252, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x1252, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x1252, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x1252, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x1253, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x1254, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x1254, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
	M(     0x81d, PAL_NONE,     0x1255, PAL_NONE,  0,  0, 16, 16,  10, 0),
 
@@ -665,33 +665,33 @@ static const DrawBuildingsTileStruct _in
 
	M(    0x1277, PAL_NONE,     0x127f, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1278, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1278, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1278, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1278, PAL_NONE,     0x1280, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1284 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1284 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1283 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1283 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1286 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1281 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1282 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1282 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1285 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1283 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1283 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1286 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1281 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1282 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1282 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1285 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1243, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1243, PAL_NONE,     0x1287, PALETTE_TO_RED,  0,  0, 16, 16,  50, 0),
 
	M(    0x1243, PAL_NONE,     0x1287, PALETTE_TO_RED,  0,  0, 16, 16,  50, 0),
 
	M(    0x1243, PAL_NONE,     0x1287, PALETTE_TO_RED,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1288, PALETTE_TO_RED,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1288, PALETTE_TO_RED,  0,  0, 16, 16,  50, 0),
 
	M(    0x1244, PAL_NONE,     0x1288, PALETTE_TO_RED,  0,  0, 16, 16,  50, 0),
 
	M(    0x1243, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x1243, PAL_NONE,     0x1289, PALETTE_TO_RED,  0,  0, 16, 16,  50, 3),
 
	M(    0x1243, PAL_NONE,     0x1289, PALETTE_TO_RED,  0,  0, 16, 16,  50, 3),
 
	M(    0x1243, PAL_NONE,     0x1289, PALETTE_TO_RED,  0,  0, 16, 16,  50, 3),
 
@@ -702,56 +702,56 @@ static const DrawBuildingsTileStruct _in
 
	M(     0xf8d, PAL_NONE,     0x129b, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x129b, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x129b, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x129b, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x129c, PAL_NONE,  0,  0, 16, 16,  50, 2),
 
	M(     0xf8d, PAL_NONE,     0x129c, PAL_NONE,  0,  0, 16, 16,  50, 2),
 
	M(     0xf8d, PAL_NONE,     0x129c, PAL_NONE,  0,  0, 16, 16,  50, 2),
 
	M(     0xf8d, PAL_NONE,     0x129c, PAL_NONE,  0,  0, 16, 16,  50, 2),
 
	M(     0xf8d, PAL_NONE,     0x129d, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x129d, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x129d, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x129d, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a0 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a0 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a0 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a0 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a1 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a1 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a1 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a1 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a2 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a2 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a2 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a2 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a3 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a3 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a3 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a3 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a0 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a0 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a0 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a0 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a1 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a1 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a1 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a1 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a2 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a2 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a2 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a2 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a3 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a3 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a3 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(    0x12a3 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,        0x0, PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a4 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a4 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a4 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a4 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a6 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a6 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a6 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a6 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a5 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 1),
 
	M(     0xf8d, PAL_NONE,     0x12a5 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 1),
 
	M(     0xf8d, PAL_NONE,     0x12a5 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 1),
 
	M(     0xf8d, PAL_NONE,     0x12a5 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE,  0,  0, 16, 16,  50, 1),
 
	M(     0xf8d, PAL_NONE,     0x12a4 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a4 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a4 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a4 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a6 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a6 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a6 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a6 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 0),
 
	M(     0xf8d, PAL_NONE,     0x12a5 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 1),
 
	M(     0xf8d, PAL_NONE,     0x12a5 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 1),
 
	M(     0xf8d, PAL_NONE,     0x12a5 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 1),
 
	M(     0xf8d, PAL_NONE,     0x12a5 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE,  0,  0, 16, 16,  50, 1),
 
};
 
#undef M
 

	
 
/* this is ONLY used for Sugar Mine*/
 
static const DrawIndustryAnimationStruct _draw_industry_spec1[96] = {
 
	{  8,   4,   0,   0},
 
	{  6,   0,   1,   0},
 
	{  4,   0,   2,   0},
 
	{  6,   0,   3,   0},
 
	{  8,   0,   4,   0},
 
	{ 10,   0,   5,   0},
 
	{ 12,   0,   6,   0},
src/table/palettes.h
Show inline comments
 
@@ -185,31 +185,31 @@ static const ExtraPaletteValues _extra_p
 
	  M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144),
 
	  M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144),
 
	  M(100, 132, 168), M(132, 172, 196), M(172, 208, 224) },
 

	
 
	/* glittery water Toyland */
 
	{ M(216, 244, 252), M(180, 220, 232), M(148, 200, 216), M(116, 180, 196),
 
	  M( 92, 164, 184), M( 92, 164, 184), M( 92, 164, 184), M( 92, 164, 184),
 
	  M( 92, 164, 184), M( 92, 164, 184), M( 92, 164, 184), M( 92, 164, 184),
 
	  M(116, 180, 196), M(148, 200, 216), M(180, 220, 232) }
 
};
 
#undef M
 

	
 
// Color table for colors in lang files (e.g. {BLACK})
 
struct StringColor {
 
// Colour table for colours in lang files (e.g. {BLACK})
 
struct StringColour {
 
	byte text;
 
	byte shadow;
 
};
 

	
 
static const StringColor _string_colourmap[][17] = {
 
static const StringColour _string_colourmap[][17] = {
 
	{ /* DOS palette. */
 
		{ 150,   1 }, // TC_BLUE
 
		{  12,   1 }, // TC_SILVER
 
		{ 189,   1 }, // TC_GOLD
 
		{ 184,   1 }, // TC_RED
 
		{ 174,   1 }, // TC_PURPLE
 
		{  30,   1 }, // TC_LIGHT_BROWN
 
		{ 195,   1 }, // TC_ORANGE
 
		{ 209,   1 }, // TC_GREEN
 
		{  68,   1 }, // TC_YELLOW
 
		{  95,   1 }, // TC_DARK_GREEN
 
		{  79,   1 }, // TC_CREAM
src/table/road_land.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @file road_land.h Sprite constructs for road depots. */
 

	
 
#define TILE_SEQ_LINE(img, pal, dx, dy, sx, sy) { dx, dy, 0, sx, sy, 20, {img, pal} },
 
#define TILE_SEQ_END() { 0, 0, 0, 0, 0, 0, {0, 0} }
 

	
 
static const DrawTileSeqStruct _road_depot_NE[] = {
 
	TILE_SEQ_LINE(0x584 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 0, 15, 16, 1)
 
	TILE_SEQ_LINE(0x584 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 15, 16, 1)
 
	TILE_SEQ_END()
 
};
 

	
 
static const DrawTileSeqStruct _road_depot_SE[] = {
 
	TILE_SEQ_LINE(0x580 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 0, 0, 1, 16)
 
	TILE_SEQ_LINE(0x581 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 15, 0, 1, 16)
 
	TILE_SEQ_LINE(0x580 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 1, 16)
 
	TILE_SEQ_LINE(0x581 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 15, 0, 1, 16)
 
	TILE_SEQ_END()
 
};
 

	
 
static const DrawTileSeqStruct _road_depot_SW[] = {
 
	TILE_SEQ_LINE(0x582 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 0, 0, 16, 1)
 
	TILE_SEQ_LINE(0x583 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 0, 15, 16, 1)
 
	TILE_SEQ_LINE(0x582 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 1)
 
	TILE_SEQ_LINE(0x583 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 15, 16, 1)
 
	TILE_SEQ_END()
 
};
 

	
 
static const DrawTileSeqStruct _road_depot_NW[] = {
 
	TILE_SEQ_LINE(0x585 | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 15, 0, 1, 16)
 
	TILE_SEQ_LINE(0x585 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 15, 0, 1, 16)
 
	TILE_SEQ_END()
 
};
 

	
 
static const DrawTileSprites _road_depot[] = {
 
	{ {0xA4A, PAL_NONE}, _road_depot_NE },
 
	{ {0xA4A, PAL_NONE}, _road_depot_SE },
 
	{ {0xA4A, PAL_NONE}, _road_depot_SW },
 
	{ {0xA4A, PAL_NONE}, _road_depot_NW }
 
};
 

	
 
static const DrawTileSeqStruct _tram_depot_NE[] = {
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x35) | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 0, 15, 16, 1)
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x35) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 15, 16, 1)
 
	TILE_SEQ_END()
 
};
 

	
 
static const DrawTileSeqStruct _tram_depot_SE[] = {
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x31) | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 0, 0, 1, 16)
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x32) | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 15, 0, 1, 16)
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x31) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 1, 16)
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x32) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 15, 0, 1, 16)
 
	TILE_SEQ_END()
 
};
 

	
 
static const DrawTileSeqStruct _tram_depot_SW[] = {
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x33) | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 0, 0, 16, 1)
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x34) | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 0, 15, 16, 1)
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x33) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 1)
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x34) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 15, 16, 1)
 
	TILE_SEQ_END()
 
};
 

	
 
static const DrawTileSeqStruct _tram_depot_NW[] = {
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x36) | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE, 15, 0, 1, 16)
 
	TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x36) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 15, 0, 1, 16)
 
	TILE_SEQ_END()
 
};
 

	
 
static const DrawTileSprites _tram_depot[] = {
 
	{ {0xA4A, PAL_NONE}, _tram_depot_NE },
 
	{ {0xA4A, PAL_NONE}, _tram_depot_SE },
 
	{ {0xA4A, PAL_NONE}, _tram_depot_SW },
 
	{ {0xA4A, PAL_NONE}, _tram_depot_NW }
 
};
 

	
 
#undef TILE_SEQ_LINE
 
#undef TILE_SEQ_END

Changeset was too big and was cut off... Show full diff anyway

0 comments (0 inline, 0 general)