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 showSelDialog(std::string text, std::vector<CSelectableComponent*> & components, int askID){};
void tileRevealed(int3 pos){}; void tileRevealed(int3 pos){};
void tileHidden(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); 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"); getAI = (CGlobalAI*(*)())GetProcAddress(dll,"GetNewAI");
#else #else
void *dll = dlopen(dllname.c_str(), RTLD_LOCAL | RTLD_LAZY); 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"); getName = (void(*)(char*))dlsym(dll,"GetAiName");
getAI = (CGlobalAI*(*)())dlsym(dll,"GetNewAI"); getAI = (CGlobalAI*(*)())dlsym(dll,"GetNewAI");
#endif #endif

View File

@ -1189,9 +1189,9 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
// } // }
//init visiting and garrisoned heroes //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 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) 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 ACLOCAL_AMFLAGS = -I aclocal/m4
EXTRA_DIST = 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_CXXFLAGS = $(BOOST_CPPFLAGS)
AM_LDFLAGS = $(BOOST_LDFLAGS) AM_LDFLAGS = $(BOOST_LDFLAGS)
SUBDIRS = lib client server SUBDIRS = lib client server AI
#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
#
#

View File

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

View File

@ -20,7 +20,7 @@ AC_DISABLE_STATIC
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
CFLAGS="-g" CFLAGS="-g"
CXXFLAGS="-g" CXXFLAGS="-O1 -ggdb -Wall"
AC_CHECK_LIB([stdc++], [main]) AC_CHECK_LIB([stdc++], [main])
if test "x$GCC" = "xyes"; then if test "x$GCC" = "xyes"; then
stdcxx_name=`$CXX -print-file-name=libstdc++.so` stdcxx_name=`$CXX -print-file-name=libstdc++.so`
@ -64,4 +64,4 @@ AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([atexit memset pow select sqrt]) 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 inp.seekg(0,std::ios::end); // na koniec
int andame2 = inp.tellg(); // read length int andame2 = inp.tellg(); // read length
inp.seekg(0,std::ios::beg); // wracamy na poczatek 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.read((char*)bufor, andame2); // read map file to buffer
inp.close(); inp.close();
bufor[andame2] = 0;
buf = std::string(bufor); buf = std::string(bufor);
delete [] bufor; delete [] bufor;

View File

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

View File

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