Hide skills with level 0 and 0 experience points

- Hide skills with level 0 and 0 experience points
- Tabs to spaces
develop
Raoul XQ 2011-04-13 06:30:37 +02:00
parent 19c4371581
commit ad93afc1ee
1 changed files with 45 additions and 41 deletions

@ -20,6 +20,7 @@
* - Kill/revive creature(s) with --kill/--revive * - Kill/revive creature(s) with --kill/--revive
* - Show skills/labors only when -ss/-sl/-v is given or a skill/labor is changed * - Show skills/labors only when -ss/-sl/-v is given or a skill/labor is changed
* - Allow multiple -i switches * - Allow multiple -i switches
* - Hide skills with level 0 and 0 experience points
* Done: * Done:
* - Add switch -1 to only display one line for every creature. Good for an overview. * - Add switch -1 to only display one line for every creature. Good for an overview.
@ -68,17 +69,17 @@ using namespace std;
#define SKILL_FLATTERY 82 #define SKILL_FLATTERY 82
#define SKILL_CONSOLING 83 #define SKILL_CONSOLING 83
#define SKILL_PACIFICATION 84 #define SKILL_PACIFICATION 84
#define LABOR_STONE_HAULING 1 #define LABOR_STONE_HAULING 1
#define LABOR_WOOD_HAULING 2 #define LABOR_WOOD_HAULING 2
#define LABOR_BURIAL 3 #define LABOR_BURIAL 3
#define LABOR_FOOD_HAULING 4 #define LABOR_FOOD_HAULING 4
#define LABOR_REFUSE_HAULING 5 #define LABOR_REFUSE_HAULING 5
#define LABOR_ITEM_HAULING 6 #define LABOR_ITEM_HAULING 6
#define LABOR_FURNITURE_HAULING 7 #define LABOR_FURNITURE_HAULING 7
#define LABOR_ANIMAL_HAULING 8 #define LABOR_ANIMAL_HAULING 8
#define LABOR_CLEANING 9 #define LABOR_CLEANING 9
#define LABOR_FEED_PATIENTS_PRISONERS 22 #define LABOR_FEED_PATIENTS_PRISONERS 22
#define LABOR_RECOVERING_WOUNDED 23 #define LABOR_RECOVERING_WOUNDED 23
#define NOT_SET INT_MIN #define NOT_SET INT_MIN
#define MAX_MOOD 4 #define MAX_MOOD 4
#define NO_MOOD -1 #define NO_MOOD -1
@ -123,7 +124,7 @@ void usage(int argc, const char * argv[])
<< "-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 : 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 : 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
@ -220,15 +221,15 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature, in
else else
{ {
if(creature.name.first_name[0]) if(creature.name.first_name[0])
{ {
name = toCaps(creature.name.first_name); name = toCaps(creature.name.first_name);
string transName = Tran->TranslateName(creature.name,false); string transName = Tran->TranslateName(creature.name,false);
if(!transName.empty()) if(!transName.empty())
{ {
name += " " + toCaps(transName); name += " " + toCaps(transName);
} }
} }
} }
string profession=""; string profession="";
@ -241,34 +242,34 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature, in
} }
if(creature.custom_profession[0]) if(creature.custom_profession[0])
{ {
profession = creature.custom_profession; profession = creature.custom_profession;
} }
string job="No Job"; string job="No Job";
if(creature.current_job.active) if(creature.current_job.active)
{ {
job=mem->getJob(creature.current_job.jobId); job=mem->getJob(creature.current_job.jobId);
} }
if (showfirstlineonly) if (showfirstlineonly)
{ {
printf("%3d", index); printf("%3d", index);
printf(" %-32s", name.c_str()); printf(" %-32s", name.c_str());
printf(" %-15s", toCaps(profession).c_str()); printf(" %-15s", toCaps(profession).c_str());
printf(" %-30s", job.c_str()); printf(" %-30s", job.c_str());
printf(" %d", creature.happiness); printf(" %d", creature.happiness);
return; return;
} }
else else
{ {
printf("ID: %d", index); printf("ID: %d", index);
printf(", %s", name.c_str()); printf(", %s", name.c_str());
printf(", %s", toCaps(profession).c_str()); printf(", %s", toCaps(profession).c_str());
printf(", Job: %s", job.c_str()); printf(", Job: %s", job.c_str());
printf(", Happiness: %d", creature.happiness); printf(", Happiness: %d", creature.happiness);
printf("\n"); printf("\n");
} }
if((creature.mood != NO_MOOD) && (creature.mood<=MAX_MOOD)) if((creature.mood != NO_MOOD) && (creature.mood<=MAX_MOOD))
@ -311,8 +312,11 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature, in
skillname = "Unknown skill"; skillname = "Unknown skill";
cout << e.what() << endl; cout << e.what() << endl;
} }
cout << "(Skill " << int(skillid) << ") " << setw(16) << skillname << ": " if (skillrating > 0 || skillexperience > 0)
<< skillrating << "/" << skillexperience << endl; {
cout << "(Skill " << int(skillid) << ") " << setw(16) << skillname << ": "
<< skillrating << "/" << skillexperience << endl;
}
} }
} }
@ -598,11 +602,11 @@ int main (int argc, const char* argv[])
} }
else else
{ {
if (showfirstlineonly) if (showfirstlineonly)
{ {
printf("ID Name/nickname Job title Current job Happiness\n"); printf("ID Name/nickname Job title Current job Happiness\n");
printf("--- -------------------------------- --------------- ------------------------------ ---------\n"); printf("--- -------------------------------- --------------- ------------------------------ ---------\n");
} }
vector<uint32_t> addrs; vector<uint32_t> addrs;
for(uint32_t creature_idx = 0; creature_idx < numCreatures; creature_idx++) for(uint32_t creature_idx = 0; creature_idx < numCreatures; creature_idx++)