From: Alexis Laferrière Date: Fri, 28 Aug 2015 17:52:14 +0000 (-0400) Subject: lib/a_star & sdl: fix warnings X-Git-Tag: v0.7.8~47^2~3 X-Git-Url: http://nitlanguage.org lib/a_star & sdl: fix warnings Signed-off-by: Alexis Laferrière --- diff --git a/lib/a_star.nit b/lib/a_star.nit index ba6b45e..488181e 100644 --- a/lib/a_star.nit +++ b/lib/a_star.nit @@ -194,7 +194,7 @@ class Node # With a large graph it can cause a stack overflow. # # Instead, we serialize the nodes first and then the links. - redef fun core_serialize_to(serializer: Serializer) + redef fun core_serialize_to(serializer) do serializer.serialize_attribute("graph", graph) end @@ -265,7 +265,7 @@ class Graph[N: Node, L: Link] # Used to check if nodes have been searched in one pathfinding private var pathfinding_current_evocation: Int = 0 - redef fun core_serialize_to(serializer: Serializer) + redef fun core_serialize_to(serializer) do serializer.serialize_attribute("nodes", nodes) serializer.serialize_attribute("links", links) @@ -380,7 +380,7 @@ class WeightedPathContext self.worst_cost = worst_cost end - redef var worst_cost: Int is noinit + redef var worst_cost is noinit redef fun cost(l) do return l.weight diff --git a/lib/sdl.nit b/lib/sdl.nit index db0f700..858e9b3 100644 --- a/lib/sdl.nit +++ b/lib/sdl.nit @@ -77,15 +77,15 @@ extern class SDLDisplay `{SDL_Surface *`} SDL_FillRect(self, NULL, SDL_MapRGB(self->format,r,g,b)); `} - redef fun width: Int `{ return self->w; `} - redef fun height: Int `{ return self->h; `} + redef fun width `{ return self->w; `} + redef fun height `{ return self->h; `} # Fill a rectangle with given color fun fill_rect(rect: SDLRectangle, r, g, b: Int) `{ SDL_FillRect(self, rect, SDL_MapRGB(self->format,r,g,b)); `} - redef fun clear(r, g, b: Float) `{ + redef fun clear(r, g, b) `{ Uint8 ri, gi, bi; ri = (Uint8)r*255; gi = (Uint8)g*255; @@ -247,8 +247,8 @@ extern class SDLImage # Destroy the image and free the memory redef fun destroy `{ SDL_FreeSurface(self); `} - redef fun width: Int `{ return self->w; `} - redef fun height: Int `{ return self->h; `} + redef fun width `{ return self->w; `} + redef fun height `{ return self->h; `} fun is_ok: Bool do return not address_is_null @@ -309,8 +309,8 @@ class SDLMouseButtonEvent var button: Int - redef var pressed: Bool - redef fun depressed: Bool do return not pressed + redef var pressed + redef fun depressed do return not pressed # Is this event raised by the left button? fun is_left_button: Bool do return button == 1 @@ -355,8 +355,8 @@ class SDLMouseMotionEvent var rel_x: Float var rel_y: Float - redef var pressed: Bool - redef fun depressed: Bool do return not pressed + redef var pressed + redef fun depressed do return not pressed init (x, y, rel_x, rel_y: Float, pressed: Bool) do @@ -384,7 +384,7 @@ class SDLKeyEvent self.down = down end - redef fun to_c: nullable Char + redef fun to_c do if name.length == 1 then return name.chars.first return null