Use pointers instead of references for Devilution exported API

With this change, all exported declarations of Devilution are now
compatible with the C-ABI; that is, all declarations of Source/*.h.

This makes it possible to link against DevilutionX from mods written in
other languages than C++, for instance Rust, Go or Python.

Updates #612.
This commit is contained in:
Robin Eklind 2020-02-14 14:41:51 +01:00 committed by Robin Eklind
commit 27b40436a9
10 changed files with 75 additions and 75 deletions

View file

@ -1274,7 +1274,7 @@ void AddTorturedBody(int i)
object[i]._oPreFlag = TRUE;
}
void GetRndObjLoc(int randarea, int &xx, int &yy)
void GetRndObjLoc(int randarea, int *xx, int *yy)
{
BOOL failed;
int i, j, tries;
@ -1287,12 +1287,12 @@ void GetRndObjLoc(int randarea, int &xx, int &yy)
tries++;
if (tries > 1000 && randarea > 1)
randarea--;
xx = random_(0, MAXDUNX);
yy = random_(0, MAXDUNY);
*xx = random_(0, MAXDUNX);
*yy = random_(0, MAXDUNY);
failed = FALSE;
for (i = 0; i < randarea && !failed; i++) {
for (j = 0; j < randarea && !failed; j++) {
failed = !RndLocOk(i + xx, j + yy);
failed = !RndLocOk(i + *xx, j + *yy);
}
}
if (!failed)
@ -1307,7 +1307,7 @@ void AddMushPatch()
if (nobjects < MAXOBJECTS) {
i = objectavail[0];
GetRndObjLoc(5, x, y);
GetRndObjLoc(5, &x, &y);
dObject[x + 1][y + 1] = -1 - i;
dObject[x + 2][y + 1] = -1 - i;
dObject[x + 1][y + 2] = -1 - i;
@ -1319,7 +1319,7 @@ void AddSlainHero()
{
int x, y;
GetRndObjLoc(5, x, y);
GetRndObjLoc(5, &x, &y);
AddObject(OBJ_SLAINHERO, x + 2, y + 2);
}
@ -2598,7 +2598,7 @@ void OperateMushPatch(int pnum, int i)
object[i]._oSelFlag = 0;
object[i]._oAnimFrame++;
if (!deltaload) {
GetSuperItemLoc(object[i]._ox, object[i]._oy, x, y);
GetSuperItemLoc(object[i]._ox, object[i]._oy, &x, &y);
SpawnQuestItem(IDI_MUSHROOM, x, y, 0, 0);
quests[QTYPE_BLKM]._qvar1 = QS_MUSHSPAWNED;
}
@ -2629,7 +2629,7 @@ void OperateInnSignChest(int pnum, int i)
object[i]._oAnimFrame += 2;
object[i]._oSelFlag = 0;
if (!deltaload) {
GetSuperItemLoc(object[i]._ox, object[i]._oy, x, y);
GetSuperItemLoc(object[i]._ox, object[i]._oy, &x, &y);
SpawnQuestItem(IDI_BANNER, x, y, 0, 0);
}
}
@ -2745,7 +2745,7 @@ void OperatePedistal(int pnum, int i)
int iv;
if (object[i]._oVar6 != 3) {
if (PlrHasItem(pnum, IDI_BLDSTONE, iv)) {
if (PlrHasItem(pnum, IDI_BLDSTONE, &iv) != NULL) {
RemoveInvItem(pnum, iv);
object[i]._oAnimFrame++;
object[i]._oVar6++;
@ -3720,7 +3720,7 @@ void OperateLazStand(int pnum, int i)
if (object[i]._oSelFlag != 0 && !deltaload && !qtextflag && pnum == myplr) {
object[i]._oAnimFrame++;
object[i]._oSelFlag = 0;
GetSuperItemLoc(object[i]._ox, object[i]._oy, xx, yy);
GetSuperItemLoc(object[i]._ox, object[i]._oy, &xx, &yy);
SpawnQuestItem(IDI_LAZSTAFF, xx, yy, 0, 0);
}
}