Hi,

Here's few casts to fix einstein compilation.
Running the game seems to work as well.

timo

Index: patches/patch-font_cpp
===================================================================
RCS file: patches/patch-font_cpp
diff -N patches/patch-font_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-font_cpp      10 Apr 2018 16:09:56 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+Index: font.cpp
+--- font.cpp.orig
++++ font.cpp
+@@ -67,15 +67,15 @@ void Font::draw(SDL_Surface *s, int x, int y, int r, i
+     if (shadow) {
+         SDL_Color color = { 1, 1, 1, 1 };
+         SDL_Surface *surface = TTF_RenderUNICODE_Blended(font, str, color);
+-        SDL_Rect src = { 0, 0, surface->w, surface->h };
+-        SDL_Rect dst = { x+1, y+1, surface->w, surface->h };
++        SDL_Rect src = { 0, 0, static_cast<Uint16>(surface->w), 
static_cast<Uint16>(surface->h) };
++        SDL_Rect dst = { static_cast<Sint16>(x+1), static_cast<Sint16>(y+1), 
static_cast<Uint16>(surface->w), static_cast<Uint16>(surface->h) };
+         SDL_BlitSurface(surface, &src, s, &dst);
+         SDL_FreeSurface(surface);
+     }
+-    SDL_Color color = { r, g, b, 0 };
++    SDL_Color color = { static_cast<Uint8>(r), static_cast<Uint8>(g), 
static_cast<Uint8>(b), 0 };
+     SDL_Surface *surface = TTF_RenderUNICODE_Blended(font, str, color);
+-    SDL_Rect src = { 0, 0, surface->w, surface->h };
+-    SDL_Rect dst = { x, y, surface->w, surface->h };
++    SDL_Rect src = { 0, 0, static_cast<Uint16>(surface->w), 
static_cast<Uint16>(surface->h) };
++    SDL_Rect dst = { static_cast<Sint16>(x), static_cast<Sint16>(y), 
static_cast<Uint16>(surface->w), static_cast<Uint16>(surface->h) };
+     SDL_BlitSurface(surface, &src, s, &dst);
+     SDL_FreeSurface(surface);
+ }
Index: patches/patch-game_cpp
===================================================================
RCS file: patches/patch-game_cpp
diff -N patches/patch-game_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-game_cpp      10 Apr 2018 16:09:56 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+Index: game.cpp
+--- game.cpp.orig
++++ game.cpp
+@@ -139,7 +139,12 @@ void Watch::draw()
+     int y = 24;
+     int w, h;
+     font->getSize(s, w, h);
+-    SDL_Rect rect = { x-2, y-2, w+4, h+4 };
++    SDL_Rect rect = {
++        static_cast<Sint16>(x-2),
++        static_cast<Sint16>(y-2),
++        static_cast<Uint16>(w+4),
++        static_cast<Uint16>(h+4)
++    };
+     SDL_FillRect(screen.getSurface(), &rect, 
+             SDL_MapRGB(screen.getSurface()->format, 0, 0, 255));
+     font->draw(x, y, 255,255,255, true, s);
Index: patches/patch-screen_cpp
===================================================================
RCS file: patches/patch-screen_cpp
diff -N patches/patch-screen_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-screen_cpp    10 Apr 2018 16:09:56 -0000
@@ -0,0 +1,78 @@
+$OpenBSD$
+
+Index: screen.cpp
+--- screen.cpp.orig
++++ screen.cpp
+@@ -116,8 +116,13 @@ void Screen::hideMouse()
+     }
+ 
+     if (mouseSave) {
+-        SDL_Rect src = { 0, 0, mouseSave->w, mouseSave->h };
+-        SDL_Rect dst = { saveX, saveY, mouseSave->w, mouseSave->h };
++        SDL_Rect src = { 0, 0, static_cast<Uint16>(mouseSave->w), 
static_cast<Uint16>(mouseSave->h) };
++        SDL_Rect dst = {
++            static_cast<Sint16>(saveX),
++          static_cast<Sint16>(saveY),
++          static_cast<Uint16>(mouseSave->w),
++          static_cast<Uint16>(mouseSave->h)
++        };
+         if (src.w > 0) {
+             SDL_BlitSurface(mouseSave, &src, screen, &dst);
+             addRegionToUpdate(dst.x, dst.y, dst.w, dst.h);
+@@ -141,8 +146,13 @@ void Screen::showMouse()
+         SDL_GetMouseState(&x, &y);
+         saveX = x;
+         saveY = y;
+-        SDL_Rect src = { 0, 0, mouseSave->w, mouseSave->h };
+-        SDL_Rect dst = { x, y, mouseImage->w, mouseImage->h };
++        SDL_Rect src = { 0, 0, static_cast<Uint16>(mouseSave->w), 
static_cast<Uint16>(mouseSave->h) };
++        SDL_Rect dst = {
++            static_cast<Sint16>(x),
++          static_cast<Sint16>(y),
++          static_cast<Uint16>(mouseImage->w),
++          static_cast<Uint16>(mouseImage->h)
++        };
+         if (src.w > 0) {
+             SDL_BlitSurface(screen, &dst, mouseSave, &src);
+             SDL_BlitSurface(mouseImage, &src, screen, &dst);
+@@ -211,7 +221,7 @@ void Screen::addRegionToUpdate(int x, int y, int w, in
+         h = h + y;
+         y = 0;
+     }
+-    SDL_Rect r = { x, y, w, h };
++    SDL_Rect r = { static_cast<Sint16>(x), static_cast<Sint16>(y), 
static_cast<Uint16>(w), static_cast<Uint16>(h) };
+     regions.push_back(r);
+ }
+ 
+@@ -255,8 +265,13 @@ void Screen::setPixel(int x, int y, int r, int g, int 
+ 
+ void Screen::draw(int x, int y, SDL_Surface *tile)
+ {
+-    SDL_Rect src = { 0, 0, tile->w, tile->h };
+-    SDL_Rect dst = { x, y, tile->w, tile->h };
++    SDL_Rect src = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
++    SDL_Rect dst = {
++        static_cast<Sint16>(x),
++        static_cast<Sint16>(y),
++        static_cast<Uint16>(tile->w),
++        static_cast<Uint16>(tile->h)
++    };
+     SDL_BlitSurface(tile, &src, screen, &dst);
+ }
+ 
+@@ -301,8 +316,13 @@ SDL_Surface* Screen::createSubimage(int x, int y, int 
+             screen->format->Bmask, screen->format->Amask);
+     if (! s)
+         throw Exception(L"Error creating buffer surface");
+-    SDL_Rect src = { x, y, width, height };
+-    SDL_Rect dst = { 0, 0, width, height };
++    SDL_Rect src = {
++        static_cast<Sint16>(x),
++        static_cast<Sint16>(y),
++        static_cast<Uint16>(width),
++        static_cast<Uint16>(height)
++    };
++    SDL_Rect dst = {0, 0, static_cast<Uint16>(width), 
static_cast<Uint16>(height) };
+     SDL_BlitSurface(screen, &src, s, &dst);
+     return s;
+ }
Index: patches/patch-topscores_cpp
===================================================================
RCS file: patches/patch-topscores_cpp
diff -N patches/patch-topscores_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-topscores_cpp 10 Apr 2018 16:09:56 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: topscores.cpp
+--- topscores.cpp.orig
++++ topscores.cpp
+@@ -122,7 +122,7 @@ ScoresWindow::ScoresWindow(int x, int y, TopScores *sc
+         int w = entryFont.getWidth(s);
+         int c = ((no - 1) == highlight) ? 0 : 255;
+         entryFont.draw(background, 30 - w, pos, 255,255,c, true, s);
+-        SDL_Rect rect = { 40, pos-20, 180, 40 };
++        SDL_Rect rect = { 40, static_cast<Sint16>(pos-20), 180, 40 };
+         SDL_SetClipRect(background, &rect);
+         entryFont.draw(background, 40, pos, 255,255,c, true, e.name);
+         SDL_SetClipRect(background, NULL);
Index: patches/patch-utils_cpp
===================================================================
RCS file: /cvs/ports/games/einstein/patches/patch-utils_cpp,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-utils_cpp
--- patches/patch-utils_cpp     3 Apr 2009 17:56:41 -0000       1.1.1.1
+++ patches/patch-utils_cpp     10 Apr 2018 16:09:56 -0000
@@ -1,21 +1,15 @@
 $OpenBSD: patch-utils_cpp,v 1.1.1.1 2009/04/03 17:56:41 landry Exp $
---- utils.cpp.orig     Thu Apr  2 09:00:22 2009
-+++ utils.cpp  Thu Apr  2 09:14:42 2009
-@@ -275,7 +275,16 @@ std::wstring secToStr(int time)
- #ifdef WIN32
-     swprintf(buf, L"%02i:%02i:%02i", hours, minutes, seconds);
- #else
--    swprintf(buf, 50, L"%02i:%02i:%02i", hours, minutes, seconds);
-+    int  c, i;
-+    char buf2 [50];
-+
-+    c = snprintf (buf2, sizeof (buf2), "%02i:%02i:%02i", hours, minutes,
-+        seconds);
-+
-+    for (i = 0; i < c; ++i) {
-+        buf [i] = (wchar_t) buf2 [i];
-+    }
-+    buf [i] = L'\0';
- #endif
- 
-     return buf;
+Index: utils.cpp
+--- utils.cpp.orig
++++ utils.cpp
+@@ -101,8 +101,8 @@ int gettimeofday(struct timeval* tp)
+ void drawWallpaper(const std::wstring &name)
+ {
+     SDL_Surface *tile = loadImage(name);
+-    SDL_Rect src = { 0, 0, tile->w, tile->h };
+-    SDL_Rect dst = { 0, 0, tile->w, tile->h };
++    SDL_Rect src = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
++    SDL_Rect dst = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
+     for (int y = 0; y < screen.getHeight(); y += tile->h)
+         for (int x = 0; x < screen.getWidth(); x += tile->w) {
+             dst.x = x;
Index: patches/patch-widgets_cpp
===================================================================
RCS file: patches/patch-widgets_cpp
diff -N patches/patch-widgets_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-widgets_cpp   10 Apr 2018 16:09:56 -0000
@@ -0,0 +1,80 @@
+$OpenBSD$
+
+Index: widgets.cpp
+--- widgets.cpp.orig
++++ widgets.cpp
+@@ -38,8 +38,8 @@ Button::Button(int x, int y, int w, int h, Font *font,
+ 
+     SDL_Surface *s = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
+             24, 0x00FF0000, 0x0000FF00, 0x000000FF, 0/*0xFF000000*/);
+-    SDL_Rect src = { x, y, width, height };
+-    SDL_Rect dst = { 0, 0, width, height };
++    SDL_Rect src = { static_cast<Sint16>(x), static_cast<Sint16>(y), 
static_cast<Uint16>(width), static_cast<Uint16>(height) };
++    SDL_Rect dst = { 0, 0, static_cast<Uint16>(width), 
static_cast<Uint16>(height) };
+     SDL_BlitSurface(screen.getSurface(), &src, s, &dst);
+     
+     int tW, tH;
+@@ -71,8 +71,8 @@ Button::Button(int x, int y, int w, int h, Font *font,
+             s->format->Bmask, s->format->Amask);
+ 
+     SDL_Surface *tile = loadImage(bg, true);
+-    SDL_Rect src = { 0, 0, tile->w, tile->h };
+-    SDL_Rect dst = { 0, 0, tile->w, tile->h };
++    SDL_Rect src = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
++    SDL_Rect dst = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
+     for (int j = 0; j < height; j += tile->h)
+         for (int i = 0; i < width; i += tile->w) {
+             dst.x = i;
+@@ -117,8 +117,8 @@ Button::Button(int x, int y, int w, int h, Font *font,
+             s->format->Bmask, s->format->Amask);
+ 
+     SDL_Surface *tile = loadImage(bg);
+-    SDL_Rect src = { 0, 0, tile->w, tile->h };
+-    SDL_Rect dst = { 0, 0, tile->w, tile->h };
++    SDL_Rect src = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
++    SDL_Rect dst = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
+     for (int j = 0; j < height; j += tile->h)
+         for (int i = 0; i < width; i += tile->w) {
+             dst.x = i;
+@@ -436,8 +436,8 @@ Window::Window(int x, int y, int w, int h, const std::
+             s->format->Bmask, s->format->Amask);
+ 
+     SDL_Surface *tile = loadImage(bg);
+-    SDL_Rect src = { 0, 0, tile->w, tile->h };
+-    SDL_Rect dst = { 0, 0, tile->w, tile->h };
++    SDL_Rect src = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
++    SDL_Rect dst = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
+     for (int j = 0; j < height; j += tile->h)
+         for (int i = 0; i < width; i += tile->w) {
+             dst.x = i;
+@@ -582,7 +582,7 @@ void InputField::draw()
+ {
+     Window::draw();
+ 
+-    SDL_Rect rect = { left+1, top+1, width-2, height-2 };
++    SDL_Rect rect = { static_cast<Sint16>(left+1), 
static_cast<Sint16>(top+1), static_cast<Uint16>(width-2), 
static_cast<Uint16>(height-2) };
+     SDL_SetClipRect(screen.getSurface(), &rect);
+     
+     font->draw(left+1, top+1, red,green,blue, true, text);
+@@ -721,8 +721,8 @@ Checkbox::Checkbox(int x, int y, int w, int h, Font *f
+             s->format->Bmask, s->format->Amask);
+ 
+     SDL_Surface *tile = loadImage(bg);
+-    SDL_Rect src = { 0, 0, tile->w, tile->h };
+-    SDL_Rect dst = { 0, 0, tile->w, tile->h };
++    SDL_Rect src = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
++    SDL_Rect dst = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
+     for (int j = 0; j < height; j += tile->h)
+         for (int i = 0; i < width; i += tile->w) {
+             dst.x = i;
+@@ -917,8 +917,8 @@ void Slider::createSlider(int size)
+             s->format->Bmask, s->format->Amask);
+ 
+     SDL_Surface *tile = loadImage(L"blue.bmp");
+-    SDL_Rect src = { 0, 0, tile->w, tile->h };
+-    SDL_Rect dst = { 0, 0, tile->w, tile->h };
++    SDL_Rect src = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
++    SDL_Rect dst = { 0, 0, static_cast<Uint16>(tile->w), 
static_cast<Uint16>(tile->h) };
+     for (int j = 0; j < size; j += tile->h)
+         for (int i = 0; i < size; i += tile->w) {
+             dst.x = i;

Reply via email to