Convert unicode to escaped characters, and some formatting niceness

develop
JapaMala 2018-12-26 00:11:08 -06:00
parent 701ac66f8e
commit 4b7e0d3c56
1 changed files with 137 additions and 137 deletions

@ -258,19 +258,19 @@ command_result dump_bp_mods(color_ostream &out, vector <string> & parameters)
command_result Dump_Trees(color_ostream &out, vector<string> &parameters) command_result Dump_Trees(color_ostream &out, vector<string> &parameters)
{ {
char filename[255]; char filename[255];
for(int columnIndex = 0; columnIndex < world->map.map_block_columns.size(); columnIndex++) for (int columnIndex = 0; columnIndex < world->map.map_block_columns.size(); columnIndex++)
{ {
auto column = world->map.map_block_columns[columnIndex]; auto column = world->map.map_block_columns[columnIndex];
if(!column) if (!column)
continue; continue;
if(column->plants.size() == 0) if (column->plants.size() == 0)
continue; continue;
for(int plantIndex = 0; plantIndex < column->plants.size(); plantIndex++) for (int plantIndex = 0; plantIndex < column->plants.size(); plantIndex++)
{ {
auto plant = column->plants[plantIndex]; auto plant = column->plants[plantIndex];
if(!plant) if (!plant)
continue; continue;
if(!plant->tree_info) if (!plant->tree_info)
continue; continue;
sprintf(filename, "plant_%03d,%03d,%03d.txt", plant->pos.z, plant->pos.y, plant->pos.x); sprintf(filename, "plant_%03d,%03d,%03d.txt", plant->pos.z, plant->pos.y, plant->pos.x);
remove(filename); remove(filename);
@ -280,11 +280,11 @@ command_result Dump_Trees(color_ostream &out, vector<string> &parameters)
output << "Material: " << plant->material << endl; output << "Material: " << plant->material << endl;
output << "Grow Counter: " << plant->grow_counter << endl; output << "Grow Counter: " << plant->grow_counter << endl;
output << "Damage Flags: "; output << "Damage Flags: ";
if(plant->damage_flags.bits.is_burning) if (plant->damage_flags.bits.is_burning)
output << "is_burning, "; output << "is_burning, ";
if(plant->damage_flags.bits.is_drowning) if (plant->damage_flags.bits.is_drowning)
output << "is_drowning, "; output << "is_drowning, ";
if(plant->damage_flags.bits.anon_1) if (plant->damage_flags.bits.anon_1)
output << "anon_1, "; output << "anon_1, ";
output << endl; output << endl;
output << "HP: " << plant->hitpoints << endl; output << "HP: " << plant->hitpoints << endl;
@ -295,105 +295,105 @@ command_result Dump_Trees(color_ostream &out, vector<string> &parameters)
output << "Dim X: " << treeInfo->dim_x << endl; output << "Dim X: " << treeInfo->dim_x << endl;
output << "Dim Y: " << treeInfo->dim_y << endl; output << "Dim Y: " << treeInfo->dim_y << endl;
output << "Dim Z: " << treeInfo->body_height << endl; output << "Dim Z: " << treeInfo->body_height << endl;
for(int z = 0; z < treeInfo->body_height; z++) for (int z = 0; z < treeInfo->body_height; z++)
{ {
for(int y = -1; y < treeInfo->dim_y; y++) for (int y = -1; y < treeInfo->dim_y; y++)
{ {
for(int x = -1; x < treeInfo->dim_x; x++) for (int x = -1; x < treeInfo->dim_x; x++)
{ {
if(x < 0) if (x < 0)
{ {
if(y < 0) if (y < 0)
{ {
output << " "; output << " ";
continue; continue;
} }
output << y%9; output << y % 9;
continue; continue;
} }
if(y < 0) if (y < 0)
{ {
output << x%9; output << x % 9;
continue; continue;
} }
auto tile = treeInfo->body[z][x + treeInfo->dim_x*y]; auto tile = treeInfo->body[z][x + treeInfo->dim_x*y];
if(tile.bits.blocked) if (tile.bits.blocked)
output << "x"; output << "x";
else if(tile.bits.twigs) else if (tile.bits.twigs)
output << ""; output << "\u2591";
else if(tile.bits.branches) else if (tile.bits.branches)
{ {
if(tile.bits.connection_east)// East Connection if (tile.bits.connection_east)// East Connection
{ {
if(tile.bits.connection_south) // South Connection if (tile.bits.connection_south) // South Connection
{ {
if(tile.bits.connection_west) // West Connection if (tile.bits.connection_west) // West Connection
{ {
if(tile.bits.connection_north) // North Connection if (tile.bits.connection_north) // North Connection
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u256c";
else else
output << ""; output << "\u253c";
} }
else else
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2566";
else else
output << ""; output << "\u252c";
} }
} }
else else
{ {
if(tile.bits.connection_north) // North Connection if (tile.bits.connection_north) // North Connection
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2560";
else else
output << ""; output << "\u251c";
} }
else else
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2554";
else else
output << ""; output << "\u250c";
} }
} }
} }
else else
{ {
if(tile.bits.connection_west) // West Connection if (tile.bits.connection_west) // West Connection
{ {
if(tile.bits.connection_north) // North Connection if (tile.bits.connection_north) // North Connection
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2569";
else else
output << ""; output << "\u2534";
} }
else else
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2550";
else else
output << ""; output << "\u2500";
} }
} }
else else
{ {
if(tile.bits.connection_north) // North Connection if (tile.bits.connection_north) // North Connection
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u255a";
else else
output << ""; output << "\u2514";
} }
else else
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u255e";
else else
output << ">"; output << ">";
} }
@ -402,38 +402,38 @@ command_result Dump_Trees(color_ostream &out, vector<string> &parameters)
} }
else else
{ {
if(tile.bits.connection_south) // South Connection if (tile.bits.connection_south) // South Connection
{ {
if(tile.bits.connection_west) // West Connection if (tile.bits.connection_west) // West Connection
{ {
if(tile.bits.connection_north) // North Connection if (tile.bits.connection_north) // North Connection
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2563";
else else
output << ""; output << "\u2524";
} }
else else
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2557";
else else
output << ""; output << "\u2510";
} }
} }
else else
{ {
if(tile.bits.connection_north) // North Connection if (tile.bits.connection_north) // North Connection
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2551";
else else
output << ""; output << "\u2502";
} }
else else
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2565";
else else
output << "v"; output << "v";
} }
@ -441,46 +441,46 @@ command_result Dump_Trees(color_ostream &out, vector<string> &parameters)
} }
else else
{ {
if(tile.bits.connection_west) // West Connection if (tile.bits.connection_west) // West Connection
{ {
if(tile.bits.connection_north) // North Connection if (tile.bits.connection_north) // North Connection
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u255d";
else else
output << ""; output << "\u2518";
} }
else else
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2561";
else else
output << "<"; output << "<";
} }
} }
else else
{ {
if(tile.bits.connection_north) // North Connection if (tile.bits.connection_north) // North Connection
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << ""; output << "\u2568";
else else
output << "^"; output << "^";
} }
else else
{ {
if(tile.bits.trunk) if (tile.bits.trunk)
output << "o"; output << "o";
else else
output << ""; output << "\u2592";
} }
} }
} }
} }
} }
else if(tile.bits.trunk) else if (tile.bits.trunk)
output << "O"; output << "O";
else if(tile.whole > 0) else if (tile.whole > 0)
output << +tile.whole; output << +tile.whole;
else else
output << " "; output << " ";