Skip to content
Snippets Groups Projects
Commit ae13c7ef authored by neil's avatar neil
Browse files

Remove some unused variables; add some headers that were missing; fix some...

Remove some unused variables; add some headers that were missing; fix some returns that were void or not void inappropriately; change a couple of variables to size_t

git-svn-id: http://svn.net-core.org/repos/t-engine4@628 51575b47-30f0-44d4-a5cc-537603b46e54
parent 44bb2fde
No related branches found
No related tags found
No related merge requests found
......@@ -593,7 +593,7 @@ void init_by_array(uint32_t init_key[], int key_length) {
uint32_t rand_div(uint32_t m)
{
uint32_t r, n;
uint32_t r;
/* Hack -- simple case */
if (m <= 1) return (0);
......
......@@ -27,10 +27,13 @@
#include "script.h"
#include "display.h"
#include "physfs.h"
#include "physfsrwops.h"
#include "SFMT.h"
#include "mzip.h"
#include "main.h"
#include "tSDL.h"
#include <math.h>
#include <time.h>
/******************************************************************
******************************************************************
......@@ -303,7 +306,7 @@ static const struct luaL_reg fovcache_reg[] =
static int lua_get_mouse(lua_State *L)
{
int x = 0, y = 0;
int buttons = SDL_GetMouseState(&x, &y);
(void)SDL_GetMouseState(&x, &y);
lua_pushnumber(L, x);
lua_pushnumber(L, y);
......@@ -1221,7 +1224,7 @@ static int lua_line_step(lua_State *L)
static int lua_free_line(lua_State *L)
{
line_data *data = (line_data*)auxiliar_checkclass(L, "line{core}", 1);
(void)auxiliar_checkclass(L, "line{core}", 1);
lua_pushnumber(L, 1);
return 1;
}
......@@ -1351,7 +1354,7 @@ static int lua_file_read(lua_State *L)
static int lua_file_write(lua_State *L)
{
PHYSFS_file **f = (PHYSFS_file**)auxiliar_checkclass(L, "physfs{file}", 1);
int len;
size_t len;
const char *data = lua_tolstring(L, 2, &len);
PHYSFS_write(*f, data, sizeof(char), len);
......@@ -1403,7 +1406,7 @@ static int lua_zip_add(lua_State *L)
{
zipFile *zf = (zipFile*)auxiliar_checkclass(L, "physfs{zip}", 1);
const char *filenameinzip = luaL_checkstring(L, 2);
int datalen;
size_t datalen;
const char *data = lua_tolstring(L, 3, &datalen);
int opt_compress_level = luaL_optnumber(L, 4, 4);
......
......@@ -27,11 +27,14 @@
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#include "luasocket.h"
#include "luasocket/mime.h"
#include "SFMT.h"
#include "types.h"
#include "script.h"
#include "physfs.h"
#include "physfsrwops.h"
#include "core_lua.h"
#include "getself.h"
#include "music.h"
......@@ -49,6 +52,15 @@ bool no_sound = FALSE;
bool isActive = TRUE;
bool tickPaused = FALSE;
/* Some lua stuff that's external but has no headers */
int luaopen_mime_core(lua_State *L);
int luaopen_profiler(lua_State *L);
int luaopen_lpeg(lua_State *L);
int luaopen_map(lua_State *L);
int luaopen_particles(lua_State *L);
int luaopen_sound(lua_State *L);
int luaopen_lanes(lua_State *L);
static int traceback (lua_State *L) {
lua_Debug ar;
int n;
......@@ -402,7 +414,7 @@ void do_resize(int w, int h, bool fullscreen)
screen = SDL_SetVideoMode(w, h, 32, flags);
if (screen==NULL) {
printf("error opening screen: %s\n", SDL_GetError());
return 0;
return;
}
resizeWindow(screen->w, screen->h);
......@@ -414,6 +426,9 @@ void do_resize(int w, int h, bool fullscreen)
// Let some platforms use a different entry point
#ifdef USE_TENGINE_MAIN
#ifdef main
#undef main
#endif
#define main tengine_main
#endif
......@@ -489,7 +504,7 @@ int main(int argc, char *argv[])
Uint32 flags=SDL_INIT_VIDEO | SDL_INIT_TIMER;
if (SDL_Init (flags) < 0) {
printf("cannot initialize SDL: %s\n", SDL_GetError ());
return;
return -1;
}
SDL_WM_SetIcon(IMG_Load_RW(PHYSFSRWOPS_openRead("/data/gfx/te4-icon.png"), TRUE), NULL);
......@@ -498,7 +513,7 @@ int main(int argc, char *argv[])
do_resize(WIDTH, HEIGHT, FALSE);
if (screen==NULL) {
printf("error opening screen: %s\n", SDL_GetError());
return;
return -1;
}
SDL_WM_SetCaption("T4Engine", NULL);
SDL_EnableUNICODE(TRUE);
......
......@@ -26,6 +26,8 @@
#include "music.h"
#include "script.h"
#include "tSDL.h"
#include "physfs.h"
#include "physfsrwops.h"
bool sound_active = TRUE;
......@@ -63,7 +65,7 @@ static int music_play(lua_State *L)
int loop = lua_isnumber(L, 2) ? lua_tonumber(L, 2) : 1;
int fadein = lua_isnumber(L, 3) ? lua_tonumber(L, 3) : 0;
printf("play music %x %d %d\n", *m, loop, fadein);
printf("play music %x %d %d\n", (unsigned int)(*m), loop, fadein);
lua_pushboolean(L, (Mix_FadeInMusic(*m, loop, fadein) == -1) ? FALSE : TRUE);
return 1;
}
......
......@@ -27,6 +27,7 @@
#include "script.h"
#include <math.h>
#include "tSDL.h"
#include "SFMT.h"
#define rng(x, y) (x + rand_div(1 + y - x))
......
......@@ -2,8 +2,10 @@
#include <SDL/SDL.h>
#include <SDL_ttf/SDL_ttf.h>
#include <SDL_mixer/SDL_mixer.h>
#include <SDL_image/SDL_image.h>
#else
#include <SDL.h>
#include <SDL_ttf.h>
#include <SDL_mixer.h>
#include <SDL_image.h>
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment