]> granicus.if.org Git - nethack/commitdiff
casting lua_tointeger
authornhmall <nhmall@nethack.org>
Fri, 29 Nov 2019 22:38:51 +0000 (17:38 -0500)
committernhmall <nhmall@nethack.org>
Fri, 29 Nov 2019 22:38:51 +0000 (17:38 -0500)
src/dungeon.c
src/nhlua.c
src/questpgr.c

index de7319b8889b9f96cf824eaf1c9920fc0a92a736..ae6e6866b20c2e7435cab8860ac6bff0b9bf3a44 100644 (file)
@@ -779,8 +779,9 @@ lua_State *L;
     lua_getfield(L, -1, "flags");
     if (lua_type(L, -1) == LUA_TTABLE) {
         int f, nflags;
+
         lua_len(L, -1);
-        nflags = LUA_INTCAST(lua_tointeger(L, -1));
+        nflags = (int) lua_tointeger(L, -1);
         lua_pop(L, 1);
         for (f = 0; f < nflags; f++) {
             lua_pushinteger(L, f+1);
@@ -856,7 +857,7 @@ init_dungeons()
         panic("dungeon is not a lua table");
 
     lua_len(L, -1);
-    g.n_dgns = LUA_INTCAST(lua_tointeger(L, -1));
+    g.n_dgns = (int) lua_tointeger(L, -1);
     lua_pop(L, 1);
 
     pd.start = 0;
@@ -905,8 +906,9 @@ init_dungeons()
         lua_getfield(L, -1, "levels");
         if (lua_type(L, -1) == LUA_TTABLE) {
             int f, nlevels;
+
             lua_len(L, -1);
-            nlevels = LUA_INTCAST(lua_tointeger(L, -1));
+            nlevels = (int) lua_tointeger(L, -1);
             pd.tmpdungeon[i].levels = nlevels;
             lua_pop(L, 1);
             for (f = 0; f < nlevels; f++) {
@@ -965,8 +967,9 @@ init_dungeons()
         lua_getfield(L, -1, "branches");
         if (lua_type(L, -1) == LUA_TTABLE) {
             int f, nbranches;
+
             lua_len(L, -1);
-            nbranches = LUA_INTCAST(lua_tointeger(L, -1));
+            nbranches = (int) lua_tointeger(L, -1);
             pd.tmpdungeon[i].branches = nbranches;
             lua_pop(L, 1);
             for (f = 0; f < nbranches; f++) {
index 39c71496e5cb9ba9cf9cdef605126ef6a03256b7..678dd7338bf04bc4cfde38577b181722982981b4 100644 (file)
@@ -217,8 +217,8 @@ lua_State *L;
     int argc = lua_gettop(L);
 
     if (argc == 2) {
-        int x = LUA_INTCAST(lua_tointeger(L, 1));
-        int y = LUA_INTCAST(lua_tointeger(L, 2));
+        int x = (int) lua_tointeger(L, 1);
+        int y = (int) lua_tointeger(L, 2);
 
         if (x >= 0 && x < COLNO && y >= 0 && y < ROWNO) {
             char buf[BUFSZ];
index 64eea0c4dd31fc0663ee364d43c56faeb7d68e1c..594e4952ba355e99525f05348c259d0364bb051c 100644 (file)
@@ -484,8 +484,9 @@ const char *msgid;
 
     if (!synopsis && !text) {
         int nelems;
+
         lua_len(L, -1);
-        nelems = LUA_INTCAST(lua_tointeger(L, -1));
+        nelems = (int) lua_tointeger(L, -1);
         lua_pop(L, 1);
         if (nelems < 2) {
             impossible("com_pager: questtext[%s][%s] in %s in not an array of strings", section, msgid, QTEXT_FILE);