From d32386353d28093a5d03ad99f161f8133d73e056 Mon Sep 17 00:00:00 2001
From: Bjørn Lindeijer <bjorn@lindeijer.nl>
Date: Mon, 13 Dec 2004 02:25:58 +0000
Subject: Some header order, namespace and lib fixes to improve MSVC support.

---
 ManaWorld.vcproj        |  4 ++--
 src/graphic/image.h     | 18 +++++++++---------
 src/gui/char_server.cpp |  1 -
 src/gui/gui.cpp         |  2 +-
 src/gui/gui.h           |  6 +++---
 src/gui/setup.cpp       | 10 ++++++----
 src/gui/setup.h         |  2 +-
 src/log.cpp             |  2 +-
 src/log.h               |  5 ++---
 src/main.h              |  2 +-
 src/sound/sound.h       |  5 ++---
 11 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/ManaWorld.vcproj b/ManaWorld.vcproj
index 0b2b1ea1..bf7b644c 100644
--- a/ManaWorld.vcproj
+++ b/ManaWorld.vcproj
@@ -33,7 +33,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="SDL.lib SDLmain.lib"
-				AdditionalDependencies="alleg.lib masking.lib alfont.lib ws2_32.lib"
+				AdditionalDependencies="alleg.lib guichan.lib guichan_allegro.lib alfont.lib ws2_32.lib"
 				OutputFile="$(OutDir)/ManaWorld.exe"
 				LinkIncremental="2"
 				GenerateDebugInformation="TRUE"
@@ -80,7 +80,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="SDL.lib"
-				AdditionalDependencies="libjgmod.lib alfont.lib alleg.lib ws2_32.lib "
+				AdditionalDependencies="alleg.lib guichan.lib guichan_allegro.lib libjgmod.lib alfont.lib ws2_32.lib "
 				OutputFile="tmw.exe"
 				LinkIncremental="1"
 				GenerateDebugInformation="TRUE"
diff --git a/src/graphic/image.h b/src/graphic/image.h
index a9b7e8cd..0ec8ccde 100644
--- a/src/graphic/image.h
+++ b/src/graphic/image.h
@@ -1,12 +1,12 @@
 #ifndef _IMAGE_H
 #define _IMAGE_H
 
+#include <allegro.h>
 #include <string>
 #include <vector>
 #include <iostream>
-#include <allegro.h>
 #include "../log.h"
-using namespace std;
+
 
 class IMAGE {
   protected:
@@ -50,14 +50,14 @@ class VIDEO_IMAGE : public IMAGE {
 };
 
 class SPRITESET {
-  private:
-    int get_property(DATAFILE *datafile, int type) {
-      return atoi(get_datafile_property(datafile, type));
-    }  
-  public:
-    vector<IMAGE *> spriteset; 
+    private:
+        int get_property(DATAFILE *datafile, int type) {
+            return atoi(get_datafile_property(datafile, type));
+        }  
+    public:
+        std::vector<IMAGE *> spriteset; 
          
-    SPRITESET(string filename) {
+    SPRITESET(std::string filename) {
       DATAFILE *datafile = load_datafile(filename.c_str());
       if(!datafile)error("Unable to load graphic file: " + filename);
       int i = 0;
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index c84fc167..caf02eed 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -32,7 +32,6 @@ gcn::ListBox *serverList;
 
 
 void ServerSelectListener::action(const std::string& eventId) {
-    printf("%s\n", eventId.c_str());
     if (eventId == "ok") {
         server_char_server(serverList->getSelected());
     }
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index b20d2e1d..6b574b45 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -19,11 +19,11 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "gui.h"
 #include <allegro.h>
 #include <allegro/internal/aintern.h>
 #include <math.h>
 #include <alfont.h>
-#include "gui.h"
 #include "../log.h"
 #include "../sound/sound.h"
 
diff --git a/src/gui/gui.h b/src/gui/gui.h
index b3c989c2..af83ccac 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -22,15 +22,15 @@
 #ifdef WIN32
   #pragma warning (disable:4312)
 #endif
-#include "login.h"
+
 #ifndef _TMW_GUI
 #define _TMW_GUI
 
+#include <guichan.hpp>
+#include <guichan/allegro.hpp>
 #include <allegro.h>
 #include <alfont.h>
 #include <string.h>
-#include <guichan.hpp>
-#include <guichan/allegro.hpp>
 
 typedef struct {
     BITMAP *grid[9];
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index c8b677db..07ade6d3 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -64,10 +64,12 @@ Setup::~Setup() {
 }
 
 void Setup::toggleVisible(bool toggle) {
-  if(visible == false && toggle == true)
-    visible == true;
-    else
-  if(visible == true && toggle == false) visible == false;
+    if (!visible && toggle) {
+        visible = true;
+    }
+    else if (visible && !toggle) {
+        visible = false;
+    }
   
   setupDialog->setVisible(visible);
 }
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 1d8b859f..5c92f136 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -8,7 +8,7 @@
 
 #include <allegro.h>
 #ifdef WIN32
-#include <winallegro.h>
+#include <winalleg.h>
 #endif
 #include "gui.h"
 #include "../graphic/graphic.h"
diff --git a/src/log.cpp b/src/log.cpp
index ecc54aea..d9eb0bda 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -79,7 +79,7 @@ void log(const char *category, const char *log_text, ...) {
  * Log an error and quit. The error will pop-up in Windows and will be printed
  * to standard error everywhere else. 
  */
-void error(const string error_text) {
+void error(const std::string error_text) {
     log("Error", error_text.c_str());
 
 #ifdef WIN32
diff --git a/src/log.h b/src/log.h
index a173fa5a..cd9079cb 100644
--- a/src/log.h
+++ b/src/log.h
@@ -24,18 +24,17 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <string>
-using namespace std;
 #include <stdarg.h>
 #include <time.h>
 #ifdef WIN32
 #include <allegro.h>
 #include <winalleg.h>
 #endif
+#include <string>
 
 void init_log();
 void log(const char *category, const char *log_text, ...);
-void error(string error_text);
+void error(std::string error_text);
 void warning(const char *warning_text);
 void status(const char *status_text);
 
diff --git a/src/main.h b/src/main.h
index 9c0607e2..0578b42a 100644
--- a/src/main.h
+++ b/src/main.h
@@ -30,12 +30,12 @@
 
 #define CORE_VERSION "0.0.8"
 
-#include <stdio.h>
 #include <allegro.h>
 #ifdef WIN32
 #include <winalleg.h>
 #endif
 #include <alfont.h>
+#include <stdio.h>
 
 #include "log.h"
 #include "game.h"
diff --git a/src/sound/sound.h b/src/sound/sound.h
index 7cd82680..4f7f573c 100644
--- a/src/sound/sound.h
+++ b/src/sound/sound.h
@@ -22,16 +22,15 @@
 #ifndef __SOUND_H
 #define __SOUND_H
 
-#include <list>
-#include <string>
-#include <fstream>
 
 #ifdef WIN32
 	#pragma warning(disable:4312)
 #endif
 #include <allegro.h>
 #include <jgmod.h>
+#include <list>
 #include <string>
+#include <fstream>
 
 /** mod file */
 #define TMWSOUND_MOD 1
-- 
cgit v1.2.3-70-g09d2