shithub: cstory

Download patch

ref: 51562f6fd85247891c0d472b94f3324a50dedcc7
parent: 9a598b1359505167ac2ec89de49731b5a1ec2f8e
author: Clownacy <[email protected]>
date: Tue Mar 31 11:37:51 EDT 2020

Use standard `main` return values

`WinMain` has weird rules for this, and they don't match `main`.

--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -2,6 +2,7 @@
 
 #include <stddef.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "SDL.h"
@@ -220,12 +221,12 @@
 			if (conf.display_mode == 1)
 			{
 				if (!StartDirectDraw(lpWindowName, windowWidth, windowHeight, 0))
-					return 0;
+					return EXIT_FAILURE;
 			}
 			else
 			{
 				if (!StartDirectDraw(lpWindowName, windowWidth, windowHeight, 1))
-					return 0;
+					return EXIT_FAILURE;
 			}
 		#else
 			// Doesn't handle StartDirectDraw failing
@@ -246,7 +247,7 @@
 
 		#ifdef FIX_BUGS
 			if (!StartDirectDraw(lpWindowName, windowWidth, windowHeight, 2))
-				return 0;
+				return EXIT_FAILURE;
 		#else
 			// Doesn't handle StartDirectDraw failing
 			StartDirectDraw(lpWindowName, windowWidth, windowHeight, 2);
@@ -292,7 +293,7 @@
 	{
         SDL_FreeCursor(cursor);
         SDL_FreeSurface(cursor_surface);
-		return 1;
+		return EXIT_SUCCESS;
 	}
 
 	// Initialize sound
@@ -320,7 +321,7 @@
 	SDL_FreeCursor(cursor);
 	SDL_FreeSurface(cursor_surface);
 
-	return 1;
+	return EXIT_SUCCESS;
 }
 
 void InactiveWindow(void)