forked from github/server
merge from master
This commit is contained in:
commit
6c0f8a81f6
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
IGNORE=$(find src -name "*.test.c" | awk '{ print "-i"$1 }')
|
IGNORE=$(find src -name "*.test.c" | awk '{ print "-i"$1 }')
|
||||||
|
|
||||||
cppcheck $IGNORE \
|
cppcheck $IGNORE -isrc/tests.c \
|
||||||
--quiet --enable=all -U_MSC_VER -UCLEANUP_CODE -UTODO \
|
--quiet --enable=all -U_MSC_VER -UCLEANUP_CODE -UTODO \
|
||||||
-UERESSEA_BUILDNO -UERESSEA_VERSION \
|
-UERESSEA_BUILDNO -UERESSEA_VERSION \
|
||||||
-IcJSON -Isrc -Iclibs -Istorage src
|
-IcJSON -Isrc -Iclibs -Istorage src
|
||||||
|
|
|
@ -11,7 +11,6 @@ follow.c
|
||||||
hate.c
|
hate.c
|
||||||
iceberg.c
|
iceberg.c
|
||||||
key.c
|
key.c
|
||||||
moved.c
|
|
||||||
movement.c
|
movement.c
|
||||||
dict.c
|
dict.c
|
||||||
otherfaction.c
|
otherfaction.c
|
||||||
|
|
|
@ -30,7 +30,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "iceberg.h"
|
#include "iceberg.h"
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
#include "stealth.h"
|
#include "stealth.h"
|
||||||
#include "moved.h"
|
#include "magic.h"
|
||||||
#include "movement.h"
|
#include "movement.h"
|
||||||
#include "dict.h"
|
#include "dict.h"
|
||||||
#include "otherfaction.h"
|
#include "otherfaction.h"
|
||||||
|
@ -212,6 +212,7 @@ void register_attributes(void)
|
||||||
at_deprecate("xontormiaexpress", a_readint); /* required for old datafiles */
|
at_deprecate("xontormiaexpress", a_readint); /* required for old datafiles */
|
||||||
at_deprecate("orcification", a_readint); /* required for old datafiles */
|
at_deprecate("orcification", a_readint); /* required for old datafiles */
|
||||||
at_deprecate("lua", read_ext); /* required for old datafiles */
|
at_deprecate("lua", read_ext); /* required for old datafiles */
|
||||||
|
at_deprecate("moved", a_readint);
|
||||||
at_deprecate("gm", a_readint);
|
at_deprecate("gm", a_readint);
|
||||||
at_deprecate("guard", a_readint); /* used to contain guard-flags (v3.10.0-259-g8597e8b) */
|
at_deprecate("guard", a_readint); /* used to contain guard-flags (v3.10.0-259-g8597e8b) */
|
||||||
at_register(&at_stealth);
|
at_register(&at_stealth);
|
||||||
|
@ -231,5 +232,4 @@ void register_attributes(void)
|
||||||
at_register(&at_racename);
|
at_register(&at_racename);
|
||||||
at_register(&at_speedup);
|
at_register(&at_speedup);
|
||||||
at_register(&at_movement);
|
at_register(&at_movement);
|
||||||
at_register(&at_moved);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
|
||||||
Katja Zedel <katze@felidae.kn-bremen.de
|
|
||||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <platform.h>
|
|
||||||
#include <kernel/config.h>
|
|
||||||
#include "moved.h"
|
|
||||||
|
|
||||||
#include <util/attrib.h>
|
|
||||||
#include <util/gamedata.h>
|
|
||||||
#include <util/macros.h>
|
|
||||||
|
|
||||||
#include <storage.h>
|
|
||||||
|
|
||||||
static int age_moved(attrib * a, void *owner)
|
|
||||||
{
|
|
||||||
UNUSED_ARG(owner);
|
|
||||||
--a->data.i;
|
|
||||||
return a->data.i > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
write_moved(const variant *var, const void *owner, struct storage *store)
|
|
||||||
{
|
|
||||||
WRITE_INT(store, var->i);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int read_moved(variant *var, void *owner, gamedata *data)
|
|
||||||
{
|
|
||||||
READ_INT(data->store, &var->i);
|
|
||||||
if (var->i != 0)
|
|
||||||
return AT_READ_OK;
|
|
||||||
else
|
|
||||||
return AT_READ_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
attrib_type at_moved = {
|
|
||||||
"moved", NULL, NULL, age_moved, write_moved, read_moved
|
|
||||||
};
|
|
||||||
|
|
||||||
bool get_moved(attrib ** alist)
|
|
||||||
{
|
|
||||||
return a_find(*alist, &at_moved) ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_moved(attrib ** alist)
|
|
||||||
{
|
|
||||||
attrib *a = a_find(*alist, &at_moved);
|
|
||||||
if (a == NULL)
|
|
||||||
a = a_add(alist, a_new(&at_moved));
|
|
||||||
a->data.i = 2;
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
|
||||||
Katja Zedel <katze@felidae.kn-bremen.de
|
|
||||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef H_ATTRIBUTE_MOVED
|
|
||||||
#define H_ATTRIBUTE_MOVED
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct attrib;
|
|
||||||
struct attrib_type;
|
|
||||||
|
|
||||||
extern bool get_moved(struct attrib **alist);
|
|
||||||
extern void set_moved(struct attrib **alist);
|
|
||||||
|
|
||||||
extern struct attrib_type at_moved;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -57,7 +57,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <attributes/key.h>
|
#include <attributes/key.h>
|
||||||
#include <attributes/racename.h>
|
#include <attributes/racename.h>
|
||||||
#include <attributes/otherfaction.h>
|
#include <attributes/otherfaction.h>
|
||||||
#include <attributes/moved.h>
|
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/assert.h>
|
#include <util/assert.h>
|
||||||
|
|
|
@ -203,8 +203,9 @@ alliedgroup(const struct plane *pl, const struct faction *f,
|
||||||
if (!(faction_alive(f) && faction_alive(f2))) {
|
if (!(faction_alive(f) && faction_alive(f2))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
while (sf && sf->faction != f2)
|
while (sf && sf->faction != f2) {
|
||||||
sf = sf->next;
|
sf = sf->next;
|
||||||
|
}
|
||||||
if (sf == NULL) {
|
if (sf == NULL) {
|
||||||
mode = mode & autoalliance(pl, f, f2);
|
mode = mode & autoalliance(pl, f, f2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -935,6 +935,7 @@ static void read_password(gamedata *data, faction *f) {
|
||||||
else {
|
else {
|
||||||
faction_setpassword(f, (data->version >= CRYPT_VERSION) ? name : password_encode(name, PASSWORD_DEFAULT));
|
faction_setpassword(f, (data->version >= CRYPT_VERSION) ? name : password_encode(name, PASSWORD_DEFAULT));
|
||||||
}
|
}
|
||||||
|
(void)_test_read_password;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _test_read_password(gamedata *data, faction *f) {
|
void _test_read_password(gamedata *data, faction *f) {
|
||||||
|
@ -943,6 +944,7 @@ void _test_read_password(gamedata *data, faction *f) {
|
||||||
|
|
||||||
static void write_password(gamedata *data, const faction *f) {
|
static void write_password(gamedata *data, const faction *f) {
|
||||||
WRITE_TOK(data->store, (const char *)f->_password);
|
WRITE_TOK(data->store, (const char *)f->_password);
|
||||||
|
(void)_test_write_password;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _test_write_password(gamedata *data, const faction *f) {
|
void _test_write_password(gamedata *data, const faction *f) {
|
||||||
|
|
|
@ -39,7 +39,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
#include "terrain.h"
|
#include "terrain.h"
|
||||||
|
|
||||||
#include <attributes/moved.h>
|
|
||||||
#include <attributes/otherfaction.h>
|
#include <attributes/otherfaction.h>
|
||||||
#include <attributes/racename.h>
|
#include <attributes/racename.h>
|
||||||
#include <attributes/stealth.h>
|
#include <attributes/stealth.h>
|
||||||
|
|
11
src/magic.c
11
src/magic.c
|
@ -2393,17 +2393,6 @@ unit *get_clone(const unit * u)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unit *get_clone_mage(const unit * u)
|
|
||||||
{
|
|
||||||
attrib *a = a_find(u->attribs, &at_clonemage);
|
|
||||||
if (a != NULL) {
|
|
||||||
unit *um = (unit *)a->data.v;
|
|
||||||
if (um->number > 0)
|
|
||||||
return um;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool is_moving_ship(ship * sh)
|
static bool is_moving_ship(ship * sh)
|
||||||
{
|
{
|
||||||
const unit *u = ship_owner(sh);
|
const unit *u = ship_owner(sh);
|
||||||
|
|
|
@ -326,7 +326,6 @@ extern "C" {
|
||||||
struct unit *get_familiar(const struct unit *u);
|
struct unit *get_familiar(const struct unit *u);
|
||||||
struct unit *get_familiar_mage(const struct unit *u);
|
struct unit *get_familiar_mage(const struct unit *u);
|
||||||
struct unit *get_clone(const struct unit *u);
|
struct unit *get_clone(const struct unit *u);
|
||||||
struct unit *get_clone_mage(const struct unit *u);
|
|
||||||
void remove_familiar(struct unit *mage);
|
void remove_familiar(struct unit *mage);
|
||||||
void create_newfamiliar(struct unit *mage, struct unit *familiar);
|
void create_newfamiliar(struct unit *mage, struct unit *familiar);
|
||||||
void create_newclone(struct unit *mage, struct unit *familiar);
|
void create_newclone(struct unit *mage, struct unit *familiar);
|
||||||
|
|
|
@ -131,169 +131,6 @@ attrib_type at_museumgiveback = {
|
||||||
a_readmuseumgiveback
|
a_readmuseumgiveback
|
||||||
};
|
};
|
||||||
|
|
||||||
void warden_add_give(unit * src, unit * u, const item_type * itype, int n)
|
|
||||||
{
|
|
||||||
attrib *aw = a_find(u->attribs, &at_warden);
|
|
||||||
museumgiveback *gb = NULL;
|
|
||||||
museumgivebackcookie *gbc;
|
|
||||||
attrib *a;
|
|
||||||
|
|
||||||
/* has the giver a cookie corresponding to the warden */
|
|
||||||
for (a = a_find(src->attribs, &at_museumgivebackcookie);
|
|
||||||
a && a->type == &at_museumgivebackcookie; a = a->next) {
|
|
||||||
if (((museumgivebackcookie *)(a->data.v))->warden_no == u->no)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if not give it one */
|
|
||||||
if (a == NULL || a->type != &at_museumgivebackcookie) {
|
|
||||||
a = a_add(&src->attribs, a_new(&at_museumgivebackcookie));
|
|
||||||
gbc = (museumgivebackcookie *)a->data.v;
|
|
||||||
gbc->warden_no = u->no;
|
|
||||||
gbc->cookie = aw->data.i;
|
|
||||||
assert(aw->data.i < INT_MAX);
|
|
||||||
aw->data.i++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gbc = (museumgivebackcookie *)(a->data.v);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now we search for the warden's corresponding item list */
|
|
||||||
for (a = a_find(u->attribs, &at_museumgiveback);
|
|
||||||
a && a->type == &at_museumgiveback; a = a->next) {
|
|
||||||
gb = (museumgiveback *)a->data.v;
|
|
||||||
if (gb->cookie == gbc->cookie) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if there's none, give it one */
|
|
||||||
if (!gb) {
|
|
||||||
a = a_add(&u->attribs, a_new(&at_museumgiveback));
|
|
||||||
gb = (museumgiveback *)a->data.v;
|
|
||||||
gb->cookie = gbc->cookie;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now register the items */
|
|
||||||
i_change(&gb->items, itype, n);
|
|
||||||
|
|
||||||
/* done */
|
|
||||||
|
|
||||||
/* this has a caveat: If the src-unit is destroyed while inside
|
|
||||||
* the museum, the corresponding itemlist of the warden will never
|
|
||||||
* be removed. to circumvent that in a generic way will be extremly
|
|
||||||
* difficult. */
|
|
||||||
}
|
|
||||||
|
|
||||||
void create_museum(void)
|
|
||||||
{
|
|
||||||
#if 0 /* TODO: move this to Lua. It should be possible. */
|
|
||||||
unsigned int museum_id = hashstring("museum");
|
|
||||||
plane *museum = getplanebyid(museum_id);
|
|
||||||
region *r;
|
|
||||||
building *b;
|
|
||||||
const terrain_type *terrain_hall = get_terrain("hall1");
|
|
||||||
const terrain_type *terrain_corridor = get_terrain("corridor1");
|
|
||||||
|
|
||||||
assert(terrain_corridor && terrain_hall);
|
|
||||||
|
|
||||||
if (!museum) {
|
|
||||||
museum = create_new_plane(museum_id, "Museum", 9500, 9550,
|
|
||||||
9500, 9550, PFL_MUSEUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (findregion(9525, 9525) == NULL) {
|
|
||||||
/* Eingangshalle */
|
|
||||||
r = new_region(9525, 9525, 0);
|
|
||||||
terraform_region(r, terrain_hall);
|
|
||||||
r->planep = museum;
|
|
||||||
rsetname(r, "Eingangshalle");
|
|
||||||
rsethorses(r, 0);
|
|
||||||
rsetmoney(r, 0);
|
|
||||||
rsetpeasants(r, 0);
|
|
||||||
set_string(&r->display,
|
|
||||||
"Die Eingangshalle des Großen Museum der 1. Welt ist bereits jetzt ein beeindruckender Anblick. Obwohl das Museum noch nicht eröffnet ist, vermittelt sie bereits einen Flair exotischer Welten. In den Boden ist ein großer Kompass eingelassen, der den Besuchern bei Orientierung helfen soll.");
|
|
||||||
}
|
|
||||||
|
|
||||||
r = findregion(9526, 9525);
|
|
||||||
if (!r) {
|
|
||||||
/* Lounge */
|
|
||||||
r = new_region(9526, 9525, 0);
|
|
||||||
terraform_region(r, terrain_hall);
|
|
||||||
r->planep = museum;
|
|
||||||
rsetname(r, "Lounge");
|
|
||||||
rsethorses(r, 0);
|
|
||||||
rsetmoney(r, 0);
|
|
||||||
rsetpeasants(r, 0);
|
|
||||||
set_string(&r->display,
|
|
||||||
"Die Lounge des großen Museums ist ein Platz, in dem sich die Besucher treffen, um die Eindrücke, die sie gewonnen haben, zu verarbeiten. Gemütliche Sitzgruppen laden zum Verweilen ein.");
|
|
||||||
}
|
|
||||||
|
|
||||||
r = findregion(9526, 9525);
|
|
||||||
if (!r->buildings) {
|
|
||||||
const building_type *bt_generic = bt_find("generic");
|
|
||||||
b = new_building(bt_generic, r, NULL);
|
|
||||||
set_string(&b->name, "Séparée im dämonischen Stil");
|
|
||||||
set_string(&b->display,
|
|
||||||
"Diese ganz im dämonischen Stil gehaltene Sitzgruppe ist ganz in dunklen Schwarztönen gehalten. Muster fremdartiger Runen bedecken das merkwürdig geformte Mobiliar, das unangenehm lebendig wirkt.");
|
|
||||||
|
|
||||||
b = new_building(bt_generic, r, NULL);
|
|
||||||
set_string(&b->name, "Séparée im elfischen Stil");
|
|
||||||
set_string(&b->display,
|
|
||||||
"Ganz in Grün- und Brauntönen gehalten wirkt die Sitzgruppe fast lebendig. Bei näherer Betrachtung erschließt sich dem Betrachter, daß sie tatsächlich aus lebenden Pflanzen erstellt ist. So ist der Tisch aus einem eizigen Baum gewachsen, und die Polster bestehen aus weichen Grassoden. Ein wunderschön gemusterter Webteppich mit tausenden naturgetreu eingestickter Blumensarten bedeckt den Boden.");
|
|
||||||
|
|
||||||
b = new_building(bt_generic, r, NULL);
|
|
||||||
set_string(&b->name, "Séparée im halblingschen Stil");
|
|
||||||
set_string(&b->display,
|
|
||||||
"Dieses rustikale Mobiliar ist aus einem einzigen, gewaltigen Baum hergestellt worden. Den Stamm haben fleißige Halblinge der Länge nach gevierteilt und aus den vier langen Viertelstämmen die Sitzbänke geschnitzt, während der verbleibende Stumpf als Tisch dient. Schon von weitem steigen dem Besucher die Gerüche der Köstlichkeiten entgegen, die auf dem Tisch stapeln.");
|
|
||||||
|
|
||||||
b = new_building(bt_generic, r, NULL);
|
|
||||||
set_string(&b->name, "Séparée im orkischen Stil");
|
|
||||||
set_string(&b->display,
|
|
||||||
"Grobgeschreinerte, elfenhautbespannte Stühle und ein Tisch aus Knochen, über deren Herkunft man sich lieber keine Gedanken macht, bilden die Sitzgruppe im orkischen Stil. Überall haben Orks ihre Namen, und anderes wenig zitierenswertes in das Holz und Gebein geritzt.");
|
|
||||||
|
|
||||||
b = new_building(bt_generic, r, NULL);
|
|
||||||
set_string(&b->name, "Séparée im Meermenschenstil");
|
|
||||||
set_string(&b->display,
|
|
||||||
"Ganz in Blau- und Grüntönen gehalten, mit Algen und Muscheln verziert wirken die aus altem Meerholz geschnitzten Stühle immer ein wenig feucht. Seltsammerweise hat der schwere aus alten Planken gezimmerte Tisch einen Mast mit kompletten Segel in der Mitte.");
|
|
||||||
|
|
||||||
b = new_building(bt_generic, r, NULL);
|
|
||||||
set_string(&b->name, "Séparée im Katzenstil");
|
|
||||||
set_string(&b->display,
|
|
||||||
"Die Wände dieses Séparée sind aus dunklem Holz. Was aus der Ferne wie ein chaotisch durchbrochenes Flechtwerk wirkt, entpuppt sich bei näherer Betrachtung als eine bis in winzige Details gestaltete dschungelartige Landschaft, in die eine Vielzahl von kleinen Bildergeschichten eingewoben sind. Wie es scheint hat sich der Künstler Mühe gegeben wirklich jedes Katzenvolk Eresseas zu porträtieren. Das schummrige Innere wird von einem Kamin dominiert, vor dem einige Sessel und weiche Kissen zu einem gemütlichen Nickerchen einladen. Feiner Anduner Sisal bezieht die Lehnen der Sessel und verlockt dazu, seine Krallen hinein zu versenken. Auf einem kleinen Ecktisch steht ein großer Korb mit roten Wollknäulen und grauen und braunen Spielmäusen.");
|
|
||||||
} else {
|
|
||||||
for (b = r->buildings; b; b = b->next) {
|
|
||||||
b->size = b->type->maxsize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
r = findregion(9524, 9526);
|
|
||||||
if (!r) {
|
|
||||||
r = new_region(9524, 9526, 0);
|
|
||||||
terraform_region(r, terrain_corridor);
|
|
||||||
r->planep = museum;
|
|
||||||
rsetname(r, "Nördliche Promenade");
|
|
||||||
rsethorses(r, 0);
|
|
||||||
rsetmoney(r, 0);
|
|
||||||
rsetpeasants(r, 0);
|
|
||||||
set_string(&r->display,
|
|
||||||
"Die Nördliche Promenade führt direkt in den naturgeschichtlichen Teil des Museums.");
|
|
||||||
}
|
|
||||||
r = findregion(9525, 9524);
|
|
||||||
if (!r) {
|
|
||||||
r = new_region(9525, 9524, 0);
|
|
||||||
terraform_region(r, terrain_corridor);
|
|
||||||
r->planep = museum;
|
|
||||||
rsetname(r, "Südliche Promenade");
|
|
||||||
rsethorses(r, 0);
|
|
||||||
rsetmoney(r, 0);
|
|
||||||
rsetpeasants(r, 0);
|
|
||||||
set_string(&r->display,
|
|
||||||
"Die Südliche Promenade führt den Besucher in den kulturgeschichtlichen Teil des Museums.");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
use_museumexitticket(unit * u, const struct item_type *itype, int amount,
|
use_museumexitticket(unit * u, const struct item_type *itype, int amount,
|
||||||
order * ord)
|
order * ord)
|
||||||
|
|
|
@ -38,9 +38,6 @@ extern "C" {
|
||||||
} museumgiveback;
|
} museumgiveback;
|
||||||
|
|
||||||
extern void register_museum(void);
|
extern void register_museum(void);
|
||||||
extern void create_museum(void);
|
|
||||||
extern void warden_add_give(struct unit *src, struct unit *u,
|
|
||||||
const struct item_type *itype, int n);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -696,8 +696,7 @@ int check_ship_allowed(struct ship *sh, const region * r)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bt_harbour && buildingtype_exists(r, bt_harbour, true)) {
|
if (bt_harbour && buildingtype_exists(r, bt_harbour, true)) {
|
||||||
unit* harbourmaster = NULL;
|
unit* harbourmaster = owner_buildingtyp(r, bt_harbour);
|
||||||
harbourmaster = owner_buildingtyp(r, bt_harbour);
|
|
||||||
if (!harbourmaster || !sh->_owner) {
|
if (!harbourmaster || !sh->_owner) {
|
||||||
return SA_HARBOUR;
|
return SA_HARBOUR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -624,12 +624,11 @@ void create_icebergs(void)
|
||||||
if (r->terrain == t_sleep && chance(0.05)) {
|
if (r->terrain == t_sleep && chance(0.05)) {
|
||||||
bool has_ocean_neighbour = false;
|
bool has_ocean_neighbour = false;
|
||||||
direction_t dir;
|
direction_t dir;
|
||||||
region *rc;
|
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
freset(r, RF_SELECT);
|
freset(r, RF_SELECT);
|
||||||
for (dir = 0; dir < MAXDIRECTIONS; dir++) {
|
for (dir = 0; dir < MAXDIRECTIONS; dir++) {
|
||||||
rc = rconnect(r, dir);
|
region *rc = rconnect(r, dir);
|
||||||
if (rc && fval(rc->terrain, SEA_REGION)) {
|
if (rc && fval(rc->terrain, SEA_REGION)) {
|
||||||
has_ocean_neighbour = true;
|
has_ocean_neighbour = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2279,9 +2279,11 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
m = msg_message("nr_market_info_p", "p1 p2",
|
m = msg_message("nr_market_info_p", "p1 p2",
|
||||||
lux->rtype, herb->rtype);
|
lux->rtype, herb->rtype);
|
||||||
}
|
}
|
||||||
else if (lux || herb) {
|
else if (lux) {
|
||||||
m = msg_message("nr_market_info_s", "p1",
|
m = msg_message("nr_market_info_s", "p1",lux->rtype);
|
||||||
lux ? lux->rtype : herb->rtype);
|
}
|
||||||
|
else if (herb) {
|
||||||
|
m = msg_message("nr_market_info_s", "p1", herb->rtype);
|
||||||
}
|
}
|
||||||
if (m) {
|
if (m) {
|
||||||
newline(out);
|
newline(out);
|
||||||
|
|
|
@ -1083,14 +1083,6 @@ struct message *msg_curse(const struct curse *c, const void *obj, objtype_t typ,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct unit *ucansee(const struct faction *f, const struct unit *u,
|
|
||||||
const struct unit *x)
|
|
||||||
{
|
|
||||||
if (cansee(f, u->region, u, 0))
|
|
||||||
return u;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
int stealth_modifier(const region *r, const faction *f, seen_mode mode)
|
int stealth_modifier(const region *r, const faction *f, seen_mode mode)
|
||||||
{
|
{
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
|
|
@ -68,9 +68,6 @@ extern "C" {
|
||||||
int init_reports(void);
|
int init_reports(void);
|
||||||
void reorder_units(struct region * r);
|
void reorder_units(struct region * r);
|
||||||
|
|
||||||
const struct unit *ucansee(const struct faction *f,
|
|
||||||
const struct unit *u, const struct unit *x);
|
|
||||||
|
|
||||||
int stealth_modifier(const struct region *r, const struct faction *f, seen_mode mode);
|
int stealth_modifier(const struct region *r, const struct faction *f, seen_mode mode);
|
||||||
|
|
||||||
typedef struct report_context {
|
typedef struct report_context {
|
||||||
|
|
|
@ -1883,10 +1883,9 @@ static int sp_treewalkexit(castorder * co)
|
||||||
rt = pa->param[0]->data.r;
|
rt = pa->param[0]->data.r;
|
||||||
tax = rt->x;
|
tax = rt->x;
|
||||||
tay = rt->y;
|
tay = rt->y;
|
||||||
rt = NULL;
|
|
||||||
|
|
||||||
rl = astralregions(r, inhabitable);
|
rl = astralregions(r, inhabitable);
|
||||||
rt = 0;
|
rt = NULL;
|
||||||
|
|
||||||
rl2 = rl;
|
rl2 = rl;
|
||||||
while (rl2) {
|
while (rl2) {
|
||||||
|
@ -1991,7 +1990,6 @@ static int sp_treewalkexit(castorder * co)
|
||||||
*/
|
*/
|
||||||
static int sp_holyground(castorder * co)
|
static int sp_holyground(castorder * co)
|
||||||
{
|
{
|
||||||
const curse_type *ctype = NULL;
|
|
||||||
region *r = co_get_region(co);
|
region *r = co_get_region(co);
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
|
@ -2000,8 +1998,7 @@ static int sp_holyground(castorder * co)
|
||||||
report_spell(mage, r, msg);
|
report_spell(mage, r, msg);
|
||||||
msg_release(msg);
|
msg_release(msg);
|
||||||
|
|
||||||
ctype = &ct_holyground;
|
create_curse(mage, &r->attribs, &ct_holyground, power * power, 1, zero_effect, 0);
|
||||||
create_curse(mage, &r->attribs, ctype, power * power, 1, zero_effect, 0);
|
|
||||||
|
|
||||||
a_removeall(&r->attribs, &at_deathcount);
|
a_removeall(&r->attribs, &at_deathcount);
|
||||||
|
|
||||||
|
@ -6445,7 +6442,7 @@ static spelldata spell_functions[] = {
|
||||||
{ "illaundestroymagic", sp_destroy_magic, 0 },
|
{ "illaundestroymagic", sp_destroy_magic, 0 },
|
||||||
{ "clone", sp_clonecopy, 0 },
|
{ "clone", sp_clonecopy, 0 },
|
||||||
{ "bad_dreams", sp_baddreams, 0 },
|
{ "bad_dreams", sp_baddreams, 0 },
|
||||||
{ "mindblast", sp_mindblast_temp, 0 },
|
{ "mindblast", sp_mindblast, 0 },
|
||||||
{ "orkdream", sp_sweetdreams, 0 },
|
{ "orkdream", sp_sweetdreams, 0 },
|
||||||
/* M_CERDDOR */
|
/* M_CERDDOR */
|
||||||
{ "appeasement", sp_appeasement, 0 },
|
{ "appeasement", sp_appeasement, 0 },
|
||||||
|
|
|
@ -473,7 +473,7 @@ static skill_t random_skill(unit * u, bool weighted)
|
||||||
/** The mind blast spell for regular folks.
|
/** The mind blast spell for regular folks.
|
||||||
* This spell temporarily reduces the skill of the victims
|
* This spell temporarily reduces the skill of the victims
|
||||||
*/
|
*/
|
||||||
int sp_mindblast_temp(struct castorder * co)
|
int sp_mindblast(struct castorder * co)
|
||||||
{
|
{
|
||||||
fighter * fi = co->magician.fig;
|
fighter * fi = co->magician.fig;
|
||||||
int level = co->level;
|
int level = co->level;
|
||||||
|
@ -535,85 +535,6 @@ int sp_mindblast_temp(struct castorder * co)
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A mind blast spell for monsters.
|
|
||||||
* This spell PERMANENTLY reduces the skill of the victims or kills them
|
|
||||||
* when they have no skills left. Not currently in use.
|
|
||||||
*/
|
|
||||||
int sp_mindblast(struct castorder * co)
|
|
||||||
{
|
|
||||||
fighter * fi = co->magician.fig;
|
|
||||||
int level = co->level;
|
|
||||||
double power = co->force;
|
|
||||||
const spell * sp = co->sp;
|
|
||||||
battle *b = fi->side->battle;
|
|
||||||
unit *mage = fi->unit;
|
|
||||||
int killed = 0, k = 0, reset = 0;
|
|
||||||
message *m;
|
|
||||||
int force = lovar(power * 25);
|
|
||||||
int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
|
||||||
|
|
||||||
if (!enemies) {
|
|
||||||
m = msg_message("spell_out_of_range", "mage spell", fi->unit, sp);
|
|
||||||
message_all(b, m);
|
|
||||||
msg_release(m);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (enemies > 0 && force > 0) {
|
|
||||||
unit *du;
|
|
||||||
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
|
||||||
|
|
||||||
assert(dt.fighter);
|
|
||||||
du = dt.fighter->unit;
|
|
||||||
if (du->flags & UFL_MARK) {
|
|
||||||
/* not this one again */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (humanoidrace(u_race(du)) && force >= du->number) {
|
|
||||||
if (!is_magic_resistant(mage, du, 0)) {
|
|
||||||
skill_t sk = random_skill(du, false);
|
|
||||||
if (sk != NOSKILL) {
|
|
||||||
skill *sv = unit_skill(du, sk);
|
|
||||||
if (sv) {
|
|
||||||
int n = 1 + rng_int() % 3;
|
|
||||||
|
|
||||||
reduce_skill(du, sv, n);
|
|
||||||
k += du->number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* unit has no skill. kill it. */
|
|
||||||
kill_troop(dt);
|
|
||||||
++killed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
force -= du->number;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* only works against humanoids, don't try others. but do remove them
|
|
||||||
* from 'force' once or we may never terminate. */
|
|
||||||
du->flags |= UFL_MARK;
|
|
||||||
reset = 1;
|
|
||||||
}
|
|
||||||
enemies -= du->number;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reset) {
|
|
||||||
unit *u;
|
|
||||||
for (u = b->region->units; u; u = u->next) {
|
|
||||||
u->flags &= ~UFL_MARK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m =
|
|
||||||
msg_message("sp_mindblast_effect", "mage spell amount dead", mage, sp, k,
|
|
||||||
killed);
|
|
||||||
message_all(b, m);
|
|
||||||
msg_release(m);
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sp_dragonodem(struct castorder * co)
|
int sp_dragonodem(struct castorder * co)
|
||||||
{
|
{
|
||||||
fighter * fi = co->magician.fig;
|
fighter * fi = co->magician.fig;
|
||||||
|
|
|
@ -38,7 +38,6 @@ extern "C" {
|
||||||
int sp_hero(struct castorder * co);
|
int sp_hero(struct castorder * co);
|
||||||
int sp_frighten(struct castorder * co);
|
int sp_frighten(struct castorder * co);
|
||||||
int sp_mindblast(struct castorder * co);
|
int sp_mindblast(struct castorder * co);
|
||||||
int sp_mindblast_temp(struct castorder * co);
|
|
||||||
int sp_speed(struct castorder * co);
|
int sp_speed(struct castorder * co);
|
||||||
int sp_wolfhowl(struct castorder * co);
|
int sp_wolfhowl(struct castorder * co);
|
||||||
int sp_igjarjuk(struct castorder * co);
|
int sp_igjarjuk(struct castorder * co);
|
||||||
|
|
|
@ -257,9 +257,8 @@ static lstr lstrs[MAXLOCALES];
|
||||||
void ** get_translations(const struct locale *lang, int index)
|
void ** get_translations(const struct locale *lang, int index)
|
||||||
{
|
{
|
||||||
assert(lang);
|
assert(lang);
|
||||||
if (lang->index >= MAXLOCALES) {
|
assert(lang->index < MAXLOCALES
|
||||||
log_fatal("you have to increase MAXLOCALES and recompile");
|
|| !"you have to increase MAXLOCALES and recompile");
|
||||||
}
|
|
||||||
if (lang->index < MAXLOCALES) {
|
if (lang->index < MAXLOCALES) {
|
||||||
return lstrs[lang->index].tokens + index;
|
return lstrs[lang->index].tokens + index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,25 +111,6 @@ size_t str_slprintf(char * dst, size_t size, const char * format, ...)
|
||||||
return (size_t)result;
|
return (size_t)result;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *set_string(char **s, const char *neu)
|
|
||||||
{
|
|
||||||
if (neu == NULL) {
|
|
||||||
free(*s);
|
|
||||||
*s = NULL;
|
|
||||||
}
|
|
||||||
else if (*s == NULL) {
|
|
||||||
*s = malloc(strlen(neu) + 1);
|
|
||||||
strcpy(*s, neu);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
char *rs = realloc(*s, strlen(neu) + 1);
|
|
||||||
assert_alloc(rs);
|
|
||||||
*s = rs;
|
|
||||||
strcpy(*s, neu);
|
|
||||||
}
|
|
||||||
return *s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void str_replace(char *buffer, size_t size, const char *tmpl, const char *var, const char *value)
|
void str_replace(char *buffer, size_t size, const char *tmpl, const char *var, const char *value)
|
||||||
{
|
{
|
||||||
size_t val_len = strlen(value);
|
size_t val_len = strlen(value);
|
||||||
|
|
|
@ -27,7 +27,6 @@ extern "C" {
|
||||||
|
|
||||||
void str_replace(char *buffer, size_t size, const char *tmpl, const char *var, const char *value);
|
void str_replace(char *buffer, size_t size, const char *tmpl, const char *var, const char *value);
|
||||||
const char *str_escape(const char *str, char *buffer, size_t len);
|
const char *str_escape(const char *str, char *buffer, size_t len);
|
||||||
char *set_string(char **s, const char *neu);
|
|
||||||
unsigned int str_hash(const char *s);
|
unsigned int str_hash(const char *s);
|
||||||
size_t str_slprintf(char * dst, size_t size, const char * format, ...);
|
size_t str_slprintf(char * dst, size_t size, const char * format, ...);
|
||||||
size_t str_strlcpy(char *dst, const char *src, size_t len);
|
size_t str_strlcpy(char *dst, const char *src, size_t len);
|
||||||
|
|
|
@ -107,7 +107,6 @@ int unicode_utf8_tolower(utf8_t * op, size_t outlen, const utf8_t * ip)
|
||||||
outlen -= size;
|
outlen -= size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*op = 0;
|
*op = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue