From 34fc1b3d348b31e6277cd0509fdbf05d677b9afe Mon Sep 17 00:00:00 2001 From: CTD Date: Mon, 12 Jan 2015 10:55:07 +0100 Subject: [PATCH] Variablen leserlicher gemacht --- res/buildings/castle-2.xml | 12 ++++++------ res/buildings/castle.xml | 14 +++++++------- res/e3a/buildings.xml | 6 +++--- src/battle.test.c | 2 +- src/kernel/build.h | 6 +++--- src/kernel/building.c | 10 +++++----- src/kernel/building.h | 6 +++--- src/kernel/xmlreader.c | 8 ++++---- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/res/buildings/castle-2.xml b/res/buildings/castle-2.xml index d1d07217b..76c908572 100644 --- a/res/buildings/castle-2.xml +++ b/res/buildings/castle-2.xml @@ -3,22 +3,22 @@ - + - + - + - + - + - + diff --git a/res/buildings/castle.xml b/res/buildings/castle.xml index 9758d5b64..49d1ca5a8 100644 --- a/res/buildings/castle.xml +++ b/res/buildings/castle.xml @@ -2,25 +2,25 @@ - + - + - + - + - + - + - + diff --git a/res/e3a/buildings.xml b/res/e3a/buildings.xml index e6513851e..227a2e47a 100644 --- a/res/e3a/buildings.xml +++ b/res/e3a/buildings.xml @@ -7,13 +7,13 @@ - + - + - + diff --git a/src/battle.test.c b/src/battle.test.c index f0b647aaf..d288b2661 100644 --- a/src/battle.test.c +++ b/src/battle.test.c @@ -57,7 +57,7 @@ static void test_make_fighter(CuTest * tc) test_cleanup(); } -static int add_two(building * b, unit * u, buildingbonus bonus) { +static int add_two(building * b, unit * u, building_bonus bonus) { return 2; } diff --git a/src/kernel/build.h b/src/kernel/build.h index 5568fb915..8bd41e409 100644 --- a/src/kernel/build.h +++ b/src/kernel/build.h @@ -45,9 +45,9 @@ extern "C" { int maxsize; /* maximum size of this type */ int reqsize; /* size of object using up 1 set of requirement. */ - int prot; /* protection bonus (defense) during combat */ - int ccbonus; /* close combat attack bonus*/ - int rangedbonus; /* ranged attack bonus */ + int defense_bonus; /* protection bonus (defense) during combat */ + int close_combat_bonus; /* close combat attack bonus*/ + int ranged_bonus; /* ranged attack bonus */ requirement *materials; /* material req'd to build one object */ const struct building_type *btype; /* building type required to make this thing */ diff --git a/src/kernel/building.c b/src/kernel/building.c index 50a892c5a..722b5d994 100644 --- a/src/kernel/building.c +++ b/src/kernel/building.c @@ -316,7 +316,7 @@ const building_type *findbuildingtype(const char *name, return (const building_type *)type.v; } -static int building_protection(building * b, unit * u, buildingbonus bonus) +static int building_protection(building * b, unit * u, building_bonus bonus) { int i = 0; @@ -334,11 +334,11 @@ static int building_protection(building * b, unit * u, buildingbonus bonus) switch (bonus) { case DEFENSE_BONUS: - return cons->prot; - case CC_ATTACK_BONUS: - return cons->ccbonus; + return cons->defense_bonus; + case CLOSE_COMBAT_ATTACK_BONUS: + return cons->close_combat_bonus; case RANGED_ATTACK_BONUS: - return cons->rangedbonus; + return cons->ranged_bonus; default: return 0; } diff --git a/src/kernel/building.h b/src/kernel/building.h index a74e30c3c..98db1bd2f 100644 --- a/src/kernel/building.h +++ b/src/kernel/building.h @@ -50,9 +50,9 @@ extern "C" { typedef enum { DEFENSE_BONUS, - CC_ATTACK_BONUS, + CLOSE_COMBAT_ATTACK_BONUS, RANGED_ATTACK_BONUS, - } buildingbonus; + } building_bonus; typedef struct building_type { char *_name; @@ -72,7 +72,7 @@ extern "C" { const struct building * b, int size); void (*init) (struct building_type *); void (*age) (struct building *); - int (*protection) (struct building *, struct unit *, buildingbonus); + int (*protection) (struct building *, struct unit *, building_bonus); double (*taxes) (const struct building *, int size); struct attrib *attribs; } building_type; diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index aa662c974..1b1c6b356 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -167,9 +167,9 @@ construction ** consPtr) con->maxsize = xml_ivalue(node, "maxsize", -1); con->minskill = xml_ivalue(node, "minskill", -1); con->reqsize = xml_ivalue(node, "reqsize", -1); - con->prot = xml_ivalue(node, "prot", 0); - con->ccbonus = xml_ivalue(node, "ccbonus", 0); - con->rangedbonus = xml_ivalue(node, "rangedbonus", 0); + con->defense_bonus = xml_ivalue(node, "defense_bonus", 0); + con->close_combat_bonus = xml_ivalue(node, "close_combat_bonus", 0); + con->ranged_bonus = xml_ivalue(node, "ranged_bonus", 0); propValue = xmlGetProp(node, BAD_CAST "building"); if (propValue != NULL) { @@ -300,7 +300,7 @@ static int parse_buildings(xmlDocPtr doc) btype->age = (void(*)(struct building *))fun; } else if (strcmp((const char *)propValue, "protection") == 0) { - btype->protection = (int(*)(struct building *, struct unit *, buildingbonus))fun; + btype->protection = (int(*)(struct building *, struct unit *, building_bonus))fun; } else if (strcmp((const char *)propValue, "taxes") == 0) { btype->taxes = (double(*)(const struct building *, int))fun;