Browse Source

Fix some compiler warnings.

Michael Ragazzon 6 years ago
parent
commit
f61bd632d7

+ 1 - 0
Samples/invaders/src/Defender.cpp

@@ -51,6 +51,7 @@ Defender::Defender(Game* _game)
 	move_direction = 0;
 	defender_frame_start = 0;
 	bullet_in_flight = false;
+	respawn_start = 0;
 	game = _game;
 	position.x = game->GetWindowDimensions().x / 2;
 	position.y = game->GetWindowDimensions().y - 50;

+ 2 - 1
Samples/invaders/src/Mothership.cpp

@@ -35,7 +35,7 @@
 const int SPRITE_WIDTH = 64;
 
 const float APPEARANCE_PROBABILITY = 0.001f;
-const float UPDATE_FREQ = 0.025f;
+const double UPDATE_FREQ = 0.025;
 const float MOVEMENT_SPEED = 5;
 
 Mothership::Mothership(Game* game, int index) : Invader(game, Invader::MOTHERSHIP, index)
@@ -43,6 +43,7 @@ Mothership::Mothership(Game* game, int index) : Invader(game, Invader::MOTHERSHI
 	// Start off dead, and set up our position
 	state = DEAD;
 	update_frame_start = 0;
+	direction = 0;
 	position = Rml::Core::Vector2f(-SPRITE_WIDTH, 64.0f);
 }
 

+ 2 - 2
Samples/luainvaders/src/DecoratorStarfield.cpp

@@ -124,8 +124,8 @@ void DecoratorStarfield::RenderElement(Rml::Core::Element* RMLUI_UNUSED_PARAMETE
 
 void DecoratorStarfield::StarField::Update()
 {
-	float time = Shell::GetElapsedTime();
-	float delta_time = time - last_update;
+	double time = Shell::GetElapsedTime();
+	float delta_time = float(time - last_update);
 	last_update = time;
 
 	if (!GameDetails::GetPaused())

+ 1 - 1
Samples/luainvaders/src/DecoratorStarfield.h

@@ -72,7 +72,7 @@ private:
 	struct StarField
 	{
 		void Update();
-		float last_update;
+		double last_update;
 		Rml::Core::Vector2f dimensions;
 
 		typedef std::vector< StarLayer > StarLayerList;

+ 12 - 8
Samples/luainvaders/src/Defender.cpp

@@ -36,11 +36,11 @@
 #include "Shield.h"
 #include "Sprite.h"
 
-const float UPDATE_FREQ = 0.01f;
-const float MOVEMENT_SPEED = 15;
-const float BULLET_SPEED = 15;
-const int SPRITE_WIDTH = 64;
-const float RESPAWN_TIME = 1.0f;
+static const float UPDATE_FREQ = 0.01f;
+static const float MOVEMENT_SPEED = 300;
+static const float BULLET_SPEED = 15;
+static const int SPRITE_WIDTH = 64;
+static const float RESPAWN_TIME = 1.0f;
 
 Sprite defender_sprite(Rml::Core::Vector2f(60, 31), Rml::Core::Vector2f(0, 0.5), Rml::Core::Vector2f(0.23437500, 0.98437500));
 Sprite bullet_sprite(Rml::Core::Vector2f(4, 20), Rml::Core::Vector2f(0.4921875, 0.515625), Rml::Core::Vector2f(0.5078125, 0.828125));
@@ -51,6 +51,7 @@ Defender::Defender(Game* _game)
 	move_direction = 0;
 	defender_frame_start = 0;
 	bullet_in_flight = false;
+	respawn_start = 0;
 	game = _game;
 	position.x = game->GetWindowDimensions().x / 2;
 	position.y = game->GetWindowDimensions().y - 50;
@@ -64,12 +65,15 @@ Defender::~Defender()
 
 void Defender::Update()
 {
-	if (Shell::GetElapsedTime() - defender_frame_start < UPDATE_FREQ)
+	float dt = float(Shell::GetElapsedTime() - defender_frame_start);
+	if (dt < UPDATE_FREQ)
 		return;
+
+	dt = Rml::Core::Math::Min(dt, 0.1f);
 	
 	defender_frame_start = Shell::GetElapsedTime();	
 
-	position.x += (move_direction * MOVEMENT_SPEED);
+	position.x += (move_direction * dt * MOVEMENT_SPEED);
 
 	if (position.x < 5)
 		position.x = 5;
@@ -91,7 +95,7 @@ void Defender::Update()
 		render = !render;
 
 		// Check if we should switch back to our alive state
-		if (Shell::GetElapsedTime() - respawn_start > RESPAWN_TIME)
+		if (float(Shell::GetElapsedTime() - respawn_start) > RESPAWN_TIME)
 		{
 			state = ALIVE;
 			render = true;

+ 2 - 2
Samples/luainvaders/src/Defender.h

@@ -69,8 +69,8 @@ private:
 	bool bullet_in_flight;
 	Rml::Core::Vector2f bullet_position;
 
-	float defender_frame_start;
-	float respawn_start;
+	double defender_frame_start;
+	double respawn_start;
 
 	bool render;
 

+ 2 - 1
Samples/luainvaders/src/Game.cpp

@@ -69,6 +69,7 @@ Game::Game()
 {
 	invader_frame_start = 0;
 	defender_lives = 3;	
+	invader_move_freq = 0;
 	game_over = false;
 	current_invader_direction = 1.0f;	
 	invaders = new Invader*[NUM_INVADERS + 1];
@@ -440,6 +441,6 @@ void Game::InitialiseWave()
 	invaders[MOTHERSHIP] = new Mothership(this, MOTHERSHIP);
 
 	// Update the move frequency	
-	invader_move_freq = ((((float)GameDetails::GetWave())-100.0f)/140.0f);
+	invader_move_freq = ((float)GameDetails::GetWave()-100.0f)/140.0f;
 	invader_move_freq *= invader_move_freq;
 }

+ 7 - 7
Samples/luainvaders/src/Invader.cpp

@@ -36,13 +36,13 @@
 #include "Shield.h"
 #include "Sprite.h"
 
-const float BOMB_UPDATE_FREQ = 0.04f;
-const float BOMB_RAY_SPEED = 10;
-const float BOMB_MISSILE_SPEED = 7;
-const float BOMB_PROBABILITY_EASY = 0.002f;
-const float BOMB_PROBABILITY_HARD = 0.005f;
-const float EXPLOSION_TIME = 0.25f;
-const Rml::Core::Colourb MOTHERSHIP_COLOUR = Rml::Core::Colourb(255, 0, 0, 255);
+static const double BOMB_UPDATE_FREQ = 0.04;
+static const float BOMB_RAY_SPEED = 10;
+static const float BOMB_MISSILE_SPEED = 7;
+static const float BOMB_PROBABILITY_EASY = 0.002f;
+static const float BOMB_PROBABILITY_HARD = 0.005f;
+static const float EXPLOSION_TIME = 0.25;
+static const Rml::Core::Colourb MOTHERSHIP_COLOUR = Rml::Core::Colourb(255, 0, 0, 255);
 
 Sprite invader_sprites[] =
 {

+ 2 - 2
Samples/luainvaders/src/Invader.h

@@ -100,14 +100,14 @@ protected:
 	// The animation frame the bomb is on
 	int bomb_animation_frame;
 	// When the last bomb update occured
-	float bomb_frame_start;
+	double bomb_frame_start;
 	// Probability of us dropping a bomb - this is calculated
 	// at construction time and based on our rank and the game
 	// difficulty level
 	float bomb_probability;
 
 	// Time when we should die - 0, until we're hit
-	float death_time;	
+	double death_time;	
 
 	int GetSpriteIndex() const;
 };

+ 1 - 1
Samples/luainvaders/src/LuaInterface.cpp

@@ -86,7 +86,7 @@ int GameSetPaused(lua_State* L)
 
 int GameSetDifficulty(lua_State* L)
 {
-    int difficulty = luaL_checkinteger(L,1);
+    int difficulty = (int)luaL_checkinteger(L,1);
     GameDetails::SetDifficulty((GameDetails::Difficulty)difficulty);
     return 0;
 }

+ 5 - 4
Samples/luainvaders/src/Mothership.cpp

@@ -32,17 +32,18 @@
 #include "Game.h"
 #include "Sprite.h"
 
-const int SPRITE_WIDTH = 64;
+static const int SPRITE_WIDTH = 64;
 
-const float APPEARANCE_PROBABILITY = 0.001f;
-const float UPDATE_FREQ = 0.025f;
-const float MOVEMENT_SPEED = 5;
+static const float APPEARANCE_PROBABILITY = 0.001f;
+static const double UPDATE_FREQ = 0.025;
+static const float MOVEMENT_SPEED = 5;
 
 Mothership::Mothership(Game* game, int index) : Invader(game, Invader::MOTHERSHIP, index)
 {
 	// Start off dead, and set up our position
 	state = DEAD;
 	update_frame_start = 0;
+	direction = 0;
 	position = Rml::Core::Vector2f(-SPRITE_WIDTH, 64.0f);
 }
 

+ 1 - 1
Samples/luainvaders/src/Mothership.h

@@ -45,7 +45,7 @@ public:
 
 private:
 	// Time of the last update
-	float update_frame_start;
+	double update_frame_start;
 
 	// Direction mothership is flying in
 	float direction;

+ 7 - 7
Samples/luainvaders/src/main.cpp

@@ -152,7 +152,7 @@ void DoAllocConsole()
 {
 	static const WORD MAX_CONSOLE_LINES = 500;
 	int hConHandle;
-	long lStdHandle;
+	HANDLE lStdHandle;
 	CONSOLE_SCREEN_BUFFER_INFO coninfo;
 	FILE *fp;
 
@@ -165,24 +165,24 @@ void DoAllocConsole()
 	SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize);
 
 	// redirect unbuffered STDOUT to the console
-	lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);
-	hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
+	lStdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
+	hConHandle = _open_osfhandle((intptr_t)lStdHandle, _O_TEXT);
 	fp = _fdopen( hConHandle, "w" );
 
 	*stdout = *fp;
 	setvbuf( stdout, nullptr, _IONBF, 0 );
 
 	// redirect unbuffered STDIN to the console
-	lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE);
-	hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
+	lStdHandle = GetStdHandle(STD_INPUT_HANDLE);
+	hConHandle = _open_osfhandle((intptr_t)lStdHandle, _O_TEXT);
 	fp = _fdopen( hConHandle, "r" );
 
 	*stdin = *fp;
 	setvbuf( stdin, nullptr, _IONBF, 0 );
 
 	// redirect unbuffered STDERR to the console
-	lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE);
-	hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
+	lStdHandle = GetStdHandle(STD_ERROR_HANDLE);
+	hConHandle = _open_osfhandle((intptr_t)lStdHandle, _O_TEXT);
 	fp = _fdopen( hConHandle, "w" );
 	*stderr = *fp;
 

+ 1 - 1
Source/Controls/Lua/DataFormatter.cpp

@@ -37,7 +37,7 @@ namespace Lua {
 //method
 int DataFormatternew(lua_State* L)
 {
-    DataFormatter* df;
+    DataFormatter* df = nullptr;
     int ref = LUA_NOREF;
     int top = lua_gettop(L);
     if(top == 0)

+ 6 - 6
Source/Controls/Lua/DataSource.cpp

@@ -49,8 +49,8 @@ int DataSourceNotifyRowAdd(lua_State* L, DataSource* obj)
 {
     LUACHECKOBJ(obj);
     const char* table_name = luaL_checkstring(L,1);
-    int first_row_added = luaL_checkinteger(L,2);
-    int num_rows_added = luaL_checkinteger(L,3);
+    int first_row_added = (int)luaL_checkinteger(L,2);
+    int num_rows_added = (int)luaL_checkinteger(L,3);
     obj->NotifyRowAdd(table_name,first_row_added,num_rows_added);
     return 0;
 }
@@ -59,8 +59,8 @@ int DataSourceNotifyRowRemove(lua_State* L, DataSource* obj)
 {
     LUACHECKOBJ(obj);
     const char* table_name = luaL_checkstring(L,1);
-    int first_row_removed = luaL_checkinteger(L,2);
-    int num_rows_removed = luaL_checkinteger(L,3);
+    int first_row_removed = (int)luaL_checkinteger(L,2);
+    int num_rows_removed = (int)luaL_checkinteger(L,3);
     obj->NotifyRowRemove(table_name,first_row_removed,num_rows_removed);
     return 0;
 }
@@ -75,8 +75,8 @@ int DataSourceNotifyRowChange(lua_State* L, DataSource* obj)
     }
     else
     {
-        int first_row_changed = luaL_checkinteger(L,2);
-        int num_rows_changed = luaL_checkinteger(L,3);
+        int first_row_changed = (int)luaL_checkinteger(L,2);
+        int num_rows_changed = (int)luaL_checkinteger(L,3);
         obj->NotifyRowChange(table_name,first_row_changed,num_rows_changed);
     }
     return 0;

+ 5 - 5
Source/Controls/Lua/ElementFormControlInput.cpp

@@ -104,7 +104,7 @@ int ElementFormControlInputSetAttrmaxlength(lua_State* L)
 {
     ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
     LUACHECKOBJ(obj);
-    int maxlength = luaL_checkinteger(L,2);
+    int maxlength = (int)luaL_checkinteger(L,2);
     obj->SetAttribute("maxlength",maxlength);
     return 0;
 }
@@ -113,7 +113,7 @@ int ElementFormControlInputSetAttrsize(lua_State* L)
 {
     ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
     LUACHECKOBJ(obj);
-    int size = luaL_checkinteger(L,2);
+    int size = (int)luaL_checkinteger(L,2);
     obj->SetAttribute("size",size);
     return 0;
 }
@@ -122,7 +122,7 @@ int ElementFormControlInputSetAttrmax(lua_State* L)
 {
     ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
     LUACHECKOBJ(obj);
-    int max = luaL_checkinteger(L,2);
+    int max = (int)luaL_checkinteger(L,2);
     obj->SetAttribute("max",max);
     return 0;
 }
@@ -131,7 +131,7 @@ int ElementFormControlInputSetAttrmin(lua_State* L)
 {
     ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
     LUACHECKOBJ(obj);
-    int min = luaL_checkinteger(L,2);
+    int min = (int)luaL_checkinteger(L,2);
     obj->SetAttribute("min",min);
     return 0;
 }
@@ -140,7 +140,7 @@ int ElementFormControlInputSetAttrstep(lua_State* L)
 {
     ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
     LUACHECKOBJ(obj);
-    int step = luaL_checkinteger(L,2);
+    int step = (int)luaL_checkinteger(L,2);
     obj->SetAttribute("step",step);
     return 0;
 }

+ 3 - 3
Source/Controls/Lua/ElementFormControlSelect.cpp

@@ -47,7 +47,7 @@ int ElementFormControlSelectAdd(lua_State* L, ElementFormControlSelect* obj)
     const char* value = luaL_checkstring(L,2);
     int before = -1; //default
     if(lua_gettop(L) >= 3)
-        before = luaL_checkinteger(L,3);
+        before = (int)luaL_checkinteger(L,3);
 
     int index = obj->Add(rml,value,before);
     lua_pushinteger(L,index);
@@ -56,7 +56,7 @@ int ElementFormControlSelectAdd(lua_State* L, ElementFormControlSelect* obj)
 
 int ElementFormControlSelectRemove(lua_State* L, ElementFormControlSelect* obj)
 {
-    int index = luaL_checkinteger(L,1);
+    int index = (int)luaL_checkinteger(L,1);
     obj->Remove(index);
     return 0;
 }
@@ -87,7 +87,7 @@ int ElementFormControlSelectSetAttrselection(lua_State* L)
 {
     ElementFormControlSelect* obj = LuaType<ElementFormControlSelect>::check(L,1);
     LUACHECKOBJ(obj);
-    int selection = luaL_checkinteger(L,2);
+    int selection = (int)luaL_checkinteger(L,2);
     obj->SetSelection(selection);
     return 0;
 }

+ 3 - 3
Source/Controls/Lua/ElementFormControlTextArea.cpp

@@ -75,7 +75,7 @@ int ElementFormControlTextAreaSetAttrcols(lua_State* L)
 {
     ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
     LUACHECKOBJ(obj);
-    int cols = luaL_checkinteger(L,2);
+    int cols = (int)luaL_checkinteger(L,2);
     obj->SetNumColumns(cols);
     return 0;
 }
@@ -84,7 +84,7 @@ int ElementFormControlTextAreaSetAttrmaxlength(lua_State* L)
 {
     ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
     LUACHECKOBJ(obj);
-    int ml = luaL_checkinteger(L,2);
+    int ml = (int)luaL_checkinteger(L,2);
     obj->SetMaxLength(ml);
     return 0;
 }
@@ -93,7 +93,7 @@ int ElementFormControlTextAreaSetAttrrows(lua_State* L)
 {
     ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
     LUACHECKOBJ(obj);
-    int rows = luaL_checkinteger(L,2);
+    int rows = (int)luaL_checkinteger(L,2);
     obj->SetNumRows(rows);
     return 0;
 }

+ 3 - 3
Source/Controls/Lua/ElementTabSet.cpp

@@ -40,7 +40,7 @@ namespace Lua {
 int ElementTabSetSetPanel(lua_State* L, ElementTabSet* obj)
 {
     LUACHECKOBJ(obj);
-    int index = luaL_checkinteger(L,1);
+    int index = (int)luaL_checkinteger(L,1);
     const char* rml = luaL_checkstring(L,2);
 
     obj->SetPanel(index,rml);
@@ -50,7 +50,7 @@ int ElementTabSetSetPanel(lua_State* L, ElementTabSet* obj)
 int ElementTabSetSetTab(lua_State* L, ElementTabSet* obj)
 {
     LUACHECKOBJ(obj);
-    int index = luaL_checkinteger(L,1);
+    int index = (int)luaL_checkinteger(L,1);
     const char* rml = luaL_checkstring(L,2);
 
     obj->SetTab(index,rml);
@@ -83,7 +83,7 @@ int ElementTabSetSetAttractive_tab(lua_State* L)
 {
     ElementTabSet* obj = LuaType<ElementTabSet>::check(L,1);
     LUACHECKOBJ(obj);
-    int tab = luaL_checkinteger(L,2);
+    int tab = (int)luaL_checkinteger(L,2);
     obj->SetActiveTab(tab);
     return 0;
 }

+ 1 - 1
Source/Controls/Lua/LuaDataSource.cpp

@@ -99,7 +99,7 @@ int LuaDataSource::GetNumRows(const Rml::Core::String& table)
     int res = lua_gettop(L);
     if(lua_type(L,res) == LUA_TNUMBER)
     {
-        return luaL_checkinteger(L,res);
+        return (int)luaL_checkinteger(L,res);
     }
     else
     {

+ 1 - 1
Source/Controls/Lua/SelectOptionsProxy.cpp

@@ -44,7 +44,7 @@ int SelectOptionsProxy__index(lua_State* L)
     {
         SelectOptionsProxy* proxy = LuaType<SelectOptionsProxy>::check(L,1);
         LUACHECKOBJ(proxy);
-        int index = luaL_checkinteger(L,2);
+        int index = (int)luaL_checkinteger(L,2);
         Rml::Controls::SelectOption* opt = proxy->owner->GetOption(index);
         LUACHECKOBJ(opt);
         lua_newtable(L);

+ 2 - 0
Source/Core/Context.cpp

@@ -849,6 +849,8 @@ void Context::OnElementDetach(Element* element)
 // Internal callback for when a new element gains focus
 bool Context::OnFocusChange(Element* new_focus)
 {
+	RMLUI_ASSERT(new_focus);
+
 	ElementSet old_chain;
 	ElementSet new_chain;
 

+ 4 - 4
Source/Core/Lua/Colourb.cpp

@@ -197,12 +197,12 @@ int ColourbSetAttrrgba(lua_State* L)
             if(top > 2)
             {
                 if(top > 3)
-                    obj->alpha = luaL_checkinteger(L,4);
-                obj->blue = luaL_checkinteger(L,3);
+                    obj->alpha = (byte)luaL_checkinteger(L,4);
+                obj->blue = (byte)luaL_checkinteger(L,3);
             }
-            obj->green = luaL_checkinteger(L,2);
+            obj->green = (byte)luaL_checkinteger(L,2);
         }
-        obj->red = luaL_checkinteger(L,1);
+        obj->red = (byte)luaL_checkinteger(L,1);
     }
     return 0;
 }

+ 1 - 1
Source/Core/Lua/ContextDocumentsProxy.cpp

@@ -55,7 +55,7 @@ int ContextDocumentsProxy__index(lua_State* L)
         if(type == LUA_TSTRING)
             ret = proxy->owner->GetDocument(luaL_checkstring(L,2));
         else
-            ret = proxy->owner->GetDocument(luaL_checkinteger(L,2));
+            ret = proxy->owner->GetDocument((int)luaL_checkinteger(L,2));
         LuaType<Document>::push(L,ret,false);
         return 1;
     }

+ 1 - 1
Source/Core/Lua/Document.cpp

@@ -81,7 +81,7 @@ int DocumentShow(lua_State* L, Document* obj)
         obj->Show();
     else
     {
-        int flag = luaL_checkinteger(L,1);
+        int flag = (int)luaL_checkinteger(L,1);
         obj->Show(flag);
     }
     return 0;

+ 1 - 1
Source/Core/Lua/ElementChildNodesProxy.cpp

@@ -52,7 +52,7 @@ int ElementChildNodesProxy__index(lua_State* L)
     {
         ElementChildNodesProxy* obj = LuaType<ElementChildNodesProxy>::check(L,1);
         LUACHECKOBJ(obj);
-        int key = luaL_checkinteger(L,2);
+        int key = (int)luaL_checkinteger(L,2);
         Element* child = obj->owner->GetChild(key);
         LuaType<Element>::push(L,child,false);
         return 1;

+ 1 - 1
Source/Core/Lua/GlobalLuaFunctions.cpp

@@ -73,7 +73,7 @@ int rmlui_pairs(lua_State* L)
 
 //copy + pasted from Lua's lbaselib.c
 int ipairsaux (lua_State *L) {
-    int i = luaL_checkinteger(L, 2);
+    lua_Integer i = luaL_checkinteger(L, 2);
     luaL_checktype(L, 1, LUA_TTABLE);
     i++;  /* next value */
     lua_pushinteger(L, i);

+ 3 - 3
Source/Core/Lua/LuaEventListener.h

@@ -56,9 +56,9 @@ public:
 	void ProcessEvent(Event& event) override;
 private:
     //the lua-side function to call when ProcessEvent is called
-    int luaFuncRef;
-    Element* attached;
-    ElementDocument* parent;
+    int luaFuncRef = 0;
+    Element* attached = nullptr;
+    ElementDocument* parent = nullptr;
     String strFunc; //for debugging purposes
 };
 

+ 1 - 1
Source/Core/Lua/RmlUiContextsProxy.cpp

@@ -61,7 +61,7 @@ int RmlUiContextsProxy__index(lua_State* L)
         }
         else
         {
-            int key = luaL_checkinteger(L,2);
+            int key = (int)luaL_checkinteger(L,2);
             LuaType<Context>::push(L,GetContext(key));
         }
         return 1;

+ 6 - 6
Source/Core/Lua/Vector2i.cpp

@@ -59,8 +59,8 @@ template<> void ExtraInit<Vector2i>(lua_State* L, int metatable_index)
 
 int Vector2inew(lua_State* L)
 {
-    int x = luaL_checkinteger(L,1);
-    int y = luaL_checkinteger(L,2);
+    int x = (int)luaL_checkinteger(L,1);
+    int y = (int)luaL_checkinteger(L,2);
 
     Vector2i* vect = new Vector2i(x,y);
 
@@ -72,7 +72,7 @@ int Vector2i__mul(lua_State* L)
 {
     Vector2i* lhs = LuaType<Vector2i>::check(L,1);
     LUACHECKOBJ(lhs);
-    int rhs = luaL_checkinteger(L,2);
+    int rhs = (int)luaL_checkinteger(L,2);
 
     Vector2i* res = new Vector2i(0,0);
     (*res) = (*lhs) * rhs;
@@ -85,7 +85,7 @@ int Vector2i__div(lua_State* L)
 {
     Vector2i* lhs = LuaType<Vector2i>::check(L,1);
     LUACHECKOBJ(lhs);
-    int rhs = luaL_checkinteger(L,2);
+    int rhs = (int)luaL_checkinteger(L,2);
 
     Vector2i* res = new Vector2i(0,0);
     (*res) = (*lhs) / rhs;
@@ -164,7 +164,7 @@ int Vector2iSetAttrx(lua_State*L)
 {
     Vector2i* self = LuaType<Vector2i>::check(L,1);
     LUACHECKOBJ(self);
-    int value = luaL_checkinteger(L,2);
+    int value = (int)luaL_checkinteger(L,2);
 
     self->x = value;
     return 0;
@@ -174,7 +174,7 @@ int Vector2iSetAttry(lua_State*L)
 {
     Vector2i* self = LuaType<Vector2i>::check(L,1);
     LUACHECKOBJ(self);
-    int value = luaL_checkinteger(L,2);
+    int value = (int)luaL_checkinteger(L,2);
 
     self->y = value;
     return 0;