1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-30 04:30:42 +02:00

* moved CThreadHelper and CConsoleHandler to lib

* corrections in linux build files
* initial version of vcmi installation script and package for programming challenge
This commit is contained in:
mateuszb 2011-10-01 17:00:12 +00:00
parent 441ddcbcfe
commit 499a401095
24 changed files with 163 additions and 600 deletions

View File

@ -1,255 +0,0 @@
#define VCMI_DLL
#include "stdafx.h"
#include "CConsoleHandler.h"
#include <boost/function.hpp>
#include <boost/thread.hpp>
#include <iomanip>
#include "CThreadHelper.h"
/*
* CConsoleHandler.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#ifndef _WIN32
typedef std::string TColor;
#define CONSOLE_GREEN "\x1b[1;32m"
#define CONSOLE_RED "\x1b[1;32m"
#define CONSOLE_MAGENTA "\x1b[1;35m"
#define CONSOLE_YELLOW "\x1b[1;32m"
#define CONSOLE_WHITE "\x1b[1;39m"
#define CONSOLE_GRAY "\x1b[1;30m"
#define CONSOLE_TEAL "\x1b[1;36m"
#else
#define WIN32_LEAN_AND_MEAN //excludes rarely used stuff from windows headers - delete this line if something is missing
#include <windows.h>
#include <dbghelp.h>
#pragma comment(lib, "dbghelp.lib")
typedef WORD TColor;
HANDLE handleIn;
HANDLE handleOut;
#define CONSOLE_GREEN FOREGROUND_GREEN | FOREGROUND_INTENSITY
#define CONSOLE_RED FOREGROUND_RED | FOREGROUND_INTENSITY
#define CONSOLE_MAGENTA FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY
#define CONSOLE_YELLOW FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY
#define CONSOLE_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
#define CONSOLE_GRAY FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
#define CONSOLE_TEAL FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
#endif
TColor defColor;
#ifdef _WIN32
void printWinError()
{
//Get error code
int error = GetLastError();
if(!error)
{
tlog0 << "No Win error information set.\n";
return;
}
tlog1 << "Error " << error << " encountered:\n";
//Get error description
char* pTemp = NULL;
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, error, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), (LPSTR)&pTemp, 1, NULL);
tlog1 << pTemp << std::endl;
LocalFree( pTemp );
}
const char* exceptionName(DWORD exc)
{
#define EXC_CASE(EXC) case EXCEPTION_##EXC : return "EXCEPTION_" #EXC
switch (exc)
{
EXC_CASE(ACCESS_VIOLATION);
EXC_CASE(DATATYPE_MISALIGNMENT);
EXC_CASE(BREAKPOINT);
EXC_CASE(SINGLE_STEP);
EXC_CASE(ARRAY_BOUNDS_EXCEEDED);
EXC_CASE(FLT_DENORMAL_OPERAND);
EXC_CASE(FLT_DIVIDE_BY_ZERO);
EXC_CASE(FLT_INEXACT_RESULT);
EXC_CASE(FLT_INVALID_OPERATION);
EXC_CASE(FLT_OVERFLOW);
EXC_CASE(FLT_STACK_CHECK);
EXC_CASE(FLT_UNDERFLOW);
EXC_CASE(INT_DIVIDE_BY_ZERO);
EXC_CASE(INT_OVERFLOW);
EXC_CASE(PRIV_INSTRUCTION);
EXC_CASE(IN_PAGE_ERROR);
EXC_CASE(ILLEGAL_INSTRUCTION);
EXC_CASE(NONCONTINUABLE_EXCEPTION);
EXC_CASE(STACK_OVERFLOW);
EXC_CASE(INVALID_DISPOSITION);
EXC_CASE(GUARD_PAGE);
EXC_CASE(INVALID_HANDLE);
default:
return "UNKNOWN EXCEPTION";
}
#undef EXC_CASE
}
LONG WINAPI onUnhandledException(EXCEPTION_POINTERS* exception)
{
tlog1 << "Disaster happened.\n";
PEXCEPTION_RECORD einfo = exception->ExceptionRecord;
tlog1 << "Reason: 0x" << std::hex << einfo->ExceptionCode << " - " << exceptionName(einfo->ExceptionCode);
tlog1 << " at " << std::setfill('0') << std::setw(4) << exception->ContextRecord->SegCs << ":" << (void*)einfo->ExceptionAddress << std::endl;;
if (einfo->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
{
tlog1 << "Attempt to " << (einfo->ExceptionInformation[0] == 1 ? "write to " : "read from ")
<< "0x" << std::setw(8) << (void*)einfo->ExceptionInformation[1] << std::endl;;
}
const DWORD threadId = ::GetCurrentThreadId();
tlog1 << "Thread ID: " << threadId << " [" << std::dec << std::setw(0) << threadId << "]\n";
//exception info to be placed in the dump
MINIDUMP_EXCEPTION_INFORMATION meinfo = {threadId, exception, TRUE};
//create file where dump will be placed
char *mname = NULL;
char buffer[MAX_PATH + 1];
HMODULE hModule = NULL;
GetModuleFileNameA(hModule, buffer, MAX_PATH);
mname = strrchr(buffer, '\\');
if (mname != 0)
mname++;
else
mname = buffer;
strcat(mname, "_crashinfo.dmp");
HANDLE dfile = CreateFileA(mname, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
tlog1 << "Crash info will be put in " << mname << std::endl;
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), dfile, MiniDumpWithDataSegs, &meinfo, 0, 0);
MessageBoxA(0, "VCMI has crashed. We are sorry. File with information about encountered problem has been created.", "VCMI Crashhandler", MB_OK | MB_ICONERROR);
return EXCEPTION_EXECUTE_HANDLER;
}
#endif
void CConsoleHandler::setColor(int level)
{
TColor color;
switch(level)
{
case -1:
color = defColor;
break;
case 0:
color = CONSOLE_GREEN;
break;
case 1:
color = CONSOLE_RED;
break;
case 2:
color = CONSOLE_MAGENTA;
break;
case 3:
color = CONSOLE_YELLOW;
break;
case 4:
color = CONSOLE_WHITE;
break;
case 5:
color = CONSOLE_GRAY;
break;
case -2:
color = CONSOLE_TEAL;
break;
default:
color = defColor;
break;
}
#ifdef _WIN32
SetConsoleTextAttribute(handleOut,color);
#else
std::cout << color;
#endif
}
int CConsoleHandler::run()
{
setThreadName(-1, "CConsoleHandler::run");
//disabling sync to make in_avail() work (othervice always returns 0)
std::ios::sync_with_stdio(false);
std::string buffer;
while ( std::cin.good() )
{
#ifndef _WIN32
//check if we have some unreaded symbols
if (std::cin.rdbuf()->in_avail())
{
if ( getline(std::cin, buffer).good() )
if ( cb && *cb )
(*cb)(buffer);
}
else
boost::this_thread::sleep(boost::posix_time::millisec(100));
boost::this_thread::interruption_point();
#else
std::getline(std::cin, buffer);
if ( cb && *cb )
(*cb)(buffer);
#endif
}
return -1;
}
CConsoleHandler::CConsoleHandler()
{
#ifdef _WIN32
handleIn = GetStdHandle(STD_INPUT_HANDLE);
handleOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(handleOut,&csbi);
defColor = csbi.wAttributes;
#ifndef _DEBUG
SetUnhandledExceptionFilter(onUnhandledException);
#endif
#else
defColor = "\x1b[0m";
#endif
cb = new boost::function<void(const std::string &)>;
thread = NULL;
}
CConsoleHandler::~CConsoleHandler()
{
tlog3 << "Killing console... ";
end();
delete cb;
tlog3 << "done!\n";
}
void CConsoleHandler::end()
{
if (thread)
{
#ifndef _WIN32
thread->interrupt();
#else
TerminateThread(thread->native_handle(),0);
#endif
thread->join();
delete thread;
thread = NULL;
}
}
void CConsoleHandler::start()
{
thread = new boost::thread(boost::bind(&CConsoleHandler::run,console));
}

View File

@ -1,47 +0,0 @@
#ifndef __CCONSOLEHANDLER_H__
#define __CCONSOLEHANDLER_H__
/*
* CConsoleHandler.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
namespace boost
{
template<typename signature>
class function;
class thread;
}
/// Class which wraps the native console. It can print text based on
/// the chosen color
class DLL_EXPORT CConsoleHandler
{
public:
boost::function<void(const std::string &)> *cb; //function to be called when message is received
int curLvl; //logging level
boost::thread *thread;
int run();
void setColor(int level); //sets color of text appropriate for given logging level
CConsoleHandler(); //c-tor
~CConsoleHandler(); //d-tor
void start(); //starts listening thread
void end(); //kills listening thread
template<typename T> void print(const T &data, int level)
{
setColor(level);
std::cout << data << std::flush;
setColor(-1);
}
};
#endif // __CCONSOLEHANDLER_H__

View File

@ -1,82 +0,0 @@
#define VCMI_DLL
#include "CThreadHelper.h"
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#ifdef _WIN32
#include <windows.h>
#endif
/*
* CThreadHelper.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
CThreadHelper::CThreadHelper(std::vector<boost::function<void()> > *Tasks, int Threads)
{
currentTask = 0; amount = Tasks->size();
tasks = Tasks;
threads = Threads;
}
void CThreadHelper::run()
{
boost::thread_group grupa;
for(int i=0;i<threads;i++)
grupa.create_thread(boost::bind(&CThreadHelper::processTasks,this));
grupa.join_all();
}
void CThreadHelper::processTasks()
{
int pom;
while(true)
{
rtinm.lock();
if((pom=currentTask) >= amount)
{
rtinm.unlock();
break;
}
else
{
++currentTask;
rtinm.unlock();
(*tasks)[pom]();
}
}
}
void setThreadName(long threadID, const std::string &name)
{
#ifdef _WIN32
//follows http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
const DWORD MS_VC_EXCEPTION=0x406D1388;
#pragma pack(push,8)
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; // Must be 0x1000.
LPCSTR szName; // Pointer to name (in user addr space).
DWORD dwThreadID; // Thread ID (-1=caller thread).
DWORD dwFlags; // Reserved for future use, must be zero.
} THREADNAME_INFO;
#pragma pack(pop)
THREADNAME_INFO info;
info.dwType = 0x1000;
info.szName = name.c_str();
info.dwThreadID = threadID;
info.dwFlags = 0;
__try
{
RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR*)&info );
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
}
#else
//*nix counterpart?
#endif
}

View File

@ -1,57 +0,0 @@
#ifndef __CTHREADHELPER_H__
#define __CTHREADHELPER_H__
#include "global.h"
#include <boost/function.hpp>
#include <boost/thread.hpp>
/*
* CThreadHelper.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
typedef boost::function<void()> Task;
/// Can assign CPU work to other threads/cores
class DLL_EXPORT CThreadHelper
{
boost::mutex rtinm;
int currentTask, amount, threads;
std::vector<Task> *tasks;
void processTasks();
public:
CThreadHelper(std::vector<boost::function<void()> > *Tasks, int Threads);
void run();
};
template <typename T> inline void setData(T * data, boost::function<T()> func)
{
*data = func();
}
void DLL_EXPORT setThreadName(long threadID, const std::string &name);
#define GET_DATA(TYPE,DESTINATION,FUNCTION_TO_GET) \
(boost::bind(&setData<TYPE>,&DESTINATION,FUNCTION_TO_GET))
#define GET_SURFACE(SUR_DESTINATION, SUR_NAME) \
(GET_DATA \
(SDL_Surface*,SUR_DESTINATION,\
boost::function<SDL_Surface*()>(boost::bind(&BitmapHandler::loadBitmap,SUR_NAME,true))))
#define GET_DEF(DESTINATION, DEF_NAME) \
(GET_DATA \
(CDefHandler*,DESTINATION,\
boost::function<CDefHandler*()>(boost::bind(CDefHandler::giveDef,DEF_NAME))))
#define GET_DEF_ESS(DESTINATION, DEF_NAME) \
(GET_DATA \
(CDefEssential*,DESTINATION,\
boost::function<CDefEssential*()>(boost::bind(CDefHandler::giveDefEss,DEF_NAME))))
#endif // __CTHREADHELPER_H__

View File

@ -4,8 +4,4 @@ odpalarka_LDADD = $(top_builddir)/lib/libvcmi.la
odpalarka_CXXFLAGS = @SDL_CXXFLAGS@
odpalarka_LDFLAGS = -L$(top_builddir)/lib
odpalarka_SOURCES = \
main.cpp \
../CConsoleHandler.cpp \
../CConsoleHandler.h \
../CThreadHelper.cpp \
../CThreadHelper.h
main.cpp

View File

@ -1,6 +1,6 @@
#include "Client.h"
#include "../lib/Connection.h"
#include "../CThreadHelper.h"
#include "../lib/CThreadHelper.h"
#include "../lib/CGameState.h"
#include "../lib/BattleAction.h"
#include "../lib/CGameInterface.h"

View File

@ -6,8 +6,4 @@ vcmirunner_LDFLAGS = -L$(top_builddir)/lib
vcmirunner_SOURCES = \
main.cpp\
Client.cpp\
NetPacksRunner.cpp\
../CConsoleHandler.cpp \
../CConsoleHandler.h \
../CThreadHelper.cpp \
../CThreadHelper.h
NetPacksRunner.cpp

View File

@ -17,7 +17,7 @@
#include "../global.h"
#include "CPreGame.h"
#include "CCastleInterface.h"
#include "../CConsoleHandler.h"
#include "../lib/CConsoleHandler.h"
#include "CCursorHandler.h"
#include "../lib/CGameState.h"
#include "../CCallback.h"
@ -176,9 +176,9 @@ static void prog_version(void)
static void prog_help(const char *progname)
{
printf("%s - A Heroes of Might and Magic 3 clone\n", NAME_VER);
printf("Copyright (C) 2007-2010 VCMI dev team - see AUTHORS file\n");
printf("This is free software; see the source for copying conditions. There is NO\n");
printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
printf("Copyright (C) 2007-2010 VCMI dev team - see AUTHORS file\n");
printf("This is free software; see the source for copying conditions. There is NO\n");
printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
printf("\n");
printf("Usage:\n");
printf(" -h, --help display this help and exit\n");

View File

@ -48,7 +48,7 @@
#include "../lib/NetPacks.h"
#include "../lib/RegisterTypes.cpp"
#include <boost/thread/recursive_mutex.hpp>
#include "../CThreadHelper.h"
#include "../lib/CThreadHelper.h"
#include "CConfigHandler.h"
#include "../lib/CFileUtility.h"

View File

@ -1,7 +1,7 @@
#include "CMusicHandler.h"
#include "../lib/CCampaignHandler.h"
#include "../CCallback.h"
#include "../CConsoleHandler.h"
#include "../lib/CConsoleHandler.h"
#include "CGameInfo.h"
#include "../lib/CGameState.h"
#include "CPlayerInterface.h"
@ -33,7 +33,7 @@
#include <sstream>
#include "CPreGame.h"
#include "CBattleInterface.h"
#include "../CThreadHelper.h"
#include "../lib/CThreadHelper.h"
#include "../lib/CScriptingModule.h"
#include "../lib/CFileUtility.h"

View File

@ -8,7 +8,7 @@
#include "CCursorHandler.h"
#include "CBitmapHandler.h"
#include "Graphics.h"
#include "../CThreadHelper.h"
#include "../lib/CThreadHelper.h"
#include "CConfigHandler.h"
#include <boost/lexical_cast.hpp>

View File

@ -10,7 +10,7 @@
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include "../CThreadHelper.h"
#include "../lib/CThreadHelper.h"
#include "CGameInfo.h"
#include "../lib/CLodHandler.h"
#include "../lib/VCMI_Lib.h"
@ -774,6 +774,6 @@ int Font::getCharWidth( char c ) const
void Font::WriteAt(const char *text, SDL_Surface *sur, int x, int y )
{
SDL_Surface *SDL_CreateRGBSurfaceFrom(pixels, w, h, 8, int pitch,
224, 28, 3, 0);
224, 28, 3, 0);
}
*/

View File

@ -6,10 +6,6 @@ vcmiclient_LDFLAGS = -L$(top_builddir)/lib
vcmiclient_SOURCES = \
../CCallback.cpp \
../CCallback.h \
../CConsoleHandler.cpp \
../CConsoleHandler.h \
../CThreadHelper.cpp \
../CThreadHelper.h \
AdventureMapButton.cpp \
AdventureMapButton.h \
CAdvmapInterface.cpp \

View File

@ -613,7 +613,7 @@ void delNull(T* &ptr) //deleted pointer and sets it to NULL
ptr = NULL;
}
#include "CConsoleHandler.h"
#include "lib/CConsoleHandler.h"
extern DLL_EXPORT std::ostream *logfile;
extern DLL_EXPORT CConsoleHandler *console;
@ -733,14 +733,14 @@ struct unaligned_Uint32 { ui32 val __attribute__(( packed )); };
static inline ui16 read_unaligned_u16(const void *p)
{
const struct unaligned_Uint16 *v = (const struct unaligned_Uint16 *)p;
return v->val;
const struct unaligned_Uint16 *v = (const struct unaligned_Uint16 *)p;
return v->val;
}
static inline ui32 read_unaligned_u32(const void *p)
{
const struct unaligned_Uint32 *v = (const struct unaligned_Uint32 *)p;
return v->val;
const struct unaligned_Uint32 *v = (const struct unaligned_Uint32 *)p;
return v->val;
}
#else

View File

@ -1018,32 +1018,32 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
day = 0;
loadTownDInfos();
//pick grail location
if(map->grailPos.x < 0 || map->grailRadious) //grail not set or set within a radius around some place
{
//pick grail location
if(map->grailPos.x < 0 || map->grailRadious) //grail not set or set within a radius around some place
{
if(!map->grailRadious) //radius not given -> anywhere on map
map->grailRadious = map->width * 2;
std::vector<int3> allowedPos;
std::vector<int3> allowedPos;
// add all not blocked tiles in range
for (int i = 0; i < map->width ; i++)
{
for (int j = 0; j < map->height ; j++)
{
for (int k = 0; k <= map->twoLevel ; k++)
{
const TerrainTile &t = map->terrain[i][j][k];
if(!t.blocked
for (int i = 0; i < map->width ; i++)
{
for (int j = 0; j < map->height ; j++)
{
for (int k = 0; k <= map->twoLevel ; k++)
{
const TerrainTile &t = map->terrain[i][j][k];
if(!t.blocked
&& !t.visitable
&& t.tertype != TerrainTile::water
&& t.tertype != TerrainTile::rock
&& map->grailPos.dist2d(int3(i,j,k)) <= map->grailRadious)
allowedPos.push_back(int3(i,j,k));
}
}
}
allowedPos.push_back(int3(i,j,k));
}
}
}
//remove tiles with holes
for(unsigned int no=0; no<map->objects.size(); ++no)
@ -1054,7 +1054,7 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
map->grailPos = allowedPos[ran() % allowedPos.size()];
else
tlog2 << "Warning: Grail cannot be placed, no appropriate tile found!\n";
}
}
//picking random factions for players
for(std::map<int, PlayerSettings>::iterator it = scenarioOps->playerInfos.begin();
@ -1417,16 +1417,16 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
}
case PlayerSettings::bartifact:
{
if(!k->second.heroes.size())
if(!k->second.heroes.size())
{
tlog5 << "Cannot give starting artifact - no heroes!" << std::endl;
break;
}
CArtifact *toGive;
toGive = VLC->arth->artifacts[VLC->arth->getRandomArt (CArtifact::ART_TREASURE)];
CArtifact *toGive;
toGive = VLC->arth->artifacts[VLC->arth->getRandomArt (CArtifact::ART_TREASURE)];
CGHeroInstance *hero = k->second.heroes[0];
hero->giveArtifact(toGive->id);
hero->giveArtifact(toGive->id);
}
}
}
@ -1746,27 +1746,27 @@ int CGameState::getPlayerRelations( ui8 color1, ui8 color2 )
void CGameState::loadTownDInfos()
{
int i;
int i;
const JsonNode config(DATA_DIR "/config/towns_defs.json");
assert(config["town_defnames"].Vector().size() == F_NUMBER);
assert(config["town_defnames"].Vector().size() == F_NUMBER);
i = 0;
i = 0;
BOOST_FOREACH(const JsonNode &t, config["town_defnames"].Vector())
{
villages[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]);
villages[i]->name = t["village"].String();
villages[i]->name = t["village"].String();
map->defy.push_back(villages[i]);
forts[i] = VLC->dobjinfo->castles[i];
map->defy.push_back(forts[i]);
capitols[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]);
capitols[i]->name = t["capitol"].String();
capitols[i]->name = t["capitol"].String();
map->defy.push_back(capitols[i]);
++i;
}
}
}
void CGameState::getNeighbours(const TerrainTile &srct, int3 tile, std::vector<int3> &vec, const boost::logic::tribool &onLand, bool limitCoastSailing)
@ -2036,7 +2036,7 @@ int CGameState::victoryCheck( ui8 player ) const
if(p->human || map->victoryCondition.appliesToAI)
{
switch(map->victoryCondition.condition)
switch(map->victoryCondition.condition)
{
case artifact:
//check if any hero has winning artifact
@ -2143,7 +2143,7 @@ int CGameState::victoryCheck( ui8 player ) const
}
}
break;
}
}
}
return 0;

View File

@ -14,6 +14,8 @@ libvcmi_la_SOURCES = \
CBuildingHandler.h \
CCampaignHandler.cpp \
CCampaignHandler.h \
CConsoleHandler.cpp \
CConsoleHandler.h \
CCreatureHandler.cpp \
CCreatureHandler.h \
CCreatureSet.cpp \
@ -40,6 +42,8 @@ libvcmi_la_SOURCES = \
CSpellHandler.cpp \
CSpellHandler.h \
CScriptingModule.h \
CThreadHelper.cpp \
CThreadHelper.h \
CTownHandler.cpp \
CTownHandler.h \
CondSh.h \

View File

@ -82,13 +82,14 @@ libvcmi_la_DEPENDENCIES =
am_libvcmi_la_OBJECTS = libvcmi_la-BattleAction.lo \
libvcmi_la-BattleState.lo libvcmi_la-CArtHandler.lo \
libvcmi_la-CBattleCallback.lo libvcmi_la-CBuildingHandler.lo \
libvcmi_la-CCampaignHandler.lo libvcmi_la-CCreatureHandler.lo \
libvcmi_la-CCreatureSet.lo libvcmi_la-CDefObjInfoHandler.lo \
libvcmi_la-CFileUtility.lo libvcmi_la-CGameInterface.lo \
libvcmi_la-CGameState.lo libvcmi_la-CGeneralTextHandler.lo \
libvcmi_la-CHeroHandler.lo libvcmi_la-CLodHandler.lo \
libvcmi_la-CMapInfo.lo libvcmi_la-CObjectHandler.lo \
libvcmi_la-CSpellHandler.lo libvcmi_la-CTownHandler.lo \
libvcmi_la-CCampaignHandler.lo libvcmi_la-CConsoleHandler.lo \
libvcmi_la-CCreatureHandler.lo libvcmi_la-CCreatureSet.lo \
libvcmi_la-CDefObjInfoHandler.lo libvcmi_la-CFileUtility.lo \
libvcmi_la-CGameInterface.lo libvcmi_la-CGameState.lo \
libvcmi_la-CGeneralTextHandler.lo libvcmi_la-CHeroHandler.lo \
libvcmi_la-CLodHandler.lo libvcmi_la-CMapInfo.lo \
libvcmi_la-CObjectHandler.lo libvcmi_la-CSpellHandler.lo \
libvcmi_la-CThreadHelper.lo libvcmi_la-CTownHandler.lo \
libvcmi_la-Connection.lo libvcmi_la-HeroBonus.lo \
libvcmi_la-IGameCallback.lo libvcmi_la-JsonNode.lo \
libvcmi_la-NetPacksLib.lo libvcmi_la-ResourceSet.lo \
@ -294,6 +295,8 @@ libvcmi_la_SOURCES = \
CBuildingHandler.h \
CCampaignHandler.cpp \
CCampaignHandler.h \
CConsoleHandler.cpp \
CConsoleHandler.h \
CCreatureHandler.cpp \
CCreatureHandler.h \
CCreatureSet.cpp \
@ -320,6 +323,8 @@ libvcmi_la_SOURCES = \
CSpellHandler.cpp \
CSpellHandler.h \
CScriptingModule.h \
CThreadHelper.cpp \
CThreadHelper.h \
CTownHandler.cpp \
CTownHandler.h \
CondSh.h \
@ -426,6 +431,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CBattleCallback.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CBuildingHandler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CCampaignHandler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CConsoleHandler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CCreatureHandler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CCreatureSet.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CDefObjInfoHandler.Plo@am__quote@
@ -438,6 +444,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CMapInfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CObjectHandler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CSpellHandler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CThreadHelper.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-CTownHandler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-Connection.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvcmi_la-HeroBonus.Plo@am__quote@
@ -521,6 +528,14 @@ libvcmi_la-CCampaignHandler.lo: CCampaignHandler.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvcmi_la_CXXFLAGS) $(CXXFLAGS) -c -o libvcmi_la-CCampaignHandler.lo `test -f 'CCampaignHandler.cpp' || echo '$(srcdir)/'`CCampaignHandler.cpp
libvcmi_la-CConsoleHandler.lo: CConsoleHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvcmi_la_CXXFLAGS) $(CXXFLAGS) -MT libvcmi_la-CConsoleHandler.lo -MD -MP -MF $(DEPDIR)/libvcmi_la-CConsoleHandler.Tpo -c -o libvcmi_la-CConsoleHandler.lo `test -f 'CConsoleHandler.cpp' || echo '$(srcdir)/'`CConsoleHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvcmi_la-CConsoleHandler.Tpo $(DEPDIR)/libvcmi_la-CConsoleHandler.Plo
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CConsoleHandler.cpp' object='libvcmi_la-CConsoleHandler.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvcmi_la_CXXFLAGS) $(CXXFLAGS) -c -o libvcmi_la-CConsoleHandler.lo `test -f 'CConsoleHandler.cpp' || echo '$(srcdir)/'`CConsoleHandler.cpp
libvcmi_la-CCreatureHandler.lo: CCreatureHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvcmi_la_CXXFLAGS) $(CXXFLAGS) -MT libvcmi_la-CCreatureHandler.lo -MD -MP -MF $(DEPDIR)/libvcmi_la-CCreatureHandler.Tpo -c -o libvcmi_la-CCreatureHandler.lo `test -f 'CCreatureHandler.cpp' || echo '$(srcdir)/'`CCreatureHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvcmi_la-CCreatureHandler.Tpo $(DEPDIR)/libvcmi_la-CCreatureHandler.Plo
@ -617,6 +632,14 @@ libvcmi_la-CSpellHandler.lo: CSpellHandler.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvcmi_la_CXXFLAGS) $(CXXFLAGS) -c -o libvcmi_la-CSpellHandler.lo `test -f 'CSpellHandler.cpp' || echo '$(srcdir)/'`CSpellHandler.cpp
libvcmi_la-CThreadHelper.lo: CThreadHelper.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvcmi_la_CXXFLAGS) $(CXXFLAGS) -MT libvcmi_la-CThreadHelper.lo -MD -MP -MF $(DEPDIR)/libvcmi_la-CThreadHelper.Tpo -c -o libvcmi_la-CThreadHelper.lo `test -f 'CThreadHelper.cpp' || echo '$(srcdir)/'`CThreadHelper.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvcmi_la-CThreadHelper.Tpo $(DEPDIR)/libvcmi_la-CThreadHelper.Plo
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CThreadHelper.cpp' object='libvcmi_la-CThreadHelper.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvcmi_la_CXXFLAGS) $(CXXFLAGS) -c -o libvcmi_la-CThreadHelper.lo `test -f 'CThreadHelper.cpp' || echo '$(srcdir)/'`CThreadHelper.cpp
libvcmi_la-CTownHandler.lo: CTownHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvcmi_la_CXXFLAGS) $(CXXFLAGS) -MT libvcmi_la-CTownHandler.lo -MD -MP -MF $(DEPDIR)/libvcmi_la-CTownHandler.Tpo -c -o libvcmi_la-CTownHandler.lo `test -f 'CTownHandler.cpp' || echo '$(srcdir)/'`CTownHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvcmi_la-CTownHandler.Tpo $(DEPDIR)/libvcmi_la-CTownHandler.Plo

View File

@ -209,14 +209,13 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\CConsoleHandler.cpp" />
<ClCompile Include="..\CThreadHelper.cpp" />
<ClCompile Include="BattleAction.cpp" />
<ClCompile Include="BattleState.cpp" />
<ClCompile Include="CArtHandler.cpp" />
<ClCompile Include="CBattleCallback.cpp" />
<ClCompile Include="CBuildingHandler.cpp" />
<ClCompile Include="CCampaignHandler.cpp" />
<ClCompile Include="CConsoleHandler.cpp" />
<ClCompile Include="CCreatureHandler.cpp" />
<ClCompile Include="CCreatureSet.cpp" />
<ClCompile Include="CDefObjInfoHandler.cpp" />
@ -230,6 +229,7 @@
<ClCompile Include="CObjectHandler.cpp" />
<ClCompile Include="Connection.cpp" />
<ClCompile Include="CSpellHandler.cpp" />
<ClCompile Include="CThreadHelper.cpp" />
<ClCompile Include="CTownHandler.cpp" />
<ClCompile Include="HeroBonus.cpp" />
<ClCompile Include="IGameCallback.cpp" />
@ -242,15 +242,14 @@
<ClCompile Include="VCMI_Lib.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CThreadHelper.h" />
<ClInclude Include="..\StartInfo.h" />
<ClInclude Include="BattleAction.h" />
<ClInclude Include="..\CConsoleHandler.h" />
<ClInclude Include="BattleState.h" />
<ClInclude Include="CArtHandler.h" />
<ClInclude Include="CBattleCallback.h" />
<ClInclude Include="CBuildingHandler.h" />
<ClInclude Include="CCampaignHandler.h" />
<ClInclude Include="CConsoleHandler.h" />
<ClInclude Include="CCreatureHandler.h" />
<ClInclude Include="CCreatureSet.h" />
<ClInclude Include="CDefObjInfoHandler.h" />
@ -268,6 +267,7 @@
<ClInclude Include="ConstTransitivePtr.h" />
<ClInclude Include="CScriptingModule.h" />
<ClInclude Include="CSpellHandler.h" />
<ClInclude Include="CThreadHelper.h" />
<ClInclude Include="CTownHandler.h" />
<ClInclude Include="HeroBonus.h" />
<ClInclude Include="IGameCallback.h" />

View File

@ -1818,7 +1818,7 @@ void CGameHandler::useScholarSkill(si32 fromHero, si32 toHero)
return;//no scholar skill or no spellbook
int h1Lvl = std::min(ScholarLevel+1, h1->getSecSkillLevel(CGHeroInstance::WISDOM)+2),
h2Lvl = std::min(ScholarLevel+1, h2->getSecSkillLevel(CGHeroInstance::WISDOM)+2);//heroes can receive this levels
h2Lvl = std::min(ScholarLevel+1, h2->getSecSkillLevel(CGHeroInstance::WISDOM)+2);//heroes can receive this levels
ChangeSpells cs1;
cs1.learn = true;
@ -2602,9 +2602,9 @@ bool CGameHandler::buyArtifact( ui32 hid, si32 aid )
if(aid==0) //spellbook
{
if((!vstd::contains(town->builtBuildings,si32(Buildings::MAGES_GUILD_1)) && complain("Cannot buy a spellbook, no mage guild in the town!"))
|| (getResource(hero->getOwner(), Res::GOLD) < SPELLBOOK_GOLD_COST && complain("Cannot buy a spellbook, not enough gold!") )
|| (hero->getArt(Arts::SPELLBOOK) && complain("Cannot buy a spellbook, hero already has a one!"))
)
|| (getResource(hero->getOwner(), Res::GOLD) < SPELLBOOK_GOLD_COST && complain("Cannot buy a spellbook, not enough gold!") )
|| (hero->getArt(Arts::SPELLBOOK) && complain("Cannot buy a spellbook, hero already has a one!"))
)
return false;
giveResource(hero->getOwner(),Res::GOLD,-SPELLBOOK_GOLD_COST);
@ -2774,22 +2774,22 @@ bool CGameHandler::sellCreatures(ui32 count, const IMarket *market, const CGHero
}
int b1, b2; //base quantities for trade
market->getOffer(s.type->idNumber, resourceID, b1, b2, CREATURE_RESOURCE);
int units = count / b1; //how many base quantities we trade
market->getOffer(s.type->idNumber, resourceID, b1, b2, CREATURE_RESOURCE);
int units = count / b1; //how many base quantities we trade
if(count%b1) //all offered units of resource should be used, if not -> somewhere in calculations must be an error
{
//TODO: complain?
assert(0);
}
if(count%b1) //all offered units of resource should be used, if not -> somewhere in calculations must be an error
{
//TODO: complain?
assert(0);
}
changeStackCount(StackLocation(hero, slot), -count);
SetResource sr;
sr.player = hero->tempOwner;
sr.resid = resourceID;
sr.val = getResource(hero->tempOwner, resourceID) + b2 * units;
sendAndApply(&sr);
SetResource sr;
sr.player = hero->tempOwner;
sr.resid = resourceID;
sr.val = getResource(hero->tempOwner, resourceID) + b2 * units;
sendAndApply(&sr);
return true;
}
@ -3576,46 +3576,46 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, THex destinati
{
ui8 tier = (*it)->base->type->level;
if (bonus)
{
switch(bonus->additionalInfo)
{
case 0: //normal
{
switch(bonus->additionalInfo)
{
case 0: //normal
{
switch(tier)
{
case 1: case 2:
power = 3;
break;
case 3: case 4:
power = 2;
break;
case 5: case 6:
power = 1;
break;
}
switch(tier)
{
case 1: case 2:
power = 3;
break;
case 3: case 4:
power = 2;
break;
case 5: case 6:
power = 1;
break;
}
Bonus specialBonus(sse.effect.back());
specialBonus.val = power; //it doesn't necessarily make sense for some spells, use it wisely
sse.uniqueBonuses.push_back (std::pair<ui32,Bonus> ((*it)->ID, specialBonus)); //additional premy to given effect
}
break;
case 1: //only Coronius as yet
break;
case 1: //only Coronius as yet
{
power = std::max(5 - tier, 0);
power = std::max(5 - tier, 0);
Bonus specialBonus = CStack::featureGenerator(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK, power, pseudoBonus.turnsRemain);
specialBonus.sid = spellID;
sse.uniqueBonuses.push_back (std::pair<ui32,Bonus> ((*it)->ID, specialBonus)); //additional attack to Slayer effect
sse.uniqueBonuses.push_back (std::pair<ui32,Bonus> ((*it)->ID, specialBonus)); //additional attack to Slayer effect
}
break;
}
}
break;
}
}
if (caster && caster->hasBonusOfType(Bonus::SPECIAL_BLESS_DAMAGE, spellID)) //TODO: better handling of bonus percentages
{
int damagePercent = caster->level * caster->valOfBonuses(Bonus::SPECIAL_BLESS_DAMAGE, spellID) / tier;
{
int damagePercent = caster->level * caster->valOfBonuses(Bonus::SPECIAL_BLESS_DAMAGE, spellID) / tier;
Bonus specialBonus = CStack::featureGenerator(Bonus::CREATURE_DAMAGE, 0, damagePercent, pseudoBonus.turnsRemain);
specialBonus.valType = Bonus::PERCENT_TO_ALL;
specialBonus.sid = spellID;
sse.uniqueBonuses.push_back (std::pair<ui32,Bonus> ((*it)->ID, specialBonus));
}
sse.uniqueBonuses.push_back (std::pair<ui32,Bonus> ((*it)->ID, specialBonus));
}
}
}

View File

@ -4,10 +4,6 @@ vcmiserver_LDADD = $(top_builddir)/lib/libvcmi.la
vcmiserver_CXXFLAGS = @SDL_CXXFLAGS@
vcmiserver_LDFLAGS = -L$(top_builddir)/lib
vcmiserver_SOURCES = \
../CConsoleHandler.cpp \
../CConsoleHandler.h \
../CThreadHelper.cpp \
../CThreadHelper.h \
CGameHandler.cpp \
CGameHandler.h \
CVCMIServer.cpp \

View File

@ -58,9 +58,7 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_vcmiserver_OBJECTS = vcmiserver-CConsoleHandler.$(OBJEXT) \
vcmiserver-CThreadHelper.$(OBJEXT) \
vcmiserver-CGameHandler.$(OBJEXT) \
am_vcmiserver_OBJECTS = vcmiserver-CGameHandler.$(OBJEXT) \
vcmiserver-CVCMIServer.$(OBJEXT) \
vcmiserver-NetPacksServer.$(OBJEXT) \
vcmiserver-stdafx.$(OBJEXT)
@ -253,10 +251,6 @@ vcmiserver_LDADD = $(top_builddir)/lib/libvcmi.la
vcmiserver_CXXFLAGS = @SDL_CXXFLAGS@
vcmiserver_LDFLAGS = -L$(top_builddir)/lib
vcmiserver_SOURCES = \
../CConsoleHandler.cpp \
../CConsoleHandler.h \
../CThreadHelper.cpp \
../CThreadHelper.h \
CGameHandler.cpp \
CGameHandler.h \
CVCMIServer.cpp \
@ -352,9 +346,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiserver-CConsoleHandler.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiserver-CGameHandler.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiserver-CThreadHelper.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiserver-CVCMIServer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiserver-NetPacksServer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiserver-stdafx.Po@am__quote@
@ -383,38 +375,6 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
vcmiserver-CConsoleHandler.o: ../CConsoleHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiserver_CXXFLAGS) $(CXXFLAGS) -MT vcmiserver-CConsoleHandler.o -MD -MP -MF $(DEPDIR)/vcmiserver-CConsoleHandler.Tpo -c -o vcmiserver-CConsoleHandler.o `test -f '../CConsoleHandler.cpp' || echo '$(srcdir)/'`../CConsoleHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vcmiserver-CConsoleHandler.Tpo $(DEPDIR)/vcmiserver-CConsoleHandler.Po
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../CConsoleHandler.cpp' object='vcmiserver-CConsoleHandler.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiserver_CXXFLAGS) $(CXXFLAGS) -c -o vcmiserver-CConsoleHandler.o `test -f '../CConsoleHandler.cpp' || echo '$(srcdir)/'`../CConsoleHandler.cpp
vcmiserver-CConsoleHandler.obj: ../CConsoleHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiserver_CXXFLAGS) $(CXXFLAGS) -MT vcmiserver-CConsoleHandler.obj -MD -MP -MF $(DEPDIR)/vcmiserver-CConsoleHandler.Tpo -c -o vcmiserver-CConsoleHandler.obj `if test -f '../CConsoleHandler.cpp'; then $(CYGPATH_W) '../CConsoleHandler.cpp'; else $(CYGPATH_W) '$(srcdir)/../CConsoleHandler.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vcmiserver-CConsoleHandler.Tpo $(DEPDIR)/vcmiserver-CConsoleHandler.Po
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../CConsoleHandler.cpp' object='vcmiserver-CConsoleHandler.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiserver_CXXFLAGS) $(CXXFLAGS) -c -o vcmiserver-CConsoleHandler.obj `if test -f '../CConsoleHandler.cpp'; then $(CYGPATH_W) '../CConsoleHandler.cpp'; else $(CYGPATH_W) '$(srcdir)/../CConsoleHandler.cpp'; fi`
vcmiserver-CThreadHelper.o: ../CThreadHelper.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiserver_CXXFLAGS) $(CXXFLAGS) -MT vcmiserver-CThreadHelper.o -MD -MP -MF $(DEPDIR)/vcmiserver-CThreadHelper.Tpo -c -o vcmiserver-CThreadHelper.o `test -f '../CThreadHelper.cpp' || echo '$(srcdir)/'`../CThreadHelper.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vcmiserver-CThreadHelper.Tpo $(DEPDIR)/vcmiserver-CThreadHelper.Po
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../CThreadHelper.cpp' object='vcmiserver-CThreadHelper.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiserver_CXXFLAGS) $(CXXFLAGS) -c -o vcmiserver-CThreadHelper.o `test -f '../CThreadHelper.cpp' || echo '$(srcdir)/'`../CThreadHelper.cpp
vcmiserver-CThreadHelper.obj: ../CThreadHelper.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiserver_CXXFLAGS) $(CXXFLAGS) -MT vcmiserver-CThreadHelper.obj -MD -MP -MF $(DEPDIR)/vcmiserver-CThreadHelper.Tpo -c -o vcmiserver-CThreadHelper.obj `if test -f '../CThreadHelper.cpp'; then $(CYGPATH_W) '../CThreadHelper.cpp'; else $(CYGPATH_W) '$(srcdir)/../CThreadHelper.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vcmiserver-CThreadHelper.Tpo $(DEPDIR)/vcmiserver-CThreadHelper.Po
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../CThreadHelper.cpp' object='vcmiserver-CThreadHelper.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiserver_CXXFLAGS) $(CXXFLAGS) -c -o vcmiserver-CThreadHelper.obj `if test -f '../CThreadHelper.cpp'; then $(CYGPATH_W) '../CThreadHelper.cpp'; else $(CYGPATH_W) '$(srcdir)/../CThreadHelper.cpp'; fi`
vcmiserver-CGameHandler.o: CGameHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiserver_CXXFLAGS) $(CXXFLAGS) -MT vcmiserver-CGameHandler.o -MD -MP -MF $(DEPDIR)/vcmiserver-CGameHandler.Tpo -c -o vcmiserver-CGameHandler.o `test -f 'CGameHandler.cpp' || echo '$(srcdir)/'`CGameHandler.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vcmiserver-CGameHandler.Tpo $(DEPDIR)/vcmiserver-CGameHandler.Po

View File

@ -27,4 +27,4 @@
#include <sstream>
#include <boost/format.hpp>
#include <sstream>
#include "../CThreadHelper.h"
#include "../lib/CThreadHelper.h"

33
vcmiinstall.sh Normal file
View File

@ -0,0 +1,33 @@
#!/bin/bash
function errorcheck(){
if [$? -gt 0]; then
echo "Error during $1"
quit
else
echo "$1 successful"
fi
}
svn co https://vcmi.svn.sourceforge.net/svnroot/vcmi/branches/programmingChallenge/ vcmi
errorcheck "fetching sources"
cd vcmi
autoreconf -i
errorcheck "autoreconf -i"
cd ..
vcmi/configure --datadir=`pwd` --bindir=`pwd`vcmi --libdir=`pwd`
errorcheck "configure"
make
errorcheck "make"
unzip vcmipack.zip -d vcmi
errorcheck "pack unzip"
ln -s "vcmi/b1.json"
errorckeck "b1.json symlink"
ln -s "AI/StupidAI/.libs/libStupidAI.so"
errorcheck "StupidAI symlink"
ln -s "Odpalarka/odpalarka"
errorcheck "Odpalarka symlink"
ln -s "VCMI_BattleAiHost/vcmirunner"
errorckeck "runner symlink"
ln -s "server/vcmiserver"
errorckeck "server symlink"

BIN
vcmipack.zip Normal file

Binary file not shown.