diff options
author | Martin Wilke <miwi@FreeBSD.org> | 2008-02-21 08:53:00 +0000 |
---|---|---|
committer | Martin Wilke <miwi@FreeBSD.org> | 2008-02-21 08:53:00 +0000 |
commit | 09ce051eb9627f6dc81bd725e4e9feda9b9d6a0d (patch) | |
tree | c0a3fe3447480cc2b649e4613ce52f4fe5b4de95 /games/lordsawar/files | |
parent | - Update to 5.68 (diff) |
A turn-based strategy game where up to 8 players strive for control
of as many cities as possible. Produce new armies in cities to
conquer nearby cities. Using the income from those cities, make
more armies to take more cities. Send a hero to a temple to get a
quest, or maybe search a nearby ruin instead. Play with others or
against the computer.
WWW: http://lordsawar.com/
PR: ports/120803
Submitted by: spam at rm-rf.kiev.ua
Notes
Notes:
svn path=/head/; revision=207687
Diffstat (limited to 'games/lordsawar/files')
-rw-r--r-- | games/lordsawar/files/patch-configure | 20 | ||||
-rw-r--r-- | games/lordsawar/files/patch-src_game.cpp | 98 | ||||
-rw-r--r-- | games/lordsawar/files/patch-src_ucompose.hpp | 14 |
3 files changed, 132 insertions, 0 deletions
diff --git a/games/lordsawar/files/patch-configure b/games/lordsawar/files/patch-configure new file mode 100644 index 000000000000..7e42d74e5343 --- /dev/null +++ b/games/lordsawar/files/patch-configure @@ -0,0 +1,20 @@ +Index: configure +@@ -4622,7 +4622,7 @@ + LDFLAGS="$LDFLAGS -lSDL_mixer" + LIBS="-lSDL_mixer $LIBS" + +- if test $CC = "gcc" || test $CXX = "g++"; then ++ if test $CC = "gcc" || test $CXX = "g++" || test $CXX = "c++"; then + + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +@@ -13798,8 +13798,7 @@ + + rm -f src/main.o + +-LORDSAWAR_DATADIR="$datadir/lordsawar" +-LORDSAWAR_DATADIR=${LORDSAWAR_DATADIR/'${prefix}'/$prefix} ++eval LORDSAWAR_DATADIR="$datadir/lordsawar" + + + ac_config_files="$ac_config_files dat/Makefile dat/army/Makefile dat/army/default/Makefile dat/army/bigdefault/Makefile dat/tilesets/Makefile dat/tilesets/default/Makefile dat/tilesets/default/misc/Makefile dat/tilesets/bigdefault/Makefile dat/tilesets/bigdefault/misc/Makefile dat/shield/Makefile dat/shield/default/Makefile dat/shield/plain/Makefile dat/citysets/Makefile dat/citysets/default/Makefile dat/citysets/bigdefault/Makefile dat/various/Makefile dat/various/items/Makefile dat/various/editor/Makefile dat/map/Makefile dat/ggz/Makefile dat/ggz/lordsawar.dsc dat/ggz/lordsawar-server.dsc dat/music/Makefile dat/glade/Makefile dat/glade/editor/Makefile intl/Makefile po/Makefile.in po/Makefile Makefile src/Makefile doc/Makefile src/server/Makefile src/editor/Makefile src/gui/Makefile" diff --git a/games/lordsawar/files/patch-src_game.cpp b/games/lordsawar/files/patch-src_game.cpp new file mode 100644 index 000000000000..0f565bfff75e --- /dev/null +++ b/games/lordsawar/files/patch-src_game.cpp @@ -0,0 +1,98 @@ +Index: src/game.cpp +@@ -1115,15 +1115,6 @@ + int + Game::loadHeroTemplates() + { +- FILE *fileptr = fopen (File::getMiscFile("heronames").c_str(), "r"); +- char *line = NULL; +- size_t len = 0; +- ssize_t read; +- int retval; +- int gender; +- int side; +- size_t bytesread = 0; +- char *tmp; + const Armysetlist* al = Armysetlist::getInstance(); + const Army* herotype; + +@@ -1131,51 +1122,41 @@ + std::vector<const Army*> heroes; + Player *p = Playerlist::getInstance()->getNeutral(); + for (unsigned int j = 0; j < al->getSize(p->getArmyset()); j++) +- { ++ { + const Army *a = al->getArmy (p->getArmyset(), j); + if (a->isHero()) +- heroes.push_back(a); ++ heroes.push_back(a); + } ++ ++ std::ifstream file(File::getMiscFile("heronames").c_str()); + +- if (fileptr == NULL) +- return -1; +- while ((read = getline (&line, &len, fileptr)) != -1) +- { +- bytesread = 0; +- retval = sscanf (line, "%d%d%n", &side, &gender, &bytesread); +- if (retval != 2) +- { +- free (line); +- return -2; +- } +- while (isspace(line[bytesread]) && line[bytesread] != '\0') +- bytesread++; +- tmp = strchr (&line[bytesread], '\n'); +- if (tmp) +- tmp[0] = '\0'; +- if (strlen (&line[bytesread]) == 0) +- { +- free (line); +- return -3; +- } +- if (side < 0 || side > (int) MAX_PLAYERS) +- { +- free (line); +- return -4; ++ if (file.good()) { ++ std::string buffer, name; ++ int side, gender; ++ ++ while (std::getline(file, buffer)) { ++ std::istringstream line(buffer); ++ if (!(line >> side >> gender >> name)) ++ return -2; ++ ++ if (side < 0 || side > (int) MAX_PLAYERS) ++ return -4; ++ ++ herotype = heroes[rand() % heroes.size()]; ++ Hero *newhero = new Hero (*herotype, "", NULL); ++ ++ if (gender) ++ newhero->setGender(Hero::MALE); ++ else ++ newhero->setGender(Hero::FEMALE); ++ ++ newhero->setName (name); ++ d_herotemplates[side].push_back (newhero); + } ++ } else ++ return -1; + +- herotype = heroes[rand() % heroes.size()]; +- Hero *newhero = new Hero (*herotype, "", NULL); +- if (gender) +- newhero->setGender(Hero::MALE); +- else +- newhero->setGender(Hero::FEMALE); +- newhero->setName (&line[bytesread]); +- d_herotemplates[side].push_back (newhero); +- } +- if (line) +- free (line); +- fclose (fileptr); ++ file.close(); + return 0; + } + diff --git a/games/lordsawar/files/patch-src_ucompose.hpp b/games/lordsawar/files/patch-src_ucompose.hpp new file mode 100644 index 000000000000..660825131678 --- /dev/null +++ b/games/lordsawar/files/patch-src_ucompose.hpp @@ -0,0 +1,14 @@ +Index: src/ucompose.hpp +@@ -178,9 +178,9 @@ + inline Composition::Composition(std::string fmt) + : arg_no(1) + { +-#if __GNUC__ >= 3 +- os.imbue(std::locale("")); // use the user's locale for the stream +-#endif ++//#if __GNUC__ >= 3 ++// os.imbue(std::locale("")); // use the user's locale for the stream ++//#endif + std::string::size_type b = 0, i = 0; + + // fill in output with the strings between the %1 %2 %3 etc. and |