Only include TBTR debug functions when debugging enabled.
Add an initial prefix for clarity. Fix log print format codes.
This commit is contained in:
@@ -45,43 +45,50 @@
|
||||
Vehicle *vhead, *vtmp;
|
||||
static const uint MAX_ARTICULATED_PARTS = 100;
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
// debugging printing functions for convenience, usually called from gdb
|
||||
void pat() {
|
||||
void tbtr_debug_pat()
|
||||
{
|
||||
TemplateVehicle *tv;
|
||||
FOR_ALL_TEMPLATES(tv) {
|
||||
if ( tv->Prev() ) continue;
|
||||
ptv(tv);
|
||||
if (tv->Prev()) continue;
|
||||
tbtr_debug_ptv(tv);
|
||||
printf("__________\n");
|
||||
}
|
||||
}
|
||||
void pav() {
|
||||
Train *t;
|
||||
FOR_ALL_TRAINS(t) {
|
||||
if ( t->Previous() ) continue;
|
||||
pvt(t);
|
||||
printf("__________\n");
|
||||
}
|
||||
}
|
||||
void ptv(TemplateVehicle* tv) {
|
||||
if (!tv) return;
|
||||
while (tv->Next() ) {
|
||||
printf("eid:%3d st:%2d tv:%x next:%x cargo: %d cargo_sub: %d\n", tv->engine_type, tv->subtype, tv, tv->Next(), tv->cargo_type, tv->cargo_subtype);
|
||||
tv = tv->Next();
|
||||
}
|
||||
printf("eid:%3d st:%2d tv:%x next:%x cargo: %d cargo_sub: %d\n", tv->engine_type, tv->subtype, tv, tv->Next(), tv->cargo_type, tv->cargo_subtype);
|
||||
}
|
||||
|
||||
void pvt (const Train *printme) {
|
||||
for ( const Train *tmp = printme; tmp; tmp=tmp->Next() ) {
|
||||
if ( tmp->index <= 0 ) {
|
||||
printf("train has weird index: %d %d %x\n", tmp->index, tmp->engine_type, (__int64)tmp);
|
||||
return;
|
||||
}
|
||||
printf("eid:%3d index:%2d subtype:%2d vehstat: %d cargo_t: %d cargo_sub: %d ref:%x\n", tmp->engine_type, tmp->index, tmp->subtype, tmp->vehstatus, tmp->cargo_type, tmp->cargo_subtype, tmp);
|
||||
void tbtr_debug_pav()
|
||||
{
|
||||
Train *t;
|
||||
FOR_ALL_TRAINS(t) {
|
||||
if (t->Previous()) continue;
|
||||
tbtr_debug_pvt(t);
|
||||
printf("__________\n");
|
||||
}
|
||||
}
|
||||
|
||||
void tbtr_debug_ptv(TemplateVehicle* tv)
|
||||
{
|
||||
if (!tv) return;
|
||||
while (tv->Next() ) {
|
||||
printf("eid:%3d st:%2d tv:%p next:%p cargo: %d cargo_sub: %d\n", tv->engine_type, tv->subtype, tv, tv->Next(), tv->cargo_type, tv->cargo_subtype);
|
||||
tv = tv->Next();
|
||||
}
|
||||
printf("eid:%3d st:%2d tv:%p next:%p cargo: %d cargo_sub: %d\n", tv->engine_type, tv->subtype, tv, tv->Next(), tv->cargo_type, tv->cargo_subtype);
|
||||
}
|
||||
|
||||
void tbtr_debug_pvt (const Train *printme)
|
||||
{
|
||||
for (const Train *tmp = printme; tmp; tmp = tmp->Next()) {
|
||||
if (tmp->index <= 0) {
|
||||
printf("train has weird index: %d %d %p\n", tmp->index, tmp->engine_type, tmp);
|
||||
return;
|
||||
}
|
||||
printf("eid:%3d index:%2d subtype:%2d vehstat: %d cargo_t: %d cargo_sub: %d ref:%p\n", tmp->engine_type, tmp->index, tmp->subtype, tmp->vehstatus, tmp->cargo_type, tmp->cargo_subtype, tmp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void BuildTemplateGuiList(GUITemplateList *list, Scrollbar *vscroll, Owner oid, RailType railtype)
|
||||
{
|
||||
list->Clear();
|
||||
|
@@ -48,11 +48,14 @@ Train* DeleteVirtualTrain(Train*, Train *);
|
||||
|
||||
CommandCost CmdTemplateReplaceVehicle(Train*, bool, DoCommandFlag);
|
||||
|
||||
void pat();
|
||||
void pav();
|
||||
void ptv(TemplateVehicle*);
|
||||
void pvt(const Train*);
|
||||
#ifdef _DEBUG
|
||||
// for testing
|
||||
void tbtr_debug_pat();
|
||||
void tbtr_debug_pav();
|
||||
void tbtr_debug_ptv(TemplateVehicle*);
|
||||
void tbtr_debug_pvt(const Train*);
|
||||
#endif
|
||||
|
||||
TemplateVehicle* GetTemplateVehicleByGroupID(GroupID);
|
||||
bool ChainContainsVehicle(Train*, Train*);
|
||||
Train* ChainContainsEngine(EngineID, Train*);
|
||||
|
Reference in New Issue
Block a user