Variablen leserlicher gemacht

This commit is contained in:
CTD 2015-01-12 10:55:07 +01:00
parent 5b82e7709d
commit 34fc1b3d34
8 changed files with 32 additions and 32 deletions

View File

@ -3,22 +3,22 @@
<function name="name" value="castle_name_2"/> <function name="name" value="castle_name_2"/>
<function name="protection" value="building_protection"/> <function name="protection" value="building_protection"/>
<function name="taxes" value="lua_building_taxes"/> <function name="taxes" value="lua_building_taxes"/>
<construction skill="building" minskill="1" maxsize="10" reqsize="1" prot="0"> <construction skill="building" minskill="1" maxsize="10" reqsize="1" defense_bonus="0">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="2" maxsize="40" reqsize="1" prot="1"> <construction skill="building" minskill="2" maxsize="40" reqsize="1" defense_bonus="1">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="3" maxsize="200" reqsize="1" prot="3"> <construction skill="building" minskill="3" maxsize="200" reqsize="1" defense_bonus="3">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="4" maxsize="1000" reqsize="1" prot="5"> <construction skill="building" minskill="4" maxsize="1000" reqsize="1" defense_bonus="5">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="5" maxsize="5000" reqsize="1" prot="8"> <construction skill="building" minskill="5" maxsize="5000" reqsize="1" defense_bonus="8">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="6" reqsize="1" prot="12"> <construction skill="building" minskill="6" reqsize="1" defense_bonus="12">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
</building> </building>

View File

@ -2,25 +2,25 @@
<building name="castle" capacity="1"> <building name="castle" capacity="1">
<function name="name" value="castle_name"/> <function name="name" value="castle_name"/>
<function name="protection" value="building_protection"/> <function name="protection" value="building_protection"/>
<construction skill="building" minskill="1" maxsize="2" reqsize="1" prot="0"> <construction skill="building" minskill="1" maxsize="2" reqsize="1" defense_bonus="0">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="1" maxsize="8" reqsize="1" prot="0"> <construction skill="building" minskill="1" maxsize="8" reqsize="1" defense_bonus="0">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="2" maxsize="40" reqsize="1" prot="1"> <construction skill="building" minskill="2" maxsize="40" reqsize="1" defense_bonus="1">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="3" maxsize="200" reqsize="1" prot="3"> <construction skill="building" minskill="3" maxsize="200" reqsize="1" defense_bonus="3">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="4" maxsize="1000" reqsize="1" prot="5"> <construction skill="building" minskill="4" maxsize="1000" reqsize="1" defense_bonus="5">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="5" maxsize="5000" reqsize="1" prot="8"> <construction skill="building" minskill="5" maxsize="5000" reqsize="1" defense_bonus="8">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="6" reqsize="1" prot="12"> <construction skill="building" minskill="6" reqsize="1" defense_bonus="12">
<requirement type="stone" quantity="1"/> <requirement type="stone" quantity="1"/>
</construction> </construction>
</building> </building>

View File

@ -7,13 +7,13 @@
<function name="name" value="fort_name"/> <function name="name" value="fort_name"/>
<function name="protection" value="building_protection"/> <function name="protection" value="building_protection"/>
<function name="taxes" value="lua_building_taxes"/> <function name="taxes" value="lua_building_taxes"/>
<construction skill="building" minskill="1" maxsize="5" reqsize="1" prot="0"> <construction skill="building" minskill="1" maxsize="5" reqsize="1" defense_bonus="0">
<requirement type="log" quantity="1"/> <requirement type="log" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="2" maxsize="5" reqsize="1" prot="1"> <construction skill="building" minskill="2" maxsize="5" reqsize="1" defense_bonus="1">
<requirement type="log" quantity="1"/> <requirement type="log" quantity="1"/>
</construction> </construction>
<construction skill="building" minskill="2" reqsize="1" prot="2"> <construction skill="building" minskill="2" reqsize="1" defense_bonus="2">
<requirement type="log" quantity="1"/> <requirement type="log" quantity="1"/>
</construction> </construction>
</building> </building>

View File

@ -57,7 +57,7 @@ static void test_make_fighter(CuTest * tc)
test_cleanup(); 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; return 2;
} }

View File

@ -45,9 +45,9 @@ extern "C" {
int maxsize; /* maximum size of this type */ int maxsize; /* maximum size of this type */
int reqsize; /* size of object using up 1 set of requirement. */ int reqsize; /* size of object using up 1 set of requirement. */
int prot; /* protection bonus (defense) during combat */ int defense_bonus; /* protection bonus (defense) during combat */
int ccbonus; /* close combat attack bonus*/ int close_combat_bonus; /* close combat attack bonus*/
int rangedbonus; /* ranged attack bonus */ int ranged_bonus; /* ranged attack bonus */
requirement *materials; /* material req'd to build one object */ requirement *materials; /* material req'd to build one object */
const struct building_type *btype; const struct building_type *btype;
/* building type required to make this thing */ /* building type required to make this thing */

View File

@ -316,7 +316,7 @@ const building_type *findbuildingtype(const char *name,
return (const building_type *)type.v; 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; int i = 0;
@ -334,11 +334,11 @@ static int building_protection(building * b, unit * u, buildingbonus bonus)
switch (bonus) switch (bonus)
{ {
case DEFENSE_BONUS: case DEFENSE_BONUS:
return cons->prot; return cons->defense_bonus;
case CC_ATTACK_BONUS: case CLOSE_COMBAT_ATTACK_BONUS:
return cons->ccbonus; return cons->close_combat_bonus;
case RANGED_ATTACK_BONUS: case RANGED_ATTACK_BONUS:
return cons->rangedbonus; return cons->ranged_bonus;
default: default:
return 0; return 0;
} }

View File

@ -50,9 +50,9 @@ extern "C" {
typedef enum { typedef enum {
DEFENSE_BONUS, DEFENSE_BONUS,
CC_ATTACK_BONUS, CLOSE_COMBAT_ATTACK_BONUS,
RANGED_ATTACK_BONUS, RANGED_ATTACK_BONUS,
} buildingbonus; } building_bonus;
typedef struct building_type { typedef struct building_type {
char *_name; char *_name;
@ -72,7 +72,7 @@ extern "C" {
const struct building * b, int size); const struct building * b, int size);
void (*init) (struct building_type *); void (*init) (struct building_type *);
void (*age) (struct building *); 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); double (*taxes) (const struct building *, int size);
struct attrib *attribs; struct attrib *attribs;
} building_type; } building_type;

View File

@ -167,9 +167,9 @@ construction ** consPtr)
con->maxsize = xml_ivalue(node, "maxsize", -1); con->maxsize = xml_ivalue(node, "maxsize", -1);
con->minskill = xml_ivalue(node, "minskill", -1); con->minskill = xml_ivalue(node, "minskill", -1);
con->reqsize = xml_ivalue(node, "reqsize", -1); con->reqsize = xml_ivalue(node, "reqsize", -1);
con->prot = xml_ivalue(node, "prot", 0); con->defense_bonus = xml_ivalue(node, "defense_bonus", 0);
con->ccbonus = xml_ivalue(node, "ccbonus", 0); con->close_combat_bonus = xml_ivalue(node, "close_combat_bonus", 0);
con->rangedbonus = xml_ivalue(node, "rangedbonus", 0); con->ranged_bonus = xml_ivalue(node, "ranged_bonus", 0);
propValue = xmlGetProp(node, BAD_CAST "building"); propValue = xmlGetProp(node, BAD_CAST "building");
if (propValue != NULL) { if (propValue != NULL) {
@ -300,7 +300,7 @@ static int parse_buildings(xmlDocPtr doc)
btype->age = (void(*)(struct building *))fun; btype->age = (void(*)(struct building *))fun;
} }
else if (strcmp((const char *)propValue, "protection") == 0) { 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) { else if (strcmp((const char *)propValue, "taxes") == 0) {
btype->taxes = (double(*)(const struct building *, int))fun; btype->taxes = (double(*)(const struct building *, int))fun;