develop
Petr Mrázek 2011-03-03 16:56:38 +01:00
commit 680fe2981e
15 changed files with 64 additions and 98 deletions

@ -268,7 +268,7 @@ void SHMProcess::getMemRanges( vector<t_memrange> & ranges )
char buffer[1024]; char buffer[1024];
char permissions[5]; // r/-, w/-, x/-, p/s, 0 char permissions[5]; // r/-, w/-, x/-, p/s, 0
sprintf(buffer, "/proc/%lu/maps", d->process_ID); sprintf(buffer, "/proc/%lu/maps", (long unsigned)d->process_ID);
FILE *mapFile = ::fopen(buffer, "r"); FILE *mapFile = ::fopen(buffer, "r");
uint64_t offset, device1, device2, node; uint64_t offset, device1, device2, node;
@ -276,7 +276,7 @@ void SHMProcess::getMemRanges( vector<t_memrange> & ranges )
{ {
t_memrange temp; t_memrange temp;
temp.name[0] = 0; temp.name[0] = 0;
sscanf(buffer, "%llx-%llx %s %llx %2llu:%2llu %llu %s", sscanf(buffer, "%zx-%zx %s %zx %2zu:%2zu %zu %s",
&temp.start, &temp.start,
&temp.end, &temp.end,
(char*)&permissions, (char*)&permissions,

@ -81,7 +81,7 @@ void LinuxProcessBase::getMemRanges( vector<t_memrange> & ranges )
char buffer[1024]; char buffer[1024];
char permissions[5]; // r/-, w/-, x/-, p/s, 0 char permissions[5]; // r/-, w/-, x/-, p/s, 0
sprintf(buffer, "/proc/%lu/maps", my_pid); sprintf(buffer, "/proc/%lu/maps", (long unsigned)my_pid);
FILE *mapFile = ::fopen(buffer, "r"); FILE *mapFile = ::fopen(buffer, "r");
uint64_t offset, device1, device2, node; uint64_t offset, device1, device2, node;
@ -89,7 +89,7 @@ void LinuxProcessBase::getMemRanges( vector<t_memrange> & ranges )
{ {
t_memrange temp; t_memrange temp;
temp.name[0] = 0; temp.name[0] = 0;
sscanf(buffer, "%llx-%llx %s %llx %2llu:%2llu %llu %s", sscanf(buffer, "%zx-%zx %s %zx %2zu:%2zu %zu %s",
&temp.start, &temp.start,
&temp.end, &temp.end,
(char*)&permissions, (char*)&permissions,

@ -145,61 +145,42 @@ std::string PrintSplatterType (int16_t mat1, int32_t mat2, vector<DFHack::t_matg
{ {
case 0: case 0:
return "Rock"; return "Rock";
break;
case 1: case 1:
return "Amber"; return "Amber";
break;
case 2: case 2:
return "Coral"; return "Coral";
break;
case 3: case 3:
return "Green Glass"; return "Green Glass";
break;
case 4: case 4:
return "Clear Glass"; return "Clear Glass";
break;
case 5: case 5:
return "Crystal Glass"; return "Crystal Glass";
break;
case 6: case 6:
return "Ice"; return "Ice";
break;
case 7: case 7:
return "Coal"; return "Coal";
break;
case 8: case 8:
return "Potash"; return "Potash";
break;
case 9: case 9:
return "Ash"; return "Ash";
break;
case 10: case 10:
return "Pearlash"; return "Pearlash";
break;
case 11: case 11:
return "Lye"; return "Lye";
break;
case 12: case 12:
return "Mud"; return "Mud";
break;
case 13: case 13:
return "Vomit"; return "Vomit";
break;
case 14: case 14:
return "Salt"; return "Salt";
break;
case 15: case 15:
return "Filth"; return "Filth";
break;
case 16: case 16:
return "Frozen? Filth"; return "Frozen? Filth";
break;
case 18: case 18:
return "Grime"; return "Grime";
break;
case 0xF2: case 0xF2:
return "Very Specific Blood (references a named creature)"; return "Very Specific Blood (references a named creature)";
break;
case 0x2A: case 0x2A:
case 0x2B: case 0x2B:
if(mat2 != -1) if(mat2 != -1)
@ -209,10 +190,8 @@ std::string PrintSplatterType (int16_t mat1, int32_t mat2, vector<DFHack::t_matg
} }
ret += "Blood"; ret += "Blood";
return ret; return ret;
break;
default: default:
return "Unknown"; return "Unknown";
break;
} }
} }
#endif #endif

@ -23,13 +23,7 @@ namespace DFHack
feature_Hell_Temple feature_Hell_Temple
}; };
static const char * sa_feature[]= extern const char * sa_feature[];
{
(char*)"Other",
(char*)"Adamantine Tube",
(char*)"Underworld",
(char*)"Hell Temple"
};
/// used as a key for the local feature map. combines X an Y coords. /// used as a key for the local feature map. combines X an Y coords.
union planecoord union planecoord

@ -41,6 +41,14 @@ distribution.
#define MAPS_GUARD if(!d->Started) throw DFHack::Error::ModuleNotInitialized(); #define MAPS_GUARD if(!d->Started) throw DFHack::Error::ModuleNotInitialized();
using namespace DFHack; using namespace DFHack;
const char * sa_feature[]=
{
"Other",
"Adamantine Tube",
"Underworld",
"Hell Temple"
};
struct Maps::Private struct Maps::Private
{ {
uint32_t * block; uint32_t * block;
@ -945,4 +953,4 @@ bool Maps::ReadVegetation(uint32_t x, uint32_t y, uint32_t z, std::vector<t_tree
} }
if(plants->empty()) return false; if(plants->empty()) return false;
return true; return true;
} }

@ -95,21 +95,21 @@ class SegmentedFinder
SegmentedFinder(vector <DFHack::t_memrange>& ranges, DFHack::Context * DF) SegmentedFinder(vector <DFHack::t_memrange>& ranges, DFHack::Context * DF)
{ {
_DF = DF; _DF = DF;
for(int i = 0; i < ranges.size(); i++) for(size_t i = 0; i < ranges.size(); i++)
{ {
segments.push_back(new SegmentFinder(ranges[i], DF, this)); segments.push_back(new SegmentFinder(ranges[i], DF, this));
} }
} }
~SegmentedFinder() ~SegmentedFinder()
{ {
for(int i = 0; i < segments.size(); i++) for(size_t i = 0; i < segments.size(); i++)
{ {
delete segments[i]; delete segments[i];
} }
} }
SegmentFinder * getSegmentForAddress (uint64_t addr) SegmentFinder * getSegmentForAddress (uint64_t addr)
{ {
for(int i = 0; i < segments.size(); i++) for(size_t i = 0; i < segments.size(); i++)
{ {
if(segments[i]->mr_.isInRange(addr)) if(segments[i]->mr_.isInRange(addr))
{ {
@ -122,7 +122,7 @@ class SegmentedFinder
bool Find (const needleType needle, const uint8_t increment, vector <uint64_t> &found, comparator oper) bool Find (const needleType needle, const uint8_t increment, vector <uint64_t> &found, comparator oper)
{ {
found.clear(); found.clear();
for(int i = 0; i < segments.size(); i++) for(size_t i = 0; i < segments.size(); i++)
{ {
segments[i]->Find<needleType,hayType,comparator>(needle, increment, found, oper); segments[i]->Find<needleType,hayType,comparator>(needle, increment, found, oper);
} }
@ -144,7 +144,7 @@ class SegmentedFinder
bool Filter (const needleType needle, vector <uint64_t> &found, comparator oper) bool Filter (const needleType needle, vector <uint64_t> &found, comparator oper)
{ {
vector <uint64_t> newfound; vector <uint64_t> newfound;
for(int i = 0; i < segments.size(); i++) for(size_t i = 0; i < segments.size(); i++)
{ {
segments[i]->Filter<needleType,hayType,comparator>(needle, found, newfound, oper); segments[i]->Filter<needleType,hayType,comparator>(needle, found, newfound, oper);
} }
@ -169,7 +169,7 @@ class SegmentedFinder
template <typename T> template <typename T>
T * Translate(uint64_t address) T * Translate(uint64_t address)
{ {
for(int i = 0; i < segments.size(); i++) for(size_t i = 0; i < segments.size(); i++)
{ {
if(segments[i]->mr_.isInRange(address)) if(segments[i]->mr_.isInRange(address))
{ {
@ -227,7 +227,6 @@ bool vectorLength (SegmentedFinder* s, vecTriplet *x, Needle &y)
bool vectorString (SegmentedFinder* s, vecTriplet *x, const char *y) bool vectorString (SegmentedFinder* s, vecTriplet *x, const char *y)
{ {
uint32_t object_ptr; uint32_t object_ptr;
uint32_t idx = x->start;
// iterate over vector of pointers // iterate over vector of pointers
for(uint32_t idx = x->start; idx < x->finish; idx += sizeof(uint32_t)) for(uint32_t idx = x->start; idx < x->finish; idx += sizeof(uint32_t))
{ {
@ -287,7 +286,6 @@ bool vectorAddrWithin (SegmentedFinder* s, vecTriplet *x, uint32_t address)
bool vectorOfPtrWithin (SegmentedFinder* s, vecTriplet *x, uint32_t address) bool vectorOfPtrWithin (SegmentedFinder* s, vecTriplet *x, uint32_t address)
{ {
uint32_t object_ptr; uint32_t object_ptr;
uint32_t idx = x->start;
for(uint32_t idx = x->start; idx < x->finish; idx += sizeof(uint32_t)) for(uint32_t idx = x->start; idx < x->finish; idx += sizeof(uint32_t))
{ {
if(!s->Read(idx,object_ptr)) if(!s->Read(idx,object_ptr))
@ -405,7 +403,7 @@ std::ostream& operator<< ( std::ostream& out, Bytestream& bs )
if(bs.d->object) if(bs.d->object)
{ {
out << "bytestream " << dec << bs.d->length << "/" << bs.d->allocated << " bytes" << endl; out << "bytestream " << dec << bs.d->length << "/" << bs.d->allocated << " bytes" << endl;
for(int i = 0; i < bs.d->length; i++) for(size_t i = 0; i < bs.d->length; i++)
{ {
out << hex << (int) ((uint8_t *) bs.d->object)[i] << " "; out << hex << (int) ((uint8_t *) bs.d->object)[i] << " ";
} }
@ -535,4 +533,4 @@ bool findStrBuffer (SegmentedFinder* s, uint32_t *addr, const char * compare )
return false; return false;
} }
#endif // SEGMENTED_FINDER_H #endif // SEGMENTED_FINDER_H

@ -235,7 +235,7 @@ public:
virtual bool LoadData(SegmentedFinder* s) virtual bool LoadData(SegmentedFinder* s)
{ {
bool OK = true; bool OK = true;
for(int i = 0; i < members.size() && OK; i++) for(size_t i = 0; i < members.size() && OK; i++)
OK &= members[i]->LoadData(s); OK &= members[i]->LoadData(s);
return OK; return OK;
}; };
@ -333,7 +333,7 @@ bool getRanges(DFHack::Process * p, vector <DFHack::t_memrange>& selected_ranges
selected_ranges.clear(); selected_ranges.clear();
p->getMemRanges(ranges); p->getMemRanges(ranges);
cout << "Which range to search? (default is 1-4)" << endl; cout << "Which range to search? (default is 1-4)" << endl;
for(int i = 0; i< ranges.size();i++) for(size_t i = 0; i< ranges.size();i++)
{ {
cout << dec << "(" << i << ") "; cout << dec << "(" << i << ") ";
printRange(&(ranges[i])); printRange(&(ranges[i]));
@ -452,7 +452,7 @@ struct tilecolors
void printFound(vector <uint64_t> &found, const char * what) void printFound(vector <uint64_t> &found, const char * what)
{ {
cout << what << ":" << endl; cout << what << ":" << endl;
for(int i = 0; i < found.size();i++) for(size_t i = 0; i < found.size();i++)
{ {
cout << hex << "0x" << found[i] << endl; cout << hex << "0x" << found[i] << endl;
} }
@ -461,7 +461,7 @@ void printFound(vector <uint64_t> &found, const char * what)
void printFoundStrVec(vector <uint64_t> &found, const char * what, SegmentedFinder & s) void printFoundStrVec(vector <uint64_t> &found, const char * what, SegmentedFinder & s)
{ {
cout << what << ":" << endl; cout << what << ":" << endl;
for(int i = 0; i < found.size();i++) for(size_t i = 0; i < found.size();i++)
{ {
cout << hex << "0x" << found[i] << endl; cout << hex << "0x" << found[i] << endl;
cout << "--------------------------" << endl; cout << "--------------------------" << endl;
@ -534,8 +534,9 @@ String * TokenFactory::Build()
case DFHack::OS_LINUX: case DFHack::OS_LINUX:
case DFHack::OS_APPLE: case DFHack::OS_APPLE:
return new LinuxString(); return new LinuxString();
case DFHack::OS_BAD:
return 0;
} }
return 0;
}; };
template <> template <>
String * TokenFactory::Build(uint64_t offset) String * TokenFactory::Build(uint64_t offset)
@ -547,8 +548,9 @@ String * TokenFactory::Build(uint64_t offset)
case DFHack::OS_LINUX: case DFHack::OS_LINUX:
case DFHack::OS_APPLE: case DFHack::OS_APPLE:
return new LinuxString(offset); return new LinuxString(offset);
case DFHack::OS_BAD:
return 0;
} }
return 0;
}; };
void autoSearch(DFHack::Context * DF, vector <DFHack::t_memrange>& ranges, DFHack::OSType platform) void autoSearch(DFHack::Context * DF, vector <DFHack::t_memrange>& ranges, DFHack::OSType platform)

@ -22,8 +22,6 @@ int main (int argc, char** argv)
} }
uint32_t x_max,y_max,z_max; uint32_t x_max,y_max,z_max;
uint32_t num_blocks = 0;
uint32_t bytes_read = 0;
vector<DFHack::t_spattervein> splatter; vector<DFHack::t_spattervein> splatter;
DFHack::ContextManager DFMgr("Memory.xml"); DFHack::ContextManager DFMgr("Memory.xml");
@ -54,7 +52,7 @@ int main (int argc, char** argv)
Mapz->getSize(x_max,y_max,z_max); Mapz->getSize(x_max,y_max,z_max);
uint8_t zeroes [16][16] = {0}; uint8_t zeroes [16][16] = {{0}};
DFHack::occupancies40d occ; DFHack::occupancies40d occ;
// walk the map // walk the map

@ -32,7 +32,6 @@ int main ()
return 1; return 1;
} }
DFHack::VersionInfo * mem = DF->getMemoryInfo();
p = DF->getProcess(); p = DF->getProcess();
uint32_t item_vec_offset = 0; uint32_t item_vec_offset = 0;
try try
@ -70,4 +69,4 @@ int main ()
cin.ignore(); cin.ignore();
#endif #endif
return 0; return 0;
} }

@ -33,7 +33,7 @@ bool getRanges(DFHack::Process * p, vector <DFHack::t_memrange>& selected_ranges
selected_ranges.clear(); selected_ranges.clear();
p->getMemRanges(ranges); p->getMemRanges(ranges);
cout << "Which range to search? (default is 1-4)" << endl; cout << "Which range to search? (default is 1-4)" << endl;
for(int i = 0; i< ranges.size();i++) for(size_t i = 0; i< ranges.size();i++)
{ {
cout << dec << "(" << i << ") "; cout << dec << "(" << i << ") ";
printRange(&(ranges[i])); printRange(&(ranges[i]));
@ -161,10 +161,10 @@ bool Incremental ( vector <uint64_t> &found, const char * what, T& output,
cout << ">>"; cout << ">>";
std::getline(cin, select); std::getline(cin, select);
size_t num = 0; size_t num = 0;
if( sscanf(select.c_str(),"p %d", &num) && num > 0) if( sscanf(select.c_str(),"p %zd", &num) && num > 0)
{ {
cout << "Found "<< plural <<":" << endl; cout << "Found "<< plural <<":" << endl;
for(int i = 0; i < min(found.size(), num);i++) for(size_t i = 0; i < min(found.size(), num);i++)
{ {
cout << hex << "0x" << found[i] << endl; cout << hex << "0x" << found[i] << endl;
} }
@ -173,7 +173,7 @@ bool Incremental ( vector <uint64_t> &found, const char * what, T& output,
else if(select == "p") else if(select == "p")
{ {
cout << "Found "<< plural <<":" << endl; cout << "Found "<< plural <<":" << endl;
for(int i = 0; i < found.size();i++) for(size_t i = 0; i < found.size();i++)
{ {
cout << hex << "0x" << found[i] << endl; cout << hex << "0x" << found[i] << endl;
} }
@ -424,10 +424,10 @@ bool TriggerIncremental ( vector <uint64_t> &found )
cout << ">>"; cout << ">>";
std::getline(cin, select); std::getline(cin, select);
size_t num = 0; size_t num = 0;
if( sscanf(select.c_str(),"p %d", &num) && num > 0) if( sscanf(select.c_str(),"p %zd", &num) && num > 0)
{ {
cout << "Found coords:" << endl; cout << "Found coords:" << endl;
for(int i = 0; i < min(found.size(), num);i++) for(size_t i = 0; i < min(found.size(), num);i++)
{ {
cout << hex << "0x" << found[i] << endl; cout << hex << "0x" << found[i] << endl;
} }
@ -436,7 +436,7 @@ bool TriggerIncremental ( vector <uint64_t> &found )
else if(select == "p") else if(select == "p")
{ {
cout << "Found coords:" << endl; cout << "Found coords:" << endl;
for(int i = 0; i < found.size();i++) for(size_t i = 0; i < found.size();i++)
{ {
cout << hex << "0x" << found[i] << endl; cout << hex << "0x" << found[i] << endl;
} }
@ -606,7 +606,7 @@ void DataPtrTrace(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& r
void printFound(vector <uint64_t> &found, const char * what) void printFound(vector <uint64_t> &found, const char * what)
{ {
cout << what << ":" << endl; cout << what << ":" << endl;
for(int i = 0; i < found.size();i++) for(size_t i = 0; i < found.size();i++)
{ {
cout << hex << "0x" << found[i] << endl; cout << hex << "0x" << found[i] << endl;
} }
@ -615,7 +615,7 @@ void printFound(vector <uint64_t> &found, const char * what)
void printFoundStrVec(vector <uint64_t> &found, const char * what, SegmentedFinder & s) void printFoundStrVec(vector <uint64_t> &found, const char * what, SegmentedFinder & s)
{ {
cout << what << ":" << endl; cout << what << ":" << endl;
for(int i = 0; i < found.size();i++) for(size_t i = 0; i < found.size();i++)
{ {
cout << hex << "0x" << found[i] << endl; cout << hex << "0x" << found[i] << endl;
cout << "--------------------------" << endl; cout << "--------------------------" << endl;
@ -719,7 +719,7 @@ void autoSearch(DFHack::Context * DF, vector <DFHack::t_memrange>& ranges)
sf.Filter<const char * ,vecTriplet>("DWARF",to_filter, vectorStringFirst); sf.Filter<const char * ,vecTriplet>("DWARF",to_filter, vectorStringFirst);
// verify // verify
for(int i = 0; i < to_filter.size(); i++) for(size_t i = 0; i < to_filter.size(); i++)
{ {
vecTriplet * vec = sf.Translate<vecTriplet>(to_filter[i]); vecTriplet * vec = sf.Translate<vecTriplet>(to_filter[i]);
if(((vec->finish - vec->start) / 4) == 4) // verified if(((vec->finish - vec->start) / 4) == 4) // verified
@ -909,9 +909,6 @@ int main (void)
vector <DFHack::t_memrange> selected_ranges; vector <DFHack::t_memrange> selected_ranges;
getRanges(p,selected_ranges); getRanges(p,selected_ranges);
DFHack::VersionInfo *minfo = DF->getMemoryInfo();
DFHack::OSType os = minfo->getOS();
string prompt = string prompt =
"Select search type: 1=number(default), 2=vector by length, 3=vector>object>string,\n" "Select search type: 1=number(default), 2=vector by length, 3=vector>object>string,\n"
" 4=string, 5=automated offset search, 6=vector by address in its array,\n" " 4=string, 5=automated offset search, 6=vector by address in its array,\n"

@ -18,7 +18,9 @@ int main (int numargs, const char ** args)
DFHack::ContextManager DFMgr("Memory.xml"); DFHack::ContextManager DFMgr("Memory.xml");
DFHack::Context *DF = DFMgr.getSingleContext(); DFHack::Context *DF = DFMgr.getSingleContext();
BEGIN_PROBE: #ifndef LINUX_BUILD
BEGIN_PROBE:
#endif
try try
{ {
DF->Attach(); DF->Attach();
@ -39,17 +41,13 @@ int main (int numargs, const char ** args)
DFHack::Process * p = DF->getProcess(); DFHack::Process * p = DF->getProcess();
OffsetGroup *mapsg = mem->getGroup("Maps"); OffsetGroup *mapsg = mem->getGroup("Maps");
OffsetGroup *mapblockg = mapsg->getGroup("block"); OffsetGroup *mapblockg = mapsg->getGroup("block");
OffsetGroup *localfeatg = mapsg->getGroup("features")->getGroup("local");
uint32_t region_x_offset = mapsg->getAddress("region_x"); uint32_t region_x_offset = mapsg->getAddress("region_x");
uint32_t region_y_offset = mapsg->getAddress("region_y"); uint32_t region_y_offset = mapsg->getAddress("region_y");
uint32_t region_z_offset = mapsg->getAddress("region_z"); uint32_t region_z_offset = mapsg->getAddress("region_z");
uint32_t designatus = mapblockg->getOffset("designation"); uint32_t designatus = mapblockg->getOffset("designation");
uint32_t block_feature1 = mapblockg->getOffset("feature_local");
uint32_t block_feature2 = mapblockg->getOffset("feature_global");
uint32_t feature1_start_ptr = localfeatg->getAddress("start_ptr");
int32_t regionX, regionY, regionZ; int32_t regionX, regionY, regionZ;
// read position of the region inside DF world // read position of the region inside DF world
@ -80,7 +78,6 @@ int main (int numargs, const char ** args)
printf("block addr: 0x%x\n", block.origin); printf("block addr: 0x%x\n", block.origin);
int16_t tiletype = block.tiletypes[tileX][tileY]; int16_t tiletype = block.tiletypes[tileX][tileY];
naked_designation &des = block.designation[tileX][tileY].bits; naked_designation &des = block.designation[tileX][tileY].bits;
uint32_t &desw = block.designation[tileX][tileY].whole;
print_bits<uint32_t>(block.designation[tileX][tileY].whole,std::cout); print_bits<uint32_t>(block.designation[tileX][tileY].whole,std::cout);
std::cout << endl; std::cout << endl;
print_bits<uint32_t>(block.occupancy[tileX][tileY].whole,std::cout); print_bits<uint32_t>(block.occupancy[tileX][tileY].whole,std::cout);
@ -91,11 +88,11 @@ int main (int numargs, const char ** args)
if(tileTypeTable[tiletype].name) if(tileTypeTable[tiletype].name)
std::cout << " = " << tileTypeTable[tiletype].name << std::endl; std::cout << " = " << tileTypeTable[tiletype].name << std::endl;
printf("%-10s: %4d %s\n","Class",tileTypeTable[tiletype].c,TileClassString[ tileTypeTable[tiletype].c ] , 0); printf("%-10s: %4d %s\n","Class",tileTypeTable[tiletype].c,TileClassString[ tileTypeTable[tiletype].c ]);
printf("%-10s: %4d %s\n","Material",tileTypeTable[tiletype].c,TileMaterialString[ tileTypeTable[tiletype].m ] , 0); printf("%-10s: %4d %s\n","Material",tileTypeTable[tiletype].c,TileMaterialString[ tileTypeTable[tiletype].m ]);
printf("%-10s: %4d %s\n","Special",tileTypeTable[tiletype].c,TileSpecialString[ tileTypeTable[tiletype].s ] , 0); printf("%-10s: %4d %s\n","Special",tileTypeTable[tiletype].c,TileSpecialString[ tileTypeTable[tiletype].s ]);
printf("%-10s: %4d\n","Variant",tileTypeTable[tiletype].v , 0); printf("%-10s: %4d\n","Variant",tileTypeTable[tiletype].v);
printf("%-10s: %s\n","Direction",tileTypeTable[tiletype].d.getStr() , 0); printf("%-10s: %s\n","Direction",tileTypeTable[tiletype].d.getStr());
std::cout << std::endl; std::cout << std::endl;

@ -309,7 +309,7 @@ int main (int argc, const char* argv[])
} }
} }
std::sort(matss.begin(), matss.end(), compare_pair_second<>()); std::sort(matss.begin(), matss.end(), compare_pair_second<>());
for(int i = 0; i < matss.size();i++) for(size_t i = 0; i < matss.size();i++)
{ {
if(matss[i].first >= Mats->inorganic.size()) if(matss[i].first >= Mats->inorganic.size())
{ {

@ -119,7 +119,7 @@ int main (void)
DF->Attach(); DF->Attach();
Maps = DF->getMaps(); Maps = DF->getMaps();
Maps->Start(); Maps->Start();
for(int i = 0; i < hidesaved.size();i++) for(size_t i = 0; i < hidesaved.size();i++)
{ {
hideblock & hb = hidesaved[i]; hideblock & hb = hidesaved[i];
Maps->ReadDesignations(hb.x,hb.y,hb.z, &designations); Maps->ReadDesignations(hb.x,hb.y,hb.z, &designations);

@ -306,7 +306,6 @@ int main (int argc, char* argv[])
uint32_t x_max,y_max,z_max; uint32_t x_max,y_max,z_max;
DFHack::Maps * Maps = DF->getMaps(); DFHack::Maps * Maps = DF->getMaps();
DFHack::Materials * Mats = DF->getMaterials();
DFHack::Position * Pos = DF->getPosition(); DFHack::Position * Pos = DF->getPosition();
// init the map // init the map

@ -50,13 +50,13 @@ int gotoxy(int x, int y)
return 0; return 0;
} }
int putch(int x, int y, int znak, int color) void putch(int x, int y, int znak, int color)
{ {
attron(COLOR_PAIR(color)); attron(COLOR_PAIR(color));
mvwaddch(stdscr, y, x, znak); mvwaddch(stdscr, y, x, znak);
attroff(COLOR_PAIR(color)); attroff(COLOR_PAIR(color));
} }
int putwch(int x, int y, int znak, int color) void putwch(int x, int y, int znak, int color)
{ {
attron(COLOR_PAIR(color)); attron(COLOR_PAIR(color));
mvwaddch(stdscr, y, x, znak); mvwaddch(stdscr, y, x, znak);
@ -88,7 +88,7 @@ int putwch(int x, int y, int znak, int color)
PEBBLES PEBBLES
};*/ };*/
int puttile(int x, int y, int tiletype, int color) void puttile(int x, int y, int tiletype, int color)
{ {
unsigned int znak; unsigned int znak;
switch(tileTypeTable[tiletype].c) switch(tileTypeTable[tiletype].c)
@ -102,7 +102,7 @@ int puttile(int x, int y, int tiletype, int color)
mvwaddwstr(stdscr, y, x, L"\u2593"); mvwaddwstr(stdscr, y, x, L"\u2593");
attroff(COLOR_PAIR(color)); attroff(COLOR_PAIR(color));
//znak = ; //znak = ;
return 0; return;
case FORTIFICATION: case FORTIFICATION:
znak = '#'; znak = '#';
break; break;
@ -119,12 +119,12 @@ int puttile(int x, int y, int tiletype, int color)
attron(COLOR_PAIR(color)); attron(COLOR_PAIR(color));
mvwaddwstr(stdscr, y, x, L"\u25B2"); mvwaddwstr(stdscr, y, x, L"\u25B2");
attroff(COLOR_PAIR(color)); attroff(COLOR_PAIR(color));
return 0; return;
case RAMP_TOP: case RAMP_TOP:
attron(COLOR_PAIR(color)); attron(COLOR_PAIR(color));
mvwaddwstr(stdscr, y, x, L"\u25BC"); mvwaddwstr(stdscr, y, x, L"\u25BC");
attroff(COLOR_PAIR(color)); attroff(COLOR_PAIR(color));
return 0; return;
case FLOOR: case FLOOR:
znak = '.'; znak = '.';
break; break;
@ -133,19 +133,19 @@ int puttile(int x, int y, int tiletype, int color)
attron(COLOR_PAIR(color)); attron(COLOR_PAIR(color));
mvwaddwstr(stdscr, y, x, L"\u2663"); mvwaddwstr(stdscr, y, x, L"\u2663");
attroff(COLOR_PAIR(color)); attroff(COLOR_PAIR(color));
return 0; return;
case SAPLING_DEAD: case SAPLING_DEAD:
case SAPLING_OK: case SAPLING_OK:
attron(COLOR_PAIR(color)); attron(COLOR_PAIR(color));
mvwaddwstr(stdscr, y, x, L"\u03C4"); mvwaddwstr(stdscr, y, x, L"\u03C4");
attroff(COLOR_PAIR(color)); attroff(COLOR_PAIR(color));
return 0; return;
case SHRUB_DEAD: case SHRUB_DEAD:
case SHRUB_OK: case SHRUB_OK:
attron(COLOR_PAIR(color)); attron(COLOR_PAIR(color));
mvwaddwstr(stdscr, y, x, L"\u2666"); mvwaddwstr(stdscr, y, x, L"\u2666");
attroff(COLOR_PAIR(color)); attroff(COLOR_PAIR(color));
return 0; return;
case BOULDER: case BOULDER:
case PEBBLES: case PEBBLES:
znak= '*'; znak= '*';
@ -249,7 +249,7 @@ void hexdump (DFHack::Context* DF, uint32_t address, uint32_t length, int filenu
myfile.open (name.c_str()); myfile.open (name.c_str());
DF->ReadRaw(address, reallength, (uint8_t *) buf); DF->ReadRaw(address, reallength, (uint8_t *) buf);
for (int i = 0; i < lines; i++) for (size_t i = 0; i < lines; i++)
{ {
// leading offset // leading offset
myfile << "0x" << hex << setw(4) << i*16 << " "; myfile << "0x" << hex << setw(4) << i*16 << " ";
@ -483,7 +483,7 @@ void do_features(Context* DF, mapblock40d * block, uint32_t blockX, uint32_t blo
} }
} }
main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
/* initialize your non-curses data structures here */ /* initialize your non-curses data structures here */
@ -495,8 +495,6 @@ main(int argc, char *argv[])
cbreak(); /* take input chars one at a time, no wait for \n */ cbreak(); /* take input chars one at a time, no wait for \n */
noecho(); /* don't echo input */ noecho(); /* don't echo input */
//nodelay(stdscr, true); //nodelay(stdscr, true);
int wxMax = getmaxx(stdscr);
int wyMax = getmaxy(stdscr);
keypad(stdscr, TRUE); keypad(stdscr, TRUE);
scrollok(stdscr, TRUE); scrollok(stdscr, TRUE);
@ -571,7 +569,6 @@ main(int argc, char *argv[])
hasmats = false; hasmats = false;
} }
Process* p = DF->getProcess();
// init the map // init the map
if(!Maps->Start()) if(!Maps->Start())
{ {
@ -761,7 +758,6 @@ main(int argc, char *argv[])
Mats->ReadCreatureTypes(); Mats->ReadCreatureTypes();
} }
} }
uint32_t effectnum;
/* /*
if(DF.InitReadEffects(effectnum)) if(DF.InitReadEffects(effectnum))
{ {
@ -950,7 +946,6 @@ main(int argc, char *argv[])
else if(vein < mineralsize + icesize + splattersize) else if(vein < mineralsize + icesize + splattersize)
{ {
realvein = vein - mineralsize - icesize; realvein = vein - mineralsize - icesize;
t_spattervein &bloodmud = splatter[realvein];
for(uint32_t yyy = 0; yyy < 16; yyy++) for(uint32_t yyy = 0; yyy < 16; yyy++)
{ {
for(uint32_t xxx = 0; xxx < 16; xxx++) for(uint32_t xxx = 0; xxx < 16; xxx++)
@ -1127,4 +1122,4 @@ static void finish(int sig)
cerr << error << endl; cerr << error << endl;
} }
exit(0); exit(0);
} }