Browse Source

Changes to work better on other(non win32) platforms

Vadim Glazunov 17 years ago
parent
commit
3d11b2c4e7
7 changed files with 19 additions and 23 deletions
  1. 1 1
      CGameState.cpp
  2. 4 10
      CHeroWindow.cpp
  3. 8 8
      CMT.cpp
  4. 3 1
      global.h
  5. 1 1
      hch/CCreatureHandler.cpp
  6. 1 1
      hch/CHeroHandler.cpp
  7. 1 1
      server/CVCMIServer.cpp

+ 1 - 1
CGameState.cpp

@@ -1160,4 +1160,4 @@ int BattleInfo::calculateDmg(const CStack* attacker, const CStack* defender)
 	}
 
 	return (float)damageBase * (float)attacker->amount * dmgBonusMultiplier;
-}
+}

+ 4 - 10
CHeroWindow.cpp

@@ -1052,11 +1052,8 @@ void LRClickableAreaWText::clickLeft(boost::logic::tribool down)
 {
 	if(!down)
 	{
-		#if !defined(__amigaos4__) && !defined(__unix__)
-		LOCPLINT->showInfoDialog(text, std::vector<SComponent*>());
-		#else
-		#warning error here!
-		#endif
+		std::vector<SComponent*> comp;
+		LOCPLINT->showInfoDialog(text, comp);
 	}
 }
 void LRClickableAreaWText::clickRight(boost::logic::tribool down)
@@ -1100,11 +1097,8 @@ void LRClickableAreaWTextComp::clickLeft(boost::logic::tribool down)
 {
 	if((!down) && pressedL)
 	{
-#if !defined(__amigaos4__) && !defined(__unix__)
-		LOCPLINT->showInfoDialog(text, std::vector<SComponent*>(1, new SComponent(SComponent::Etype(baseType), type, bonus)));
-#else
-#warning error here!
-#endif
+		std::vector<SComponent*> comp(1, new SComponent(SComponent::Etype(baseType), type, bonus));
+		LOCPLINT->showInfoDialog(text, comp);
 	}
 	ClickableL::clickLeft(down);
 }

+ 8 - 8
CMT.cpp

@@ -76,11 +76,11 @@ int main(int argc, _TCHAR* argv[])
 		CSDL_Ext::std32bppSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 1, 32, rmask, gmask, bmask, amask);
 		THC std::cout<<"\tInitializing minors: "<<pomtime.getDif()<<std::endl;
 		TTF_Init();
-		TNRB16 = TTF_OpenFont("Fonts\\tnrb.ttf",16);
-		GEOR13 = TTF_OpenFont("Fonts\\georgia.ttf",13);
-		GEOR16 = TTF_OpenFont("Fonts\\georgia.ttf",16);
-		GEORXX = TTF_OpenFont("Fonts\\tnrb.ttf",22);
-		GEORM = TTF_OpenFont("Fonts\\georgia.ttf",10);
+		TNRB16 = TTF_OpenFont("Fonts" PATHSEPARATOR "tnrb.ttf",16);
+		GEOR13 = TTF_OpenFont("Fonts" PATHSEPARATOR "georgia.ttf",13);
+		GEOR16 = TTF_OpenFont("Fonts" PATHSEPARATOR "georgia.ttf",16);
+		GEORXX = TTF_OpenFont("Fonts" PATHSEPARATOR "tnrb.ttf",22);
+		GEORM = TTF_OpenFont("Fonts" PATHSEPARATOR "georgia.ttf",10);
 		atexit(TTF_Quit);
 		THC std::cout<<"\tInitializing fonts: "<<pomtime.getDif()<<std::endl;
 		CMusicHandler * mush = new CMusicHandler;  //initializing audio
@@ -91,9 +91,9 @@ int main(int argc, _TCHAR* argv[])
 		THC std::cout<<"\tInitializing sound: "<<pomtime.getDif()<<std::endl;
 		THC std::cout<<"Initializing screen, fonts and sound handling: "<<tmh.getDif()<<std::endl;
 		CDefHandler::Spriteh = cgi->spriteh = new CLodHandler();
-		cgi->spriteh->init("Data\\H3sprite.lod","Sprites");
+		cgi->spriteh->init("Data" PATHSEPARATOR "H3sprite.lod","Sprites");
 		BitmapHandler::bitmaph = cgi->bitmaph = new CLodHandler;
-		cgi->bitmaph->init("Data\\H3bitmap.lod","Data");
+		cgi->bitmaph->init("Data" PATHSEPARATOR "H3bitmap.lod","Data");
 		THC std::cout<<"Loading .lod files: "<<tmh.getDif()<<std::endl;
 		initDLL(cgi->bitmaph);
 		CGI->arth = VLC->arth;
@@ -136,7 +136,7 @@ int main(int argc, _TCHAR* argv[])
 		cpg->mush = mush;
 		StartInfo *options = new StartInfo(cpg->runLoop());
 ///////////////////////////////////////////////////////////////////////////////////////
-		boost::thread servthr(boost::bind(system,"VCMI_server.exe > server_log.txt")); //runs server executable; 
+		boost::thread servthr(boost::bind(system,SERVER_NAME " > server_log.txt")); //runs server executable; 
 												//TODO: will it work on non-windows platforms?
 		THC tmh.getDif();pomtime.getDif();//reset timers
 		CSpellHandler * spellh = new CSpellHandler;

+ 3 - 1
global.h

@@ -22,9 +22,11 @@ typedef boost::int8_t si8; //signed int 8 bits (1 byte)
 #ifdef _WIN32
 #define PATHSEPARATOR "\\"
 #define DATA_DIR ""
+#define SERVER_NAME "VCMI_server.exe"
 #else
 #define PATHSEPARATOR "/"
-#define DATA_DIR "/progdir/"
+#define DATA_DIR ""
+#define SERVER_NAME "./vcmiserver"
 #endif
 
 enum Ecolor {RED, BLUE, TAN, GREEN, ORANGE, PURPLE, TEAL, PINK}; //player's colors

+ 1 - 1
hch/CCreatureHandler.cpp

@@ -421,7 +421,7 @@ void CCreatureHandler::loadCreatures()
 
 	//loading id to projectile mapping
 
-	std::ifstream inp2("config/cr_shots.TXT", std::ios::in | std::ios::binary); //this file is not in lod
+	std::ifstream inp2("config" PATHSEPARATOR "cr_shots.txt", std::ios::in | std::ios::binary); //this file is not in lod
 	char dump [200];
 	inp2.getline(dump, 200);
 	while(true)

+ 1 - 1
hch/CHeroHandler.cpp

@@ -335,7 +335,7 @@ unsigned int CHeroHandler::reqExp(unsigned int level)
 void CHeroHandler::initTerrainCosts()
 {
 	std::ifstream inp;
-	inp.open("config\\TERCOSTS.TXT", std::ios_base::in|std::ios_base::binary);
+	inp.open("config" PATHSEPARATOR "TERCOSTS.TXT", std::ios_base::in|std::ios_base::binary);
 	int tynum;
 	inp>>tynum;
 	for(int i=0; i<2*tynum; i+=2)

+ 1 - 1
server/CVCMIServer.cpp

@@ -127,7 +127,7 @@ int main(int argc, _TCHAR* argv[])
 #endif
 {
 	CLodHandler h3bmp;
-	h3bmp.init("Data\\H3bitmap.lod","Data");
+	h3bmp.init("Data/H3bitmap.lod","Data");
 	initDLL(&h3bmp);
 	srand ( (unsigned int)time(NULL) );
 	try