forked from github/server
fix stone golems (assert).
remove improvement logic from build().
This commit is contained in:
parent
22734a4ae4
commit
e0e873044d
2 changed files with 7 additions and 23 deletions
|
@ -339,11 +339,11 @@ function test_stonegolems()
|
|||
u1:set_skill("building", 1)
|
||||
u2:set_skill("building", 1)
|
||||
|
||||
-- test that no server crash occur
|
||||
-- test that no server crash occurs
|
||||
u1:clear_orders()
|
||||
u1:add_order("Mache Burg")
|
||||
process_orders()
|
||||
assert_equal(0 ,u1.number, "There shoud be no Stone Golems")
|
||||
assert_equal(0, u1.number, "There should be no more stone golems")
|
||||
-- end test server crash
|
||||
|
||||
-- test that Stone Golems build for four stones
|
||||
|
@ -351,7 +351,7 @@ function test_stonegolems()
|
|||
u2:add_order("MACHE 4 BURG " .. itoa36(c1.id))
|
||||
process_orders()
|
||||
assert_equal(230, c1.size, "resulting size should be 230")
|
||||
assert_equal(1 ,u2.number, "There shoud be one Stone Golems")
|
||||
assert_equal(1, u2.number, "There should be one stone golem")
|
||||
-- end test Stone Golems four stones
|
||||
end
|
||||
|
||||
|
|
|
@ -512,15 +512,16 @@ int build(unit * u, const construction * ctype, int completed, int want, int ski
|
|||
|
||||
if (want <= 0)
|
||||
return 0;
|
||||
if (con == NULL)
|
||||
if (con == NULL) {
|
||||
return ENOMATERIALS;
|
||||
if (con->improvement == NULL && completed == con->maxsize)
|
||||
}
|
||||
if (completed == con->maxsize) {
|
||||
return ECOMPLETE;
|
||||
}
|
||||
if (con->skill != NOSKILL) {
|
||||
int effsk;
|
||||
int dm = get_effect(u, oldpotiontype[P_DOMORE]);
|
||||
|
||||
assert(u->number);
|
||||
basesk = effskill(u, con->skill, 0);
|
||||
if (basesk == 0)
|
||||
return ENEEDSKILL;
|
||||
|
@ -544,23 +545,6 @@ int build(unit * u, const construction * ctype, int completed, int want, int ski
|
|||
for (; want > 0 && skills > 0;) {
|
||||
int err, n;
|
||||
|
||||
/* skip over everything that's already been done:
|
||||
* type->improvement==NULL means no more improvements, but no size limits
|
||||
* type->improvement==type means build another object of the same time
|
||||
* while material lasts type->improvement==x means build x when type
|
||||
* is finished */
|
||||
while (con && con->improvement &&
|
||||
con->improvement != con &&
|
||||
con->maxsize > 0 && con->maxsize <= completed) {
|
||||
completed -= con->maxsize;
|
||||
con = con->improvement;
|
||||
}
|
||||
if (con == NULL) {
|
||||
if (made == 0)
|
||||
return ECOMPLETE;
|
||||
break; /* completed */
|
||||
}
|
||||
|
||||
/* Hier ist entweder maxsize == -1, oder completed < maxsize.
|
||||
* Andernfalls ist das Datenfile oder sonstwas kaputt...
|
||||
* (enno): Nein, das ist f<EFBFBD>r Dinge, bei denen die n<EFBFBD>chste Ausbaustufe
|
||||
|
|
Loading…
Reference in a new issue