matter states for tile coverings, pig iron watch in dfstatus

develop
Petr Mrázek 2011-05-25 05:13:24 +02:00
parent a1a5df52a1
commit e7d9bc6f91
5 changed files with 78 additions and 58 deletions

@ -181,7 +181,7 @@ std::string PrintSplatterType (int16_t mat1, int32_t mat2, vector<DFHack::t_matg
case 5:
return "Crystal Glass";
case 6:
return "Ice";
return "Water";
case 7:
return "Coal";
case 8:

@ -149,7 +149,18 @@ namespace DFHack
/// this is NOT part of the DF vein, but an address of the vein as seen by DFhack.
uint32_t address_of;
};
/**
* \ingroup grp_maps
*/
enum e_matter_state
{
state_solid,
state_liquid,
state_gas,
state_powder,
state_paste,
state_pressed
};
/**
* a 'spattervein' defines what coverings the individual map tiles have (snow, blood, etc)
* bitmap of intensity with matrial type
@ -164,8 +175,8 @@ namespace DFHack
uint16_t unk1;
/// material vector index
uint32_t mat2;
/// something even more specific?
uint16_t mat3;
/// matter state - liquid/solid/etc.
e_matter_state matter_state : 16;
/// 16x16 array of covering 'intensity'
uint8_t intensity[16][16];
/// this is NOT part of the DF vein, but an address of the vein as seen by DFhack.

@ -62,9 +62,52 @@ int get_material_vector(uint32_t vein_8, uint16_t vein_4, int WORLD_)
}
return result;
}
char shades[10] = {'#','$','O','=','+','|','-','^','.',' '};
void printSpatter(DFHack::Context * DF, t_spattervein & spatter)
{
DFHack::Materials *Mats = DF->getMaterials();
printf("Splatter\nmat1: %d\nunknown: %d\nmat2: %d\n",spatter.mat1,spatter.unk1,spatter.mat2);
printf ("Material : %d - ", spatter.matter_state);
// FIXME: stupid
switch(spatter.matter_state)
{
case state_gas:
printf("Gas ");
break;
case state_solid:
printf("Solid ");
break;
case state_liquid:
printf("Liquid ");
break;
case state_paste:
printf("Paste ");
break;
case state_powder:
printf("Powder ");
break;
case state_pressed:
printf("Pressed ");
break;
default:
printf("Unknown state ");
}
cout << PrintSplatterType(spatter.mat1,spatter.mat2,Mats->race) << endl;
printf("Address 0x%08x\n",spatter.address_of);
for(uint32_t yyy = 0; yyy < 16; yyy++)
{
cout << "|";
for(uint32_t xxx = 0; xxx < 16; xxx++)
{
uint8_t intensity = spatter.intensity[xxx][yyy];
cout << shades[9 - (intensity / 28)];
}
cout << "|" << endl;
}
hexdump(DF, spatter.address_of,20*16);
}
char shades[10] = {'#','$','O','=','+','|','-','^','.',' '};
int main (int numargs, const char ** args)
{
uint32_t x_max,y_max,z_max;
@ -119,25 +162,10 @@ int main (int numargs, const char ** args)
if(splatter.size())
{
printf("Block %d/%d/%d\n",x,y,z);
for(uint32_t i = 0; i < splatter.size(); i++)
{
printf("Splatter %d\nmat1: %d\nunknown: %d\nmat2: %d\nmat3: %d\n",i,splatter[i].mat1,splatter[i].unk1,splatter[i].mat2,splatter[i].mat3);
cout << PrintSplatterType(splatter[i].mat1,splatter[i].mat2,Mats->race) << endl;
printf("Address 0x%08x\n",splatter[i].address_of);
for(uint32_t yyy = 0; yyy < 16; yyy++)
{
cout << "|";
for(uint32_t xxx = 0; xxx < 16; xxx++)
{
uint8_t intensity = splatter[i].intensity[xxx][yyy];
cout << shades[9 - (intensity / 28)];
}
cout << "|" << endl;
}
hexdump(DF, splatter[i].address_of,20*16);
cout << endl;
cout << i << ":" << endl;
printSpatter(DF,splatter[i]);
}
}
}
@ -154,32 +182,9 @@ int main (int numargs, const char ** args)
if(splatter.size())
{
printf("Block %d/%d/%d\n",bx,by,bz);
for(uint32_t i = 0; i < splatter.size(); i++)
{
printf("Splatter %d\nmat1: %d\nunknown: %d\nmat2: %d\nmat3: %d\n",i,splatter[i].mat1,splatter[i].unk1,splatter[i].mat2,splatter[i].mat3);
PrintSplatterType(splatter[i].mat1,splatter[i].mat2,Mats->race);
cout << endl;
printf("Address 0x%08x\n",splatter[i].address_of);
for(uint32_t y = 0; y < 16; y++)
{
cout << "|";
for(uint32_t x = 0; x < 16; x++)
{
uint8_t intensity = splatter[i].intensity[x][y];
if(intensity)
{
cout << "#";
}
else
{
cout << " ";
}
}
cout << "|" << endl;
}
hexdump(DF, splatter[i].address_of,20*16);
printSpatter(DF,splatter[i]);
cout << endl;
}
}

@ -38,6 +38,7 @@ WINDOW *create_newwin(int height, int width, int starty, int startx);
int32_t barCount = 0;
int32_t clothCount = 0;
int32_t ironBars = 0;
int32_t pigIronBars = 0;
int32_t goldBars = 0;
int32_t silverBars = 0;
int32_t copperBars = 0;
@ -63,12 +64,13 @@ WINDOW *create_newwin(int height, int width, int starty, int startx){
mvwprintw(local_win,10,2,"Logs : %d", logsCount);
mvwprintw(local_win,12,2,"Cloth : %d", clothCount);
//second row
mvwprintw(local_win,2,22,"Iron Bars : %d", ironBars);
mvwprintw(local_win,3,22,"Gold Bars : %d", goldBars);
mvwprintw(local_win,4,22,"Silver Bars: %d", silverBars);
mvwprintw(local_win,5,22,"Copper Bars: %d", copperBars);
mvwprintw(local_win,6,22,"Steel Bars : %d", steelBars);
mvwprintw(local_win,9,22,"Fuel : %d", fuel);
mvwprintw(local_win,2,22,"Iron Bars : %d", ironBars);
mvwprintw(local_win,3,22,"Gold Bars : %d", goldBars);
mvwprintw(local_win,4,22,"Silver Bars : %d", silverBars);
mvwprintw(local_win,5,22,"Copper Bars : %d", copperBars);
mvwprintw(local_win,6,22,"Steel Bars : %d", steelBars);
mvwprintw(local_win,7,22,"Pig iron Bars : %d", pigIronBars);
mvwprintw(local_win,9,22,"Fuel : %d", fuel);
total_time += end_time - start_time;
mvwprintw(local_win,14,2,"Time: %d ms last update, %d ms total", end_time - start_time, total_time);
@ -116,6 +118,7 @@ int main()
barCount = 0;
clothCount = 0;
ironBars = 0;
pigIronBars = 0;
goldBars = 0;
silverBars = 0;
copperBars = 0;
@ -165,7 +168,8 @@ int main()
else if(s0 == "bar") //need to break it down by ItemDescription to get the different types of bars.
{
barCount = barCount + itm.quantity;
if(s1.find("IRON")!=string::npos){ironBars++;}
if(s1.find("PIG_IRON")!=string::npos){pigIronBars++;}
else if(s1.find("IRON")!=string::npos){ironBars++;}
else if(s1.find("GOLD")!=string::npos){goldBars++;}
else if(s1.find("SILVER")!=string::npos){silverBars++;}
else if(s1.find("COPPER")!=string::npos){copperBars++;}

@ -90,11 +90,11 @@ void printMats(MatMap &mat, std::vector<DFHack::t_matgloss> &materials)
std::sort(sorting_vector.begin(), sorting_vector.end(), compare_pair_second<>());
for (MatSorter::const_iterator it = sorting_vector.begin(); it != sorting_vector.end(); ++it)
{
if(it->first >= materials.size())
{
cerr << "Bad index: " << it->first << " out of " << materials.size() << endl;
continue;
}
if(it->first >= materials.size())
{
cerr << "Bad index: " << it->first << " out of " << materials.size() << endl;
continue;
}
DFHack::t_matgloss mat = materials[it->first];
std::cout << std::setw(25) << mat.id << " : " << it->second << std::endl;
total += it->second;