From 6380a93cec1163c40da9762793fdf752045a9997 Mon Sep 17 00:00:00 2001
From: Jonas Kulla <Nyocurio@gmail.com>
Date: Wed, 10 Jun 2015 13:23:39 +0200
Subject: [PATCH] Graphics: Fix ::transition() "filename" default value

The default value is an empty string, which triggers the simple
transition. Passing null is not legal (and wasn't possible in
mkxp from Ruby side anyway).

Fixes #108.
---
 binding-mri/graphics-binding.cpp   | 2 +-
 binding-mruby/graphics-binding.cpp | 2 +-
 src/graphics.cpp                   | 2 +-
 src/graphics.h                     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/binding-mri/graphics-binding.cpp b/binding-mri/graphics-binding.cpp
index c28be77..a585e17 100644
--- a/binding-mri/graphics-binding.cpp
+++ b/binding-mri/graphics-binding.cpp
@@ -48,7 +48,7 @@ RB_METHOD(graphicsTransition)
 	RB_UNUSED_PARAM;
 
 	int duration = 8;
-	const char *filename = 0;
+	const char *filename = "";
 	int vague = 40;
 
 	rb_get_args(argc, argv, "|izi", &duration, &filename, &vague RB_ARG_END);
diff --git a/binding-mruby/graphics-binding.cpp b/binding-mruby/graphics-binding.cpp
index 632283c..035da21 100644
--- a/binding-mruby/graphics-binding.cpp
+++ b/binding-mruby/graphics-binding.cpp
@@ -45,7 +45,7 @@ MRB_FUNCTION(graphicsFreeze)
 MRB_FUNCTION(graphicsTransition)
 {
 	mrb_int duration = 8;
-	const char *filename = 0;
+	const char *filename = "";
 	mrb_int vague = 40;
 
 	mrb_get_args(mrb, "|izi", &duration, &filename, &vague);
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 41fcc72..1862629 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -716,7 +716,7 @@ void Graphics::transition(int duration,
 		return;
 
 	vague = clamp(vague, 1, 256);
-	Bitmap *transMap = filename ? new Bitmap(filename) : 0;
+	Bitmap *transMap = *filename ? new Bitmap(filename) : 0;
 
 	setBrightness(255);
 
diff --git a/src/graphics.h b/src/graphics.h
index 05436bc..e914178 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -37,7 +37,7 @@ public:
 	void update();
 	void freeze();
 	void transition(int duration = 8,
-	                const char *filename = 0,
+	                const char *filename = "",
 	                int vague = 40);
 	void frameReset();