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

View File

@ -390,7 +390,10 @@ ui32 CStack::speed() const
//bind effect check
effect = getEffect(72);
if(effect)
premy = -creature->speed;
{
premy = creature->speed; //don't use '- creature->speed' - speed is unsigned!
premy = -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);
GEORXX = TTF_OpenFont("Fonts" PATHSEPARATOR "tnrb.ttf",22);
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);
THC tlog0<<"\tInitializing fonts: "<<pomtime.getDif()<<std::endl;
CMusicHandler * mush = new CMusicHandler; //initializing audio

View File

@ -1126,7 +1126,11 @@ void MapSel::init()
{
//get map files names
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;
for ( fs::directory_iterator dir (tie); dir!=end_iter; ++dir )
{
@ -1218,6 +1222,10 @@ void MapSel::init()
pliczkiTemp.clear();
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" );
for ( fs::directory_iterator dir (tie); dir!=end_iter; ++dir )
{

View File

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

View File

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

View File

@ -56,6 +56,9 @@ void CMusicHandler::initMusics()
//winScenario = Mix_LoadMUS(DATA_DIR "MP3" PATHSEPARATOR "Win Scenario.mp3");
click = Mix_LoadWAV(DATA_DIR "MP3" PATHSEPARATOR "snd1.wav");
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"));

View File

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

View File

@ -41,7 +41,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/MP2"
Optimization="0"
AdditionalIncludeDirectories="G:\vcmt\repa\include"
AdditionalIncludeDirectories="..\..\include"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -61,7 +61,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
AdditionalLibraryDirectories="../../libs;"
GenerateDebugInformation="true"
TargetMachine="1"
/>
@ -118,7 +118,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="G:\vcmt\repa\include"
AdditionalIncludeDirectories="..\..\include"
StringPooling="true"
MinimalRebuild="false"
BasicRuntimeChecks="0"
@ -140,7 +140,7 @@
Name="VCLinkerTool"
AdditionalDependencies="zdll.lib"
Version=""
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
AdditionalLibraryDirectories=""
GenerateDebugInformation="false"
OptimizeReferences="2"
EnableCOMDATFolding="2"
@ -201,7 +201,7 @@
OmitFramePointers="false"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="G:\vcmt\repa\include"
AdditionalIncludeDirectories="..\..\include"
StringPooling="true"
MinimalRebuild="false"
BasicRuntimeChecks="0"
@ -225,7 +225,7 @@
Name="VCLinkerTool"
AdditionalDependencies="zdll.lib"
Version=""
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
GenerateMapFile="true"
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);
none.erase(hero->secSkills[i].first);
}
//first offered skill
if(hero->secSkills.size() < hero->type->heroClass->skillLimit) //free skill slot
{
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);
hlu.skills.push_back(s);
basicAndAdv.erase(s);
}
//second offered skill
if(basicAndAdv.size())
{
hlu.skills.push_back(hero->type->heroClass->chooseSecSkill(basicAndAdv)); //new skill
@ -259,9 +264,22 @@ void CGameHandler::changePrimSkill(int ID, int which, int val, bool abs)
{
hlu.skills.push_back(hero->type->heroClass->chooseSecSkill(none)); //new skill
}
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"
AdditionalOptions="/MP2"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -60,7 +61,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="VCMI_lib.lib zdll.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
AdditionalLibraryDirectories="../../libs;../"
GenerateDebugInformation="true"
TargetMachine="1"
/>
@ -116,6 +117,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories="..\..\include"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="false"
@ -135,7 +137,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="VCMI_lib.lib zdll.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
AdditionalLibraryDirectories="../../libs;../"
GenerateDebugInformation="false"
OptimizeReferences="2"
EnableCOMDATFolding="2"
@ -194,6 +196,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="false"
EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories="..\..\include"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="false"
@ -215,7 +218,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="VCMI_lib.lib zdll.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
AdditionalLibraryDirectories="../../libs;../"
GenerateDebugInformation="true"
GenerateMapFile="true"
OptimizeReferences="2"