[Change] Compressed the debug messages.

This commit is contained in:
Allanis 2013-02-27 14:36:56 +00:00
parent e87f160e23
commit ddadb068fe
4 changed files with 18 additions and 12 deletions

View File

@ -266,7 +266,7 @@ int factions_load(void) {
free(buf); free(buf);
xmlCleanupParser(); xmlCleanupParser();
DEBUG("Loaded %d faction%c", nfactions, (nfactions==1)?' ':'s'); DEBUG("Loaded %d Faction%s", nfactions, (nfactions==1) ?"": "s");
return 0; return 0;
} }

View File

@ -280,8 +280,6 @@ static Outfit* outfit_parse(const xmlNodePtr parent) {
MELEMENT(tmp->type==0, "type"); MELEMENT(tmp->type==0, "type");
#undef MELEMENT #undef MELEMENT
DEBUG("Loaded outfit '%s' of type '%s'", tmp->name, outfit_getType(tmp));
return tmp; return tmp;
} }
@ -319,6 +317,9 @@ int outfit_load(void) {
xmlFreeDoc(doc); xmlFreeDoc(doc);
free(buf); free(buf);
xmlCleanupParser(); xmlCleanupParser();
DEBUG("Loaded %d outfit%s", outfits, (outfits==1) ? "" : "s");
return 0; return 0;
} }

View File

@ -166,9 +166,7 @@ static Ship* ship_parse(xmlNodePtr parent) {
MELEMENT(tmp->cap_weapon==0, "cap_weapon"); MELEMENT(tmp->cap_weapon==0, "cap_weapon");
#undef MELEMENT #undef MELEMENT
DEBUG("Loaded ship '%s'", tmp->name);
return tmp; return tmp;
} }
int ships_load(void) { int ships_load(void) {
@ -205,6 +203,8 @@ int ships_load(void) {
free(buf); free(buf);
xmlCleanupParser(); xmlCleanupParser();
DEBUG("Loaded %d ship%s", ships, (ships==1) ? "" : "s");
return 0; return 0;
} }

View File

@ -36,8 +36,9 @@
#define FLAG_ASTEROIDSSET (1<<2) #define FLAG_ASTEROIDSSET (1<<2)
#define FLAG_INTEFERENCESET (1<<3) #define FLAG_INTEFERENCESET (1<<3)
StarSystem* systems = NULL; StarSystem* systems = NULL; // Star system stack.
static int nsystems = 0; static int nsystems = 0; // Number of star systems.
static int nplanets = 0; // Total number of loaded planets - A little silly.
StarSystem* cur_system = NULL; // Current star system. StarSystem* cur_system = NULL; // Current star system.
// Current stardate in nice format. // Current stardate in nice format.
@ -52,7 +53,7 @@ typedef struct Star_ {
static Star* stars = NULL; // Star array. static Star* stars = NULL; // Star array.
static int nstars = 0; // Total stars. static int nstars = 0; // Total stars.
static int mstars = 0; static int mstars = 0; // Memory stars are taking.
// Intern // Intern
static Planet* planet_get(const char* name); static Planet* planet_get(const char* name);
@ -390,6 +391,7 @@ static StarSystem* system_parse(const xmlNodePtr parent) {
cur = node->children; cur = node->children;
do { do {
if(xml_isNode(cur, "planet")) { if(xml_isNode(cur, "planet")) {
nplanets++; // Increase planet counter.
planet = planet_get(xml_get(cur)); planet = planet_get(xml_get(cur));
planet = planet_get((const char*)cur->children->content); planet = planet_get((const char*)cur->children->content);
tmp->planets = realloc(tmp->planets, sizeof(Planet)*(++tmp->nplanets)); tmp->planets = realloc(tmp->planets, sizeof(Planet)*(++tmp->nplanets));
@ -430,7 +432,6 @@ static StarSystem* system_parse(const xmlNodePtr parent) {
MELEMENT(flags&FLAG_ASTEROIDSSET, "asteroids"); // Can be 0. MELEMENT(flags&FLAG_ASTEROIDSSET, "asteroids"); // Can be 0.
MELEMENT(flags&FLAG_INTEFERENCESET, "inteference"); MELEMENT(flags&FLAG_INTEFERENCESET, "inteference");
#undef MELEMENT #undef MELEMENT
DEBUG("Loaded Star System '%s' with %d Planet%c", tmp->name, tmp->nplanets, (tmp->nplanets == 1) ? ' ' : 's');
return tmp; return tmp;
} }
@ -517,6 +518,10 @@ int space_load(void) {
free(buf); free(buf);
xmlCleanupParser(); xmlCleanupParser();
DEBUG("Loaded %d star system%s with %d planet%s",
nsystems, (nsystems==1) ? "" : "s",
nplanets, (nplanets==1) ? "" : "s");
return 0; return 0;
} }