(svn r20576) [1.0] -Backport from trunk:

- Fix: Warn OpenGFX users when they are using a base set that misses sprites (r20566)
- Fix: Wrong tooltip for the company select button in the AI debug and performance rating windows [FS#4053] (r20556, r20555)
- Fix: In old savegames aircraft can have an invalid state (r20528)
This commit is contained in:
rubidium 2010-08-20 10:31:20 +00:00
parent 0dc153f022
commit 544887688b
9 changed files with 122 additions and 60 deletions

View File

@ -22,6 +22,7 @@ ROOT_DIR = !!ROOT_DIR!!
GRF_DIR = $(ROOT_DIR)/media/extra_grf
BIN_DIR = !!BIN_DIR!!/data
OBJS_DIR = !!GRF_OBJS_DIR!!
OS = !!OS!!
# Check if we want to show what we are doing
ifdef VERBOSE
@ -35,6 +36,7 @@ endif
# Some configurational settings for your environment.
GRFCODEC := grfcodec
NFORENUM := $(shell [ `which nforenum 2>/dev/null` ] && echo "nforenum" || echo "renum")
MD5SUM := $(shell [ "$(OS)" = "OSX" ] && echo "md5 -r" || echo "md5sum")
# Some "should not be changed" settings.
NFO_FILES := $(GRF_DIR)/*.nfo
@ -51,13 +53,14 @@ $(BIN_DIR)/openttdd.grf: $(PCX_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
@# Only try; if nforenum isn't available, just retouch the file as they likely didn't need it anyway.
$(Q) ($(NFORENUM) -? > /dev/null 2>&1 && $(MAKE) $(OBJS_DIR)/openttdd.grf && cp $(OBJS_DIR)/openttdd.grf $(BIN_DIR)/openttdd.grf) || ([ -e $(BIN_DIR)/openttdd.grf ] && touch $(BIN_DIR)/openttdd.grf && echo "no NFORenum and GRFCodec found, skipping rebuild of openttdd.grf...") || (echo "no NFORenum and GRFCodec found, but no openttdd.grf either. Install NFORenum and GRFCodec." && exit 1)
# Yeah, we'd like to use -i in the sed, but Mac OS X's sed and GNU sed just can't agree on the usage of -i. In any case either one of them fails.
$(OBJS_DIR)/openttdd.grf: $(PCX_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
$(Q)-cp $(PCX_FILES) $(OBJS_DIR)/sprites 2> /dev/null
$(Q) gcc -DDOS -I$(GRF_DIR) -C -E - < "$(GRF_DIR)/openttd.nfo" | sed -e '/^#/d' -e '/^$$/d' > $(OBJS_DIR)/sprites/openttdd.nfo
$(Q) $(NFORENUM) $(OBJS_DIR)/sprites/openttdd.nfo
$(Q) $(GRFCODEC) -e -m1 $(OBJS_DIR)/openttdd.grf
$(Q) cp $(OBJS_DIR)/openttdd.grf $(BIN_DIR)/openttdd.grf
$(Q) for grf in $(BIN_DIR)/orig_dos*.obg; do sed 's/^OPENTTDD.GRF = [0-9a-f]*$$/OPENTTDD.GRF = '`md5sum $(BIN_DIR)/openttdd.grf | sed 's@ .*@@'`'/' -i $$grf; done
$(Q) for grf in $(BIN_DIR)/orig_dos*.obg; do sed 's/^OPENTTDD.GRF = [0-9a-f]*$$/OPENTTDD.GRF = '`$(MD5SUM) $(BIN_DIR)/openttdd.grf | sed 's@ .*@@'`'/' $$grf > $$grf.tmp && mv $$grf.tmp $$grf; done
$(BIN_DIR)/openttdw.grf: $(PCX_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
@# Only try; if nforenum isn't available, just retouch the file as they likely didn't need it anyway.
@ -69,7 +72,7 @@ $(OBJS_DIR)/openttdw.grf: $(PCX_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
$(Q) $(NFORENUM) $(OBJS_DIR)/sprites/openttdw.nfo
$(Q) $(GRFCODEC) -e -p2 $(OBJS_DIR)/openttdw.grf
$(Q) cp $(OBJS_DIR)/openttdw.grf $(BIN_DIR)/openttdw.grf
$(Q) for grf in $(BIN_DIR)/orig_win.obg; do sed 's/^OPENTTDW.GRF = [0-9a-f]*$$/OPENTTDW.GRF = '`md5sum $(BIN_DIR)/openttdw.grf | sed 's@ .*@@'`'/' -i $$grf; done
$(Q) for grf in $(BIN_DIR)/orig_win.obg; do sed 's/^OPENTTDW.GRF = [0-9a-f]*$$/OPENTTDW.GRF = '`$(MD5SUM) $(BIN_DIR)/openttdw.grf | sed 's@ .*@@'`'/' $$grf > $$grf.tmp && mv $$grf.tmp $$grf; done
# Clean up temporary files.
clean:

View File

@ -3184,7 +3184,7 @@ showhelp() {
echo " --with-midi-arg=arg define which args to use for the"
echo " midi-player"
echo " --with-libtimidity enables libtimidity support"
echo " --with-allegrol[=allegro-config]"
echo " --with-allegro[=allegro-config]"
echo " enables Allegro video driver support"
echo " --with-cocoa enables COCOA video driver (OSX ONLY)"
echo " --with-sdl[=sdl-config] enables SDL video driver support"

View File

@ -946,39 +946,39 @@ static const NWidgetPart _nested_ai_debug_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_VIEW),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 1), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 1), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 2), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 2), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 3), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 3), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 4), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 4), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 5), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 5), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 6), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 6), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 7), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 7), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 8), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 8), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 9), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 9), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 10), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 10), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 11), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 11), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 12), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 12), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 13), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 13), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 14), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_COMPANY_BUTTON_START + 14), SetMinimalSize(37, 13), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_SELECT_AI_TOOLTIP),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(39, 0), SetResize(1, 0),
EndContainer(),

View File

@ -1466,7 +1466,7 @@ static NWidgetBase *MakeCompanyButtonRows(int *biggest_index)
NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum);
panel->SetMinimalSize(sprite_size.width, sprite_size.height);
panel->SetFill(1, 0);
panel->SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP);
panel->SetDataTip(0x0, STR_PERFORMANCE_DETAIL_SELECT_COMPANY_TOOLTIP);
hor->Add(panel);
hor_length++;
}

View File

@ -550,6 +550,7 @@ STR_PERFORMANCE_DETAIL_KEY :{BLACK}Detail
STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY :{BLACK}({CURRCOMPACT}/{CURRCOMPACT})
STR_PERFORMANCE_DETAIL_AMOUNT_INT :{BLACK}({COMMA}/{COMMA})
STR_PERFORMANCE_DETAIL_PERCENT :{WHITE}{NUM}%
STR_PERFORMANCE_DETAIL_SELECT_COMPANY_TOOLTIP :{BLACK}View details about this company
############ Those following lines need to be in this order!!
STR_PERFORMANCE_DETAIL_VEHICLES :{BLACK}Vehicles:
STR_PERFORMANCE_DETAIL_STATIONS :{BLACK}Stations:
@ -2385,6 +2386,7 @@ STR_NEWGRF_ERROR_INVALID_ID :Attempt to use
STR_NEWGRF_ERROR_CORRUPT_SPRITE :{YELLOW}{RAW_STRING} contains a corrupt sprite. All corrupt sprites will be shown as a red question mark (?).
STR_NEWGRF_ERROR_MULTIPLE_ACTION_8 :Contains multiple Action 8 entries.
STR_NEWGRF_ERROR_READ_BOUNDS :Read past end of pseudo-sprite.
STR_NEWGRF_ERROR_MISSING_SPRITES :{WHITE}The currently used base graphics set is missing a number of sprites.{}Please update the base graphics set.
# NewGRF related 'general' warnings
STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}Caution!
@ -3240,6 +3242,7 @@ STR_AI_DEBUG_SETTINGS :{BLACK}AI Setti
STR_AI_DEBUG_SETTINGS_TOOLTIP :{BLACK}Change the settings of the AI
STR_AI_DEBUG_RELOAD :{BLACK}Reload AI
STR_AI_DEBUG_RELOAD_TOOLTIP :{BLACK}Kill the AI, reload the script, and restart the AI
STR_AI_DEBUG_SELECT_AI_TOOLTIP :{BLACK}View debug output of this AI
STR_ERROR_NO_AI :{WHITE}OpenTTD is built without AI support...
STR_ERROR_NO_AI_SUB :{WHITE}... no AIs are available!

View File

@ -46,6 +46,7 @@
#include "core/alloc_type.hpp"
#include "core/mem_func.hpp"
#include "smallmap_gui.h"
#include "gui.h"
#include "table/strings.h"
#include "table/build_industry.h"
@ -3956,6 +3957,49 @@ static uint16 SanitizeSpriteOffset(uint16& num, uint16 offset, int max_sprites,
return 0;
}
/** The type of action 5 type. */
enum Action5BlockType {
A5BLOCK_FIXED, ///< Only allow replacing a whole block of sprites. (TTDP compatible)
A5BLOCK_ALLOW_OFFSET, ///< Allow replacing any subset by specifiing an offset.
A5BLOCK_INVALID, ///< unknown/not-implemented type
};
/** Information about a single action 5 type. */
struct Action5Type {
Action5BlockType block_type; ///< How is this Action5 type processed?
SpriteID sprite_base; ///< Load the sprites starting from this sprite.
uint16 min_sprites; ///< If the Action5 contains less sprites, the whole block will be ignored.
uint16 max_sprites; ///< If the Action5 contains more sprites, only the first max_sprites sprites will be used.
const char *name; ///< Name for error messages.
};
/** The information about action 5 types. */
static const Action5Type _action5_types[] = {
/* Note: min_sprites should not be changed. Therefore these constants are directly here and not in sprites.h */
/* 0x00 */ { A5BLOCK_INVALID, 0, 0, 0, "Type 0x00" },
/* 0x01 */ { A5BLOCK_INVALID, 0, 0, 0, "Type 0x01" },
/* 0x02 */ { A5BLOCK_INVALID, 0, 0, 0, "Type 0x02" },
/* 0x03 */ { A5BLOCK_INVALID, 0, 0, 0, "Type 0x03" },
/* 0x04 */ { A5BLOCK_FIXED, SPR_SIGNALS_BASE, 48, PRESIGNAL_SEMAPHORE_AND_PBS_SPRITE_COUNT, "Signal graphics" },
/* 0x05 */ { A5BLOCK_FIXED, SPR_ELRAIL_BASE, 48, ELRAIL_SPRITE_COUNT, "Catenary graphics" },
/* 0x06 */ { A5BLOCK_FIXED, SPR_SLOPES_BASE, 74, NORMAL_AND_HALFTILE_FOUNDATION_SPRITE_COUNT, "Foundation graphics" },
/* 0x07 */ { A5BLOCK_INVALID, 0, 75, 0, "TTDP GUI graphics" }, // Not used by OTTD.
/* 0x08 */ { A5BLOCK_FIXED, SPR_CANALS_BASE, 65, CANALS_SPRITE_COUNT, "Canal graphics" },
/* 0x09 */ { A5BLOCK_FIXED, SPR_ONEWAY_BASE, 6, ONEWAY_SPRITE_COUNT, "One way road graphics" },
/* 0x0A */ { A5BLOCK_FIXED, SPR_2CCMAP_BASE, 256, TWOCCMAP_SPRITE_COUNT, "2CC colour maps" },
/* 0x0B */ { A5BLOCK_FIXED, SPR_TRAMWAY_BASE, 113, TRAMWAY_SPRITE_COUNT, "Tramway graphics" },
/* 0x0C */ { A5BLOCK_INVALID, 0, 133, 0, "Snowy temperate tree" }, // Not yet used by OTTD.
/* 0x0D */ { A5BLOCK_FIXED, SPR_SHORE_BASE, 16, SPR_SHORE_SPRITE_COUNT, "Shore graphics" },
/* 0x0E */ { A5BLOCK_INVALID, 0, 0, 0, "New Signals graphics" }, // Not yet used by OTTD.
/* 0x0F */ { A5BLOCK_FIXED, SPR_TRACKS_FOR_SLOPES_BASE, 12, TRACKS_FOR_SLOPES_SPRITE_COUNT, "Sloped rail track" },
/* 0x10 */ { A5BLOCK_FIXED, SPR_AIRPORTX_BASE, 15, AIRPORTX_SPRITE_COUNT, "Airport graphics" },
/* 0x11 */ { A5BLOCK_FIXED, SPR_ROADSTOP_BASE, 8, ROADSTOP_SPRITE_COUNT, "Road stop graphics" },
/* 0x12 */ { A5BLOCK_FIXED, SPR_AQUEDUCT_BASE, 8, AQUEDUCT_SPRITE_COUNT, "Aqueduct graphics" },
/* 0x13 */ { A5BLOCK_FIXED, SPR_AUTORAIL_BASE, 55, AUTORAIL_SPRITE_COUNT, "Autorail graphics" },
/* 0x14 */ { A5BLOCK_ALLOW_OFFSET, SPR_FLAGS_BASE, 1, FLAGS_SPRITE_COUNT, "Flag graphics" },
/* 0x15 */ { A5BLOCK_ALLOW_OFFSET, SPR_OPENTTD_BASE, 1, OPENTTD_SPRITE_COUNT, "OpenTTD GUI graphics" },
};
/* Action 0x05 */
static void GraphicsNew(ByteReader *buf)
{
@ -3966,45 +4010,6 @@ static void GraphicsNew(ByteReader *buf)
* V other data Graphics type specific data. Currently unused. */
/* TODO */
enum Action5BlockType {
A5BLOCK_FIXED, ///< Only allow replacing a whole block of sprites. (TTDP compatible)
A5BLOCK_ALLOW_OFFSET, ///< Allow replacing any subset by specifiing an offset.
A5BLOCK_INVALID, ///< unknown/not-implemented type
};
struct Action5Type {
Action5BlockType block_type; ///< How is this Action5 type processed?
SpriteID sprite_base; ///< Load the sprites starting from this sprite.
uint16 min_sprites; ///< If the Action5 contains less sprites, the whole block will be ignored.
uint16 max_sprites; ///< If the Action5 contains more sprites, only the first max_sprites sprites will be used.
const char *name; ///< Name for error messages.
};
static const Action5Type action5_types[] = {
/* Note: min_sprites should not be changed. Therefore these constants are directly here and not in sprites.h */
/* 0x00 */ { A5BLOCK_INVALID, 0, 0, 0, "Type 0x00" },
/* 0x01 */ { A5BLOCK_INVALID, 0, 0, 0, "Type 0x01" },
/* 0x02 */ { A5BLOCK_INVALID, 0, 0, 0, "Type 0x02" },
/* 0x03 */ { A5BLOCK_INVALID, 0, 0, 0, "Type 0x03" },
/* 0x04 */ { A5BLOCK_FIXED, SPR_SIGNALS_BASE, 48, PRESIGNAL_SEMAPHORE_AND_PBS_SPRITE_COUNT, "Signal graphics" },
/* 0x05 */ { A5BLOCK_FIXED, SPR_ELRAIL_BASE, 48, ELRAIL_SPRITE_COUNT, "Catenary graphics" },
/* 0x06 */ { A5BLOCK_FIXED, SPR_SLOPES_BASE, 74, NORMAL_AND_HALFTILE_FOUNDATION_SPRITE_COUNT, "Foundation graphics" },
/* 0x07 */ { A5BLOCK_INVALID, 0, 75, 0, "TTDP GUI graphics" }, // Not used by OTTD.
/* 0x08 */ { A5BLOCK_FIXED, SPR_CANALS_BASE, 65, CANALS_SPRITE_COUNT, "Canal graphics" },
/* 0x09 */ { A5BLOCK_FIXED, SPR_ONEWAY_BASE, 6, ONEWAY_SPRITE_COUNT, "One way road graphics" },
/* 0x0A */ { A5BLOCK_FIXED, SPR_2CCMAP_BASE, 256, TWOCCMAP_SPRITE_COUNT, "2CC colour maps" },
/* 0x0B */ { A5BLOCK_FIXED, SPR_TRAMWAY_BASE, 113, TRAMWAY_SPRITE_COUNT, "Tramway graphics" },
/* 0x0C */ { A5BLOCK_INVALID, 0, 133, 0, "Snowy temperate tree" }, // Not yet used by OTTD.
/* 0x0D */ { A5BLOCK_FIXED, SPR_SHORE_BASE, 16, SPR_SHORE_SPRITE_COUNT, "Shore graphics" },
/* 0x0E */ { A5BLOCK_INVALID, 0, 0, 0, "New Signals graphics" }, // Not yet used by OTTD.
/* 0x0F */ { A5BLOCK_FIXED, SPR_TRACKS_FOR_SLOPES_BASE, 12, TRACKS_FOR_SLOPES_SPRITE_COUNT, "Sloped rail track" },
/* 0x10 */ { A5BLOCK_FIXED, SPR_AIRPORTX_BASE, 15, AIRPORTX_SPRITE_COUNT, "Airport graphics" },
/* 0x11 */ { A5BLOCK_FIXED, SPR_ROADSTOP_BASE, 8, ROADSTOP_SPRITE_COUNT, "Road stop graphics" },
/* 0x12 */ { A5BLOCK_FIXED, SPR_AQUEDUCT_BASE, 8, AQUEDUCT_SPRITE_COUNT, "Aqueduct graphics" },
/* 0x13 */ { A5BLOCK_FIXED, SPR_AUTORAIL_BASE, 55, AUTORAIL_SPRITE_COUNT, "Autorail graphics" },
/* 0x14 */ { A5BLOCK_ALLOW_OFFSET, SPR_FLAGS_BASE, 1, FLAGS_SPRITE_COUNT, "Flag graphics" },
/* 0x15 */ { A5BLOCK_ALLOW_OFFSET, SPR_OPENTTD_BASE, 1, OPENTTD_SPRITE_COUNT, "OpenTTD GUI graphics" },
};
uint8 type = buf->ReadByte();
uint16 num = buf->ReadExtended();
uint16 offset = HasBit(type, 7) ? buf->ReadExtended() : 0;
@ -4029,13 +4034,13 @@ static void GraphicsNew(ByteReader *buf)
}
/* Supported type? */
if ((type >= lengthof(action5_types)) || (action5_types[type].block_type == A5BLOCK_INVALID)) {
if ((type >= lengthof(_action5_types)) || (_action5_types[type].block_type == A5BLOCK_INVALID)) {
grfmsg(2, "GraphicsNew: Custom graphics (type 0x%02X) sprite block of length %u (unimplemented, ignoring)", type, num);
_skip_sprites = num;
return;
}
const Action5Type *action5_type = &action5_types[type];
const Action5Type *action5_type = &_action5_types[type];
/* Ignore offset if not allowed */
if ((action5_type->block_type != A5BLOCK_ALLOW_OFFSET) && (offset != 0)) {
@ -4080,6 +4085,35 @@ static void SkipAct5(ByteReader *buf)
grfmsg(3, "SkipAct5: Skipping %d sprites", _skip_sprites);
}
/**
* Check whether we are (obviously) missing some of the extra
* (Action 0x05) sprites that we like to use.
* When missing sprites are found a warning will be shown.
*/
void CheckForMissingSprites()
{
/* Don't break out quickly, but allow to check the other
* sprites as well, so we can give the best information. */
bool missing = false;
for (uint8 i = 0; i < lengthof(_action5_types); i++) {
const Action5Type *type = &_action5_types[i];
if (type->block_type == A5BLOCK_INVALID) continue;
for (uint j = 0; j < type->max_sprites; j++) {
if (!SpriteExists(type->sprite_base + j)) {
DEBUG(grf, 0, "%s sprites are missing", type->name);
missing = true;
/* No need to log more of the same. */
break;
}
}
}
if (missing) {
ShowErrorMessage(STR_NEWGRF_ERROR_MISSING_SPRITES, INVALID_STRING_ID, 0, 0, true);
}
}
/**
* Reads a variable common to VarAction2 and Action7/9/D.
*

View File

@ -94,6 +94,7 @@ extern GRFConfig *_grfconfig_newgame; ///< First item in list of default GRF set
extern GRFConfig *_grfconfig_static; ///< First item in list of static GRF set up
void ScanNewGRFFiles();
void CheckForMissingSprites();
const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum = NULL);
GRFConfig *GetGRFConfig(uint32 grfid, uint32 mask = 0xFFFFFFFF);
GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src, bool init_only);

View File

@ -377,6 +377,7 @@ static void LoadIntroGame()
_pause_mode = PM_UNPAUSED;
_cursor.fix_at = false;
CheckForMissingSprites();
CheckForMissingGlyphsInLoadedLanguagePack();
/* Play main theme */

View File

@ -2072,6 +2072,26 @@ bool AfterLoadGame()
}
}
/* In old versions it was possible to remove an airport while a plane was
* taking off or landing. This gives all kind of problems when building
* another airport in the same station so we don't allow that anymore.
* For old savegames with such aircraft we just throw them in the air and
* treat the aircraft like they were flying already. */
if (CheckSavegameVersion(146)) {
Aircraft *v;
FOR_ALL_AIRCRAFT(v) {
if (!v->IsNormalAircraft()) continue;
Station *st = GetTargetAirportIfValid(v);
if (st == NULL && v->state != FLYING) {
v->state = FLYING;
UpdateAircraftCache(v);
AircraftNextAirportPos_and_Order(v);
/* get aircraft back on running altitude */
if ((v->vehstatus & VS_CRASHED) == 0) SetAircraftPosition(v, v->x_pos, v->y_pos, GetAircraftFlyingAltitude(v));
}
}
}
/* Road stops is 'only' updating some caches */
AfterLoadRoadStops();
AfterLoadLabelMaps();