Add --showdead flag to also display dead creatures

- Add --showdead flag to also display dead creatures
- Display more creature flags
- Updated usage()
develop
Raoul XQ 2011-04-13 12:47:50 +02:00
parent 30d5bfbf47
commit 1d1c10601d
1 changed files with 41 additions and 17 deletions

@ -23,8 +23,10 @@
* - Hide skills with level 0 and 0 experience points * - Hide skills with level 0 and 0 experience points
* Done: * Done:
* - Add --showdead flag to also display dead creatures
* - Display more creature flags
* - Show creature type (again) * - Show creature type (again)
* - Add switch -1 to only display one line for every creature. Good for an overview. * - Add switch -1/--summary to only display one line for every creature. Good for an overview.
* - Display current job (has been there all the time, but not shown in Windows due to missing memory offsets) * - Display current job (has been there all the time, but not shown in Windows due to missing memory offsets)
* - Remove magic numbers * - Remove magic numbers
* - Show social skills only when -ss is given * - Show social skills only when -ss is given
@ -90,6 +92,7 @@ bool verbose = false;
bool showhauler = true; bool showhauler = true;
bool showsocial = false; bool showsocial = false;
bool showfirstlineonly = false; bool showfirstlineonly = false;
bool showdead = false;
int hauler_labors[] = { int hauler_labors[] = {
LABOR_STONE_HAULING LABOR_STONE_HAULING
@ -122,14 +125,19 @@ void usage(int argc, const char * argv[])
cout cout
<< "Usage:" << endl << "Usage:" << endl
<< argv[0] << " [option 1] [option 2] [...]" << endl << argv[0] << " [option 1] [option 2] [...]" << endl
<< endl
<< "Display options:" << endl
<< "-q : Suppress \"Press any key to continue\" at program termination" << endl << "-q : Suppress \"Press any key to continue\" at program termination" << endl
<< "-v : Increase verbosity" << endl << "-v : Increase verbosity" << endl
<< "-c creature : Only show/modify this creature type instead of dwarfes" << endl << "-c creature : Only show/modify this creature type instead of dwarfes" << endl
<< "-1 : Only display one line per creature" << endl << "-1/--summary : Only display one line per creature" << endl
<< "-i id : Only show/modify creature with this id" << endl << "-i id : Only show/modify creature with this id" << endl
<< "-nn : Only show/modify creatures with no custom nickname (migrants)" << endl << "-nn/--nonicks : Only show/modify creatures with no custom nickname (migrants)" << endl
<< "--nicks : Only show/modify creatures with custom nickname" << endl << "--nicks : Only show/modify creatures with custom nickname" << endl
<< "-ll : List available labors" << endl << "-ll : List available labors" << endl
<< "--showdead : Also show/modify dead creatures" << endl
<< endl
<< "Modifying options:" << endl
<< "-al <n> : Add labor <n> to creature" << endl << "-al <n> : Add labor <n> to creature" << endl
<< "-rl <n> : Remove labor <n> from creature" << endl << "-rl <n> : Remove labor <n> from creature" << endl
<< "-ras : Remove all skills from creature" << endl << "-ras : Remove all skills from creature" << endl
@ -279,7 +287,11 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature, in
printf(" %-32s", name.c_str()); printf(" %-32s", name.c_str());
printf(" %-16s", toCaps(profession).c_str()); printf(" %-16s", toCaps(profession).c_str());
printf(" %-30s", job.c_str()); printf(" %-30s", job.c_str());
printf(" %d", creature.happiness); printf(" %5d", creature.happiness);
if (showdead)
{
printf(" %-5s", creature.flags1.bits.dead ? "Dead" : "Alive");
}
return; return;
} }
@ -366,8 +378,16 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature, in
if(creature.flags1.bits.skeleton) { cout << "Flag: Skeletal" << endl; } if(creature.flags1.bits.skeleton) { cout << "Flag: Skeletal" << endl; }
if(creature.flags1.bits.zombie) { cout << "Flag: Zombie" << endl; } if(creature.flags1.bits.zombie) { cout << "Flag: Zombie" << endl; }
if(creature.flags1.bits.tame) { cout << "Flag: Tame" << endl; } if(creature.flags1.bits.tame) { cout << "Flag: Tame" << endl; }
if(creature.flags1.bits.active_invader) { cout << toCaps("Flag: active_invader") << endl; }
if(creature.flags1.bits.hidden_in_ambush) { cout << toCaps("Flag: hidden_in_ambush") << endl; }
if(creature.flags1.bits.invader_origin) { cout << toCaps("Flag: invader_origin") << endl; }
if(creature.flags1.bits.coward) { cout << toCaps("Flag: coward") << endl; }
if(creature.flags1.bits.hidden_ambusher) { cout << toCaps("Flag: hidden_ambusher") << endl; }
if(creature.flags1.bits.caged) { cout << toCaps("Flag: caged") << endl; }
if(creature.flags1.bits.chained) { cout << toCaps("Flag: chained") << endl; }
if(creature.flags1.bits.royal_guard) { cout << "Flag: Royal guard" << endl; } if(creature.flags1.bits.royal_guard) { cout << "Flag: Royal guard" << endl; }
if(creature.flags1.bits.fortress_guard) { cout << "Flag: Fortress guard" << endl; } if(creature.flags1.bits.fortress_guard) { cout << "Flag: Fortress guard" << endl; }
/* FLAGS 2 */ /* FLAGS 2 */
if(creature.flags2.bits.killed) { cout << "Flag: Killed by kill function" << endl; } if(creature.flags2.bits.killed) { cout << "Flag: Killed by kill function" << endl; }
if(creature.flags2.bits.resident) { cout << "Flag: Resident" << endl; } if(creature.flags2.bits.resident) { cout << "Flag: Resident" << endl; }
@ -440,7 +460,7 @@ int main (int argc, const char* argv[])
{ {
verbose = true; verbose = true;
} }
else if(arg_cur == "-1") else if(arg_cur == "-1" || arg_cur == "--summary")
{ {
showfirstlineonly = true; showfirstlineonly = true;
} }
@ -452,6 +472,10 @@ int main (int argc, const char* argv[])
{ {
showhauler = false; showhauler = false;
} }
else if(arg_cur == "--showdead")
{
showdead = true;
}
else if(arg_cur == "-ras") else if(arg_cur == "-ras")
{ {
remove_skills = true; remove_skills = true;
@ -519,7 +543,7 @@ int main (int argc, const char* argv[])
{ {
remove_hauler = true; remove_hauler = true;
} }
else if(arg_cur == "-nn") else if(arg_cur == "-nn" || arg_cur == "--nonicks")
{ {
find_nonicks = true; find_nonicks = true;
} }
@ -626,8 +650,8 @@ int main (int argc, const char* argv[])
{ {
if (showfirstlineonly) if (showfirstlineonly)
{ {
printf("ID Type Name/nickname Job title Current job Happiness\n"); printf("ID Type Name/nickname Job title Current job Happy%s\n", showdead?" Dead ":"");
printf("--- ----------------- -------------------------------- ---------------- ------------------------------ ---------\n"); printf("--- ----------------- -------------------------------- ---------------- ------------------------------ -----%s\n", showdead?" -----":"");
} }
vector<uint32_t> addrs; vector<uint32_t> addrs;
@ -648,7 +672,7 @@ int main (int argc, const char* argv[])
|| (find_nicks == true && hasnick == true) || (find_nicks == true && hasnick == true)
|| (find_nicks == false && find_nonicks == false)) || (find_nicks == false && find_nonicks == false))
&& (find_nonicks == false || creature.name.nickname[0] == '\0') && (find_nonicks == false || creature.name.nickname[0] == '\0')
&& (!creature.flags1.bits.dead) && (showdead == true || !creature.flags1.bits.dead)
) )
{ {
printCreature(DF,creature,creature_idx); printCreature(DF,creature,creature_idx);
@ -674,7 +698,7 @@ int main (int argc, const char* argv[])
{ {
cout cout
<< "Not changing creature because none of -c (other than dwarf), -i or -nn was" << endl << "Not changing creature because none of -c (other than dwarf), -i or -nn was" << endl
<< "selected. Add -f to still do mass designation." << endl; << "selected. Add -f (force) to override this safety measure." << endl;
dochange = false; dochange = false;
} }