Debug: Show if action 2s have been modified by action 6 in debug window
This commit is contained in:
@@ -423,6 +423,7 @@ struct GRFLocation {
|
|||||||
static btree::btree_map<GRFLocation, SpriteID> _grm_sprites;
|
static btree::btree_map<GRFLocation, SpriteID> _grm_sprites;
|
||||||
typedef btree::btree_map<GRFLocation, byte*> GRFLineToSpriteOverride;
|
typedef btree::btree_map<GRFLocation, byte*> GRFLineToSpriteOverride;
|
||||||
static GRFLineToSpriteOverride _grf_line_to_action6_sprite_override;
|
static GRFLineToSpriteOverride _grf_line_to_action6_sprite_override;
|
||||||
|
static bool _action6_override_active = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEBUG() function dedicated to newGRF debugging messages
|
* DEBUG() function dedicated to newGRF debugging messages
|
||||||
@@ -7594,6 +7595,7 @@ static void NewSpriteGroup(ByteReader *buf)
|
|||||||
DeterministicSpriteGroup *group = new DeterministicSpriteGroup();
|
DeterministicSpriteGroup *group = new DeterministicSpriteGroup();
|
||||||
group->nfo_line = _cur.nfo_line;
|
group->nfo_line = _cur.nfo_line;
|
||||||
group->feature = feature;
|
group->feature = feature;
|
||||||
|
if (_action6_override_active) group->sg_flags |= SGF_ACTION6;
|
||||||
act_group = group;
|
act_group = group;
|
||||||
group->var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
|
group->var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
|
||||||
|
|
||||||
@@ -7714,6 +7716,7 @@ static void NewSpriteGroup(ByteReader *buf)
|
|||||||
assert(RandomizedSpriteGroup::CanAllocateItem());
|
assert(RandomizedSpriteGroup::CanAllocateItem());
|
||||||
RandomizedSpriteGroup *group = new RandomizedSpriteGroup();
|
RandomizedSpriteGroup *group = new RandomizedSpriteGroup();
|
||||||
group->nfo_line = _cur.nfo_line;
|
group->nfo_line = _cur.nfo_line;
|
||||||
|
if (_action6_override_active) group->sg_flags |= SGF_ACTION6;
|
||||||
act_group = group;
|
act_group = group;
|
||||||
group->var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
|
group->var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
|
||||||
|
|
||||||
@@ -7821,6 +7824,7 @@ static void NewSpriteGroup(ByteReader *buf)
|
|||||||
assert(RealSpriteGroup::CanAllocateItem());
|
assert(RealSpriteGroup::CanAllocateItem());
|
||||||
RealSpriteGroup *group = new RealSpriteGroup();
|
RealSpriteGroup *group = new RealSpriteGroup();
|
||||||
group->nfo_line = _cur.nfo_line;
|
group->nfo_line = _cur.nfo_line;
|
||||||
|
if (_action6_override_active) group->sg_flags |= SGF_ACTION6;
|
||||||
act_group = group;
|
act_group = group;
|
||||||
|
|
||||||
for (uint16 spriteid : loaded) {
|
for (uint16 spriteid : loaded) {
|
||||||
@@ -7846,6 +7850,7 @@ static void NewSpriteGroup(ByteReader *buf)
|
|||||||
assert(TileLayoutSpriteGroup::CanAllocateItem());
|
assert(TileLayoutSpriteGroup::CanAllocateItem());
|
||||||
TileLayoutSpriteGroup *group = new TileLayoutSpriteGroup();
|
TileLayoutSpriteGroup *group = new TileLayoutSpriteGroup();
|
||||||
group->nfo_line = _cur.nfo_line;
|
group->nfo_line = _cur.nfo_line;
|
||||||
|
if (_action6_override_active) group->sg_flags |= SGF_ACTION6;
|
||||||
act_group = group;
|
act_group = group;
|
||||||
|
|
||||||
/* On error, bail out immediately. Temporary GRF data was already freed */
|
/* On error, bail out immediately. Temporary GRF data was already freed */
|
||||||
@@ -7862,6 +7867,7 @@ static void NewSpriteGroup(ByteReader *buf)
|
|||||||
assert(IndustryProductionSpriteGroup::CanAllocateItem());
|
assert(IndustryProductionSpriteGroup::CanAllocateItem());
|
||||||
IndustryProductionSpriteGroup *group = new IndustryProductionSpriteGroup();
|
IndustryProductionSpriteGroup *group = new IndustryProductionSpriteGroup();
|
||||||
group->nfo_line = _cur.nfo_line;
|
group->nfo_line = _cur.nfo_line;
|
||||||
|
if (_action6_override_active) group->sg_flags |= SGF_ACTION6;
|
||||||
act_group = group;
|
act_group = group;
|
||||||
group->version = type;
|
group->version = type;
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
@@ -12715,6 +12721,7 @@ static void DecodeSpecialSprite(byte *buf, uint num, GrfLoadingStage stage)
|
|||||||
GRFLocation location(_cur.grfconfig->ident.grfid, _cur.nfo_line);
|
GRFLocation location(_cur.grfconfig->ident.grfid, _cur.nfo_line);
|
||||||
|
|
||||||
GRFLineToSpriteOverride::iterator it = _grf_line_to_action6_sprite_override.find(location);
|
GRFLineToSpriteOverride::iterator it = _grf_line_to_action6_sprite_override.find(location);
|
||||||
|
_action6_override_active = (it != _grf_line_to_action6_sprite_override.end());
|
||||||
if (it == _grf_line_to_action6_sprite_override.end()) {
|
if (it == _grf_line_to_action6_sprite_override.end()) {
|
||||||
/* No preloaded sprite to work with; read the
|
/* No preloaded sprite to work with; read the
|
||||||
* pseudo sprite content. */
|
* pseudo sprite content. */
|
||||||
|
@@ -798,11 +798,14 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, int padding, uint
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
char extra_info[64] = "";
|
||||||
|
if (sg->sg_flags & SGF_ACTION6) strecat(extra_info, " (action 6 modified)", lastof(extra_info));
|
||||||
|
|
||||||
switch (sg->type) {
|
switch (sg->type) {
|
||||||
case SGT_REAL: {
|
case SGT_REAL: {
|
||||||
const RealSpriteGroup *rsg = (const RealSpriteGroup*)sg;
|
const RealSpriteGroup *rsg = (const RealSpriteGroup*)sg;
|
||||||
seprintf(this->buffer, lastof(this->buffer), "%*sReal (loaded: %u, loading: %u) [%u]",
|
seprintf(this->buffer, lastof(this->buffer), "%*sReal (loaded: %u, loading: %u)%s [%u]",
|
||||||
padding, "", (uint)rsg->loaded.size(), (uint)rsg->loading.size(), sg->nfo_line);
|
padding, "", (uint)rsg->loaded.size(), (uint)rsg->loading.size(), extra_info, sg->nfo_line);
|
||||||
print();
|
print();
|
||||||
emit_start();
|
emit_start();
|
||||||
for (size_t i = 0; i < rsg->loaded.size(); i++) {
|
for (size_t i = 0; i < rsg->loaded.size(); i++) {
|
||||||
@@ -849,8 +852,8 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, int padding, uint
|
|||||||
print();
|
print();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
seprintf(this->buffer, lastof(this->buffer), "%*sDeterministic (%s, %s), [%u]",
|
seprintf(this->buffer, lastof(this->buffer), "%*sDeterministic (%s, %s)%s [%u]",
|
||||||
padding, "", _sg_scope_names[dsg->var_scope], _sg_size_names[dsg->size], dsg->nfo_line);
|
padding, "", _sg_scope_names[dsg->var_scope], _sg_size_names[dsg->size], extra_info, dsg->nfo_line);
|
||||||
print();
|
print();
|
||||||
emit_start();
|
emit_start();
|
||||||
padding += 2;
|
padding += 2;
|
||||||
@@ -890,9 +893,9 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, int padding, uint
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
seprintf(this->buffer, lastof(this->buffer), "%*sRandom (%s, %s, triggers: %X, count: %X, lowest_randbit: %X, groups: %u) [%u]",
|
seprintf(this->buffer, lastof(this->buffer), "%*sRandom (%s, %s, triggers: %X, count: %X, lowest_randbit: %X, groups: %u)%s [%u]",
|
||||||
padding, "", _sg_scope_names[rsg->var_scope], rsg->cmp_mode == RSG_CMP_ANY ? "ANY" : "ALL",
|
padding, "", _sg_scope_names[rsg->var_scope], rsg->cmp_mode == RSG_CMP_ANY ? "ANY" : "ALL",
|
||||||
rsg->triggers, rsg->count, rsg->lowest_randbit, (uint)rsg->groups.size(), rsg->nfo_line);
|
rsg->triggers, rsg->count, rsg->lowest_randbit, (uint)rsg->groups.size(), extra_info, rsg->nfo_line);
|
||||||
print();
|
print();
|
||||||
emit_start();
|
emit_start();
|
||||||
for (const auto &group : (*groups)) {
|
for (const auto &group : (*groups)) {
|
||||||
@@ -911,7 +914,7 @@ void SpriteGroupDumper::DumpSpriteGroup(const SpriteGroup *sg, int padding, uint
|
|||||||
break;
|
break;
|
||||||
case SGT_TILELAYOUT: {
|
case SGT_TILELAYOUT: {
|
||||||
const TileLayoutSpriteGroup *tlsg = (const TileLayoutSpriteGroup*)sg;
|
const TileLayoutSpriteGroup *tlsg = (const TileLayoutSpriteGroup*)sg;
|
||||||
seprintf(this->buffer, lastof(this->buffer), "%*sTile Layout [%u]", padding, "", sg->nfo_line);
|
seprintf(this->buffer, lastof(this->buffer), "%*sTile Layout%s [%u]", padding, "", extra_info, sg->nfo_line);
|
||||||
print();
|
print();
|
||||||
emit_start();
|
emit_start();
|
||||||
padding += 2;
|
padding += 2;
|
||||||
|
@@ -94,6 +94,12 @@ struct AnalyseCallbackOperation {
|
|||||||
typedef Pool<SpriteGroup, SpriteGroupID, 1024, 1 << 30, PT_DATA> SpriteGroupPool;
|
typedef Pool<SpriteGroup, SpriteGroupID, 1024, 1 << 30, PT_DATA> SpriteGroupPool;
|
||||||
extern SpriteGroupPool _spritegroup_pool;
|
extern SpriteGroupPool _spritegroup_pool;
|
||||||
|
|
||||||
|
enum SpriteGroupFlags : uint8 {
|
||||||
|
SGF_NONE = 0,
|
||||||
|
SGF_ACTION6 = 1 << 0,
|
||||||
|
};
|
||||||
|
DECLARE_ENUM_AS_BIT_SET(SpriteGroupFlags)
|
||||||
|
|
||||||
/* Common wrapper for all the different sprite group types */
|
/* Common wrapper for all the different sprite group types */
|
||||||
struct SpriteGroup : SpriteGroupPool::PoolItem<&_spritegroup_pool> {
|
struct SpriteGroup : SpriteGroupPool::PoolItem<&_spritegroup_pool> {
|
||||||
protected:
|
protected:
|
||||||
@@ -107,6 +113,7 @@ public:
|
|||||||
uint32 nfo_line;
|
uint32 nfo_line;
|
||||||
SpriteGroupType type;
|
SpriteGroupType type;
|
||||||
GrfSpecFeature feature;
|
GrfSpecFeature feature;
|
||||||
|
SpriteGroupFlags sg_flags = SGF_NONE;
|
||||||
|
|
||||||
virtual SpriteID GetResult() const { return 0; }
|
virtual SpriteID GetResult() const { return 0; }
|
||||||
virtual byte GetNumResults() const { return 0; }
|
virtual byte GetNumResults() const { return 0; }
|
||||||
|
Reference in New Issue
Block a user