Remove both debug dump functions. They aren't needed anymore.

develop
JapaMala 2018-12-26 01:04:31 -06:00
parent 9d9b6b377b
commit 84578d7052
2 changed files with 1 additions and 308 deletions

@ -57,7 +57,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `RemoteFortressReader`:
- added basic framework for controlling and reading the menus in DF, currently only supports the building menu.
- added support for reading item raws.
- added a debug function to dump a file of every tree in the currently loaded map.
- removed a debug function that's not needed anymore.
## Internals
- Linux/macOS: changed recommended build backend from Make to Ninja (Make builds will be significantly slower now)

@ -207,300 +207,6 @@ command_result loadArtImageChunk(color_ostream &out, vector <string> & parameter
return CR_OK;
}
command_result dump_bp_mods(color_ostream &out, vector <string> & parameters)
{
remove("bp_appearance_mods.csv");
ofstream output;
output.open("bp_appearance_mods.csv");
output << "Race Index;Race;Caste;Bodypart Token;Bodypart Name;Tissue Layer;Modifier Type;Range\n";
for (size_t creatureIndex = 0; creatureIndex < world->raws.creatures.all.size(); creatureIndex++)
{
auto creatureRaw = world->raws.creatures.all[creatureIndex];
for (size_t casteIndex = 0; casteIndex < creatureRaw->caste.size(); casteIndex++)
{
df::caste_raw *casteRaw = creatureRaw->caste[casteIndex];
for (size_t partIndex = 0; partIndex < casteRaw->bp_appearance.part_idx.size(); partIndex++)
{
output << creatureIndex << ";";
output << creatureRaw->creature_id << ";";
output << casteRaw->caste_id << ";";
output << casteRaw->body_info.body_parts[casteRaw->bp_appearance.part_idx[partIndex]]->token << ";";
output << casteRaw->body_info.body_parts[casteRaw->bp_appearance.part_idx[partIndex]]->name_singular[0]->c_str() << ";";
int layer = casteRaw->bp_appearance.layer_idx[partIndex];
if (layer < 0)
output << "N/A;";
else
output << casteRaw->body_info.body_parts[casteRaw->bp_appearance.part_idx[partIndex]]->layers[layer]->layer_name << ";";
output << ENUM_KEY_STR(appearance_modifier_type, casteRaw->bp_appearance.modifiers[casteRaw->bp_appearance.modifier_idx[partIndex]]->type) << ";";
auto appMod = casteRaw->bp_appearance.modifiers[casteRaw->bp_appearance.modifier_idx[partIndex]];
#if DF_VERSION_INT > 34011
if (appMod->growth_rate > 0)
{
output << appMod->growth_min << " - " << appMod->growth_max << "\n";
}
else
#endif
{
output << casteRaw->bp_appearance.modifiers[casteRaw->bp_appearance.modifier_idx[partIndex]]->ranges[0] << " - ";
output << casteRaw->bp_appearance.modifiers[casteRaw->bp_appearance.modifier_idx[partIndex]]->ranges[6] << "\n";
}
}
}
}
output.close();
return CR_OK;
}
command_result Dump_Trees(color_ostream &out, vector<string> &parameters)
{
char filename[255];
for (int columnIndex = 0; columnIndex < world->map.map_block_columns.size(); columnIndex++)
{
auto column = world->map.map_block_columns[columnIndex];
if (!column)
continue;
if (column->plants.size() == 0)
continue;
for (int plantIndex = 0; plantIndex < column->plants.size(); plantIndex++)
{
auto plant = column->plants[plantIndex];
if (!plant)
continue;
if (!plant->tree_info)
continue;
sprintf(filename, "plant_%03d,%03d,%03d.txt", plant->pos.z, plant->pos.y, plant->pos.x);
remove(filename);
ofstream output;
output.open(filename);
output << "Pos: " << plant->pos.x << ", " << plant->pos.y << ", " << plant->pos.z << endl;
output << "Material: " << plant->material << endl;
output << "Grow Counter: " << plant->grow_counter << endl;
output << "Damage Flags: ";
if (plant->damage_flags.bits.is_burning)
output << "is_burning, ";
if (plant->damage_flags.bits.is_drowning)
output << "is_drowning, ";
if (plant->damage_flags.bits.anon_1)
output << "anon_1, ";
output << endl;
output << "HP: " << plant->hitpoints << endl;
output << "Update Order: " << plant->update_order << endl;
output << "Site ID: " << plant->site_id << endl;
output << "SRB ID: " << plant->srb_id << endl;
auto treeInfo = plant->tree_info;
output << "Dim X: " << treeInfo->dim_x << endl;
output << "Dim Y: " << treeInfo->dim_y << endl;
output << "Dim Z: " << treeInfo->body_height << endl;
for (int z = 0; z < treeInfo->body_height; z++)
{
for (int y = -1; y < treeInfo->dim_y; y++)
{
for (int x = -1; x < treeInfo->dim_x; x++)
{
if (x < 0)
{
if (y < 0)
{
output << " ";
continue;
}
output << y % 9;
continue;
}
if (y < 0)
{
output << x % 9;
continue;
}
auto tile = treeInfo->body[z][x + treeInfo->dim_x*y];
if (tile.bits.blocked)
output << "x";
else if (tile.bits.twigs)
output << u8"\u2591";
else if (tile.bits.branches)
{
if (tile.bits.connection_east)// East Connection
{
if (tile.bits.connection_south) // South Connection
{
if (tile.bits.connection_west) // West Connection
{
if (tile.bits.connection_north) // North Connection
{
if (tile.bits.trunk)
output << u8"\u256c";
else
output << u8"\u253c";
}
else
{
if (tile.bits.trunk)
output << u8"\u2566";
else
output << u8"\u252c";
}
}
else
{
if (tile.bits.connection_north) // North Connection
{
if (tile.bits.trunk)
output << u8"\u2560";
else
output << u8"\u251c";
}
else
{
if (tile.bits.trunk)
output << u8"\u2554";
else
output << u8"\u250c";
}
}
}
else
{
if (tile.bits.connection_west) // West Connection
{
if (tile.bits.connection_north) // North Connection
{
if (tile.bits.trunk)
output << u8"\u2569";
else
output << u8"\u2534";
}
else
{
if (tile.bits.trunk)
output << u8"\u2550";
else
output << u8"\u2500";
}
}
else
{
if (tile.bits.connection_north) // North Connection
{
if (tile.bits.trunk)
output << u8"\u255a";
else
output << u8"\u2514";
}
else
{
if (tile.bits.trunk)
output << u8"\u255e";
else
output << ">";
}
}
}
}
else
{
if (tile.bits.connection_south) // South Connection
{
if (tile.bits.connection_west) // West Connection
{
if (tile.bits.connection_north) // North Connection
{
if (tile.bits.trunk)
output << u8"\u2563";
else
output << u8"\u2524";
}
else
{
if (tile.bits.trunk)
output << u8"\u2557";
else
output << u8"\u2510";
}
}
else
{
if (tile.bits.connection_north) // North Connection
{
if (tile.bits.trunk)
output << u8"\u2551";
else
output << u8"\u2502";
}
else
{
if (tile.bits.trunk)
output << u8"\u2565";
else
output << "v";
}
}
}
else
{
if (tile.bits.connection_west) // West Connection
{
if (tile.bits.connection_north) // North Connection
{
if (tile.bits.trunk)
output << u8"\u255d";
else
output << u8"\u2518";
}
else
{
if (tile.bits.trunk)
output << u8"\u2561";
else
output << "<";
}
}
else
{
if (tile.bits.connection_north) // North Connection
{
if (tile.bits.trunk)
output << u8"\u2568";
else
output << "^";
}
else
{
if (tile.bits.trunk)
output << "o";
else
output << u8"\u2592";
}
}
}
}
}
else if (tile.bits.trunk)
output << "O";
else if (tile.whole > 0)
output << +tile.whole;
else
output << " ";
}
output << endl;
}
output << "extent_east: " << treeInfo->extent_east[z];
output << "extent_south: " << treeInfo->extent_south[z];
output << "extent_west: " << treeInfo->extent_west[z];
output << "extent_north: " << treeInfo->extent_north[z];
output << endl;
}
//...
output.close();
}
}
return CR_OK;
}
command_result RemoteFortressReader_version(color_ostream &out, vector<string> &parameters)
{
out.print(RFR_VERSION);
@ -512,19 +218,6 @@ DFHACK_PLUGIN_IS_ENABLED(enableUpdates);
// Mandatory init function. If you have some global state, create it here.
DFhackCExport command_result plugin_init(color_ostream &out, std::vector <PluginCommand> &commands)
{
//// Fill the command list with your commands.
commands.push_back(PluginCommand(
"dump-bp-mods", "Dump bodypart mods for debugging",
dump_bp_mods, false, /* true means that the command can't be used from non-interactive user interface */
// Extended help string. Used by CR_WRONG_USAGE and the help command:
" Saves every possible body part appearance modifier to bp_appearance_mods.csv\n"
));
commands.push_back(PluginCommand(
"dump-trees", "Dump trees for debugging",
Dump_Trees, false, /* true means that the command can't be used from non-interactive user interface */
// Extended help string. Used by CR_WRONG_USAGE and the help command:
" saves each tree on the map to a separate text file.\n"
));
commands.push_back(PluginCommand("RemoteFortressReader_version", "List the loaded RemoteFortressReader version", RemoteFortressReader_version, false, "This is used for plugin version checking."));
commands.push_back(PluginCommand(
"load-art-image-chunk",