diff options
author | Darkvater <Darkvater@openttd.org> | 2006-04-22 13:56:16 +0000 |
---|---|---|
committer | Darkvater <Darkvater@openttd.org> | 2006-04-22 13:56:16 +0000 |
commit | 0a0b8f22aa45e7c87d86a0f0c54f1878b9c80cae (patch) | |
tree | f8cd633aad6536932155068f74bc9f8e1a346ebb | |
parent | 3d409cc986a758d119181eb351ef795b6b260234 (diff) | |
download | openttd-0a0b8f22aa45e7c87d86a0f0c54f1878b9c80cae.tar.xz |
(svn r4529) - Codechange: Use proper naming for hex numbers in debug prints eg. 0xF3A6. Use fixed lengths where applicable (newgrf). Unfortunately '%#X' is unusable since it gives 0XFF3 and '%#x' gives 0xff3 while we want 0xFF3 :P
-rw-r--r-- | newgrf.c | 39 | ||||
-rw-r--r-- | newgrf_engine.c | 2 | ||||
-rw-r--r-- | newgrf_text.c | 2 | ||||
-rw-r--r-- | npf.c | 14 | ||||
-rw-r--r-- | oldloader.c | 2 | ||||
-rw-r--r-- | roadveh_cmd.c | 20 | ||||
-rw-r--r-- | station_cmd.c | 4 |
7 files changed, 41 insertions, 42 deletions
@@ -1210,7 +1210,7 @@ static void VehicleChangeInfo(byte *buf, int len) } if (ignoring) - grfmsg(GMS_NOTICE, "VehicleChangeInfo: Ignoring property %x (not implemented).", prop); + grfmsg(GMS_NOTICE, "VehicleChangeInfo: Ignoring property 0x%02X (not implemented).", prop); } } @@ -1388,7 +1388,7 @@ static void NewSpriteGroup(byte *buf, int len) if (HASBIT(groupid, 15)) { dg->ranges[i].group = NewCallBackResultSpriteGroup(groupid); } else if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { - grfmsg(GMS_WARN, "NewSpriteGroup(%02x:0x%x): Groupid %04x does not exist, leaving empty.", setid, numloaded, groupid); + grfmsg(GMS_WARN, "NewSpriteGroup(0x%02X:0x%02X): Groupid 0x%04X does not exist, leaving empty.", setid, numloaded, groupid); dg->ranges[i].group = NULL; } else { dg->ranges[i].group = _cur_grffile->spritegroups[groupid]; @@ -1402,7 +1402,7 @@ static void NewSpriteGroup(byte *buf, int len) if (HASBIT(groupid, 15)) { dg->default_group = NewCallBackResultSpriteGroup(groupid); } else if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { - grfmsg(GMS_WARN, "NewSpriteGroup(%02x:0x%x): Groupid %04x does not exist, leaving empty.", setid, numloaded, groupid); + grfmsg(GMS_WARN, "NewSpriteGroup(0x%02X:0x%02X): Groupid 0x%04X does not exist, leaving empty.", setid, numloaded, groupid); dg->default_group = NULL; } else { dg->default_group = _cur_grffile->spritegroups[groupid]; @@ -1446,7 +1446,7 @@ static void NewSpriteGroup(byte *buf, int len) if (HASBIT(groupid, 15)) { rg->groups[i] = NewCallBackResultSpriteGroup(groupid); } else if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { - grfmsg(GMS_WARN, "NewSpriteGroup(%02x:0x%x): Groupid %04x does not exist, leaving empty.", setid, numloaded, groupid); + grfmsg(GMS_WARN, "NewSpriteGroup(0x%02X:0x%02X): Groupid 0x%04X does not exist, leaving empty.", setid, numloaded, groupid); rg->groups[i] = NULL; } else { rg->groups[i] = _cur_grffile->spritegroups[groupid]; @@ -1463,7 +1463,7 @@ static void NewSpriteGroup(byte *buf, int len) } if (_cur_grffile->spriteset_feature != feature) { - grfmsg(GMS_ERROR, "NewSpriteGroup: Group feature %x doesn't match set feature %x! Playing it risky and trying to use it anyway.", feature, _cur_grffile->spriteset_feature); + grfmsg(GMS_ERROR, "NewSpriteGroup: Group feature 0x%02X doesn't match set feature 0x%X! Playing it risky and trying to use it anyway.", feature, _cur_grffile->spriteset_feature); // return; // XXX: we can't because of MB's newstats.grf --pasky } @@ -1573,7 +1573,7 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len) uint16 groupid = grf_load_word(&bp); if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { - grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x or empty, skipping.", + grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.", groupid, _cur_grffile->spritegroups_count); return; } @@ -1592,7 +1592,7 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len) uint16 groupid = grf_load_word(&bp); if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { - grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x or empty, skipping.", + grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.", groupid, _cur_grffile->spritegroups_count); return; } @@ -1649,8 +1649,7 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len) byte *bp = &buf[4 + idcount]; if (engine_id > _vehcounts[feature]) { - grfmsg(GMS_ERROR, "Id %u for feature %x is out of bounds.", - engine_id, feature); + grfmsg(GMS_ERROR, "Id %u for feature 0x%02X is out of bounds.", engine_id, feature); return; } @@ -1660,10 +1659,10 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len) uint8 ctype = grf_load_byte(&bp); uint16 groupid = grf_load_word(&bp); - DEBUG(grf, 8) ("VehicleMapSpriteGroup: * [%d] Cargo type %x, group id %x", c, ctype, groupid); + DEBUG(grf, 8) ("VehicleMapSpriteGroup: * [%d] Cargo type 0x%X, group id 0x%02X", c, ctype, groupid); if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { - grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x or empty, skipping.", groupid, _cur_grffile->spritegroups_count); + grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.", groupid, _cur_grffile->spritegroups_count); return; } @@ -1683,14 +1682,14 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len) byte *bp = buf + 4 + idcount + cidcount * 3; uint16 groupid = grf_load_word(&bp); - DEBUG(grf, 8) ("-- Default group id %x", groupid); + DEBUG(grf, 8) ("-- Default group id 0x%04X", groupid); for (i = 0; i < idcount; i++) { uint8 engine = buf[3 + i] + _vehshifts[feature]; // Don't tell me you don't love duplicated code! if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { - grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset %x out of range %x or empty, skipping.", groupid, _cur_grffile->spritegroups_count); + grfmsg(GMS_WARN, "VehicleMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.", groupid, _cur_grffile->spritegroups_count); return; } @@ -1750,7 +1749,7 @@ static void VehicleNewName(byte *buf, int len) } endid = id + num; - DEBUG(grf, 6) ("VehicleNewName: About to rename engines %d..%d (feature %d) in language 0x%x.", + DEBUG(grf, 6) ("VehicleNewName: About to rename engines %d..%d (feature %d) in language 0x%02X.", id, endid, feature, lang); name = (const char*)buf; /*transfer read value*/ @@ -1785,7 +1784,7 @@ static void VehicleNewName(byte *buf, int len) break; default: - DEBUG(grf, 7) ("VehicleNewName: Unsupported ID (%x)", id); + DEBUG(grf, 7) ("VehicleNewName: Unsupported ID (0x%04X)", id); break; } break; @@ -1797,7 +1796,7 @@ static void VehicleNewName(byte *buf, int len) switch (GB(id, 8,8)) { case 0xC9: /* House name */ default: - DEBUG(grf, 7) ("VehicleNewName: Unsupported ID (%x)", id); + DEBUG(grf, 7) ("VehicleNewName: Unsupported ID (0x%04X)", id); } break; @@ -1806,7 +1805,7 @@ static void VehicleNewName(byte *buf, int len) AddGRFString(_cur_spriteid, id, lang, name); break; default : - DEBUG(grf,7) ("VehicleNewName: Unsupported feature (%x)", feature); + DEBUG(grf,7) ("VehicleNewName: Unsupported feature (0x%02X)", feature); break; #endif } @@ -1836,7 +1835,7 @@ static void GraphicsNew(byte *buf, int len) type = grf_load_byte(&buf); num = grf_load_extended(&buf); - grfmsg(GMS_NOTICE, "GraphicsNew: Custom graphics (type %x) sprite block of length %d (unimplemented, ignoring).\n", + grfmsg(GMS_NOTICE, "GraphicsNew: Custom graphics (type 0x%02X) sprite block of length %d (unimplemented, ignoring).\n", type, num); } @@ -1946,7 +1945,7 @@ static void SkipIf(byte *buf, int len) } } - DEBUG(grf, 7) ("Test condtype %d, param %x, condval %x", condtype, param_val, cond_val); + DEBUG(grf, 7) ("Test condtype %d, param 0x%08X, condval 0x%08X", condtype, param_val, cond_val); switch (condtype) { case 0: result = !!(param_val & (1 << cond_val)); break; @@ -2367,7 +2366,7 @@ static void DefineGotoLabel(byte *buf, int len) l->next = label; } - grfmsg(GMS_NOTICE, "DefineGotoLabel: GOTO target with label 0x%X", label->label); + grfmsg(GMS_NOTICE, "DefineGotoLabel: GOTO target with label 0x%02X", label->label); } static void InitializeGRFSpecial(void) diff --git a/newgrf_engine.c b/newgrf_engine.c index 841cba1a9..e6f878a7c 100644 --- a/newgrf_engine.c +++ b/newgrf_engine.c @@ -169,7 +169,7 @@ static int VehicleSpecificProperty(const Vehicle *v, byte var) { break; } - DEBUG(grf, 1)("Unhandled vehicle property 0x%x (var 0x%x), type 0x%x", var, var + 0x80, v->type); + DEBUG(grf, 1)("Unhandled vehicle property 0x%02X (var 0x%02X), type 0x%02X", var, var + 0x80, v->type); return -1; } diff --git a/newgrf_text.c b/newgrf_text.c index c3250fc4c..5dc322492 100644 --- a/newgrf_text.c +++ b/newgrf_text.c @@ -174,7 +174,7 @@ StringID AddGRFString(uint32 grfid, uint16 stringid, byte langid_to_add, const c textptr->next = newtext; } - DEBUG(grf, 2)("Added %x: grfid %x string %x lang %x string %s", id, grfid, stringid, newtext->langid, newtext->text); + DEBUG(grf, 2)("Added 0x%X: grfid 0x%X string 0x%X lang 0x%X string %s", id, grfid, stringid, newtext->langid, newtext->text); return (GRFTAB << TABSIZE) + id; } @@ -152,7 +152,7 @@ static void NPFFillTrackdirChoice(AyStarNode* current, OpenListNode* parent) /* This is a first order decision, so we'd better save the * direction we chose */ current->user_data[NPF_TRACKDIR_CHOICE] = trackdir; - DEBUG(npf, 6)("Saving trackdir: %#x", trackdir); + DEBUG(npf, 6)("Saving trackdir: 0x%X", trackdir); } else { /* We've already made the decision, so just save our parent's decision */ current->user_data[NPF_TRACKDIR_CHOICE] = parent->path.node.user_data[NPF_TRACKDIR_CHOICE]; @@ -608,13 +608,13 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current) } trackdirbits = ts & TRACKDIR_BIT_MASK; /* Filter out signal status and the unused bits */ - DEBUG(npf, 4)("Next node: (%d, %d) [%d], possible trackdirs: %#x", TileX(dst_tile), TileY(dst_tile), dst_tile, trackdirbits); + DEBUG(npf, 4)("Next node: (%d, %d) [%d], possible trackdirs: 0x%X", TileX(dst_tile), TileY(dst_tile), dst_tile, trackdirbits); /* Select only trackdirs we can reach from our current trackdir */ trackdirbits &= TrackdirReachesTrackdirs(src_trackdir); if (_patches.forbid_90_deg && (type == TRANSPORT_RAIL || type == TRANSPORT_WATER)) /* Filter out trackdirs that would make 90 deg turns for trains */ trackdirbits &= ~TrackdirCrossesTrackdirs(src_trackdir); - DEBUG(npf,6)("After filtering: (%d, %d), possible trackdirs: %#x", TileX(dst_tile), TileY(dst_tile), trackdirbits); + DEBUG(npf,6)("After filtering: (%d, %d), possible trackdirs: 0x%X", TileX(dst_tile), TileY(dst_tile), trackdirbits); i = 0; /* Enumerate possible track */ @@ -622,7 +622,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current) Trackdir dst_trackdir; dst_trackdir = FindFirstBit2x64(trackdirbits); trackdirbits = KillFirstBit2x64(trackdirbits); - DEBUG(npf, 5)("Expanded into trackdir: %d, remaining trackdirs: %#x", dst_trackdir, trackdirbits); + DEBUG(npf, 5)("Expanded into trackdir: %d, remaining trackdirs: 0x%X", dst_trackdir, trackdirbits); /* Check for oneway signal against us */ if (IsTileType(dst_tile, MP_RAILWAY) && GetRailTileType(dst_tile) == RAIL_TYPE_SIGNALS) { @@ -704,10 +704,10 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode* start1, AyStarNode* start if (result.best_bird_dist != 0) { if (target != NULL) { - DEBUG(npf, 1) ("Could not find route to tile 0x%x from 0x%x.", target->dest_coords, start1->tile); + DEBUG(npf, 1) ("Could not find route to tile 0x%X from 0x%X.", target->dest_coords, start1->tile); } else { /* Assumption: target == NULL, so we are looking for a depot */ - DEBUG(npf, 1) ("Could not find route to a depot from tile 0x%x.", start1->tile); + DEBUG(npf, 1) ("Could not find route to a depot from tile 0x%X.", start1->tile); } } @@ -855,7 +855,7 @@ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir, best_result = result; } if (result.best_bird_dist != 0) { - DEBUG(npf, 1) ("Could not find route to any depot from tile 0x%x.", tile); + DEBUG(npf, 1) ("Could not find route to any depot from tile 0x%X.", tile); } return best_result; } diff --git a/oldloader.c b/oldloader.c index 644d76be8..59fffc7da 100644 --- a/oldloader.c +++ b/oldloader.c @@ -211,7 +211,7 @@ static bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks) break; case OC_ASSERT: - DEBUG(oldloader, 4)("[OldLoader] Assert point: %x / %x", ls->total_read, chunk->offset + _bump_assert_value); + DEBUG(oldloader, 4)("[OldLoader] Assert point: 0x%X / 0x%X", ls->total_read, chunk->offset + _bump_assert_value); if (ls->total_read != chunk->offset + _bump_assert_value) ls->failed = true; default: break; } diff --git a/roadveh_cmd.c b/roadveh_cmd.c index 7bae69524..fbe1e454f 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -240,7 +240,7 @@ void ClearSlot(Vehicle *v) assert(rs->num_vehicles != 0); rs->num_vehicles--; - DEBUG(ms, 3) ("Multistop: Clearing slot at 0x%x", rs->xy); + DEBUG(ms, 3) ("Multistop: Clearing slot at 0x%X", rs->xy); } /** Sell a road vehicle. @@ -1459,10 +1459,10 @@ again: //but I guess we need to clear the slot DEBUG(ms, 0) ("Multistop: Vehicle %d (index %d) arrived at wrong stop.", v->unitnumber, v->index); if (v->tile != v->dest_tile) { - DEBUG(ms, 0) ("Multistop: -- Current tile 0x%x is not destination tile 0x%x. Route problem", v->tile, v->dest_tile); + DEBUG(ms, 0) ("Multistop: -- Current tile 0x%X is not destination tile 0x%X. Route problem", v->tile, v->dest_tile); } if (v->dest_tile != v->u.road.slot->xy) { - DEBUG(ms, 0) ("Multistop: -- Stop tile 0x%x is not destination tile 0x%x. Multistop desync", v->u.road.slot->xy, v->dest_tile); + DEBUG(ms, 0) ("Multistop: -- Stop tile 0x%X is not destination tile 0x%X. Multistop desync", v->u.road.slot->xy, v->dest_tile); } if (v->current_order.type != OT_GOTO_STATION) { DEBUG(ms, 0) ("Multistop: -- Current order type (%d) is not OT_GOTO_STATION.", v->current_order.type); @@ -1604,7 +1604,7 @@ void OnNewDay_RoadVeh(Vehicle *v) //Current slot has expired if (v->current_order.type == OT_GOTO_STATION && v->u.road.slot != NULL && v->u.road.slot_age-- == 0) { - DEBUG(ms, 2) ("Multistop: Slot expired for vehicle %d (index %d) at stop 0x%x", + DEBUG(ms, 2) ("Multistop: Slot expired for vehicle %d (index %d) at stop 0x%X", v->unitnumber, v->index, v->u.road.slot->xy); ClearSlot(v); } @@ -1624,18 +1624,18 @@ void OnNewDay_RoadVeh(Vehicle *v) uint dist, badness; uint minbadness = UINT_MAX; - DEBUG(ms, 2) ("Multistop: Attempting to obtain a slot for vehicle %d (index %d) at station %d (0x%x)", v->unitnumber, + DEBUG(ms, 2) ("Multistop: Attempting to obtain a slot for vehicle %d (index %d) at station %d (0x%X)", v->unitnumber, v->index, st->index, st->xy); /* Now we find the nearest road stop that has a free slot */ for (; rs != NULL; rs = rs->next) { dist = RoadFindPathToStop(v, rs->xy); if (dist == UINT_MAX) { - DEBUG(ms, 4) (" ---- stop 0x%x is not reachable, not treating further", rs->xy); + DEBUG(ms, 4) (" ---- stop 0x%X is not reachable, not treating further", rs->xy); continue; } badness = (rs->num_vehicles + 1) * (rs->num_vehicles + 1) + dist / NPF_TILE_LENGTH; - DEBUG(ms, 4) (" ---- stop 0x%x has %d vehicle%s waiting", rs->xy, rs->num_vehicles, rs->num_vehicles == 1 ? "":"s"); + DEBUG(ms, 4) (" ---- stop 0x%X has %d vehicle%s waiting", rs->xy, rs->num_vehicles, rs->num_vehicles == 1 ? "":"s"); DEBUG(ms, 4) (" ---- Distance is %u", dist); DEBUG(ms, 4) (" -- Badness %u", badness); @@ -1647,7 +1647,7 @@ void OnNewDay_RoadVeh(Vehicle *v) if (best != NULL) { best->num_vehicles++; - DEBUG(ms, 3) (" -- Assigned to stop 0x%x", best->xy); + DEBUG(ms, 3) (" -- Assigned to stop 0x%X", best->xy); v->u.road.slot = best; v->dest_tile = best->xy; @@ -1656,11 +1656,11 @@ void OnNewDay_RoadVeh(Vehicle *v) DEBUG(ms, 3) (" -- Could not find a suitable stop"); } } else { - DEBUG(ms, 5) ("Multistop: --- Distance from station too far. Postponing slotting for vehicle %d (index %d) at station %d, (0x%x)", + DEBUG(ms, 5) ("Multistop: --- Distance from station too far. Postponing slotting for vehicle %d (index %d) at station %d, (0x%X)", v->unitnumber, v->index, st->index, st->xy); } } else { - DEBUG(ms, 4) ("Multistop: No road stop for vehicle %d (index %d) at station %d (0x%x)", + DEBUG(ms, 4) ("Multistop: No road stop for vehicle %d (index %d) at station %d (0x%X)", v->unitnumber, v->index, st->index, st->xy); } } diff --git a/station_cmd.c b/station_cmd.c index 0871d6d4b..cf9876149 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -2643,11 +2643,11 @@ void BuildOilRig(TileIndex tile) Station *st = AllocateStation(); if (st == NULL) { - DEBUG(misc, 0) ("Couldn't allocate station for oilrig at %#X, reverting to oilrig only...", tile); + DEBUG(misc, 0) ("Couldn't allocate station for oilrig at 0x%X, reverting to oilrig only...", tile); return; } if (!GenerateStationName(st, tile, 2)) { - DEBUG(misc, 0) ("Couldn't allocate station-name for oilrig at %#X, reverting to oilrig only...", tile); + DEBUG(misc, 0) ("Couldn't allocate station-name for oilrig at 0x%X, reverting to oilrig only...", tile); return; } |