Tagging first DF 2010 release

develop
Petr Mrázek 2010-04-10 03:49:37 +02:00
parent b248663e33
commit 887f1942cc
14 changed files with 26 additions and 23 deletions

@ -395,7 +395,7 @@ bool memory_info::resolveClassnameToVPtr(const string classname, uint32_t & vptr
bool memory_info::resolveClassIDToClassname (const int32_t classID, string & classname) bool memory_info::resolveClassIDToClassname (const int32_t classID, string & classname)
{ {
if (classID >=0 && classID < d->classnames.size()) if (classID >=0 && (uint32_t)classID < d->classnames.size())
{ {
classname = d->classnames[classID]; classname = d->classnames[classID];
return true; return true;

@ -9,6 +9,8 @@
#pragma warning( disable: 4251 ) #pragma warning( disable: 4251 )
// don't display bogus 'deprecation' and 'unsafe' warnings // don't display bogus 'deprecation' and 'unsafe' warnings
#pragma warning( disable: 4996 ) #pragma warning( disable: 4996 )
// disable stupid
#pragma warning( disable: 4800 )
#endif #endif
#endif #endif

@ -25,7 +25,7 @@ namespace DFHack
// FIXME: not complete, we need building presence bitmaps for stuff like farm plots and stockpiles, orientation (N,E,S,W) and state (open/closed) // FIXME: not complete, we need building presence bitmaps for stuff like farm plots and stockpiles, orientation (N,E,S,W) and state (open/closed)
}; };
struct APIPrivate; class APIPrivate;
class DFHACK_EXPORT Buildings class DFHACK_EXPORT Buildings
{ {
public: public:

@ -39,7 +39,7 @@ namespace DFHack
uint32_t origin; uint32_t origin;
}; };
struct APIPrivate; class APIPrivate;
class DFHACK_EXPORT Constructions class DFHACK_EXPORT Constructions
{ {
public: public:

@ -6,7 +6,7 @@
#include "Export.h" #include "Export.h"
namespace DFHack namespace DFHack
{ {
struct APIPrivate; class APIPrivate;
struct t_matgloss struct t_matgloss
{ {

@ -6,7 +6,7 @@
#include "Export.h" #include "Export.h"
namespace DFHack namespace DFHack
{ {
struct APIPrivate; class APIPrivate;
class DFHACK_EXPORT Position class DFHACK_EXPORT Position
{ {
public: public:

@ -6,7 +6,7 @@
#include "Export.h" #include "Export.h"
namespace DFHack namespace DFHack
{ {
struct APIPrivate; class APIPrivate;
typedef std::vector< std::vector<std::string> > DFDict; typedef std::vector< std::vector<std::string> > DFDict;
typedef struct typedef struct
{ {

@ -27,7 +27,7 @@ namespace DFHack
uint32_t address; uint32_t address;
}; };
struct APIPrivate; class APIPrivate;
class DFHACK_EXPORT Vegetation class DFHACK_EXPORT Vegetation
{ {
public: public:

@ -121,4 +121,5 @@ bool Buildings::Finish()
d->p_bld = NULL; d->p_bld = NULL;
} }
d->Started = false; d->Started = false;
return true;
} }

@ -292,6 +292,7 @@ bool Creatures::WriteLabors(const uint32_t index, uint8_t labors[NUM_CREATURE_LA
if(!d->Started) return false; if(!d->Started) return false;
uint32_t temp = * (uint32_t *) d->p_cre->at (index); uint32_t temp = * (uint32_t *) d->p_cre->at (index);
g_pProcess->write(temp + d->creatures.labors_offset, NUM_CREATURE_LABORS, labors); g_pProcess->write(temp + d->creatures.labors_offset, NUM_CREATURE_LABORS, labors);
return true;
} }
/* /*

@ -104,7 +104,7 @@ int main (int argc,const char* argv[])
{ {
DFHack::t_building temp; DFHack::t_building temp;
Bld->Read(i, temp); Bld->Read(i, temp);
if(x >= temp.x1 && x <= temp.x2 && y >= temp.y1 && y <= temp.y2 && z == temp.z) if((uint32_t)x >= temp.x1 && (uint32_t)x <= temp.x2 && (uint32_t)y >= temp.y1 && (uint32_t)y <= temp.y2 && (uint32_t)z == temp.z)
{ {
string typestr; string typestr;
mem->resolveClassIDToClassname(temp.type, typestr); mem->resolveClassIDToClassname(temp.type, typestr);

@ -44,7 +44,7 @@ int main (int numargs, const char ** args)
cout << "----==== Inorganic ====----" << endl; cout << "----==== Inorganic ====----" << endl;
vector<DFHack::t_matgloss> matgloss; vector<DFHack::t_matgloss> matgloss;
Materials->ReadInorganicMaterials (matgloss); Materials->ReadInorganicMaterials (matgloss);
for(int i = 0; i < matgloss.size();i++) for(uint32_t i = 0; i < matgloss.size();i++)
{ {
cout << matgloss[i].id << endl; cout << matgloss[i].id << endl;
} }
@ -52,14 +52,14 @@ int main (int numargs, const char ** args)
cout << endl << "----==== Organic ====----" << endl; cout << endl << "----==== Organic ====----" << endl;
vector<DFHack::t_matgloss> organic; vector<DFHack::t_matgloss> organic;
Materials->ReadOrganicMaterials (matgloss); Materials->ReadOrganicMaterials (matgloss);
for(int i = 0; i < matgloss.size();i++) for(uint32_t i = 0; i < matgloss.size();i++)
{ {
cout << matgloss[i].id << endl; cout << matgloss[i].id << endl;
} }
cout << endl << "----==== Creature types ====----" << endl; cout << endl << "----==== Creature types ====----" << endl;
vector<DFHack::t_matgloss> creature; vector<DFHack::t_matgloss> creature;
Materials->ReadCreatureTypes (matgloss); Materials->ReadCreatureTypes (matgloss);
for(int i = 0; i < matgloss.size();i++) for(uint32_t i = 0; i < matgloss.size();i++)
{ {
cout << matgloss[i].id << endl; cout << matgloss[i].id << endl;
} }

@ -16,7 +16,7 @@ void DumpObjStr0Vector (const char * name, DFHack::Process *p, uint32_t addr)
{ {
cout << "----==== " << name << " ====----" << endl; cout << "----==== " << name << " ====----" << endl;
DFHack::DfVector vect(p,addr,4); DFHack::DfVector vect(p,addr,4);
for(int i = 0; i < vect.getSize();i++) for(uint32_t i = 0; i < vect.getSize();i++)
{ {
uint32_t addr = *(uint32_t *) vect[i]; uint32_t addr = *(uint32_t *) vect[i];
cout << p->readSTLString(addr) << endl; cout << p->readSTLString(addr) << endl;
@ -27,7 +27,7 @@ void DumpObjVtables (const char * name, DFHack::Process *p, uint32_t addr)
{ {
cout << "----==== " << name << " ====----" << endl; cout << "----==== " << name << " ====----" << endl;
DFHack::DfVector vect(p,addr,4); DFHack::DfVector vect(p,addr,4);
for(int i = 0; i < vect.getSize();i++) for(uint32_t i = 0; i < vect.getSize();i++)
{ {
uint32_t addr = *(uint32_t *) vect[i]; uint32_t addr = *(uint32_t *) vect[i];
uint32_t vptr = p->readDWord(addr); uint32_t vptr = p->readDWord(addr);
@ -39,7 +39,7 @@ void DumpDWordVector (const char * name, DFHack::Process *p, uint32_t addr)
{ {
cout << "----==== " << name << " ====----" << endl; cout << "----==== " << name << " ====----" << endl;
DFHack::DfVector vect(p,addr,4); DFHack::DfVector vect(p,addr,4);
for(int i = 0; i < vect.getSize();i++) for(uint32_t i = 0; i < vect.getSize();i++)
{ {
uint32_t number = *(uint32_t *) vect[i]; uint32_t number = *(uint32_t *) vect[i];
cout << number << endl; cout << number << endl;
@ -56,7 +56,7 @@ void hexdump (DFHack::API& DF, uint32_t address, uint32_t length)
char *buf = new char[length * 16]; char *buf = new char[length * 16];
DF.ReadRaw(address, length * 16, (uint8_t *) buf); DF.ReadRaw(address, length * 16, (uint8_t *) buf);
for (int i = 0; i < length; i++) for (uint32_t i = 0; i < length; i++)
{ {
// leading offset // leading offset
cout << "0x" << hex << setw(8) << address + i*16 << "| "; cout << "0x" << hex << setw(8) << address + i*16 << "| ";
@ -81,7 +81,7 @@ void interleave_hex (DFHack::API& DF, vector < uint32_t > & addresses, uint32_t
{ {
vector <char * > bufs; vector <char * > bufs;
for(int counter = 0; counter < addresses.size(); counter ++) for(uint32_t counter = 0; counter < addresses.size(); counter ++)
{ {
char * buf = new char[length * 16]; char * buf = new char[length * 16];
DF.ReadRaw(addresses[counter], length * 16, (uint8_t *) buf); DF.ReadRaw(addresses[counter], length * 16, (uint8_t *) buf);
@ -91,13 +91,13 @@ void interleave_hex (DFHack::API& DF, vector < uint32_t > & addresses, uint32_t
// output a header // output a header
cout << "line offset "; cout << "line offset ";
for (int obj = 0; obj < addresses.size(); obj++) for (uint32_t obj = 0; obj < addresses.size(); obj++)
{ {
cout << "0x" << hex << setw(9) << addresses[obj] << " "; cout << "0x" << hex << setw(9) << addresses[obj] << " ";
} }
cout << endl; cout << endl;
for(int offs = 0 ; offs < length * 16; offs += 4) for(uint32_t offs = 0 ; offs < length * 16; offs += 4)
{ {
if((!(offs % 16)) && offs != 0) if((!(offs % 16)) && offs != 0)
{ {
@ -107,7 +107,7 @@ void interleave_hex (DFHack::API& DF, vector < uint32_t > & addresses, uint32_t
cout << dec << setw(4) << offs/4 << " "; cout << dec << setw(4) << offs/4 << " ";
cout << setfill('0'); cout << setfill('0');
cout << "0x" << hex << setw(4) << offs << " "; cout << "0x" << hex << setw(4) << offs << " ";
for (int object = 0; object < bufs.size(); object++) for (uint32_t object = 0; object < bufs.size(); object++)
{ {
// bytes // bytes
for(int k = 0; k < 4; k++) for(int k = 0; k < 4; k++)
@ -119,7 +119,7 @@ void interleave_hex (DFHack::API& DF, vector < uint32_t > & addresses, uint32_t
} }
cout << endl; cout << endl;
} }
for(int counter = 0; counter < addresses.size(); counter ++) for(uint32_t counter = 0; counter < addresses.size(); counter ++)
{ {
delete bufs[counter]; delete bufs[counter];
} }

@ -77,7 +77,6 @@ int get_material_vector(uint32_t vein_8, uint16_t vein_4, int WORLD_)
char shades[10] = {'#','$','O','=','+','|','-','^','.',' '}; char shades[10] = {'#','$','O','=','+','|','-','^','.',' '};
int main (int numargs, const char ** args) int main (int numargs, const char ** args)
{ {
uint32_t addr;
uint32_t x_max,y_max,z_max; uint32_t x_max,y_max,z_max;
vector<t_vein> veinVector; vector<t_vein> veinVector;
vector<t_frozenliquidvein> IceVeinVector; vector<t_frozenliquidvein> IceVeinVector;
@ -130,7 +129,7 @@ int main (int numargs, const char ** args)
{ {
printf("Block %d/%d/%d\n",x,y,z); printf("Block %d/%d/%d\n",x,y,z);
for(int i = 0; i < splatter.size(); i++) 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); 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,creature_types) << endl; cout << PrintSplatterType(splatter[i].mat1,splatter[i].mat2,creature_types) << endl;
@ -165,7 +164,7 @@ int main (int numargs, const char ** args)
{ {
printf("Block %d/%d/%d\n",bx,by,bz); printf("Block %d/%d/%d\n",bx,by,bz);
for(int i = 0; i < splatter.size(); i++) 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); 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,creature_types); PrintSplatterType(splatter[i].mat1,splatter[i].mat2,creature_types);