1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

* applied ubuntux's patches

* fixed AmptyAI (it builds now)
This commit is contained in:
mateuszb 2009-04-13 18:52:20 +00:00
parent de71191307
commit 4d3808cfa0
11 changed files with 142 additions and 173 deletions

View File

@ -13,6 +13,8 @@ public:
void showSelDialog(std::string text, std::vector<CSelectableComponent*> & components, int askID){};
void tileRevealed(int3 pos){};
void tileHidden(int3 pos){};
void showBlockingDialog(const std::string &text, const std::vector<Component> &components, ui32 askID, bool selection, bool cancel){};
void showGarrisonDialog(const CArmedInstance *up, const CGHeroInstance *down, boost::function<void()> &onEnd){};
void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback);
};

8
AI/GeniusAI/Makefile.am Normal file
View File

@ -0,0 +1,8 @@
pkglib_LTLIBRARIES = GeniusAI.la
GeniusAI_la_LIBADD = $(top_builddir)/lib/libvcmi.a $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_THREAD_LIB)
GeniusAI_la_LDFLAGS = -L$(top_builddir)/lib -module
GeniusAI_la_SOURCES = \
CGeniusAI.cpp \
CGeniusAI.h \
DLLMain.cpp

1
AI/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = GeniusAI

View File

@ -27,6 +27,11 @@ CGlobalAI * CAIHandler::getNewAI(CCallback * cb, std::string dllname)
getAI = (CGlobalAI*(*)())GetProcAddress(dll,"GetNewAI");
#else
void *dll = dlopen(dllname.c_str(), RTLD_LOCAL | RTLD_LAZY);
if (!dll)
{
tlog1 << "Cannot open AI library ("<<dllname<<"). Throwing..."<<std::endl;
throw new std::string("Cannot open AI library");
}
getName = (void(*)(char*))dlsym(dll,"GetAiName");
getAI = (CGlobalAI*(*)())dlsym(dll,"GetNewAI");
#endif

View File

@ -1189,9 +1189,9 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
// }
//init visiting and garrisoned heroes
for(int l=0; l<k->second.heroes.size();l++)
for(unsigned int l=0; l<k->second.heroes.size();l++)
{
for(int m=0; m<k->second.towns.size();m++)
for(unsigned int m=0; m<k->second.towns.size();m++)
{
int3 vistile = k->second.towns[m]->pos; vistile.x--; //tile next to the entrance
if(vistile == k->second.heroes[l]->pos || k->second.heroes[l]->pos==k->second.towns[m]->pos)

View File

@ -1,49 +1,7 @@
ACLOCAL_AMFLAGS = -I aclocal/m4
EXTRA_DIST = aclocal/m4
#bin_PROGRAMS = vcmi
#vcmi_LDADD = $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_THREAD_LIB)
AM_CXXFLAGS = $(BOOST_CPPFLAGS)
AM_LDFLAGS = $(BOOST_LDFLAGS)
SUBDIRS = lib client server
#vcmi_SOURCES = \
# AdventureMapButton.cpp CGameState.cpp \
# AdventureMapButton.h CGameState.h global.h \
# AI_Base.h CHeroWindow.cpp int3.h \
# CAdvmapInterface.cpp CHeroWindow.h map.cpp \
# CAdvmapInterface.h CLua.cpp map.h \
# CBattleInterface.cpp CLua.h mapHandler.cpp \
# CBattleInterface.h CLuaHandler.cpp mapHandler.h \
# CCallback.cpp CLuaHandler.h nodrze.h \
# CCallback.h CMessage.cpp SDL_Extensions.cpp \
# CCastleInterface.cpp CMessage.h SDL_Extensions.h \
# CCastleInterface.h CMT.cpp SDL_framerate.cpp \
# CConsoleHandler.cpp SDL_framerate.h \
# CConsoleHandler.h CPathfinder.cpp \
# CCursorHandler.cpp CPathfinder.h \
# CCursorHandler.h CPlayerInterface.cpp StartInfo.h \
# CGameInfo.cpp CPlayerInterface.h stdafx.cpp \
# CGameInfo.h CPreGame.cpp stdafx.h \
# CGameInterface.cpp CPreGame.h tchar_amigaos4.h \
# CGameInterface.h timeHandler.h \
# hch/CAbilityHandler.cpp hch/CDefObjInfoHandler.cpp \
# hch/CAbilityHandler.h hch/CDefObjInfoHandler.h \
# hch/CAmbarCendamo.cpp hch/CGeneralTextHandler.cpp \
# hch/CAmbarCendamo.h hch/CGeneralTextHandler.h \
# hch/CArtHandler.cpp hch/CHeroHandler.cpp hch/CSndHandler.cpp \
# hch/CArtHandler.h hch/CHeroHandler.h hch/CSndHandler.h \
# hch/CBuildingHandler.cpp hch/CLodHandler.cpp hch/CSpellHandler.cpp \
# hch/CBuildingHandler.h hch/CLodHandler.h hch/CSpellHandler.h \
# hch/CMusicHandler.cpp hch/CTownHandler.cpp \
# hch/CMusicHandler.h hch/CTownHandler.h \
# hch/CCreatureHandler.cpp hch/CObjectHandler.cpp hch/CVideoHandler.cpp \
# hch/CCreatureHandler.h hch/CObjectHandler.h hch/CVideoHandler.h \
# hch/CDefHandler.cpp hch/CPreGameTextHandler.cpp \
# hch/CDefHandler.h hch/CPreGameTextHandler.h \
#client/CBitmapHandler.cpp client/CCreatureAnimation.cpp client/Client.cpp client/Graphics.cpp \
#client/CBitmapHandler.h client/CCreatureAnimation.h client/Client.h client/Graphics.h \
#lib/VCMI_Lib.h lib/VCMI_Lib.cpp \
# server/CScriptCallback.h server/CScriptCallback.cpp \
# lib/Connection.cpp lib/Connection.h \
# CThreadHelper.cpp CThreadHelper.h
#
#
SUBDIRS = lib client server AI

View File

@ -1,73 +1,72 @@
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS = vcmiclient
#vcmi_LDADD = $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_THREAD_LIB)
#AM_CXXFLAGS = $(BOOST_CPPFLAGS)
vcmiclient_LDADD = $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_THREAD_LIB)
#vcmiclient_LDADD = $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_THREAD_LIB)
vcmiclient_LDADD = $(top_builddir)/lib/libvcmi.a $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_THREAD_LIB)
vcmiclient_LDFLAGS = -L$(top_builddir)/lib
vcmiclient_LDADD += -lvcmi
vcmiclient_SOURCES = \
../AdventureMapButton.cpp \
../CAdvmapInterface.cpp \
../CBattleInterface.cpp \
./CBitmapHandler.cpp \
../CCallback.cpp \
../CCastleInterface.cpp \
./CConfigHandler.cpp \
./CCreatureAnimation.cpp \
../CCursorHandler.cpp \
../hch/CDefHandler.cpp \
../CGameInfo.cpp \
../CGameInterface.cpp \
../CHeroWindow.cpp \
./Client.cpp \
../CMessage.cpp \
../CMT.cpp \
../hch/CMusicHandler.cpp \
../CPlayerInterface.cpp \
../CPreGame.cpp \
../hch/CSndHandler.cpp \
./CSpellWindow.cpp \
../CThreadHelper.cpp \
./Graphics.cpp \
../mapHandler.cpp \
./NetPacksClient.cpp \
../SDL_Extensions.cpp \
../SDL_framerate.cpp \
../AdventureMapButton.h \
../AI_Base.h \
../AdventureMapButton.cpp \
../AdventureMapButton.h \
../CAdvmapInterface.cpp \
../CAdvmapInterface.h \
../hch/CAmbarCendamo.h \
../CBattleInterface.cpp \
../CBattleInterface.h \
./CBitmapHandler.h \
../hch/CBuildingHandler.h \
../CCallback.cpp \
../CCallback.h \
../CCastleInterface.cpp \
../CCastleInterface.h \
./CConfigHandler.h \
./CCreatureAnimation.h \
../CCursorHandler.cpp \
../CCursorHandler.h \
../hch/CDefHandler.h \
../CGameInfo.cpp \
../CGameInfo.h \
../CGameInterface.cpp \
../CGameInterface.h \
../hch/CHeroHandler.h \
../CHeroWindow.cpp \
../CHeroWindow.h \
./Client.h \
../CMT.cpp \
../CMessage.cpp \
../CMessage.h \
../hch/CMusicHandler.h \
../hch/CObjectHandler.h \
../CPlayerInterface.cpp \
../CPlayerInterface.h \
../CPreGame.cpp \
../CPreGame.h \
../hch/CSndHandler.h \
./CSpellWindow.h \
../CThreadHelper.cpp \
../CThreadHelper.h \
./FunctionList.h \
../global.h \
./Graphics.h \
../int3.h \
../map.h \
../mapHandler.h \
../nodrze.h \
../SDL_Extensions.cpp \
../SDL_Extensions.h \
../SDL_framerate.cpp \
../SDL_framerate.h \
../StartInfo.h \
../global.h \
../hch/CAmbarCendamo.h \
../hch/CBuildingHandler.h \
../hch/CDefHandler.cpp \
../hch/CDefHandler.h \
../hch/CHeroHandler.h \
../hch/CMusicHandler.cpp \
../hch/CMusicHandler.h \
../hch/CObjectHandler.h \
../hch/CSndHandler.cpp \
../hch/CSndHandler.h \
../hch/CVideoHandler.h \
../int3.h \
../map.h \
../mapHandler.cpp \
../mapHandler.h \
../nodrze.h \
../stdafx.h \
../timeHandler.h
../tchar_amigaos4.h \
../timeHandler.h \
./CBitmapHandler.cpp \
./CBitmapHandler.h \
./CConfigHandler.cpp \
./CConfigHandler.h \
./CCreatureAnimation.cpp \
./CCreatureAnimation.h \
./CSpellWindow.cpp \
./CSpellWindow.h \
./Client.cpp \
./Client.h \
./FunctionList.h \
./Graphics.cpp \
./Graphics.h \
./NetPacksClient.cpp

View File

@ -20,7 +20,7 @@ AC_DISABLE_STATIC
AC_PROG_LIBTOOL
CFLAGS="-g"
CXXFLAGS="-g"
CXXFLAGS="-O1 -ggdb -Wall"
AC_CHECK_LIB([stdc++], [main])
if test "x$GCC" = "xyes"; then
stdcxx_name=`$CXX -print-file-name=libstdc++.so`
@ -64,4 +64,4 @@ AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([atexit memset pow select sqrt])
AC_OUTPUT(Makefile lib/Makefile client/Makefile server/Makefile)
AC_OUTPUT(Makefile lib/Makefile client/Makefile server/Makefile AI/Makefile AI/GeniusAI/Makefile)

View File

@ -389,9 +389,10 @@ void CCreatureHandler::loadCreatures()
inp.seekg(0,std::ios::end); // na koniec
int andame2 = inp.tellg(); // read length
inp.seekg(0,std::ios::beg); // wracamy na poczatek
char * bufor = new char[andame2]; // allocate memory
char * bufor = new char[andame2+1]; // allocate memory
inp.read((char*)bufor, andame2); // read map file to buffer
inp.close();
bufor[andame2] = 0;
buf = std::string(bufor);
delete [] bufor;

View File

@ -1,45 +1,43 @@
noinst_LIBRARIES = libvcmi.a
#vcmi_LDADD = $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_THREAD_LIB)
#AM_CXXFLAGS = $(BOOST_CPPFLAGS)
libvcmi_a_SOURCES = \
../hch/CArtHandler.cpp \
../hch/CBuildingHandler.cpp \
../CConsoleHandler.cpp \
../hch/CCreatureHandler.cpp \
../hch/CDefObjInfoHandler.cpp \
../CGameState.cpp \
../hch/CGeneralTextHandler.cpp \
../hch/CHeroHandler.cpp \
../hch/CLodHandler.cpp \
../hch/CObjectHandler.cpp \
./Connection.cpp \
../hch/CSpellHandler.cpp \
../hch/CTownHandler.cpp \
./IGameCallback.cpp \
../map.cpp \
./NetPacksLib.cpp \
./RegisterTypes.cpp \
../stdafx.cpp \
./VCMI_Lib.cpp \
./BattleAction.h \
../hch/CArtHandler.h \
../hch/CBuildingHandler.h \
../CConsoleHandler.h \
../hch/CCreatureHandler.h \
../hch/CDefObjInfoHandler.h \
../CGameState.cpp \
../CGameState.h \
../hch/CArtHandler.cpp \
../hch/CArtHandler.h \
../hch/CBuildingHandler.cpp \
../hch/CBuildingHandler.h \
../hch/CCreatureHandler.cpp \
../hch/CCreatureHandler.h \
../hch/CDefObjInfoHandler.cpp \
../hch/CDefObjInfoHandler.h \
../hch/CGeneralTextHandler.cpp \
../hch/CGeneralTextHandler.h \
../hch/CHeroHandler.cpp \
../hch/CHeroHandler.h \
../hch/CLodHandler.cpp \
../hch/CLodHandler.h \
../hch/CObjectHandler.cpp \
../hch/CObjectHandler.h \
./CondSh.h \
./Connection.h \
../hch/CSpellHandler.cpp \
../hch/CSpellHandler.h \
../hch/CTownHandler.cpp \
../hch/CTownHandler.h \
./Herobonus.h \
../map.cpp \
../map.h \
../stdafx.cpp \
./BattleAction.h \
./CondSh.h \
./Connection.cpp \
./Connection.h \
./HeroBonus.h \
./IGameCallback.cpp \
./IGameCallback.h \
./Interprocess.h \
../map.h \
./NetPacks.h \
./NetPacksLib.cpp \
./RegisterTypes.cpp \
./RegisterTypes.h \
./VCMI_Lib.cpp \
./VCMI_Lib.h

View File

@ -1,13 +1,10 @@
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS = vcmiserver
vcmiserver_LDADD = $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_THREAD_LIB)
#vcmi_LDADD = $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_THREAD_LIB)
#AM_CXXFLAGS = $(BOOST_CPPFLAGS)
vcmiserver_LDADD = $(top_builddir)/lib/libvcmi.a $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_THREAD_LIB)
vcmiserver_LDFLAGS = -L$(top_builddir)/lib
vcmiserver_LDADD += -lvcmi
vcmiserver_SOURCES = \
./CGameHandler.cpp \
./CVCMIServer.cpp \
./NetPacksServer.cpp \
./CGameHandler.h \
./CVCMIServer.h
./CVCMIServer.cpp \
./CVCMIServer.h \
./NetPacksServer.cpp