clintbellanger/flare-engine — pull request #541 by stefanbeller (2013-03-29 14:14:19+00:00)
Title: Refactoring the codebase

This pullrequest delivers:
* The largest part is the introduction of loadGraphicsSurface in Utils. This offers a convenient way to reduce the often occuring pattern
```
image = IMG_Load(mods->locate(filename).c_str());
if(!image) {
fprintf(stderr, "Couldn't load image: %s\n", IMG_GetError());
} else {
// optimize
SDL_Surface *cleanup = image;
image = SDL_DisplayFormatAlpha(image);
SDL_FreeSurface(cleanup);
}
```

* The loadGraphicsSurface function was enhanced to also deal with custom error messages, exiting flare if the image is not found (is used for some menu graphics) and having a color key applied (is used in the character loading screen).
So all image loading could go through this function.

* reducing unused lines of code such as
```
bool getClick() {
if (getClick(mouse.x, mouse.y))
return true;
else
return false;
}
```
was reduced to
```
bool getClick()
return getClick(mouse.x, mouse.y);
```

I propose to pull not before 0.18 release. I don't know how much interference there is with other large code changes, such as minions and cutscenes, so I'd give it a low prio.