fix berkeley size/ulen error

remove weather module (unused)
This commit is contained in:
Enno Rehling 2017-12-08 20:17:40 +01:00
parent 5e435a7c0b
commit 1b9a686101
7 changed files with 6 additions and 193 deletions

View File

@ -4,7 +4,6 @@ sender = Eressea Server
name = Eressea
report = reports
verbose = 0
lomem = 0
memcheck = 0
locales = de,en

View File

@ -1009,7 +1009,7 @@ int natural_armor(unit * du)
static int rc_specialdamage(const unit *au, const unit *du, const struct weapon_type *wtype)
{
const race *ar = u_race(au);
int m, modifier = 0;
int modifier = 0;
if (wtype != NULL) {
if (fval(u_race(du), RCF_DRAGON)) {
static int cache;
@ -1022,6 +1022,7 @@ static int rc_specialdamage(const unit *au, const unit *du, const struct weapon_
}
}
if (wtype->modifiers != NULL) {
int m;
for (m = 0; wtype->modifiers[m].value; ++m) {
/* weapon damage for this weapon, possibly by race */
if (wtype->modifiers[m].flags & WMF_DAMAGE) {

View File

@ -41,10 +41,10 @@ int db_driver_order_save(struct order_data *od)
assert(od && od->_str);
key.data = &recno;
key.size = sizeof(recno);
key.size = key.ulen = sizeof(recno);
key.flags = DB_DBT_USERMEM;
data.data = (void *)od->_str;
data.size = strlen(od->_str) + 1;
data.size = data.ulen = strlen(od->_str) + 1;
data.flags = DB_DBT_USERMEM;
ret = g_dbp->put(g_dbp, NULL, &key, &data, DB_APPEND);
assert(ret == 0);
@ -63,7 +63,7 @@ struct order_data *db_driver_order_load(int id)
memset(&data, 0, sizeof(DBT));
recno = (db_recno_t)id;
key.data = &recno;
key.size = sizeof(recno);
key.size = key.ulen = sizeof(recno);
key.flags = DB_DBT_USERMEM;
ret = g_dbp->get(g_dbp, NULL, &key, &data, 0);
if (ret == 0) {

View File

@ -4,7 +4,6 @@ autoseed.c
gmcmd.c
museum.c
score.c
weather.c
xmas.c
)
FOREACH(_FILE ${_FILES})

View File

@ -1,132 +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.
**/
#ifdef WEATHER
#include <platform.h>
#include <config.h>
#include "weather.h"
/* libc includes */
#include <math.h>
weather *create_weather(region * r, weather_t type)
{
weather *w;
w = calloc(1, sizeof(weather));
w->center[0] = r->x;
w->center[1] = r->y;
w->type = type;
w->move[0] = (rng_int() % 3) - 1;
w->move[1] = (rng_int() % 3) - 1;
switch (type) {
case WEATHER_STORM:
w->radius = rng_int() % 2 + 1;
break;
case WEATHER_HURRICANE:
w->radius = 1;
break;
default:
w->radius = 0;
}
addlist(&weathers, w);
return w;
}
double distance(int x1, int y1, int x2, int y2)
{
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
/* Diese Funktion ermittelt für jede Region, welches Wetter in ihr
herrscht. Die Wettertypen sind dabei nach ihrer Reihenfolge in der
enumeration priorisiert.
- Einladen
set_weather();
- Eigentliche Auswertung
- Veränderungen des Wetters
set_weather();
- Report generieren
- Abspeichern
Diese Routine ist sehr rechenaufwendig!
*/
void set_weather(void)
{
weather_t i;
weather *w;
short x, y;
int d;
region *r;
for (r = regions; r; r = r->next) {
r->weathertype = WEATHER_NONE;
}
for (i = 0; i < MAXWEATHERS; i++) {
for (w = weathers; w; w = w->next) {
if (w->type == i) {
for (x = w->center[0] - w->radius; x <= w->center[0] + w->radius; x++) {
for (y = w->center[1] - w->radius; y <= w->center[1] + w->radius; y++) {
d = distance(w->center[0], w->center[1], x, y);
if (floor(d + 0.5) <= w->radius) {
r = findregion(x, y);
if (r) {
r->weathertype = w->type;
}
}
}
}
}
}
}
}
void move_weather(void)
{
weather *w, *wnext;
region *r;
for (w = weathers; w;) {
wnext = w->next;
w->center[0] = w->center[0] + w->move[0];
w->center[1] = w->center[1] + w->move[1];
r = findregion(w->center[0], w->center[1]);
if (!r || rng_int() % 100 < 5) {
removelist(&weathers, w);
}
w = wnext;
}
}
#else
#include <stdio.h>
static const char *copyright = "(c) Eressea PBEM 2000";
void init_weather(void)
{
fputs(copyright, stderr);
/* TODO: Initialization */
}
#endif

View File

@ -1,54 +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_MOD_WEATHER_H
#define H_MOD_WEATHER_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WEATHER
# error "the weather system is disabled"
#endif
enum {
WEATHER_NONE,
WEATHER_STORM,
WEATHER_HURRICANE,
MAXWEATHERS
};
typedef unsigned char weather_t;
typedef struct weather {
struct weather *next;
weather_t type; /* Typ der Wetterzone */
int center[2]; /* Koordinaten des Zentrums */
int radius;
int move[2];
} weather;
weather *weathers;
void set_weather(void);
void move_weather(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -19,7 +19,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <platform.h>
#include "shock.h"
#include "magic.h"
#include <magic.h>
/* kernel includes */
#include <kernel/curse.h>