Compile error at iuse.cpp, function iuse::portal

last experimental

error message:

src/iuse.cpp: In member function ‘int iuse::portal(player*, item*, bool, const tripoint&)’:
src/iuse.cpp:5565:30: error: narrowing conversion of ‘(((long int)p->player::posx()) + rng(-2l, 2l))’ from ‘long int’ t
o ‘int’ inside { } [-Werror=narrowing]
g->m.add_trap({p->posx() + rng(-2, 2), p->posy() + rng(-2, 2), p->posz()}, tr_portal);
^
src/iuse.cpp:5565:54: error: narrowing conversion of ‘(((long int)p->player::posy()) + rng(-2l, 2l))’ from ‘long int’ t
o ‘int’ inside { } [-Werror=narrowing]
g->m.add_trap({p->posx() + rng(-2, 2), p->posy() + rng(-2, 2), p->posz()}, tr_portal);
^
cc1plus: all warnings being treated as errors
Makefile:437: recipe for target ‘obj/iuse.o’ failed
make: *** [obj/iuse.o] Error 1

quick & dirty fix (although i did not check if they should be cast into long long int instead of just int - or what is int, what is long and why):


int iuse::portal(player *p, item *it, bool, const tripoint& )
{
if (it->charges < it->type->charges_to_use()) {
return 0;
}
g->m.add_trap({static_cast(p->posx()) + static_cast(rng(-2, 2)), static_cast(p->posy()) + static_cast(rng(-2, 2)), p->posz()}, tr_portal);
return it->type->charges_to_use();
}