forked from github/server
"ID zu groß" - fixed parameters for some lua functions (pointers/objects)
This commit is contained in:
parent
7c65bfc5f7
commit
cf789999cf
4 changed files with 32 additions and 22 deletions
|
@ -973,6 +973,7 @@ maintain(building * b, boolean first)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef COLLAPSE_CHANCE
|
||||
static void
|
||||
gebaeude_stuerzt_ein(region * r, building * b)
|
||||
{
|
||||
|
@ -990,11 +991,13 @@ gebaeude_stuerzt_ein(region * r, building * b)
|
|||
freset(u, UFL_OWNER);
|
||||
leave(r,u);
|
||||
n = u->number;
|
||||
#ifdef COLLAPSE_SURVIVAL
|
||||
for (i = 0; i < n; i++) {
|
||||
if (rng_double() >= COLLAPSE_SURVIVAL) {
|
||||
++loss;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
scale_number(u, u->number - loss);
|
||||
opfer += loss;
|
||||
}
|
||||
|
@ -1012,6 +1015,7 @@ gebaeude_stuerzt_ein(region * r, building * b)
|
|||
msg_release(msg);
|
||||
remove_building(&r->buildings, b);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
maintain_buildings(region * r, boolean crash)
|
||||
|
@ -1023,10 +1027,13 @@ maintain_buildings(region * r, boolean crash)
|
|||
|
||||
/* the second time, send a message */
|
||||
if (crash) {
|
||||
#ifdef COLLAPSE_CHANCE
|
||||
if (!maintained && (rng_double() < COLLAPSE_CHANCE)) {
|
||||
gebaeude_stuerzt_ein(r, b);
|
||||
continue;
|
||||
} else if (!fval(b, BLD_WORKING)) {
|
||||
}
|
||||
#endif
|
||||
if (!fval(b, BLD_WORKING)) {
|
||||
unit * u = buildingowner(r, b);
|
||||
const char * msgtype = maintained?"maintenance_nowork":"maintenance_none";
|
||||
struct message * msg = msg_message(msgtype, "building", b);
|
||||
|
|
|
@ -66,13 +66,15 @@ extern "C" {
|
|||
#define PLAGUE_HEALCHANCE 0.25F /* Wahrscheinlichkeit Heilung */
|
||||
#define PLAGUE_HEALCOST 30 /* Heilkosten */
|
||||
|
||||
/** Monster */
|
||||
/* Chance of a monster attack */
|
||||
#define MONSTERATTACK 0.4F
|
||||
|
||||
#define MONSTERATTACK 0.4F /* Chance für Monsterangriff */
|
||||
|
||||
/** Gebäude */
|
||||
#define COLLAPSE_CHANCE 0.4F /* Chance für Einsturz bei unversorgtem Gebaeude */
|
||||
#define COLLAPSE_SURVIVAL 0.5F /* Soviele % überleben den Einsturz */
|
||||
/** Chance of an unmaintained building crashing */
|
||||
/* #define COLLAPSE_CHANCE 0.4F */
|
||||
#undef COLLAPSE_CHANCE
|
||||
/** chance to survive the crash of a building */
|
||||
/* #define COLLAPSE_SURVIVAL 0.5F */
|
||||
#undef COLLAPSE_SURVIVAL
|
||||
|
||||
/* Magiesystem */
|
||||
#define NIGHT_EYE_TALENT 5
|
||||
|
|
|
@ -56,9 +56,9 @@ lc_age(struct attrib * a)
|
|||
try {
|
||||
if (fparam) {
|
||||
std::string param(fparam);
|
||||
retval = luabind::call_function<int>(L, fname, *b, param);
|
||||
retval = luabind::call_function<int>(L, fname, b, param);
|
||||
} else {
|
||||
retval = luabind::call_function<int>(L, fname, *b);
|
||||
retval = luabind::call_function<int>(L, fname, b);
|
||||
}
|
||||
}
|
||||
catch (luabind::error& e) {
|
||||
|
@ -166,10 +166,10 @@ public:
|
|||
|
||||
|
||||
static eressea::list<unit *, unit *, buildingunit>
|
||||
building_units(const building& b) {
|
||||
region * r = b.region;
|
||||
building_units(const building * b) {
|
||||
region * r = b->region;
|
||||
unit * u = r->units;
|
||||
while (u!=NULL && (!u->building || u->building->no!=b.no)) u=u->next;
|
||||
while (u!=NULL && (!u->building || u->building->no!=b->no)) u=u->next;
|
||||
return eressea::list<unit *, unit *, buildingunit>(u);
|
||||
}
|
||||
|
||||
|
|
|
@ -317,9 +317,9 @@ unit_hpmax(const unit& u)
|
|||
}
|
||||
|
||||
static void
|
||||
unit_setregion(unit& u, region& r)
|
||||
unit_setregion(unit * u, region * r)
|
||||
{
|
||||
move_unit(&u, &r, NULL);
|
||||
move_unit(u, r, NULL);
|
||||
}
|
||||
|
||||
static region *
|
||||
|
@ -329,13 +329,13 @@ unit_getregion(const unit& u)
|
|||
}
|
||||
|
||||
static void
|
||||
unit_setship(unit& u, ship& s)
|
||||
unit_setship(unit& u, const ship& s)
|
||||
{
|
||||
leave(u.region, &u);
|
||||
if (u.region!=s.region) {
|
||||
unit_setregion(u, *s.region);
|
||||
move_unit(&u, s.region, NULL);
|
||||
}
|
||||
u.ship = &s;
|
||||
u.ship = findship(s.no);
|
||||
}
|
||||
|
||||
static ship *
|
||||
|
@ -345,13 +345,14 @@ unit_getship(const unit& u)
|
|||
}
|
||||
|
||||
static void
|
||||
unit_setbuilding(unit& u, building& b)
|
||||
unit_setbuilding(unit * u, building * b)
|
||||
{
|
||||
leave(u.region, &u);
|
||||
if (u.region!=b.region) {
|
||||
unit_setregion(u, *b.region);
|
||||
leave(u->region, u);
|
||||
if (u->region!=b->region) {
|
||||
move_unit(u, b->region, NULL);
|
||||
}
|
||||
u.building = &b;
|
||||
assert(b==findbuilding(b->no));
|
||||
u->building = b;
|
||||
}
|
||||
|
||||
static building *
|
||||
|
|
Loading…
Reference in a new issue