forked from github/server
enable stricter conversion checking for gcc < 4.9, fix code
This commit is contained in:
parent
dd8449783a
commit
df325b243a
24 changed files with 137 additions and 157 deletions
|
@ -16,8 +16,9 @@ if (CMAKE_COMPILER_IS_GNUCC)
|
||||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
||||||
OUTPUT_VARIABLE GCC_VERSION)
|
OUTPUT_VARIABLE GCC_VERSION)
|
||||||
if (GCC_VERSION VERSION_GREATER 4.9)
|
if (GCC_VERSION VERSION_GREATER 4.9)
|
||||||
message(STATUS "Version ${GCC_VERSION} >= 4.9")
|
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion")
|
||||||
|
else()
|
||||||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wno-sign-conversion")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
|
||||||
|
|
|
@ -1695,7 +1695,7 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
||||||
|
|
||||||
level = eff_skill(mage, SK_MAGIC, r);
|
level = eff_skill(mage, SK_MAGIC, r);
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
float power;
|
double power;
|
||||||
const spell *sp;
|
const spell *sp;
|
||||||
const struct locale *lang = mage->faction->locale;
|
const struct locale *lang = mage->faction->locale;
|
||||||
order *ord;
|
order *ord;
|
||||||
|
@ -2497,14 +2497,14 @@ troop select_ally(fighter * af, int minrow, int maxrow, int allytype)
|
||||||
static int loot_quota(const unit * src, const unit * dst,
|
static int loot_quota(const unit * src, const unit * dst,
|
||||||
const item_type * type, int n)
|
const item_type * type, int n)
|
||||||
{
|
{
|
||||||
static float divisor = -1;
|
static double divisor = -1;
|
||||||
if (dst && src && src->faction != dst->faction) {
|
if (dst && src && src->faction != dst->faction) {
|
||||||
if (divisor < 0) {
|
if (divisor < 0) {
|
||||||
divisor = get_param_flt(global.parameters, "rules.items.loot_divisor", 1);
|
divisor = get_param_flt(global.parameters, "rules.items.loot_divisor", 1);
|
||||||
assert(divisor == 0 || divisor >= 1);
|
assert(divisor == 0 || divisor >= 1);
|
||||||
}
|
}
|
||||||
if (divisor >= 1) {
|
if (divisor >= 1) {
|
||||||
double r = (float)n / divisor;
|
double r = n / divisor;
|
||||||
int x = (int)r;
|
int x = (int)r;
|
||||||
|
|
||||||
r = r - x;
|
r = r - x;
|
||||||
|
|
|
@ -118,7 +118,7 @@ static int tolua_quicklist_iter(lua_State * L)
|
||||||
quicklist **qlp = (quicklist **)lua_touserdata(L, lua_upvalueindex(1));
|
quicklist **qlp = (quicklist **)lua_touserdata(L, lua_upvalueindex(1));
|
||||||
quicklist *ql = *qlp;
|
quicklist *ql = *qlp;
|
||||||
if (ql != NULL) {
|
if (ql != NULL) {
|
||||||
int index = lua_tointeger(L, lua_upvalueindex(2));
|
int index = (int)lua_tointeger(L, lua_upvalueindex(2));
|
||||||
const char *type = lua_tostring(L, lua_upvalueindex(3));
|
const char *type = lua_tostring(L, lua_upvalueindex(3));
|
||||||
void *data = ql_get(ql, index);
|
void *data = ql_get(ql, index);
|
||||||
tolua_pushusertype(L, data, TOLUA_CAST type);
|
tolua_pushusertype(L, data, TOLUA_CAST type);
|
||||||
|
|
|
@ -62,7 +62,7 @@ without prior permission by the authors of Eressea.
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
||||||
#include <util/crmessage.h>
|
#include <util/crmessage.h>
|
||||||
#include <util/goodies.h>
|
#include <util/strings.h>
|
||||||
#include <util/language.h>
|
#include <util/language.h>
|
||||||
#include <util/log.h>
|
#include <util/log.h>
|
||||||
#include <util/message.h>
|
#include <util/message.h>
|
||||||
|
|
|
@ -77,7 +77,7 @@ static WINDOW *hstatus;
|
||||||
|
|
||||||
static void init_curses(void)
|
static void init_curses(void)
|
||||||
{
|
{
|
||||||
short fg, bg;
|
int fg, bg;
|
||||||
initscr();
|
initscr();
|
||||||
|
|
||||||
if (has_colors() || force_color) {
|
if (has_colors() || force_color) {
|
||||||
|
@ -93,7 +93,7 @@ static void init_curses(void)
|
||||||
#endif
|
#endif
|
||||||
for (fg = 0; fg != 8; ++fg) {
|
for (fg = 0; fg != 8; ++fg) {
|
||||||
for (bg = 0; bg != 2; ++bg) {
|
for (bg = 0; bg != 2; ++bg) {
|
||||||
init_pair(fg + 8 * bg, fg, bg ? hcol : bcol);
|
init_pair((short)(fg + 8 * bg), (short)fg, (short)(bg ? hcol : bcol));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ void equip_unit_mask(struct unit *u, const struct equipment *eq, int mask)
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; eq->subsets[i].sets; ++i) {
|
for (i = 0; eq->subsets[i].sets; ++i) {
|
||||||
if (chance(eq->subsets[i].chance)) {
|
if (chance(eq->subsets[i].chance)) {
|
||||||
float rnd = (1 + rng_int() % 1000) / 1000.0f;
|
double rnd = (1 + rng_int() % 1000) / 1000.0;
|
||||||
int k;
|
int k;
|
||||||
for (k = 0; eq->subsets[i].sets[k].set; ++k) {
|
for (k = 0; eq->subsets[i].sets[k].set; ++k) {
|
||||||
if (rnd <= eq->subsets[i].sets[k].chance) {
|
if (rnd <= eq->subsets[i].sets[k].chance) {
|
||||||
|
@ -209,7 +209,7 @@ void equip_items(struct item **items, const struct equipment *eq)
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; eq->subsets[i].sets; ++i) {
|
for (i = 0; eq->subsets[i].sets; ++i) {
|
||||||
if (chance(eq->subsets[i].chance)) {
|
if (chance(eq->subsets[i].chance)) {
|
||||||
float rnd = (1 + rng_int() % 1000) / 1000.0f;
|
double rnd = (1 + rng_int() % 1000) / 1000.0;
|
||||||
int k;
|
int k;
|
||||||
for (k = 0; eq->subsets[i].sets[k].set; ++k) {
|
for (k = 0; eq->subsets[i].sets[k].set; ++k) {
|
||||||
if (rnd <= eq->subsets[i].sets[k].chance) {
|
if (rnd <= eq->subsets[i].sets[k].chance) {
|
||||||
|
|
|
@ -249,7 +249,7 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex)
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static order *create_order_i(keyword_t kwd, const char *sptr, int persistent,
|
static order *create_order_i(keyword_t kwd, const char *sptr, bool persistent,
|
||||||
const struct locale *lang)
|
const struct locale *lang)
|
||||||
{
|
{
|
||||||
order *ord = NULL;
|
order *ord = NULL;
|
||||||
|
@ -338,7 +338,7 @@ order *create_order(keyword_t kwd, const struct locale * lang,
|
||||||
else {
|
else {
|
||||||
zBuffer[0] = 0;
|
zBuffer[0] = 0;
|
||||||
}
|
}
|
||||||
return create_order_i(kwd, zBuffer, 0, lang);
|
return create_order_i(kwd, zBuffer, false, lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
order *parse_order(const char *s, const struct locale * lang)
|
order *parse_order(const char *s, const struct locale * lang)
|
||||||
|
@ -351,11 +351,11 @@ order *parse_order(const char *s, const struct locale * lang)
|
||||||
if (*s != 0) {
|
if (*s != 0) {
|
||||||
keyword_t kwd;
|
keyword_t kwd;
|
||||||
const char *sptr;
|
const char *sptr;
|
||||||
int persistent = 0;
|
bool persistent = false;
|
||||||
const char * p;
|
const char * p;
|
||||||
|
|
||||||
while (*s == '@') {
|
while (*s == '@') {
|
||||||
persistent = 1;
|
persistent = true;
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
sptr = s;
|
sptr = s;
|
||||||
|
@ -511,18 +511,15 @@ bool is_long(const order * ord)
|
||||||
bool is_persistent(const order * ord)
|
bool is_persistent(const order * ord)
|
||||||
{
|
{
|
||||||
keyword_t kwd = ORD_KEYWORD(ord);
|
keyword_t kwd = ORD_KEYWORD(ord);
|
||||||
int persist = ord->_persistent != 0;
|
|
||||||
switch (kwd) {
|
switch (kwd) {
|
||||||
case K_MOVE:
|
case K_MOVE:
|
||||||
case NOKEYWORD:
|
case NOKEYWORD:
|
||||||
/* lang, aber niemals persistent! */
|
/* lang, aber niemals persistent! */
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case K_KOMMENTAR:
|
case K_KOMMENTAR:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return persist || is_repeated(ord);
|
return ord->_persistent || is_repeated(ord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ extern "C" {
|
||||||
struct order *next;
|
struct order *next;
|
||||||
/* do not access this data: */
|
/* do not access this data: */
|
||||||
struct order_data *data;
|
struct order_data *data;
|
||||||
int _persistent : 1;
|
bool _persistent;
|
||||||
} order;
|
} order;
|
||||||
|
|
||||||
/* constructor */
|
/* constructor */
|
||||||
|
|
|
@ -555,10 +555,10 @@ void rsetroad(region * r, direction_t d, int val)
|
||||||
b = new_border(&bt_road, r, r2);
|
b = new_border(&bt_road, r, r2);
|
||||||
}
|
}
|
||||||
if (r == b->from) {
|
if (r == b->from) {
|
||||||
b->data.sa[0] = val;
|
b->data.sa[0] = (short)val;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
b->data.sa[1] = val;
|
b->data.sa[1] = (short)val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ cancast(unit * u, const spell * sp, int level, int range, struct order * ord)
|
||||||
* Spruchfunktionsroutine ermittelt.
|
* Spruchfunktionsroutine ermittelt.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
float
|
double
|
||||||
spellpower(region * r, unit * u, const spell * sp, int cast_level, struct order *ord)
|
spellpower(region * r, unit * u, const spell * sp, int cast_level, struct order *ord)
|
||||||
{
|
{
|
||||||
curse *c;
|
curse *c;
|
||||||
|
|
|
@ -131,7 +131,7 @@ extern "C" {
|
||||||
den Vertrauten gezaubert wird */
|
den Vertrauten gezaubert wird */
|
||||||
const struct spell *sp; /* Spruch */
|
const struct spell *sp; /* Spruch */
|
||||||
int level; /* gewünschte Stufe oder Stufe des Magiers */
|
int level; /* gewünschte Stufe oder Stufe des Magiers */
|
||||||
float force; /* Stärke des Zaubers */
|
double force; /* Stärke des Zaubers */
|
||||||
struct region *_rtarget; /* Zielregion des Spruchs */
|
struct region *_rtarget; /* Zielregion des Spruchs */
|
||||||
int distance; /* Entfernung zur Zielregion */
|
int distance; /* Entfernung zur Zielregion */
|
||||||
struct order *order; /* Befehl */
|
struct order *order; /* Befehl */
|
||||||
|
@ -277,7 +277,7 @@ extern "C" {
|
||||||
/* verändert die maximalen Magiepunkte einer Einheit */
|
/* verändert die maximalen Magiepunkte einer Einheit */
|
||||||
|
|
||||||
/* Zaubern */
|
/* Zaubern */
|
||||||
extern float spellpower(struct region *r, struct unit *u, const struct spell * sp,
|
extern double spellpower(struct region *r, struct unit *u, const struct spell * sp,
|
||||||
int cast_level, struct order *ord);
|
int cast_level, struct order *ord);
|
||||||
/* ermittelt die Stärke eines Spruchs */
|
/* ermittelt die Stärke eines Spruchs */
|
||||||
bool fumble(struct region *r, struct unit *u, const struct spell * sp,
|
bool fumble(struct region *r, struct unit *u, const struct spell * sp,
|
||||||
|
|
|
@ -71,12 +71,12 @@ static void test_regionid(CuTest * tc) {
|
||||||
|
|
||||||
memset(buffer, 0x7d, sizeof(buffer));
|
memset(buffer, 0x7d, sizeof(buffer));
|
||||||
len = f_regionid(r, 0, buffer, sizeof(buffer));
|
len = f_regionid(r, 0, buffer, sizeof(buffer));
|
||||||
CuAssertIntEquals(tc, 11, len);
|
CuAssertIntEquals(tc, 11, (int)len);
|
||||||
CuAssertStrEquals(tc, "plain (0,0)", buffer);
|
CuAssertStrEquals(tc, "plain (0,0)", buffer);
|
||||||
|
|
||||||
memset(buffer, 0x7d, sizeof(buffer));
|
memset(buffer, 0x7d, sizeof(buffer));
|
||||||
len = f_regionid(r, 0, buffer, 11);
|
len = f_regionid(r, 0, buffer, 11);
|
||||||
CuAssertIntEquals(tc, 10, len);
|
CuAssertIntEquals(tc, 10, (int)len);
|
||||||
CuAssertStrEquals(tc, "plain (0,0", buffer);
|
CuAssertStrEquals(tc, "plain (0,0", buffer);
|
||||||
CuAssertIntEquals(tc, 0x7d, buffer[11]);
|
CuAssertIntEquals(tc, 0x7d, buffer[11]);
|
||||||
}
|
}
|
||||||
|
|
164
src/spells.c
164
src/spells.c
|
@ -102,7 +102,7 @@
|
||||||
#include <attributes/hate.h>
|
#include <attributes/hate.h>
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
static float zero_effect = 0.0F;
|
static double zero_effect = 0.0;
|
||||||
|
|
||||||
attrib_type at_wdwpyramid = {
|
attrib_type at_wdwpyramid = {
|
||||||
"wdwpyramid", NULL, NULL, NULL, a_writevoid, a_readvoid
|
"wdwpyramid", NULL, NULL, NULL, a_writevoid, a_readvoid
|
||||||
|
@ -636,7 +636,7 @@ static int sp_destroy_magic(castorder * co)
|
||||||
{
|
{
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
curse *c = NULL;
|
curse *c = NULL;
|
||||||
char ts[80];
|
char ts[80];
|
||||||
|
@ -801,7 +801,7 @@ static int sp_goodwinds(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
int duration = cast_level + 1;
|
int duration = cast_level + 1;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
message *m;
|
message *m;
|
||||||
|
@ -898,7 +898,7 @@ static int sp_summonent(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
unit *u;
|
unit *u;
|
||||||
attrib *a;
|
attrib *a;
|
||||||
int ents;
|
int ents;
|
||||||
|
@ -1124,7 +1124,7 @@ static int sp_hain(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
|
|
||||||
if (!r->land) {
|
if (!r->land) {
|
||||||
cmistake(mage, co->order, 296, MSG_MAGIC);
|
cmistake(mage, co->order, 296, MSG_MAGIC);
|
||||||
|
@ -1170,7 +1170,7 @@ static int sp_mallornhain(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
|
|
||||||
if (!r->land) {
|
if (!r->land) {
|
||||||
cmistake(mage, co->order, 296, MSG_MAGIC);
|
cmistake(mage, co->order, 296, MSG_MAGIC);
|
||||||
|
@ -1204,7 +1204,7 @@ static void fumble_ents(const castorder * co)
|
||||||
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; */
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
|
|
||||||
if (!r->land) {
|
if (!r->land) {
|
||||||
cmistake(mage, co->order, 296, MSG_MAGIC);
|
cmistake(mage, co->order, 296, MSG_MAGIC);
|
||||||
|
@ -1368,10 +1368,10 @@ static int sp_kaelteschutz(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int duration = _max(cast_level, (int)force) + 1;
|
int duration = _max(cast_level, (int)force) + 1;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
float effect;
|
double effect;
|
||||||
|
|
||||||
force *= 10; /* 10 Personen pro Force-Punkt */
|
force *= 10; /* 10 Personen pro Force-Punkt */
|
||||||
|
|
||||||
|
@ -1431,7 +1431,7 @@ static int sp_sparkle(castorder * co)
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
int duration = cast_level + 1;
|
int duration = cast_level + 1;
|
||||||
float effect;
|
double effect;
|
||||||
|
|
||||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||||
if (pa->param[0]->flag == TARGET_NOTFOUND)
|
if (pa->param[0]->flag == TARGET_NOTFOUND)
|
||||||
|
@ -1491,7 +1491,7 @@ static int sp_create_irongolem(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int number = lovar(force * 8 * RESOURCE_QUANTITY);
|
int number = lovar(force * 8 * RESOURCE_QUANTITY);
|
||||||
if (number < 1)
|
if (number < 1)
|
||||||
number = 1;
|
number = 1;
|
||||||
|
@ -1616,9 +1616,9 @@ static int sp_great_drought(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int duration = 2;
|
int duration = 2;
|
||||||
float effect;
|
double effect;
|
||||||
|
|
||||||
if (fval(r->terrain, SEA_REGION)) {
|
if (fval(r->terrain, SEA_REGION)) {
|
||||||
cmistake(mage, co->order, 189, MSG_MAGIC);
|
cmistake(mage, co->order, 189, MSG_MAGIC);
|
||||||
|
@ -1743,7 +1743,7 @@ static int sp_treewalkenter(castorder * co)
|
||||||
region *r = co_get_region(co);
|
region *r = co_get_region(co);
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
region *rt;
|
region *rt;
|
||||||
int remaining_cap;
|
int remaining_cap;
|
||||||
|
@ -1868,7 +1868,7 @@ static int sp_treewalkexit(castorder * co)
|
||||||
int erfolg = 0;
|
int erfolg = 0;
|
||||||
region *r = co_get_region(co);
|
region *r = co_get_region(co);
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
|
|
||||||
|
@ -2007,7 +2007,7 @@ static int sp_holyground(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
message *msg = msg_message("sp_holyground_effect", "mage region", mage, r);
|
message *msg = msg_message("sp_holyground_effect", "mage region", mage, r);
|
||||||
report_spell(mage, r, msg);
|
report_spell(mage, r, msg);
|
||||||
msg_release(msg);
|
msg_release(msg);
|
||||||
|
@ -2042,8 +2042,8 @@ static int sp_homestone(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
float effect;
|
double effect;
|
||||||
message *msg;
|
message *msg;
|
||||||
if (!mage->building || mage->building->type != bt_find("castle")) {
|
if (!mage->building || mage->building->type != bt_find("castle")) {
|
||||||
cmistake(mage, co->order, 197, MSG_MAGIC);
|
cmistake(mage, co->order, 197, MSG_MAGIC);
|
||||||
|
@ -2101,7 +2101,7 @@ static int sp_drought(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
int duration = (int)power + 1;
|
int duration = (int)power + 1;
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
|
@ -2126,7 +2126,7 @@ static int sp_drought(castorder * co)
|
||||||
c->duration = _max(c->duration, (int)power);
|
c->duration = _max(c->duration, (int)power);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float effect = 4.0;
|
double effect = 4.0;
|
||||||
/* Baeume und Pferde sterben */
|
/* Baeume und Pferde sterben */
|
||||||
rsettrees(r, 2, rtrees(r, 2) / 2);
|
rsettrees(r, 2, rtrees(r, 2) / 2);
|
||||||
rsettrees(r, 1, rtrees(r, 1) / 2);
|
rsettrees(r, 1, rtrees(r, 1) / 2);
|
||||||
|
@ -2222,7 +2222,7 @@ static int sp_stormwinds(castorder * co)
|
||||||
int erfolg = 0;
|
int erfolg = 0;
|
||||||
region *r = co_get_region(co);
|
region *r = co_get_region(co);
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
int n, force = (int)power;
|
int n, force = (int)power;
|
||||||
message *m = NULL;
|
message *m = NULL;
|
||||||
|
@ -2502,8 +2502,8 @@ static int sp_fumblecurse(castorder * co)
|
||||||
int duration;
|
int duration;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
float effect;
|
double effect;
|
||||||
curse *c;
|
curse *c;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
|
|
||||||
|
@ -2535,9 +2535,9 @@ void patzer_fumblecurse(const castorder * co)
|
||||||
{
|
{
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int duration = (cast_level / 2) + 1;
|
int duration = (cast_level / 2) + 1;
|
||||||
float effect;
|
double effect;
|
||||||
curse *c;
|
curse *c;
|
||||||
|
|
||||||
effect = force / 2;
|
effect = force / 2;
|
||||||
|
@ -2574,7 +2574,7 @@ static int sp_summondragon(castorder * co)
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
unit *u;
|
unit *u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
region_list *rl, *rl2;
|
region_list *rl, *rl2;
|
||||||
faction *f;
|
faction *f;
|
||||||
int time;
|
int time;
|
||||||
|
@ -2646,7 +2646,7 @@ static int sp_firewall(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
direction_t dir;
|
direction_t dir;
|
||||||
region *r2;
|
region *r2;
|
||||||
|
@ -2843,9 +2843,9 @@ static struct curse_type ct_deathcloud = {
|
||||||
NULL, dc_age
|
NULL, dc_age
|
||||||
};
|
};
|
||||||
|
|
||||||
static curse *mk_deathcloud(unit * mage, region * r, float force, int duration)
|
static curse *mk_deathcloud(unit * mage, region * r, double force, int duration)
|
||||||
{
|
{
|
||||||
float effect;
|
double effect;
|
||||||
curse *c;
|
curse *c;
|
||||||
|
|
||||||
effect = force / 2;
|
effect = force / 2;
|
||||||
|
@ -2878,7 +2878,7 @@ static int dc_read_compat(struct attrib *a, void *target, struct storage * store
|
||||||
r = findregion(rx, ry);
|
r = findregion(rx, ry);
|
||||||
|
|
||||||
if (r != NULL) {
|
if (r != NULL) {
|
||||||
float effect;
|
double effect;
|
||||||
curse *c;
|
curse *c;
|
||||||
|
|
||||||
effect = strength;
|
effect = strength;
|
||||||
|
@ -3024,7 +3024,7 @@ static int sp_summonshadow(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
unit *u;
|
unit *u;
|
||||||
int val, number = (int)(force * force);
|
int val, number = (int)(force * force);
|
||||||
|
|
||||||
|
@ -3065,7 +3065,7 @@ static int sp_summonshadowlords(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int amount = (int)(force * force);
|
int amount = (int)(force * force);
|
||||||
|
|
||||||
u = create_unit(r, mage->faction, amount, get_race(RC_SHADOWLORD), 0,
|
u = create_unit(r, mage->faction, amount, get_race(RC_SHADOWLORD), 0,
|
||||||
|
@ -3192,8 +3192,8 @@ static int sp_magicboost(castorder * co)
|
||||||
curse *c;
|
curse *c;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
float effect;
|
double effect;
|
||||||
trigger *tsummon;
|
trigger *tsummon;
|
||||||
static const curse_type *ct_auraboost;
|
static const curse_type *ct_auraboost;
|
||||||
static const curse_type *ct_magicboost;
|
static const curse_type *ct_magicboost;
|
||||||
|
@ -3425,7 +3425,7 @@ static int sp_analysesong_obj(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
|
|
||||||
obj = pa->param[0]->typ;
|
obj = pa->param[0]->typ;
|
||||||
|
@ -3474,7 +3474,7 @@ static int sp_analysesong_unit(castorder * co)
|
||||||
unit *u;
|
unit *u;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
|
|
||||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||||
|
@ -3559,7 +3559,7 @@ static int sp_charmingsong(castorder * co)
|
||||||
skill_t i;
|
skill_t i;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
int resist_bonus = 0;
|
int resist_bonus = 0;
|
||||||
int tb = 0;
|
int tb = 0;
|
||||||
|
@ -3648,7 +3648,7 @@ static int sp_song_resistmagic(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int duration = (int)force + 1;
|
int duration = (int)force + 1;
|
||||||
|
|
||||||
create_curse(mage, &r->attribs, ct_find("goodmagicresistancezone"),
|
create_curse(mage, &r->attribs, ct_find("goodmagicresistancezone"),
|
||||||
|
@ -3677,7 +3677,7 @@ static int sp_song_susceptmagic(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int duration = (int)force + 1;
|
int duration = (int)force + 1;
|
||||||
|
|
||||||
create_curse(mage, &r->attribs, ct_find("badmagicresistancezone"),
|
create_curse(mage, &r->attribs, ct_find("badmagicresistancezone"),
|
||||||
|
@ -3759,7 +3759,7 @@ static int sp_raisepeasantmob(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int duration = (int)force + 1;
|
int duration = (int)force + 1;
|
||||||
faction *monsters = get_monsters();
|
faction *monsters = get_monsters();
|
||||||
message *msg;
|
message *msg;
|
||||||
|
@ -3883,7 +3883,7 @@ static int sp_song_of_peace(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int duration = 2 + lovar(force / 2);
|
int duration = 2 + lovar(force / 2);
|
||||||
message *msg[2] = { NULL, NULL };
|
message *msg[2] = { NULL, NULL };
|
||||||
|
|
||||||
|
@ -3932,9 +3932,9 @@ static int sp_generous(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int duration = (int)force + 1;
|
int duration = (int)force + 1;
|
||||||
float effect;
|
double effect;
|
||||||
message *msg[2] = { NULL, NULL };
|
message *msg[2] = { NULL, NULL };
|
||||||
|
|
||||||
if (is_cursed(r->attribs, C_DEPRESSION, 0)) {
|
if (is_cursed(r->attribs, C_DEPRESSION, 0)) {
|
||||||
|
@ -3990,7 +3990,7 @@ static int sp_recruit(castorder * co)
|
||||||
double n;
|
double n;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
faction *f = mage->faction;
|
faction *f = mage->faction;
|
||||||
const struct race *rc = f->race;
|
const struct race *rc = f->race;
|
||||||
|
|
||||||
|
@ -4045,7 +4045,7 @@ static int sp_bigrecruit(castorder * co)
|
||||||
int n, maxp = rpeasants(r);
|
int n, maxp = rpeasants(r);
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
faction *f = mage->faction;
|
faction *f = mage->faction;
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
|
@ -4168,7 +4168,7 @@ static int sp_seduce(castorder * co)
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
|
|
||||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||||
if (pa->param[0]->flag == TARGET_NOTFOUND)
|
if (pa->param[0]->flag == TARGET_NOTFOUND)
|
||||||
|
@ -4244,8 +4244,8 @@ static int sp_calm_monster(castorder * co)
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
float effect;
|
double effect;
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||||
|
@ -4260,7 +4260,7 @@ static int sp_calm_monster(castorder * co)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
effect = (float)mage->faction->subscription;
|
effect = mage->faction->subscription;
|
||||||
c = create_curse(mage, &target->attribs, ct_find("calmmonster"), force,
|
c = create_curse(mage, &target->attribs, ct_find("calmmonster"), force,
|
||||||
(int)force, effect, 0);
|
(int)force, effect, 0);
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
|
@ -4352,7 +4352,7 @@ static int sp_raisepeasants(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
if (rpeasants(r) == 0) {
|
if (rpeasants(r) == 0) {
|
||||||
|
@ -4405,7 +4405,7 @@ static int sp_depression(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int duration = (int)force + 1;
|
int duration = (int)force + 1;
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
|
@ -4472,7 +4472,7 @@ int sp_icastle(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
icastle_data *data;
|
icastle_data *data;
|
||||||
const char *bname;
|
const char *bname;
|
||||||
|
@ -4551,7 +4551,7 @@ int sp_illusionary_shapeshift(castorder * co)
|
||||||
const race *rc;
|
const race *rc;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
const race *irace;
|
const race *irace;
|
||||||
|
|
||||||
|
@ -4689,7 +4689,7 @@ static int sp_gbdreams(castorder * co, const char *curse_name, int effect)
|
||||||
int duration;
|
int duration;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
region *r = co_get_region(co);
|
region *r = co_get_region(co);
|
||||||
curse *c;
|
curse *c;
|
||||||
|
|
||||||
|
@ -4699,7 +4699,7 @@ static int sp_gbdreams(castorder * co, const char *curse_name, int effect)
|
||||||
duration = 2 + rng_int() % duration;
|
duration = 2 + rng_int() % duration;
|
||||||
|
|
||||||
/* Nichts machen als ein entsprechendes Attribut in die Region legen. */
|
/* Nichts machen als ein entsprechendes Attribut in die Region legen. */
|
||||||
c = create_curse(mage, &r->attribs, ct_find(curse_name), power, duration, (float)effect, 0);
|
c = create_curse(mage, &r->attribs, ct_find(curse_name), power, duration, effect, 0);
|
||||||
|
|
||||||
/* Erfolg melden */
|
/* Erfolg melden */
|
||||||
ADDMSG(&mage->faction->msgs, msg_message("regionmagic_effect",
|
ADDMSG(&mage->faction->msgs, msg_message("regionmagic_effect",
|
||||||
|
@ -4759,7 +4759,7 @@ int sp_dreamreading(castorder * co)
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||||
|
@ -4810,7 +4810,7 @@ int sp_sweetdreams(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
int men, n;
|
int men, n;
|
||||||
int duration = (int)(power / 2) + 1;
|
int duration = (int)(power / 2) + 1;
|
||||||
|
@ -4820,7 +4820,7 @@ int sp_sweetdreams(castorder * co)
|
||||||
for (n = 0; n < pa->length; n++) {
|
for (n = 0; n < pa->length; n++) {
|
||||||
curse *c;
|
curse *c;
|
||||||
unit *u;
|
unit *u;
|
||||||
float effect;
|
double effect;
|
||||||
message *msg;
|
message *msg;
|
||||||
/* sollte nie negativ werden */
|
/* sollte nie negativ werden */
|
||||||
if (opfer < 1)
|
if (opfer < 1)
|
||||||
|
@ -4860,9 +4860,9 @@ int sp_disturbingdreams(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
int duration = 1 + (int)(power / 6);
|
int duration = 1 + (int)(power / 6);
|
||||||
float effect;
|
double effect;
|
||||||
curse *c;
|
curse *c;
|
||||||
|
|
||||||
effect = 10;
|
effect = 10;
|
||||||
|
@ -4950,7 +4950,7 @@ int sp_itemcloak(castorder * co)
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
int duration = (int)_max(2.0, power + 1); /* works in the report, and ageing this round would kill it if it's <=1 */
|
int duration = (int)_max(2.0, power + 1); /* works in the report, and ageing this round would kill it if it's <=1 */
|
||||||
|
|
||||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||||
|
@ -4990,7 +4990,7 @@ int sp_resist_magic_bonus(castorder * co)
|
||||||
int duration = 6;
|
int duration = 6;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
/* Pro Stufe koennen bis zu 5 Personen verzaubert werden */
|
/* Pro Stufe koennen bis zu 5 Personen verzaubert werden */
|
||||||
double maxvictims = 5 * power;
|
double maxvictims = 5 * power;
|
||||||
|
@ -5050,7 +5050,7 @@ int sp_enterastral(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
|
|
||||||
switch (getplaneid(r)) {
|
switch (getplaneid(r)) {
|
||||||
|
@ -5165,7 +5165,7 @@ int sp_pullastral(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
|
|
||||||
switch (getplaneid(r)) {
|
switch (getplaneid(r)) {
|
||||||
|
@ -5307,7 +5307,7 @@ int sp_leaveastral(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
|
|
||||||
switch (getplaneid(r)) {
|
switch (getplaneid(r)) {
|
||||||
|
@ -5434,7 +5434,7 @@ int sp_fetchastral(castorder * co)
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
int remaining_cap = (int)((power - 3) * 1500);
|
int remaining_cap = (int)((power - 3) * 1500);
|
||||||
region_list *rtl = NULL;
|
region_list *rtl = NULL;
|
||||||
region *rt = co_get_region(co); /* region to which we are fetching */
|
region *rt = co_get_region(co); /* region to which we are fetching */
|
||||||
|
@ -5566,7 +5566,7 @@ int sp_showastral(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
|
|
||||||
switch (getplaneid(r)) {
|
switch (getplaneid(r)) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -5697,7 +5697,7 @@ int sp_disruptastral(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
int duration = (int)(power / 3) + 1;
|
int duration = (int)(power / 3) + 1;
|
||||||
|
|
||||||
switch (getplaneid(r)) {
|
switch (getplaneid(r)) {
|
||||||
|
@ -5722,7 +5722,7 @@ int sp_disruptastral(castorder * co)
|
||||||
|
|
||||||
for (rl2 = rl; rl2 != NULL; rl2 = rl2->next) {
|
for (rl2 = rl; rl2 != NULL; rl2 = rl2->next) {
|
||||||
attrib *a;
|
attrib *a;
|
||||||
float effect;
|
double effect;
|
||||||
region *r2 = rl2->data;
|
region *r2 = rl2->data;
|
||||||
spec_direction *sd;
|
spec_direction *sd;
|
||||||
int inhab_regions = 0;
|
int inhab_regions = 0;
|
||||||
|
@ -5806,7 +5806,7 @@ static int sp_eternizewall(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
|
@ -6011,7 +6011,7 @@ int sp_flying_ship(castorder * co)
|
||||||
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;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
message *m = NULL;
|
message *m = NULL;
|
||||||
int cno;
|
int cno;
|
||||||
|
@ -6078,7 +6078,7 @@ int sp_stealaura(castorder * co)
|
||||||
unit *u;
|
unit *u;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
|
|
||||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||||
|
@ -6143,12 +6143,12 @@ int sp_stealaura(castorder * co)
|
||||||
*/
|
*/
|
||||||
int sp_antimagiczone(castorder * co)
|
int sp_antimagiczone(castorder * co)
|
||||||
{
|
{
|
||||||
float power;
|
double power;
|
||||||
float effect;
|
double effect;
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
int duration = (int)force + 1;
|
int duration = (int)force + 1;
|
||||||
|
|
||||||
/* Haelt Sprueche bis zu einem summierten Gesamtlevel von power aus.
|
/* Haelt Sprueche bis zu einem summierten Gesamtlevel von power aus.
|
||||||
|
@ -6157,7 +6157,7 @@ int sp_antimagiczone(castorder * co)
|
||||||
power = force * 10;
|
power = force * 10;
|
||||||
|
|
||||||
/* Reduziert die Staerke jedes Spruchs um effect */
|
/* Reduziert die Staerke jedes Spruchs um effect */
|
||||||
effect = (float)cast_level;
|
effect = cast_level;
|
||||||
|
|
||||||
create_curse(mage, &r->attribs, ct_find("antimagiczone"), power, duration,
|
create_curse(mage, &r->attribs, ct_find("antimagiczone"), power, duration,
|
||||||
effect, 0);
|
effect, 0);
|
||||||
|
@ -6205,9 +6205,9 @@ static int sp_magicrunes(castorder * co)
|
||||||
int duration;
|
int duration;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
float effect;
|
double effect;
|
||||||
|
|
||||||
duration = 3 + rng_int() % cast_level;
|
duration = 3 + rng_int() % cast_level;
|
||||||
effect = 20;
|
effect = 20;
|
||||||
|
@ -6265,14 +6265,14 @@ int sp_speed2(castorder * co)
|
||||||
unit *u;
|
unit *u;
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
|
|
||||||
maxmen = 2 * cast_level * cast_level;
|
maxmen = 2 * cast_level * cast_level;
|
||||||
dur = _max(1, cast_level / 2);
|
dur = _max(1, cast_level / 2);
|
||||||
|
|
||||||
for (n = 0; n < pa->length; n++) {
|
for (n = 0; n < pa->length; n++) {
|
||||||
float effect;
|
double effect;
|
||||||
/* sollte nie negativ werden */
|
/* sollte nie negativ werden */
|
||||||
if (maxmen < 1)
|
if (maxmen < 1)
|
||||||
break;
|
break;
|
||||||
|
@ -6326,7 +6326,7 @@ int sp_q_antimagie(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
const char *ts = NULL;
|
const char *ts = NULL;
|
||||||
|
|
||||||
|
@ -6406,7 +6406,7 @@ int sp_break_curse(castorder * co)
|
||||||
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;
|
||||||
float force = co->force;
|
double force = co->force;
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
const char *ts = NULL;
|
const char *ts = NULL;
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ static int cw_read(attrib * a, void *target, storage * store)
|
||||||
* Was fuer eine Wirkung hat die?
|
* Was fuer eine Wirkung hat die?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void wall_vigour(curse * c, float delta)
|
void wall_vigour(curse * c, double delta)
|
||||||
{
|
{
|
||||||
wallcurse *wc = (wallcurse *)c->data.v;
|
wallcurse *wc = (wallcurse *)c->data.v;
|
||||||
assert(wc->buddy->vigour == c->vigour);
|
assert(wc->buddy->vigour == c->vigour);
|
||||||
|
|
|
@ -908,11 +908,11 @@ int sp_strong_wall(struct castorder * co)
|
||||||
{
|
{
|
||||||
fighter * fi = co->magician.fig;
|
fighter * fi = co->magician.fig;
|
||||||
int level = co->level;
|
int level = co->level;
|
||||||
float power = co->force;
|
double power = co->force;
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
building *burg;
|
building *burg;
|
||||||
float effect;
|
double effect;
|
||||||
static bool init = false;
|
static bool init = false;
|
||||||
message *msg;
|
message *msg;
|
||||||
static const curse_type *strongwall_ct;
|
static const curse_type *strongwall_ct;
|
||||||
|
|
|
@ -121,7 +121,7 @@ static struct curse_type ct_shipspeedup = { "shipspeedup",
|
||||||
CURSETYP_NORM, 0, 0, cinfo_ship
|
CURSETYP_NORM, 0, 0, cinfo_ship
|
||||||
};
|
};
|
||||||
|
|
||||||
curse *shipcurse_flyingship(ship * sh, unit * mage, float power, int duration)
|
curse *shipcurse_flyingship(ship * sh, unit * mage, double power, int duration)
|
||||||
{
|
{
|
||||||
static const curse_type *ct_flyingship = NULL;
|
static const curse_type *ct_flyingship = NULL;
|
||||||
if (!ct_flyingship) {
|
if (!ct_flyingship) {
|
||||||
|
@ -146,7 +146,7 @@ curse *shipcurse_flyingship(ship * sh, unit * mage, float power, int duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int levitate_ship(ship * sh, unit * mage, float power, int duration)
|
int levitate_ship(ship * sh, unit * mage, double power, int duration)
|
||||||
{
|
{
|
||||||
curse *c = shipcurse_flyingship(sh, mage, power, duration);
|
curse *c = shipcurse_flyingship(sh, mage, power, duration);
|
||||||
if (c) {
|
if (c) {
|
||||||
|
|
|
@ -29,8 +29,8 @@ extern "C" {
|
||||||
const struct curse *c, int self);
|
const struct curse *c, int self);
|
||||||
void register_shipcurse(void);
|
void register_shipcurse(void);
|
||||||
struct curse *shipcurse_flyingship(struct ship *sh, struct unit *mage,
|
struct curse *shipcurse_flyingship(struct ship *sh, struct unit *mage,
|
||||||
float power, int duration);
|
double power, int duration);
|
||||||
int levitate_ship(struct ship *sh, struct unit *mage, float power,
|
int levitate_ship(struct ship *sh, struct unit *mage, double power,
|
||||||
int duration);
|
int duration);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -48,9 +48,9 @@ typedef struct createcurse_data {
|
||||||
struct unit *mage;
|
struct unit *mage;
|
||||||
struct unit *target;
|
struct unit *target;
|
||||||
const curse_type *type;
|
const curse_type *type;
|
||||||
float vigour;
|
double vigour;
|
||||||
int duration;
|
int duration;
|
||||||
float effect;
|
double effect;
|
||||||
int men;
|
int men;
|
||||||
} createcurse_data;
|
} createcurse_data;
|
||||||
|
|
||||||
|
@ -97,13 +97,15 @@ static int createcurse_read(trigger * t, struct storage *store)
|
||||||
{
|
{
|
||||||
createcurse_data *td = (createcurse_data *)t->data.v;
|
createcurse_data *td = (createcurse_data *)t->data.v;
|
||||||
char zText[128];
|
char zText[128];
|
||||||
|
float flt;
|
||||||
|
|
||||||
read_reference(&td->mage, store, read_unit_reference, resolve_unit);
|
read_reference(&td->mage, store, read_unit_reference, resolve_unit);
|
||||||
read_reference(&td->target, store, read_unit_reference, resolve_unit);
|
read_reference(&td->target, store, read_unit_reference, resolve_unit);
|
||||||
|
|
||||||
READ_TOK(store, zText, sizeof(zText));
|
READ_TOK(store, zText, sizeof(zText));
|
||||||
td->type = ct_find(zText);
|
td->type = ct_find(zText);
|
||||||
READ_FLT(store, &td->vigour);
|
READ_FLT(store, &flt);
|
||||||
|
td->vigour = flt;
|
||||||
READ_INT(store, &td->duration);
|
READ_INT(store, &td->duration);
|
||||||
if (global.data_version < CURSEFLOAT_VERSION) {
|
if (global.data_version < CURSEFLOAT_VERSION) {
|
||||||
int n;
|
int n;
|
||||||
|
@ -111,7 +113,8 @@ static int createcurse_read(trigger * t, struct storage *store)
|
||||||
td->effect = (float)n;
|
td->effect = (float)n;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
READ_FLT(store, &td->effect);
|
READ_FLT(store, &flt);
|
||||||
|
td->effect = flt;
|
||||||
}
|
}
|
||||||
READ_INT(store, &td->men);
|
READ_INT(store, &td->men);
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
|
@ -127,7 +130,7 @@ trigger_type tt_createcurse = {
|
||||||
};
|
};
|
||||||
|
|
||||||
trigger *trigger_createcurse(struct unit * mage, struct unit * target,
|
trigger *trigger_createcurse(struct unit * mage, struct unit * target,
|
||||||
const curse_type * ct, float vigour, int duration, float effect, int men)
|
const curse_type * ct, double vigour, int duration, double effect, int men)
|
||||||
{
|
{
|
||||||
trigger *t = t_new(&tt_createcurse);
|
trigger *t = t_new(&tt_createcurse);
|
||||||
createcurse_data *td = (createcurse_data *)t->data.v;
|
createcurse_data *td = (createcurse_data *)t->data.v;
|
||||||
|
|
|
@ -33,8 +33,8 @@ extern "C" {
|
||||||
extern struct trigger_type tt_createcurse;
|
extern struct trigger_type tt_createcurse;
|
||||||
|
|
||||||
struct trigger *trigger_createcurse(struct unit *mage,
|
struct trigger *trigger_createcurse(struct unit *mage,
|
||||||
struct unit *target, const struct curse_type *ct, float vigour,
|
struct unit *target, const struct curse_type *ct, double vigour,
|
||||||
int duration, float effect, int men);
|
int duration, double effect, int men);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,15 @@ static void test_strlcat(CuTest * tc)
|
||||||
memset(buffer, 0x7f, sizeof(buffer));
|
memset(buffer, 0x7f, sizeof(buffer));
|
||||||
|
|
||||||
buffer[0] = '\0';
|
buffer[0] = '\0';
|
||||||
CuAssertIntEquals(tc, 4, strlcat(buffer, "herp", 4));
|
CuAssertIntEquals(tc, 4, (int)strlcat(buffer, "herp", 4));
|
||||||
CuAssertStrEquals(tc, "her", buffer);
|
CuAssertStrEquals(tc, "her", buffer);
|
||||||
|
|
||||||
buffer[0] = '\0';
|
buffer[0] = '\0';
|
||||||
CuAssertIntEquals(tc, 4, strlcat(buffer, "herp", 8));
|
CuAssertIntEquals(tc, 4, (int)strlcat(buffer, "herp", 8));
|
||||||
CuAssertStrEquals(tc, "herp", buffer);
|
CuAssertStrEquals(tc, "herp", buffer);
|
||||||
CuAssertIntEquals(tc, 0x7f, buffer[5]);
|
CuAssertIntEquals(tc, 0x7f, buffer[5]);
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 8, strlcat(buffer, "derp", 8));
|
CuAssertIntEquals(tc, 8, (int)strlcat(buffer, "derp", 8));
|
||||||
CuAssertStrEquals(tc, "herpder", buffer);
|
CuAssertStrEquals(tc, "herpder", buffer);
|
||||||
CuAssertIntEquals(tc, 0x7f, buffer[8]);
|
CuAssertIntEquals(tc, 0x7f, buffer[8]);
|
||||||
}
|
}
|
||||||
|
@ -28,14 +28,14 @@ static void test_strlcpy(CuTest * tc)
|
||||||
|
|
||||||
memset(buffer, 0x7f, sizeof(buffer));
|
memset(buffer, 0x7f, sizeof(buffer));
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 4, strlcpy(buffer, "herp", 4));
|
CuAssertIntEquals(tc, 4, (int)strlcpy(buffer, "herp", 4));
|
||||||
CuAssertStrEquals(tc, "her", buffer);
|
CuAssertStrEquals(tc, "her", buffer);
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 4, strlcpy(buffer, "herp", 8));
|
CuAssertIntEquals(tc, 4, (int)strlcpy(buffer, "herp", 8));
|
||||||
CuAssertStrEquals(tc, "herp", buffer);
|
CuAssertStrEquals(tc, "herp", buffer);
|
||||||
CuAssertIntEquals(tc, 0x7f, buffer[5]);
|
CuAssertIntEquals(tc, 0x7f, buffer[5]);
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 8, strlcpy(buffer, "herpderp", 8));
|
CuAssertIntEquals(tc, 8, (int)strlcpy(buffer, "herpderp", 8));
|
||||||
CuAssertStrEquals(tc, "herpder", buffer);
|
CuAssertStrEquals(tc, "herpder", buffer);
|
||||||
CuAssertIntEquals(tc, 0x7f, buffer[8]);
|
CuAssertIntEquals(tc, 0x7f, buffer[8]);
|
||||||
}
|
}
|
||||||
|
@ -49,11 +49,11 @@ static void test_slprintf(CuTest * tc)
|
||||||
CuAssertTrue(tc, slprintf(buffer, 4, "%s", "herpderp") > 3);
|
CuAssertTrue(tc, slprintf(buffer, 4, "%s", "herpderp") > 3);
|
||||||
CuAssertStrEquals(tc, "her", buffer);
|
CuAssertStrEquals(tc, "her", buffer);
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 4, slprintf(buffer, 8, "%s", "herp"));
|
CuAssertIntEquals(tc, 4, (int)slprintf(buffer, 8, "%s", "herp"));
|
||||||
CuAssertStrEquals(tc, "herp", buffer);
|
CuAssertStrEquals(tc, "herp", buffer);
|
||||||
CuAssertIntEquals(tc, 0x7f, buffer[5]);
|
CuAssertIntEquals(tc, 0x7f, buffer[5]);
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 8, slprintf(buffer, 8, "%s", "herpderp"));
|
CuAssertIntEquals(tc, 8, (int)slprintf(buffer, 8, "%s", "herpderp"));
|
||||||
CuAssertStrEquals(tc, "herpder", buffer);
|
CuAssertStrEquals(tc, "herpder", buffer);
|
||||||
CuAssertIntEquals(tc, 0x7f, buffer[8]);
|
CuAssertIntEquals(tc, 0x7f, buffer[8]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#ifndef GOODIES_H
|
#ifndef GOODIES_H
|
||||||
#define GOODIES_H
|
#define GOODIES_H
|
||||||
|
|
||||||
|
#include "strings.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,30 +32,6 @@ extern "C" {
|
||||||
extern int *intlist_add(int *i_p, int i);
|
extern int *intlist_add(int *i_p, int i);
|
||||||
extern int *intlist_find(int *i_p, int i);
|
extern int *intlist_find(int *i_p, int i);
|
||||||
|
|
||||||
extern unsigned int hashstring(const char *s);
|
|
||||||
extern const char *escape_string(const char *str, char *buffer,
|
|
||||||
unsigned int len);
|
|
||||||
extern unsigned int jenkins_hash(unsigned int a);
|
|
||||||
extern unsigned int wang_hash(unsigned int a);
|
|
||||||
|
|
||||||
/* benchmark for units:
|
|
||||||
* JENKINS_HASH: 5.25 misses/hit (with good cache behavior)
|
|
||||||
* WANG_HASH: 5.33 misses/hit (with good cache behavior)
|
|
||||||
* KNUTH_HASH: 1.93 misses/hit (with bad cache behavior)
|
|
||||||
* CF_HASH: fucking awful!
|
|
||||||
*/
|
|
||||||
#define KNUTH_HASH1(a, m) ((a) % m)
|
|
||||||
#define KNUTH_HASH2(a, m) (m - 2 - a % (m-2))
|
|
||||||
#define CF_HASH1(a, m) ((a) % m)
|
|
||||||
#define CF_HASH2(a, m) (8 - ((a) & 7))
|
|
||||||
#define JENKINS_HASH1(a, m) (jenkins_hash(a) % m)
|
|
||||||
#define JENKINS_HASH2(a, m) 1
|
|
||||||
#define WANG_HASH1(a, m) (wang_hash(a) % m)
|
|
||||||
#define WANG_HASH2(a, m) 1
|
|
||||||
|
|
||||||
#define HASH1 JENKINS_HASH1
|
|
||||||
#define HASH2 JENKINS_HASH2
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,7 +32,7 @@ unsigned int hashstring(const char *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *escape_string(const char *str, char *buffer,
|
const char *escape_string(const char *str, char *buffer,
|
||||||
unsigned int len)
|
size_t len)
|
||||||
{
|
{
|
||||||
const char *start = strchr(str, '\"');
|
const char *start = strchr(str, '\"');
|
||||||
if (!start) start = strchr(str, '\\');
|
if (!start) start = strchr(str, '\\');
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "goodies.h"
|
#include "strings.h"
|
||||||
|
|
||||||
static void test_escape_string(CuTest * tc)
|
static void test_escape_string(CuTest * tc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,7 +84,7 @@ size_t * inlen)
|
||||||
if (op - out >= os - 1)
|
if (op - out >= os - 1)
|
||||||
break;
|
break;
|
||||||
*op++ = 0xC3;
|
*op++ = 0xC3;
|
||||||
*op++ = c - 64;
|
*op++ = (unsigned char)(c - 64);
|
||||||
}
|
}
|
||||||
else if (c > 0x7F) {
|
else if (c > 0x7F) {
|
||||||
if (op - out >= os - 1)
|
if (op - out >= os - 1)
|
||||||
|
|
Loading…
Reference in a new issue