(svn r24423) [1.2] -Backport from trunk:

- Fix: ReInit could crash for windows with NWidgetMatrix widgets [FS#5218] (r24378)
- Fix: [NewGRF] Extended action A1 did not work correctly [FS#5227] (r24369, r24361)
- Fix: Add C(XX)FLAGS_BUILD to all the executables that are compiled for the build enviroment (r24365)
- Fix: [NewGRF] Ship-specific 80+x variables were missing for unknown reason [FS#5224] (r24360)
This commit is contained in:
rubidium 2012-07-20 19:42:00 +00:00
parent 975b6de604
commit b704037039
6 changed files with 42 additions and 23 deletions

View File

@ -14,6 +14,7 @@ LANGS_SRC = $(shell ls $(LANG_DIR)/*.txt)
LANGS = $(LANGS_SRC:$(LANG_DIR)/%.txt=%.lng)
CXX_BUILD = !!CXX_BUILD!!
CFLAGS_BUILD = !!CFLAGS_BUILD!!
CXXFLAGS_BUILD= !!CXXFLAGS_BUILD!!
LDFLAGS_BUILD = !!LDFLAGS_BUILD!!
STRGEN_FLAGS = !!STRGEN_FLAGS!!
STAGE = !!STAGE!!
@ -44,23 +45,23 @@ all: table/strings.h $(LANGS)
strgen_base.o: $(SRC_DIR)/strgen/strgen_base.cpp $(SRC_DIR)/strgen/strgen.h endian_host.h $(SRC_DIR)/table/control_codes.h $(SRC_DIR)/table/strgen_tables.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
strgen.o: $(SRC_DIR)/strgen/strgen.cpp $(SRC_DIR)/strgen/strgen.h endian_host.h $(SRC_DIR)/table/control_codes.h $(SRC_DIR)/table/strgen_tables.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
string.o: $(SRC_DIR)/string.cpp endian_host.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
alloc_func.o: $(SRC_DIR)/core/alloc_func.cpp endian_host.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
getoptdata.o: $(SRC_DIR)/misc/getoptdata.cpp $(SRC_DIR)/misc/getoptdata.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/misc/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSTRGEN -c -o $@ $<
lang/english.txt: $(LANG_DIR)/english.txt
$(Q)mkdir -p lang
@ -68,7 +69,7 @@ lang/english.txt: $(LANG_DIR)/english.txt
$(STRGEN): alloc_func.o string.o strgen_base.o strgen.o getoptdata.o
$(E) '$(STAGE) Compiling and Linking $@'
$(Q)$(CXX_BUILD) $(LDFLAGS_BUILD) $^ -o $@
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) $^ -o $@
table/strings.h: lang/english.txt $(STRGEN)
$(E) '$(STAGE) Generating $@'
@ -87,7 +88,7 @@ endian_host.h: $(ENDIAN_CHECK)
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
$(E) '$(STAGE) Compiling and Linking $@'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $< -o $@
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) $< -o $@
depend:

View File

@ -10,6 +10,7 @@ ENDIAN_CHECK = !!ENDIAN_CHECK!!
SRC_DIR = !!SRC_DIR!!
CXX_BUILD = !!CXX_BUILD!!
CFLAGS_BUILD = !!CFLAGS_BUILD!!
CXXFLAGS_BUILD = !!CXXFLAGS_BUILD!!
LDFLAGS_BUILD = !!LDFLAGS_BUILD!!
STAGE = !!STAGE!!
SETTING_OBJS_DIR = !!SETTING_OBJS_DIR!!
@ -29,27 +30,27 @@ all: table/settings.h
settingsgen.o: $(SRC_DIR)/settingsgen/settingsgen.cpp $(SRC_DIR)/string_func.h $(SRC_DIR)/strings_type.h $(SRC_DIR)/misc/getoptdata.h $(SRC_DIR)/ini_type.h $(SRC_DIR)/core/smallvec_type.hpp
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
alloc_func.o: $(SRC_DIR)/core/alloc_func.cpp endian_host.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
getoptdata.o: $(SRC_DIR)/misc/getoptdata.cpp $(SRC_DIR)/misc/getoptdata.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/misc/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
string.o: $(SRC_DIR)/string.cpp endian_host.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
ini_load.o: $(SRC_DIR)/ini_load.cpp $(SRC_DIR)/core/alloc_func.hpp $(SRC_DIR)/core/mem_func.hpp $(SRC_DIR)/ini_type.h $(SRC_DIR)/string_func.h
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) -DSETTINGSGEN -c -o $@ $<
$(SETTINGSGEN): alloc_func.o string.o ini_load.o settingsgen.o getoptdata.o
$(E) '$(STAGE) Compiling and Linking $@'
$(Q)$(CXX_BUILD) $(LDFLAGS_BUILD) $^ -o $@
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) $^ -o $@
table/settings.h: $(SETTINGSGEN) $(SRC_DIR)/table/settings.h.preamble $(SRC_DIR)/table/settings.h.postamble $(SRC_DIR)/table/*.ini
$(E) '$(STAGE) Generating $@'
@ -64,7 +65,7 @@ endian_host.h: $(ENDIAN_CHECK)
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
$(E) '$(STAGE) Compiling and Linking $@'
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $< -o $@
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) $< -o $@
depend:

View File

@ -1771,6 +1771,7 @@ make_cflags_and_ldflags() {
if [ "$enable_assert" = "0" ]; then
CFLAGS="$CFLAGS -DNDEBUG"
CFLAGS_BUILD="$CFLAGS_BUILD -DNDEBUG"
fi
if [ "$enable_desync_debug" != "0" ]; then

View File

@ -4384,11 +4384,13 @@ static void ReserveChangeInfo(ByteReader *buf)
/* Action 0x01 */
static void NewSpriteSet(ByteReader *buf)
{
/* <01> <feature> <num-sets> <num-ent>
/* Basic format: <01> <feature> <num-sets> <num-ent>
* Extended format: <01> <feature> 00 <first-set> <num-sets> <num-ent>
*
* B feature feature to define sprites for
* 0, 1, 2, 3: veh-type, 4: train stations
* B num-sets number of sprite sets
* E first-set first sprite set to define
* B num-sets number of sprite sets (extended byte in extended format)
* E num-ent how many entries per sprite set
* For vehicles, this is the number of different
* vehicle directions in each sprite set
@ -4396,11 +4398,11 @@ static void NewSpriteSet(ByteReader *buf)
* In that case, use num-dirs=4.
*/
uint8 feature = buf->ReadByte();
uint8 num_sets = buf->ReadByte();
uint8 feature = buf->ReadByte();
uint16 num_sets = buf->ReadByte();
uint16 first_set = 0;
if (num_sets == 0 && buf->HasData(2)) {
if (num_sets == 0 && buf->HasData(3)) {
/* Extended Action1 format.
* Some GRFs define zero sets of zero sprites, though there is actually no use in that. Ignore them. */
first_set = buf->ReadExtendedByte();
@ -4424,7 +4426,14 @@ static void NewSpriteSet(ByteReader *buf)
static void SkipAct1(ByteReader *buf)
{
buf->ReadByte();
uint8 num_sets = buf->ReadByte();
uint16 num_sets = buf->ReadByte();
if (num_sets == 0 && buf->HasData(3)) {
/* Extended Action1 format.
* Some GRFs define zero sets of zero sprites, though there is actually no use in that. Ignore them. */
buf->ReadExtendedByte(); // first_set
num_sets = buf->ReadExtendedByte();
}
uint16 num_ents = buf->ReadExtendedByte();
_cur.skip_sprites = num_sets * num_ents;

View File

@ -23,6 +23,7 @@
#include "station_base.h"
#include "company_base.h"
#include "newgrf_railtype.h"
#include "ship.h"
struct WagonOverride {
EngineID *train_id;
@ -830,6 +831,14 @@ static uint32 VehicleGetVariable(Vehicle *v, const ResolverObject *object, byte
break;
}
case VEH_SHIP: {
Ship *s = Ship::From(v);
switch (variable - 0x80) {
case 0x62: return s->state;
}
break;
}
case VEH_AIRCRAFT: {
Aircraft *a = Aircraft::From(v);
switch (variable - 0x80) {

View File

@ -1528,9 +1528,7 @@ void NWidgetMatrix::AssignSizePosition(SizingType sizing, uint x, uint y, uint g
/* When resizing, update the scrollbar's count. E.g. with a vertical
* scrollbar becoming wider or narrower means the amount of rows in
* the scrollbar becomes respectively smaller or higher. */
if (sizing == ST_RESIZE) {
this->SetCount(this->count);
}
this->SetCount(this->count);
}
void NWidgetMatrix::FillNestedArray(NWidgetBase **array, uint length)