Fix number input in search tool

develop
Petr Mrázek 2010-06-06 01:33:18 +02:00
parent 1645df7088
commit f1e06b0c22
2 changed files with 29 additions and 11 deletions

@ -1975,6 +1975,25 @@ map_data_1b60_offset 0x1B9c
</Entry> </Entry>
<Entry version="v0.31.05" os="linux" id="30_05lin" base="linux-offsets-2010"> <Entry version="v0.31.05" os="linux" id="30_05lin" base="linux-offsets-2010">
<String name="md5">fea3801a26538b1741f3cc9294139fca</String> <String name="md5">fea3801a26538b1741f3cc9294139fca</String>
<!-- most probably a static object, because its parts are often
referenced as offset to this address *and* as addresses -->
<Address name="WORLD">0x92D00C0</Address> BOGUS!
Position and window dimensions
==============================
<Address name="window_x">0x8b0d36c</Address> BOGUS!
<Address name="window_y">0x8b0d370</Address> BOGUS!
<Address name="window_z">0x8b0d374</Address> BOGUS!
<Address name="cursor_xyz">0x8b0d36c</Address> VERIFIED
<Address name="window_dims">0x8b0d370</Address> BOGUS!
GUI State
=========
<Address name="pause_state">0x92bf73c</Address> VERIFIED
Map data
========
WORLD + 0x52C60?
<Address name="map_data">0x9322d20</Address>
</Entry> </Entry>
</MemoryDescriptors> </MemoryDescriptors>
</DFExtractor> </DFExtractor>

@ -208,21 +208,20 @@ bool Incremental ( vector <uint64_t> &found, const char * what, T& output,
} }
else else
{ {
stringstream ss (stringstream::in | stringstream::out); if( sscanf(select.c_str(),"0x%x", &output) == 1 )
ss << select;
ss >> hex >> output;
if(ss.fail())
{ {
ss >> dec >> output; cout << dec << output << endl;
if(ss.fail()) return true;
}
if( sscanf(select.c_str(),"%d", &output) == 1 )
{ {
cout << dec << output << endl;
return true;
}
cout << "not a valid value for type: " << what << endl; cout << "not a valid value for type: " << what << endl;
goto incremental_more; goto incremental_more;
} }
} }
return true;
}
}
void FindIntegers(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& ranges) void FindIntegers(DFHack::ContextManager & DFMgr, vector <DFHack::t_memrange>& ranges)
{ {