forked from github/server
- equipment for new factions defined in xml, not lua.
- added possibility to give equipment to factions, not only the first unit - 4 adamantine for new factions - removed obsolete SHORTPWDS define
This commit is contained in:
parent
4035d153e7
commit
689dedae6d
10 changed files with 17 additions and 90 deletions
|
@ -997,19 +997,6 @@ cr_find_address(FILE * F, const faction * uf, const faction_list * addresses)
|
||||||
fprintf(F, "%d;alliance\n", f->alliance->id);
|
fprintf(F, "%d;alliance\n", f->alliance->id);
|
||||||
fprintf(F, "\"%s\";alliancename\n", f->alliance->name);
|
fprintf(F, "\"%s\";alliancename\n", f->alliance->name);
|
||||||
}
|
}
|
||||||
#ifdef SHORTPWDS
|
|
||||||
if (f->shortpwds) {
|
|
||||||
shortpwd * spwd = f->shortpwds;
|
|
||||||
while (spwd) {
|
|
||||||
unsigned int vacation = 0;
|
|
||||||
if (spwd->used) {
|
|
||||||
fprintf(F, "VACATION %u\n", ++vacation);
|
|
||||||
fprintf(F, "\"%s\";email\n", spwd->email);
|
|
||||||
}
|
|
||||||
spwd=spwd->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
flist = flist->next;
|
flist = flist->next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1722,18 +1722,6 @@ list_address(FILE * F, const faction * uf, const faction_list * seenfactions)
|
||||||
if (ALLIED(uf, f)) label = '*';
|
if (ALLIED(uf, f)) label = '*';
|
||||||
else if (alliedfaction(NULL, uf, f, HELP_ALL)) label = '+';
|
else if (alliedfaction(NULL, uf, f, HELP_ALL)) label = '+';
|
||||||
rparagraph(F, buf, 4, 0, label);
|
rparagraph(F, buf, 4, 0, label);
|
||||||
#ifdef SHORTPWDS
|
|
||||||
if (f->shortpwds) {
|
|
||||||
shortpwd * spwd = f->shortpwds;
|
|
||||||
while (spwd) {
|
|
||||||
if (spwd->used) {
|
|
||||||
sprintf(buf, "Vertretung: %s", spwd->email);
|
|
||||||
rparagraph(F, buf, 6, '-');
|
|
||||||
}
|
|
||||||
spwd=spwd->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
flist = flist->next;
|
flist = flist->next;
|
||||||
|
|
|
@ -182,7 +182,8 @@ addplayer(region *r, faction * f)
|
||||||
assert(f->units==NULL);
|
assert(f->units==NULL);
|
||||||
set_ursprung(f, 0, r->x, r->y);
|
set_ursprung(f, 0, r->x, r->y);
|
||||||
u = createunit(r, f, 1, f->race);
|
u = createunit(r, f, 1, f->race);
|
||||||
equip_unit(u, get_equipment("new_faction"));
|
equip_items(&u->faction->items, get_equipment("new_faction"));
|
||||||
|
equip_unit(u, get_equipment("first_unit"));
|
||||||
equip_unit(u, get_equipment(u->race->_name[0]));
|
equip_unit(u, get_equipment(u->race->_name[0]));
|
||||||
u->hp = unit_max_hp(u) * u->number;
|
u->hp = unit_max_hp(u) * u->number;
|
||||||
fset(u, UFL_ISNEW);
|
fset(u, UFL_ISNEW);
|
||||||
|
@ -200,16 +201,6 @@ addplayer(region *r, faction * f)
|
||||||
boolean
|
boolean
|
||||||
checkpasswd(const faction * f, const char * passwd, boolean shortp)
|
checkpasswd(const faction * f, const char * passwd, boolean shortp)
|
||||||
{
|
{
|
||||||
#ifdef SHORTPWDS
|
|
||||||
shortpwd * slist = f->shortpwds;
|
|
||||||
if (shortp) while (slist) {
|
|
||||||
if (strcmp(slist->pwd, passwd)==0) {
|
|
||||||
slist->used = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
slist = slist->next;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (unicode_utf8_strcasecmp(f->passw, passwd)==0) return true;
|
if (unicode_utf8_strcasecmp(f->passw, passwd)==0) return true;
|
||||||
if (unicode_utf8_strcasecmp(f->override, passwd)==0) return true;
|
if (unicode_utf8_strcasecmp(f->override, passwd)==0) return true;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -25,15 +25,6 @@ struct seen_region;
|
||||||
faction is in. defining this speeds up the turn by 30-40% */
|
faction is in. defining this speeds up the turn by 30-40% */
|
||||||
#define SMART_INTERVALS
|
#define SMART_INTERVALS
|
||||||
|
|
||||||
#ifdef SHORTPWDS
|
|
||||||
typedef struct shortpwd {
|
|
||||||
struct shortpwd * next;
|
|
||||||
char * email;
|
|
||||||
char * pwd;
|
|
||||||
boolean used;
|
|
||||||
} shortpwd;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* faction flags */
|
/* faction flags */
|
||||||
#define FFL_NEWID (1<<0) /* Die Partei hat bereits einmal ihre no gewechselt */
|
#define FFL_NEWID (1<<0) /* Die Partei hat bereits einmal ihre no gewechselt */
|
||||||
#define FFL_ISNEW (1<<1)
|
#define FFL_ISNEW (1<<1)
|
||||||
|
@ -74,9 +65,6 @@ typedef struct faction {
|
||||||
char *email;
|
char *email;
|
||||||
char *passw;
|
char *passw;
|
||||||
char *override;
|
char *override;
|
||||||
#ifdef SHORTPWDS
|
|
||||||
struct shortpwd * shortpwds;
|
|
||||||
#endif
|
|
||||||
const struct locale * locale;
|
const struct locale * locale;
|
||||||
int lastorders; /* enno: short? */
|
int lastorders; /* enno: short? */
|
||||||
int age; /* enno: short? */
|
int age; /* enno: short? */
|
||||||
|
|
|
@ -170,45 +170,10 @@ write_summary()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SHORTPWDS
|
|
||||||
static void
|
|
||||||
readshortpwds()
|
|
||||||
{
|
|
||||||
FILE * F;
|
|
||||||
char zText[MAX_PATH];
|
|
||||||
sprintf(zText, "%s/%s.%u", basepath(), "shortpwds", turn);
|
|
||||||
|
|
||||||
F = fopen(zText, "r");
|
|
||||||
if (F==NULL) {
|
|
||||||
log_error(("could not open password file %s", zText));
|
|
||||||
} else {
|
|
||||||
while (!feof(F)) {
|
|
||||||
faction * f;
|
|
||||||
char passwd[16], faction[5], email[64];
|
|
||||||
fscanf(F, "%s %s %s\n", faction, passwd, email);
|
|
||||||
f = findfaction(atoi36(faction));
|
|
||||||
if (f!=NULL) {
|
|
||||||
shortpwd * pwd = (shortpwd*)malloc(sizeof(shortpwd));
|
|
||||||
if (set_email(&pwd->email, email)!=0) {
|
|
||||||
log_error(("Invalid email address: %s\n", email));
|
|
||||||
}
|
|
||||||
pwd->pwd = strdup(passwd);
|
|
||||||
pwd->used = false;
|
|
||||||
pwd->next = f->shortpwds;
|
|
||||||
f->shortpwds = pwd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
process_orders(void)
|
process_orders(void)
|
||||||
{
|
{
|
||||||
#ifdef SHORTPWDS
|
|
||||||
readshortpwds("passwords");
|
|
||||||
#endif
|
|
||||||
turn++;
|
turn++;
|
||||||
processorders();
|
processorders();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,18 @@
|
||||||
<xi:include href="dungeons.xml"/>
|
<xi:include href="dungeons.xml"/>
|
||||||
<xi:include href="directions.xml"/>
|
<xi:include href="directions.xml"/>
|
||||||
|
|
||||||
|
<equipment>
|
||||||
|
<set name="first_unit">
|
||||||
|
<item name="conquesttoken" amount="1"/>
|
||||||
|
<item name="log" amount="30"/>
|
||||||
|
<item name="stone" amount="30"/>
|
||||||
|
<item name="money" amount="4200"/>
|
||||||
|
</set>
|
||||||
|
<set name="new_faction">
|
||||||
|
<item name="diamond" amount="4"/>
|
||||||
|
</set>
|
||||||
|
</equipment>
|
||||||
|
|
||||||
<xi:include href="names-undead.xml"/>
|
<xi:include href="names-undead.xml"/>
|
||||||
<xi:include href="names-skeletons.xml"/>
|
<xi:include href="names-skeletons.xml"/>
|
||||||
<xi:include href="names-zombies.xml"/>
|
<xi:include href="names-zombies.xml"/>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<xi:include href="terrains.xml"/>
|
<xi:include href="terrains.xml"/>
|
||||||
|
|
||||||
<equipment>
|
<equipment>
|
||||||
<set name="new_faction">
|
<set name="first_unit">
|
||||||
<item name="wood" amount="5"/>
|
<item name="wood" amount="5"/>
|
||||||
<item name="stone" amount="10"/>
|
<item name="stone" amount="10"/>
|
||||||
</set>
|
</set>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<xi:include href="kingdoms/buildings.xml"/>
|
<xi:include href="kingdoms/buildings.xml"/>
|
||||||
|
|
||||||
<equipment>
|
<equipment>
|
||||||
<set name="new_faction">
|
<set name="first_unit">
|
||||||
<item name="wood" amount="5"/>
|
<item name="wood" amount="5"/>
|
||||||
<item name="stone" amount="10"/>
|
<item name="stone" amount="10"/>
|
||||||
</set>
|
</set>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<skill name="building" level="2"/>
|
<skill name="building" level="2"/>
|
||||||
</set>
|
</set>
|
||||||
|
|
||||||
<set name="new_faction">
|
<set name="first_unit">
|
||||||
<subset>
|
<subset>
|
||||||
<set name="craftsman"/>
|
<set name="craftsman"/>
|
||||||
</subset>
|
</subset>
|
||||||
|
|
|
@ -50,10 +50,6 @@ end
|
||||||
|
|
||||||
function process(orders)
|
function process(orders)
|
||||||
-- initialize starting equipment for new players
|
-- initialize starting equipment for new players
|
||||||
equipment_setitem("new_faction", "conquesttoken", "1");
|
|
||||||
equipment_setitem("new_faction", "log", "30");
|
|
||||||
equipment_setitem("new_faction", "stone", "30");
|
|
||||||
equipment_setitem("new_faction", "money", "4200");
|
|
||||||
|
|
||||||
if open_game(get_turn())~=0 then
|
if open_game(get_turn())~=0 then
|
||||||
print("could not read game")
|
print("could not read game")
|
||||||
|
|
Loading…
Reference in a new issue