forked from github/server
Merge branch 'master' into develop
This commit is contained in:
commit
1c11d25082
|
@ -6,6 +6,10 @@ local function equip_first(u)
|
||||||
equip_unit(u, name, 255)
|
equip_unit(u, name, 255)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function equip_demon(u)
|
||||||
|
u.race_name = 'human'
|
||||||
|
end
|
||||||
|
|
||||||
local mysets = {
|
local mysets = {
|
||||||
['first_unit'] = {
|
['first_unit'] = {
|
||||||
['items'] = {
|
['items'] = {
|
||||||
|
@ -77,7 +81,8 @@ local mysets = {
|
||||||
['seed_demon'] = {
|
['seed_demon'] = {
|
||||||
['skills'] = {
|
['skills'] = {
|
||||||
['stamina'] = 15
|
['stamina'] = 15
|
||||||
}
|
},
|
||||||
|
['callback'] = equip_demon
|
||||||
},
|
},
|
||||||
['seed_insect'] = {
|
['seed_insect'] = {
|
||||||
['items'] = {
|
['items'] = {
|
||||||
|
|
|
@ -258,11 +258,14 @@ unit *addplayer(region * r, faction * f)
|
||||||
const char * name;
|
const char * name;
|
||||||
|
|
||||||
assert(r->land);
|
assert(r->land);
|
||||||
|
assert(f->units == NULL);
|
||||||
if (rpeasants(r) < PEASANT_MIN) {
|
if (rpeasants(r) < PEASANT_MIN) {
|
||||||
rsetpeasants(r, PEASANT_MIN + rng_int() % (PEASANT_MAX - PEASANT_MIN));
|
rsetpeasants(r, PEASANT_MIN + rng_int() % (PEASANT_MAX - PEASANT_MIN));
|
||||||
}
|
}
|
||||||
|
if (rtrees(r, TREE_TREE) < 50) {
|
||||||
|
rsettrees(r, TREE_TREE, 50);
|
||||||
|
}
|
||||||
|
|
||||||
assert(f->units == NULL);
|
|
||||||
faction_setorigin(f, 0, r->x, r->y);
|
faction_setorigin(f, 0, r->x, r->y);
|
||||||
u = create_unit(r, f, 1, f->race, 0, NULL, NULL);
|
u = create_unit(r, f, 1, f->race, 0, NULL, NULL);
|
||||||
u->status = ST_FLEE;
|
u->status = ST_FLEE;
|
||||||
|
|
|
@ -232,20 +232,22 @@ typedef struct parser_state {
|
||||||
|
|
||||||
static void handle_faction(void *userData, int no, const char *password) {
|
static void handle_faction(void *userData, int no, const char *password) {
|
||||||
parser_state *state = (parser_state *)userData;
|
parser_state *state = (parser_state *)userData;
|
||||||
faction * f = state->f = findfaction(no);
|
faction * f = findfaction(no);
|
||||||
if (!f) {
|
if (!f) {
|
||||||
log_debug("orders for unknown faction %s", itoa36(no));
|
log_debug("orders for unknown faction %s", itoa36(no));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
state->u = NULL;
|
||||||
|
state->next_order = NULL;
|
||||||
|
state->f = NULL;
|
||||||
if (checkpasswd(f, password)) {
|
if (checkpasswd(f, password)) {
|
||||||
|
state->f = f;
|
||||||
f->lastorders = turn;
|
f->lastorders = turn;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log_debug("invalid password for faction %s", itoa36(no));
|
log_debug("invalid password for faction %s", itoa36(no));
|
||||||
ADDMSG(&f->msgs, msg_message("wrongpasswd", "password", password));
|
ADDMSG(&f->msgs, msg_message("wrongpasswd", "password", password));
|
||||||
}
|
}
|
||||||
state->u = NULL;
|
|
||||||
state->next_order = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue