1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

* probably fixed Bind effect

* reverted unwanted part of r730
* project files will now have relative paths to libs/includes
* more checkings on startup
This commit is contained in:
Michał W. Urbańczyk 2009-02-14 15:00:29 +00:00
parent 9dbe9bd277
commit 99aef852be
11 changed files with 81 additions and 35 deletions

View File

@ -41,7 +41,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="G:\vcmt\repa\include" AdditionalIncludeDirectories="../../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GENIUS_EXPORTS" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GENIUS_EXPORTS"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -64,7 +64,7 @@
AdditionalDependencies="VCMI_lib.lib" AdditionalDependencies="VCMI_lib.lib"
OutputFile="../GeniusAI.dll" OutputFile="../GeniusAI.dll"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories="../../../libs; ../../"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"
OptimizeReferences="0" OptimizeReferences="0"
@ -120,7 +120,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="3" Optimization="3"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="&quot;D:\!GameDevelopment\VCMI\libs\include&quot;;G:\vcmt\repa\include" AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GENIUS_EXPORTS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GENIUS_EXPORTS"
RuntimeLibrary="2" RuntimeLibrary="2"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
@ -142,7 +142,7 @@
AdditionalDependencies="VCMI_lib.lib" AdditionalDependencies="VCMI_lib.lib"
OutputFile="../GeniusAI.dll" OutputFile="../GeniusAI.dll"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories="../../../libs; ../../"
GenerateManifest="false" GenerateManifest="false"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"
@ -200,7 +200,7 @@
AdditionalOptions="/Oy-" AdditionalOptions="/Oy-"
Optimization="3" Optimization="3"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="&quot;D:\!GameDevelopment\VCMI\libs\include&quot;;G:\vcmt\repa\include" AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GENIUS_EXPORTS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GENIUS_EXPORTS"
RuntimeLibrary="2" RuntimeLibrary="2"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
@ -225,7 +225,7 @@
AdditionalDependencies="VCMI_lib.lib" AdditionalDependencies="VCMI_lib.lib"
OutputFile="../GeniusAI.dll" OutputFile="../GeniusAI.dll"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories="../../../libs; ../../"
GenerateManifest="false" GenerateManifest="false"
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true" GenerateMapFile="true"

View File

@ -390,7 +390,10 @@ ui32 CStack::speed() const
//bind effect check //bind effect check
effect = getEffect(72); effect = getEffect(72);
if(effect) if(effect)
premy = -creature->speed; {
premy = creature->speed; //don't use '- creature->speed' - speed is unsigned!
premy = -premy;
}
return creature->speed + premy; return creature->speed + premy;
} }

View File

@ -99,6 +99,11 @@ int main(int argc, char** argv)
GEOR16 = TTF_OpenFont("Fonts" PATHSEPARATOR "georgia.ttf",16); GEOR16 = TTF_OpenFont("Fonts" PATHSEPARATOR "georgia.ttf",16);
GEORXX = TTF_OpenFont("Fonts" PATHSEPARATOR "tnrb.ttf",22); GEORXX = TTF_OpenFont("Fonts" PATHSEPARATOR "tnrb.ttf",22);
GEORM = TTF_OpenFont("Fonts" PATHSEPARATOR "georgia.ttf",10); GEORM = TTF_OpenFont("Fonts" PATHSEPARATOR "georgia.ttf",10);
if(! (TNRB16 && GEOR16 && GEORXX && GEORM))
{
tlog1 << "One of the fonts couldn't be loaded!\n";
throw "One of the fonts couldn't be loaded!\n";
}
atexit(TTF_Quit); atexit(TTF_Quit);
THC tlog0<<"\tInitializing fonts: "<<pomtime.getDif()<<std::endl; THC tlog0<<"\tInitializing fonts: "<<pomtime.getDif()<<std::endl;
CMusicHandler * mush = new CMusicHandler; //initializing audio CMusicHandler * mush = new CMusicHandler; //initializing audio

View File

@ -1126,7 +1126,11 @@ void MapSel::init()
{ {
//get map files names //get map files names
std::vector<std::string> pliczkiTemp; std::vector<std::string> pliczkiTemp;
fs::path tie( (fs::initial_path<fs::path>())/"/Maps" ); if(!boost::filesystem::exists("Maps"))
{
tlog1 << "Cannot find /Maps directory!\n";
}
fs::path tie( (fs::initial_path<fs::path>())/"Maps" );
fs::directory_iterator end_iter; fs::directory_iterator end_iter;
for ( fs::directory_iterator dir (tie); dir!=end_iter; ++dir ) for ( fs::directory_iterator dir (tie); dir!=end_iter; ++dir )
{ {
@ -1218,6 +1222,10 @@ void MapSel::init()
pliczkiTemp.clear(); pliczkiTemp.clear();
std::vector<std::string> datestemp; std::vector<std::string> datestemp;
if(!boost::filesystem::exists("Games"))
{
tlog1 << "Cannot find /Games directory!\n";
}
tie = fs::path( (fs::initial_path<fs::path>())/"/Games" ); tie = fs::path( (fs::initial_path<fs::path>())/"/Games" );
for ( fs::directory_iterator dir (tie); dir!=end_iter; ++dir ) for ( fs::directory_iterator dir (tie); dir!=end_iter; ++dir )
{ {

View File

@ -41,7 +41,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP2" AdditionalOptions="/MP2"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="G:\vcmt\repa\include" AdditionalIncludeDirectories="..\..\include"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -61,9 +61,9 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib SDL_mixer.lib lua5.1.lib VCMI_lib.lib" AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib SDL_mixer.lib VCMI_lib.lib"
ShowProgress="0" ShowProgress="0"
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories="../../libs;../"
GenerateDebugInformation="true" GenerateDebugInformation="true"
OptimizeReferences="1" OptimizeReferences="1"
TargetMachine="1" TargetMachine="1"
@ -122,7 +122,7 @@
OmitFramePointers="true" OmitFramePointers="true"
EnableFiberSafeOptimizations="true" EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true" WholeProgramOptimization="true"
AdditionalIncludeDirectories="G:\vcmt\repa\include" AdditionalIncludeDirectories="..\..\include"
StringPooling="true" StringPooling="true"
BasicRuntimeChecks="0" BasicRuntimeChecks="0"
RuntimeLibrary="2" RuntimeLibrary="2"
@ -142,8 +142,8 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib SDL_mixer.lib lua5.1.lib VCMI_lib.lib" AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib SDL_mixer.lib VCMI_lib.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories="../../libs;../"
GenerateDebugInformation="true" GenerateDebugInformation="true"
Driver="0" Driver="0"
OptimizeReferences="2" OptimizeReferences="2"
@ -206,7 +206,7 @@
OmitFramePointers="false" OmitFramePointers="false"
EnableFiberSafeOptimizations="true" EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true" WholeProgramOptimization="true"
AdditionalIncludeDirectories="G:\vcmt\repa\include" AdditionalIncludeDirectories="..\..\include"
StringPooling="true" StringPooling="true"
BasicRuntimeChecks="0" BasicRuntimeChecks="0"
RuntimeLibrary="2" RuntimeLibrary="2"
@ -228,8 +228,8 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib SDL_mixer.lib lua5.1.lib VCMI_lib.lib" AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib SDL_mixer.lib VCMI_lib.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories="../../libs;../"
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true" GenerateMapFile="true"
Driver="0" Driver="0"

View File

@ -335,6 +335,11 @@ void CLodHandler::init(std::string lodFile, std::string dirName)
mutex = new boost::mutex; mutex = new boost::mutex;
std::string Ts; std::string Ts;
FLOD = fopen(lodFile.c_str(), "rb"); FLOD = fopen(lodFile.c_str(), "rb");
if(!FLOD)
{
tlog1 << "Cannot open " << lodFile << std::endl;
return;
}
fseek(FLOD, 8, 0); fseek(FLOD, 8, 0);
unsigned char temp[4]; unsigned char temp[4];
fread((char*)temp, 1, 4, FLOD); fread((char*)temp, 1, 4, FLOD);
@ -404,7 +409,9 @@ void CLodHandler::init(std::string lodFile, std::string dirName)
} }
} }
else else
{
tlog1<<"Warning: No "+dirName+"/ folder!"<<std::endl; tlog1<<"Warning: No "+dirName+"/ folder!"<<std::endl;
}
} }
std::string CLodHandler::getTextFile(std::string name) std::string CLodHandler::getTextFile(std::string name)
{ {

View File

@ -56,7 +56,10 @@ void CMusicHandler::initMusics()
//winScenario = Mix_LoadMUS(DATA_DIR "MP3" PATHSEPARATOR "Win Scenario.mp3"); //winScenario = Mix_LoadMUS(DATA_DIR "MP3" PATHSEPARATOR "Win Scenario.mp3");
click = Mix_LoadWAV(DATA_DIR "MP3" PATHSEPARATOR "snd1.wav"); click = Mix_LoadWAV(DATA_DIR "MP3" PATHSEPARATOR "snd1.wav");
click->volume = 30; if(!click)
tlog1 << "Cannot open " DATA_DIR "MP3" PATHSEPARATOR "snd1.wav\n";
else
click->volume = 30;
this->sndh = new CSndHandler(std::string(DATA_DIR "Data" PATHSEPARATOR "Heroes3.snd")); this->sndh = new CSndHandler(std::string(DATA_DIR "Data" PATHSEPARATOR "Heroes3.snd"));
} }

View File

@ -12,11 +12,10 @@ CSndHandler::CSndHandler(std::string fname):CHUNK(65535)
{ {
file.open(fname.c_str(),std::ios::binary); file.open(fname.c_str(),std::ios::binary);
if (!file.is_open()) if (!file.is_open())
#ifndef __GNUC__ {
throw new std::exception((std::string("Cannot open ")+fname).c_str()); tlog1 << "Cannot open " << fname << std::endl;
#else throw std::string("Cannot open ")+fname;
throw new std::exception(); }
#endif
int nr = readNormalNr(0,4); int nr = readNormalNr(0,4);
char tempc; char tempc;
for (int i=0;i<nr;i++) for (int i=0;i<nr;i++)

View File

@ -41,7 +41,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP2" AdditionalOptions="/MP2"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="G:\vcmt\repa\include" AdditionalIncludeDirectories="..\..\include"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -61,7 +61,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib" AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories="../../libs;"
GenerateDebugInformation="true" GenerateDebugInformation="true"
TargetMachine="1" TargetMachine="1"
/> />
@ -118,7 +118,7 @@
OmitFramePointers="true" OmitFramePointers="true"
EnableFiberSafeOptimizations="true" EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true" WholeProgramOptimization="true"
AdditionalIncludeDirectories="G:\vcmt\repa\include" AdditionalIncludeDirectories="..\..\include"
StringPooling="true" StringPooling="true"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="0" BasicRuntimeChecks="0"
@ -140,7 +140,7 @@
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="zdll.lib" AdditionalDependencies="zdll.lib"
Version="" Version=""
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories=""
GenerateDebugInformation="false" GenerateDebugInformation="false"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
@ -201,7 +201,7 @@
OmitFramePointers="false" OmitFramePointers="false"
EnableFiberSafeOptimizations="true" EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true" WholeProgramOptimization="true"
AdditionalIncludeDirectories="G:\vcmt\repa\include" AdditionalIncludeDirectories="..\..\include"
StringPooling="true" StringPooling="true"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="0" BasicRuntimeChecks="0"
@ -225,7 +225,7 @@
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="zdll.lib" AdditionalDependencies="zdll.lib"
Version="" Version=""
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories=""
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true" GenerateMapFile="true"
OptimizeReferences="2" OptimizeReferences="2"

View File

@ -241,16 +241,21 @@ void CGameHandler::changePrimSkill(int ID, int which, int val, bool abs)
expert.insert(hero->secSkills[i].first); expert.insert(hero->secSkills[i].first);
none.erase(hero->secSkills[i].first); none.erase(hero->secSkills[i].first);
} }
//first offered skill
if(hero->secSkills.size() < hero->type->heroClass->skillLimit) //free skill slot if(hero->secSkills.size() < hero->type->heroClass->skillLimit) //free skill slot
{ {
hlu.skills.push_back(hero->type->heroClass->chooseSecSkill(none)); //new skill hlu.skills.push_back(hero->type->heroClass->chooseSecSkill(none)); //new skill
none.erase(hlu.skills.back());
} }
else else if(basicAndAdv.size())
{ {
int s = hero->type->heroClass->chooseSecSkill(basicAndAdv); int s = hero->type->heroClass->chooseSecSkill(basicAndAdv);
hlu.skills.push_back(s); hlu.skills.push_back(s);
basicAndAdv.erase(s); basicAndAdv.erase(s);
} }
//second offered skill
if(basicAndAdv.size()) if(basicAndAdv.size())
{ {
hlu.skills.push_back(hero->type->heroClass->chooseSecSkill(basicAndAdv)); //new skill hlu.skills.push_back(hero->type->heroClass->chooseSecSkill(basicAndAdv)); //new skill
@ -259,8 +264,21 @@ void CGameHandler::changePrimSkill(int ID, int which, int val, bool abs)
{ {
hlu.skills.push_back(hero->type->heroClass->chooseSecSkill(none)); //new skill hlu.skills.push_back(hero->type->heroClass->chooseSecSkill(none)); //new skill
} }
boost::function<void(ui32)> callback = boost::function<void(ui32)>(boost::bind(callWith<ui16>,hlu.skills,boost::function<void(ui16)>(boost::bind(&CGameHandler::changeSecSkill,this,ID,_1,1,0)),_1));
applyAndAsk(&hlu,hero->tempOwner,callback); //call changeSecSkill with appropriate args when client responds if(hlu.skills.size() > 1) //apply and ask for secondary skill
{
boost::function<void(ui32)> callback = boost::function<void(ui32)>(boost::bind(callWith<ui16>,hlu.skills,boost::function<void(ui16)>(boost::bind(&CGameHandler::changeSecSkill,this,ID,_1,1,0)),_1));
applyAndAsk(&hlu,hero->tempOwner,callback); //call changeSecSkill with appropriate args when client responds
}
else if(hlu.skills.size() == 1) //apply, give only possible skill and send info
{
changeSecSkill(ID,hlu.skills.back(),1,false);
sendAndApply(&hlu);
}
else //apply and send info
{
sendAndApply(&hlu);
}
} }
} }
} }

View File

@ -41,6 +41,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP2" AdditionalOptions="/MP2"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\include"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -60,7 +61,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="VCMI_lib.lib zdll.lib" AdditionalDependencies="VCMI_lib.lib zdll.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories="../../libs;../"
GenerateDebugInformation="true" GenerateDebugInformation="true"
TargetMachine="1" TargetMachine="1"
/> />
@ -116,6 +117,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
EnableFiberSafeOptimizations="true" EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories="..\..\include"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
EnableFunctionLevelLinking="false" EnableFunctionLevelLinking="false"
@ -135,7 +137,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="VCMI_lib.lib zdll.lib" AdditionalDependencies="VCMI_lib.lib zdll.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories="../../libs;../"
GenerateDebugInformation="false" GenerateDebugInformation="false"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
@ -194,6 +196,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="false" OmitFramePointers="false"
EnableFiberSafeOptimizations="true" EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories="..\..\include"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
EnableFunctionLevelLinking="false" EnableFunctionLevelLinking="false"
@ -215,7 +218,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="VCMI_lib.lib zdll.lib" AdditionalDependencies="VCMI_lib.lib zdll.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs" AdditionalLibraryDirectories="../../libs;../"
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true" GenerateMapFile="true"
OptimizeReferences="2" OptimizeReferences="2"