From f6952988e458061bc3be3387dc20c4757dca61f8 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 1 Nov 2005 20:33:21 +0000 Subject: [PATCH] made compatible to earlier luabind version (just to avoid some work non VC++), but a little hackishly through the BOOST_VERSION define. removed some almost unused funtions (pt_find, etc). --- src/common/gamecode/laws.c | 33 ++++--- src/common/items/seed.c | 2 - src/common/items/weapons.c | 2 - src/common/kernel/alchemy.c | 10 +- src/common/kernel/item.c | 28 ------ src/common/kernel/item.h | 10 +- src/common/kernel/save.c | 5 +- src/common/kernel/xmlreader.c | 4 - src/common/modules/arena.c | 22 ----- src/eressea/lua/building.cpp | 42 ++++----- src/eressea/lua/item.cpp | 23 +++-- src/eressea/lua/script.cpp | 166 +++++++++++++++++----------------- src/eressea/lua/script.h | 2 + src/eressea/server.cpp | 8 ++ src/mapper/mapper.c | 6 +- 15 files changed, 162 insertions(+), 201 deletions(-) diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 06aef5518..d4dd290a5 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -252,21 +252,26 @@ get_food(region *r) while (donor!=NULL && hungry>0) { /* always start with the first known unit that may have some blood */ static const struct potion_type * pt_blood; - if (pt_blood==NULL) pt_blood = pt_find("peasantblood"); - while (donor!=NULL) { - if (donor->race==new_race[RC_DAEMON]) { - if (get_effect(donor, pt_blood)) { - /* if he's in our faction, drain him: */ - if (donor->faction==u->faction) break; - } - } - donor = donor->next; + if (pt_blood==NULL) { + const item_type * it_blood = it_find("peasantblood"); + if (it_blood) pt_blood = it_blood->rtype->ptype; } - if (donor != NULL) { - int blut = get_effect(donor, pt_blood); - blut = min(blut, hungry); - change_effect(donor, pt_blood, -blut); - hungry -= blut; + if (pt_blood!=NULL) { + while (donor!=NULL) { + if (donor->race==new_race[RC_DAEMON]) { + if (get_effect(donor, pt_blood)) { + /* if he's in our faction, drain him: */ + if (donor->faction==u->faction) break; + } + } + donor = donor->next; + } + if (donor != NULL) { + int blut = get_effect(donor, pt_blood); + blut = min(blut, hungry); + change_effect(donor, pt_blood, -blut); + hungry -= blut; + } } } if (r->planep == NULL || !fval(r->planep, PFL_NOFEED)) { diff --git a/src/common/items/seed.c b/src/common/items/seed.c index f8630828d..35fe2cf87 100644 --- a/src/common/items/seed.c +++ b/src/common/items/seed.c @@ -53,7 +53,6 @@ init_seed(void) rt_seed = rt_find("seed"); assert(rt_seed!=NULL); - rt_seed->itype->flags |= ITF_NOBUILDBESIEGED; a = a_add(&rt_seed->attribs, a_new(&at_resourcelimit)); rdata = (resource_limit*)a->data.v; @@ -90,7 +89,6 @@ init_mallornseed(void) rt_mallornseed = rt_find("mallornseed"); assert(rt_mallornseed!=NULL); rt_mallornseed->flags |= RTF_LIMITED; - rt_mallornseed->itype->flags |= ITF_NOBUILDBESIEGED; rt_mallornseed->flags |= RTF_POOLED; a = a_add(&rt_mallornseed->attribs, a_new(&at_resourcelimit)); diff --git a/src/common/items/weapons.c b/src/common/items/weapons.c index dc9dc4242..7b9292bed 100644 --- a/src/common/items/weapons.c +++ b/src/common/items/weapons.c @@ -229,8 +229,6 @@ init_oldweapons(void) assert(itype!=NULL || !"item not initialized"); - itype->flags |= ITF_WEAPON; - if (weapontable[w].rear) wflags |= WTF_MISSILE; if (weapontable[w].is_magic) wflags |= WTF_MAGICAL; if (weapontable[w].damage_type & CUT) wflags |= WTF_CUT; diff --git a/src/common/kernel/alchemy.c b/src/common/kernel/alchemy.c index 7c2ce960a..f0d775e06 100644 --- a/src/common/kernel/alchemy.c +++ b/src/common/kernel/alchemy.c @@ -174,13 +174,15 @@ static int a_readeffect(attrib *a, FILE *f) { int power; - const potion_type * ptype; + const item_type * itype; effect_data * edata = (effect_data*)a->data.v; char zText[32]; fscanf(f, "%s %d", zText, &power); - ptype = pt_find(zText); - if (ptype==NULL || power<=0) return AT_READ_FAIL; - edata->type = ptype; + itype = it_find(zText); + if (itype==NULL || itype->rtype==NULL || itype->rtype->ptype==NULL || power<=0) { + return AT_READ_FAIL; + } + edata->type = itype->rtype->ptype; edata->value = power; return AT_READ_OK; } diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index 5acda932e..4653a70ad 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -234,7 +234,6 @@ new_luxurytype(item_type * itype, int price) luxury_type * ltype; assert(resource2luxury(itype->rtype) == NULL); - assert(itype->flags & ITF_LUXURY); ltype = calloc(sizeof(luxury_type), 1); ltype->itype = itype; @@ -251,7 +250,6 @@ new_weapontype(item_type * itype, weapon_type * wtype; assert(resource2weapon(itype->rtype)==NULL); - assert(itype->flags & ITF_WEAPON); wtype = calloc(sizeof(weapon_type), 1); if (damage) { @@ -306,7 +304,6 @@ new_potiontype(item_type * itype, potion_type * ptype; assert(resource2potion(itype->rtype)==NULL); - assert(itype->flags & ITF_POTION); ptype = calloc(sizeof(potion_type), 1); ptype->itype = itype; @@ -424,30 +421,6 @@ it_find(const char * zname) return itype; } -luxury_type * -lt_find(const char * name) -{ - unsigned int hash = hashstring(name); - luxury_type * ltype; - - for (ltype=luxurytypes; ltype; ltype=ltype->next) - if (ltype->itype->rtype->hashkey==hash && !strcmp(ltype->itype->rtype->_name[0], name)) break; - - return ltype; -} - -potion_type * -pt_find(const char * name) -{ - unsigned int hash = hashstring(name); - potion_type * ptype; - - for (ptype=potiontypes; ptype; ptype=ptype->next) - if (ptype->itype->rtype->hashkey==hash && !strcmp(ptype->itype->rtype->_name[0], name)) break; - - return ptype; -} - item ** i_find(item ** i, const item_type * it) { @@ -1015,7 +988,6 @@ init_olditems(void) switch (itemdata[i].typ) { case IS_RESOURCE: rtype->flags |= RTF_LIMITED; - itype->flags |= ITF_NOBUILDBESIEGED; a = a_add(&rtype->attribs, a_new(&at_resourcelimit)); { resource_limit * rdata = (resource_limit*)a->data.v; diff --git a/src/common/kernel/item.h b/src/common/kernel/item.h index 336f61642..9dca0c002 100644 --- a/src/common/kernel/item.h +++ b/src/common/kernel/item.h @@ -37,8 +37,7 @@ typedef struct item { #define RTF_SNEAK (1<<1) /* can be sneaked to another struct unit, e.g. P_FOOL */ #define RTF_LIMITED (1<<2) /* a resource that's freely available, but in * limited supply */ -#define RTF_DYNAMIC (1<<3) /* dynamic type, must be saved */ -#define RTF_POOLED (1<<4) /* resource is available in pool */ +#define RTF_POOLED (1<<3) /* resource is available in pool */ /* flags for resource_type::name() */ #define NMF_PLURAL 0x01 @@ -84,15 +83,10 @@ typedef struct resource_limit { /* bitfield values for item_type::flags */ #define ITF_NONE 0x0000 #define ITF_HERB 0x0001 /* this item is a herb */ -#define ITF_WEAPON 0x0002 /* this item is a weapon */ -#define ITF_LUXURY 0x0004 /* this item is a luxury item */ -#define ITF_POTION 0x0008 /* this item is a potion */ #define ITF_CURSED 0x0010 /* cursed object, cannot be given away */ #define ITF_NOTLOST 0x0020 /* special object (quests), cannot be lost through death etc. */ #define ITF_BIG 0x0040 /* big item, e.g. does not fit in a bag of holding */ #define ITF_ANIMAL 0x0080 /* an animal */ -#define ITF_NOBUILDBESIEGED 0x0100 /* cannot be built under siege */ -#define ITF_DYNAMIC 0x0200 /* dynamic type, must be saved */ /* error codes for item_type::use */ #define ECUSTOM -1; @@ -200,8 +194,6 @@ typedef struct weapon_type { extern void rt_register(resource_type * it); extern resource_type * rt_find(const char * name); extern item_type * it_find(const char * name); -extern luxury_type * lt_find(const char * name); -extern potion_type * pt_find(const char * name); extern void it_register(item_type * it); extern void wt_register(weapon_type * wt); diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 570fdc894..81225381e 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1431,9 +1431,12 @@ readregion(FILE * F, short x, short y) if (r->land) { for (;;) { + const struct item_type * itype; rs(F, buf); if (!strcmp(buf, "end")) break; - r_setdemand(r, lt_find(buf), ri(F)); + itype = it_find(buf); + assert(itype->rtype->ltype); + r_setdemand(r, itype->rtype->ltype, ri(F)); } } a_read(F, &r->attribs); diff --git a/src/common/kernel/xmlreader.c b/src/common/kernel/xmlreader.c index f6d984990..cce4d76fb 100644 --- a/src/common/kernel/xmlreader.c +++ b/src/common/kernel/xmlreader.c @@ -764,7 +764,6 @@ xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype) result = xmlXPathEvalExpression(BAD_CAST "weapon", xpath); assert(result->nodesetval->nodeNr<=1); if (result->nodesetval->nodeNr!=0) { - itype->flags |= ITF_WEAPON; xpath->node = result->nodesetval->nodeTab[0]; rtype->wtype = xml_readweapon(xpath, itype); } @@ -775,7 +774,6 @@ xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype) result = xmlXPathEvalExpression(BAD_CAST "potion", xpath); assert(result->nodesetval->nodeNr<=1); if (result->nodesetval->nodeNr!=0) { - itype->flags |= ITF_POTION; xpath->node = result->nodesetval->nodeTab[0]; rtype->ptype = xml_readpotion(xpath, itype); } @@ -786,7 +784,6 @@ xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype) result = xmlXPathEvalExpression(BAD_CAST "luxury", xpath); assert(result->nodesetval->nodeNr<=1); if (result->nodesetval->nodeNr!=0) { - itype->flags |= ITF_LUXURY; xpath->node = result->nodesetval->nodeTab[0]; rtype->ltype = xml_readluxury(xpath, itype); } @@ -797,7 +794,6 @@ xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype) result = xmlXPathEvalExpression(BAD_CAST "armor", xpath); assert(result->nodesetval->nodeNr<=1); if (result->nodesetval->nodeNr!=0) { - itype->flags |= ITF_WEAPON; xpath->node = result->nodesetval->nodeTab[0]; rtype->atype = xml_readarmor(xpath, itype); } diff --git a/src/common/modules/arena.c b/src/common/modules/arena.c index 99a680ec4..a7e89a933 100644 --- a/src/common/modules/arena.c +++ b/src/common/modules/arena.c @@ -181,27 +181,6 @@ use_wand_of_tears(unit * user, const struct item_type * itype, int amount, order return 0; } -static void -init_wand_of_tears(void) -{ - const char * names[2] = {"wand_of_tears", "wand_of_tears_p"}; - const char * appearances[2] = {"wand", "wand_p"}; - item_type * itype = it_find(names[0]); - int i; - - if (itype==NULL) { - /* Dieser Teil kann, nachdem sie ausgeteilt wurden, gänzlich verschwinden. */ - resource_type * rtype = new_resourcetype(names, appearances, RTF_DYNAMIC|RTF_ITEM); - itype = new_itemtype(rtype, ITF_DYNAMIC|ITF_NOTLOST, 1, 0); - itype->use = use_wand_of_tears; - for (i=0;i!=6;++i) { - unit * u = tower_region[i]->units; - if (u==NULL) continue; - i_change(&u->items, itype, 1); - } - } -} - /** * Tempel der Schreie, Demo-Gebäude **/ @@ -514,7 +493,6 @@ create_arena(void) rsetmoney(arena_center, 0); rsetpeasants(arena_center, 0); tower_init(); - init_wand_of_tears(); } void diff --git a/src/eressea/lua/building.cpp b/src/eressea/lua/building.cpp index dc840944b..5004bc4a3 100644 --- a/src/eressea/lua/building.cpp +++ b/src/eressea/lua/building.cpp @@ -2,6 +2,7 @@ #include #include #include "list.h" +#include "script.h" // kernel includes #include @@ -33,41 +34,34 @@ add_building(region * r, const char * name) static int lc_age(struct attrib * a) { - lua_State * L = (lua_State *)global.vm_state; building_action * data = (building_action*)a->data.v; const char * fname = data->fname; const char * fparam = data->param; building * b = data->b; + int retval = -1; assert(b!=NULL); if (fname==NULL) return -1; - try { - luabind::object globals = luabind::globals(L); - luabind::object fun = globals[fname]; - if (!fun.is_valid()) { - log_error(("Could not index function %s\n", fname)); - return -1; + lua_State * L = (lua_State *)global.vm_state; + if (is_function(L, fname)) { + try { + if (fparam) { + retval = luabind::call_function(L, fname, *b, fparam); + } else { + retval = luabind::call_function(L, fname, *b); + } } - if (type(fun)!=LUA_TFUNCTION) { - log_error(("Lua global object %s is not a function, type is %u\n", fname, type(fun))); - return -1; + catch (luabind::error& e) { + lua_State* L = e.state(); + const char* error = lua_tostring(L, -1); + log_error(("An exception occured while %b tried to call '%s': %s.\n", + buildingname(b), fname, error)); + lua_pop(L, 1); + std::terminate(); } } - catch (luabind::error& e) { - lua_State* L = e.state(); - const char* error = lua_tostring(L, -1); - - log_error((error)); - lua_pop(L, 1); - std::terminate(); - } - - if (fparam) { - return luabind::call_function(L, fname, *b, fparam); - } else { - return luabind::call_function(L, fname, *b); - } + return retval; } static int diff --git a/src/eressea/lua/item.cpp b/src/eressea/lua/item.cpp index 46794b476..b67be07c3 100644 --- a/src/eressea/lua/item.cpp +++ b/src/eressea/lua/item.cpp @@ -1,6 +1,8 @@ #include #include +#include "script.h" + // kernel includes #include #include @@ -18,19 +20,26 @@ lua_useitem(struct unit * u, const struct item_type * itype, int amount, struct order *ord) { char fname[64]; - lua_State * L = (lua_State *)global.vm_state; - int retval; + int retval = -1; const char * iname = itype->rtype->_name[0]; assert(u!=NULL); strcat(strcpy(fname, iname), "_use"); - { - luabind::object globals = luabind::globals(L); - if (type(globals[fname])!=LUA_TFUNCTION) return -1; + lua_State * L = (lua_State *)global.vm_state; + if (is_function(L, fname)) { + try { + retval = luabind::call_function(L, fname, u, amount); + } + catch (luabind::error& e) { + lua_State* L = e.state(); + const char* error = lua_tostring(L, -1); + log_error(("An exception occured while %s tried to call '%s': %s.\n", + unitname(u), fname, error)); + lua_pop(L, 1); + std::terminate(); + } } - - retval = luabind::call_function(L, fname, *u, amount); return retval; } diff --git a/src/eressea/lua/script.cpp b/src/eressea/lua/script.cpp index f207e3163..cc41d7094 100644 --- a/src/eressea/lua/script.cpp +++ b/src/eressea/lua/script.cpp @@ -32,8 +32,6 @@ #include #include -static lua_State * luaState; - static void free_script(attrib * a) { if (a->data.v!=NULL) { @@ -94,16 +92,19 @@ lua_callspell(castorder *co) mage = co->familiar; } - try { - retval = luabind::call_function(luaState, fname, co->rt, mage, co->level, co->force); - } - catch (luabind::error& e) { - lua_State* L = e.state(); - const char* error = lua_tostring(L, -1); - log_error(("An exception occured while %s tried to call '%s': %s.\n", - unitname(mage), fname, error)); - lua_pop(L, 1); - std::terminate(); + lua_State * L = (lua_State *)global.vm_state; + if (is_function(L, fname)) { + try { + retval = luabind::call_function(L, fname, co->rt, mage, co->level, co->force); + } + catch (luabind::error& e) { + lua_State* L = e.state(); + const char* error = lua_tostring(L, -1); + log_error(("An exception occured while %s tried to call '%s': %s.\n", + unitname(mage), fname, error)); + lua_pop(L, 1); + std::terminate(); + } } return retval; } @@ -116,23 +117,18 @@ lua_useitem(struct unit * u, const struct item_type * itype, int amount, struct char fname[64]; snprintf(fname, sizeof(fname), "use_%s", itype->rtype->_name[0]); - luabind::object globals = luabind::globals(luaState); - luabind::object fun = globals[fname]; - if (fun.is_valid()) { - if (luabind::type(fun)!=LUA_TFUNCTION) { - log_warning(("Lua global object %s is not a function, type is %u\n", fname, luabind::type(fun))); - } else { - try { - retval = luabind::call_function(luaState, fname, u, amount); - } - catch (luabind::error& e) { - lua_State* L = e.state(); - const char* error = lua_tostring(L, -1); - log_error(("An exception occured while %s tried to call '%s': %s.\n", - unitname(u), fname, error)); - lua_pop(L, 1); - std::terminate(); - } + lua_State * L = (lua_State *)global.vm_state; + if (is_function(L, fname)) { + try { + retval = luabind::call_function(L, fname, u, amount); + } + catch (luabind::error& e) { + lua_State* L = e.state(); + const char* error = lua_tostring(L, -1); + log_error(("An exception occured while %s tried to call '%s': %s.\n", + unitname(u), fname, error)); + lua_pop(L, 1); + std::terminate(); } } return retval; @@ -145,23 +141,18 @@ lua_initfamiliar(unit * u) char fname[64]; snprintf(fname, sizeof(fname), "initfamiliar_%s", u->race->_name[0]); - luabind::object globals = luabind::globals(luaState); - luabind::object fun = globals[fname]; - if (fun.is_valid()) { - if (luabind::type(fun)!=LUA_TFUNCTION) { - log_warning(("Lua global object %s is not a function, type is %u\n", fname, luabind::type(fun))); - } else { - try { - luabind::call_function(luaState, fname, u); - } - catch (luabind::error& e) { - lua_State* L = e.state(); - const char* error = lua_tostring(L, -1); - log_error(("An exception occured while %s tried to call '%s': %s.\n", - unitname(u), fname, error)); - lua_pop(L, 1); - std::terminate(); - } + lua_State * L = (lua_State *)global.vm_state; + if (is_function(L, fname)) { + try { + luabind::call_function(L, fname, u); + } + catch (luabind::error& e) { + lua_State* L = e.state(); + const char* error = lua_tostring(L, -1); + log_error(("An exception occured while %s tried to call '%s': %s.\n", + unitname(u), fname, error)); + lua_pop(L, 1); + std::terminate(); } } @@ -176,28 +167,47 @@ lua_changeresource(unit * u, const struct resource_type * rtype, int delta) snprintf(fname, sizeof(fname), "%s_changeresource", rtype->_name[0]); int retval = -1; - luabind::object globals = luabind::globals(luaState); - luabind::object fun = globals[fname]; - if (fun.is_valid()) { - if (luabind::type(fun)!=LUA_TFUNCTION) { - log_warning(("Lua global object %s is not a function, type is %u\n", fname, luabind::type(fun))); - } else { - try { - retval = luabind::call_function(luaState, fname, u, delta); - } - catch (luabind::error& e) { - lua_State* L = e.state(); - const char* error = lua_tostring(L, -1); - log_error(("An exception occured while %s tried to call '%s': %s.\n", - unitname(u), fname, error)); - lua_pop(L, 1); - std::terminate(); - } + lua_State * L = (lua_State *)global.vm_state; + if (is_function(L, fname)) { + try { + retval = luabind::call_function(L, fname, u, delta); + } + catch (luabind::error& e) { + lua_State* L = e.state(); + const char* error = lua_tostring(L, -1); + log_error(("An exception occured while %s tried to call '%s': %s.\n", + unitname(u), fname, error)); + lua_pop(L, 1); + std::terminate(); } } return retval; } +bool +is_function(struct lua_State * luaState, const char * fname) +{ +#if BOOST_VERSION > 103002 + luabind::object globals = luabind::globals(luaState); + luabind::object fun = globals[fname]; + if (fun.is_valid()) { + if (luabind::type(fun)==LUA_TFUNCTION) { + return true; + } + log_warning(("Lua global object %s is not a function, type is %u\n", fname, luabind::type(fun))); + } +#else + luabind::object globals = luabind::get_globals(luaState); + luabind::object fun = globals[fname]; + if (fun.is_valid()) { + if (fun.type()==LUA_TFUNCTION) { + return true; + } + log_warning(("Lua global object %s is not a function, type is %u\n", fname, fun.type())); + } +#endif + return false; +} static int lua_getresource(unit * u, const struct resource_type * rtype) @@ -206,23 +216,18 @@ lua_getresource(unit * u, const struct resource_type * rtype) snprintf(fname, sizeof(fname), "%s_getresource", rtype->_name[0]); int retval = -1; - luabind::object globals = luabind::globals(luaState); - luabind::object fun = globals[fname]; - if (fun.is_valid()) { - if (luabind::type(fun)!=LUA_TFUNCTION) { - log_warning(("Lua global object %s is not a function, type is %u\n", fname, luabind::type(fun))); - } else { - try { - retval = luabind::call_function(luaState, fname, u); - } - catch (luabind::error& e) { - lua_State* L = e.state(); - const char* error = lua_tostring(L, -1); - log_error(("An exception occured while %s tried to call '%s': %s.\n", - unitname(u), fname, error)); - lua_pop(L, 1); - std::terminate(); - } + lua_State * L = (lua_State *)global.vm_state; + if (is_function(L, fname)) { + try { + retval = luabind::call_function(L, fname, u); + } + catch (luabind::error& e) { + lua_State* L = e.state(); + const char* error = lua_tostring(L, -1); + log_error(("An exception occured while %s tried to call '%s': %s.\n", + unitname(u), fname, error)); + lua_pop(L, 1); + std::terminate(); } } return retval; @@ -231,7 +236,6 @@ lua_getresource(unit * u, const struct resource_type * rtype) void bind_script(lua_State * L) { - luaState = L; register_function((pf_generic)&lua_callspell, "lua_castspell"); register_function((pf_generic)&lua_initfamiliar, "lua_initfamiliar"); register_function((pf_generic)&lua_useitem, "lua_useitem"); diff --git a/src/eressea/lua/script.h b/src/eressea/lua/script.h index af692ed66..4667d1cae 100644 --- a/src/eressea/lua/script.h +++ b/src/eressea/lua/script.h @@ -15,4 +15,6 @@ extern int call_script(struct unit * u); extern void setscript(struct attrib ** ap, void * fptr); +extern bool is_function(struct lua_State * luaState, const char * fname); + #endif diff --git a/src/eressea/server.cpp b/src/eressea/server.cpp index fc784e120..168cd8877 100644 --- a/src/eressea/server.cpp +++ b/src/eressea/server.cpp @@ -487,14 +487,22 @@ usage(const char * prog, const char * arg) static void setLuaString(lua_State * luaState, const char * name, const char * value) { +#if BOOST_VERSION > 103002 luabind::object globals = luabind::globals(luaState); +#else + luabind::object globals = luabind::get_globals(luaState); +#endif globals[name] = value; } static void setLuaNumber(lua_State * luaState, const char * name, double value) { +#if BOOST_VERSION > 103002 luabind::object globals = luabind::globals(luaState); +#else + luabind::object globals = luabind::get_globals(luaState); +#endif globals[name] = value; } diff --git a/src/mapper/mapper.c b/src/mapper/mapper.c index d99b1c6bf..3ade104ef 100644 --- a/src/mapper/mapper.c +++ b/src/mapper/mapper.c @@ -496,7 +496,7 @@ drawmap(boolean maponly) { addch(rs); } addch(' '); - q--; y1--; y2++; x1+=(s&1); s--; + q--; y1--; y2++; if (s--&1) ++x1; } while (q); if(maponly == false) { @@ -545,7 +545,7 @@ mark_region(int x1, int y1, int x2, int y2) } void -mark(int x, int y, int rx, int ry) { +mark(short x, short y, short rx, short ry) { int q; char num[6]; @@ -962,7 +962,7 @@ movearound(short rx, short ry) { if (!Tagged) { const terrain_type * terrain = select_terrain(r->terrain); if (hx>-1) { - int Rx,Ry; + short Rx,Ry; Rx=rx; Ry=ry; if (rx>Hx) { a=Hx; Hx=Rx; rx=a; } if (ry>Hy) { a=Hy; Hy=Ry; ry=a; }