Commit 47fb016e4efd5265c8e4bbf90907f15195024758
1 parent
5da6c8f963
Exists in
master
and in
2 other branches
Fixed warnings, added -Wall to Makefile CFLAGS. Configuration works properly.
Showing 4 changed files with 14 additions and 17 deletions Side-by-side Diff
client/Makefile
View file @
47fb016
client/cfg.c
View file @
47fb016
1 | 1 | #include <stdio.h> |
2 | -#include <lua.h> | |
3 | -#include <lauxlib.h> | |
4 | -#include <lualib.h> | |
5 | 2 | |
6 | 3 | #include "mot.h" |
7 | 4 | |
... | ... | @@ -14,7 +11,7 @@ |
14 | 11 | { |
15 | 12 | if (!lua_isboolean(L, -1)) |
16 | 13 | { |
17 | - error(L, "`%s' should be a boolean.\n", name); | |
14 | + luaL_error(L, "`%s' should be a boolean.\n", name); | |
18 | 15 | } |
19 | 16 | else |
20 | 17 | { |
... | ... | @@ -33,7 +30,7 @@ |
33 | 30 | { |
34 | 31 | if (!lua_isnumber(L, -1)) |
35 | 32 | { |
36 | - error(L, "`%s' should be a number.\n", name); | |
33 | + luaL_error(L, "`%s' should be a number.\n", name); | |
37 | 34 | } |
38 | 35 | else |
39 | 36 | { |
40 | 37 | |
... | ... | @@ -52,11 +49,12 @@ |
52 | 49 | { |
53 | 50 | if (!lua_isstring(L, -1)) |
54 | 51 | { |
55 | - error(L, "`%s' should be a string.\n", name); | |
52 | + luaL_error(L, "`%s' should be a string.\n", name); | |
56 | 53 | } |
57 | 54 | else |
58 | 55 | { |
59 | - *arg = lua_tostring(L, -1); | |
56 | + /* Suppress const char * whining */ | |
57 | + *arg = (char *) lua_tostring(L, -1); | |
60 | 58 | } |
61 | 59 | } |
62 | 60 | lua_pop(L, 1); |
... | ... | @@ -65,8 +63,6 @@ |
65 | 63 | void |
66 | 64 | parsecfg(lua_State *L, CLC_CONFIG *config) |
67 | 65 | { |
68 | - FILE *cfile; | |
69 | - | |
70 | 66 | /* |
71 | 67 | * Set default values for configuration. |
72 | 68 | */ |
... | ... | @@ -83,7 +79,8 @@ |
83 | 79 | */ |
84 | 80 | if (luaL_loadfile(L, CFG_FNAME) || lua_pcall(L, 0, 0, 0)) |
85 | 81 | { |
86 | - error(L, "Failed to parse configuration file: %s", lua_tostring(L, -1)); | |
82 | + luaL_error(L, "Failed to parse configuration file: %s", | |
83 | + lua_tostring(L, -1)); | |
87 | 84 | return; |
88 | 85 | } |
89 | 86 |
client/main.c
View file @
47fb016
1 | 1 | #include <stdio.h> |
2 | 2 | #include <stdlib.h> |
3 | 3 | #include <stddef.h> |
4 | -#include <lua.h> | |
5 | -#include <lauxlib.h> | |
6 | -#include <lualib.h> | |
7 | 4 | |
8 | 5 | /* debug */ |
9 | 6 | #include "../common/mot_maze.h" |
... | ... | @@ -48,7 +45,6 @@ |
48 | 45 | lua_State *L; |
49 | 46 | |
50 | 47 | /* debug, should remove later */ |
51 | - unsigned int i; | |
52 | 48 | FILE *mfile; |
53 | 49 | |
54 | 50 | L = lua_open(); |
client/mot.h
View file @
47fb016
... | ... | @@ -3,6 +3,9 @@ |
3 | 3 | |
4 | 4 | #include <SDL2/SDL.h> |
5 | 5 | #include <SDL2/SDL_image.h> |
6 | +#include <lua.h> | |
7 | +#include <lauxlib.h> | |
8 | +#include <lualib.h> | |
6 | 9 | |
7 | 10 | #define CFG_FNAME "config.lua" |
8 | 11 | |
... | ... | @@ -15,8 +18,8 @@ |
15 | 18 | |
16 | 19 | typedef struct |
17 | 20 | { |
18 | - Uint32 win_width; | |
19 | - Uint32 win_height; | |
21 | + int win_width; | |
22 | + int win_height; | |
20 | 23 | Uint32 win_flags; |
21 | 24 | Uint32 renderflags; |
22 | 25 | char *luamain; |
... | ... | @@ -30,6 +33,7 @@ |
30 | 33 | } PICTURE; |
31 | 34 | |
32 | 35 | void draw_maze(int x, int y); |
36 | +void parsecfg(lua_State *L, CLC_CONFIG *config); | |
33 | 37 | |
34 | 38 | #endif |