- Update Lords a War to 0.0.9

PR:		ports/125590
Submitted by:	Alex Kozlov <spam at rm-rf dot kiev dot ua> (maintainer)
Approved by:	miwi (mentor)
This commit is contained in:
Dmitry Marakasov 2008-07-31 16:05:43 +00:00
parent 6fd6448c02
commit b08d7ca641
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=217881
6 changed files with 141 additions and 112 deletions

View File

@ -6,15 +6,15 @@
#
PORTNAME= lordsawar
PORTVERSION= 0.0.8
PORTREVISION= 2
PORTVERSION= 0.0.9
CATEGORIES= games
MASTER_SITES= http://lordsawar.com/
MAINTAINER= spam@rm-rf.kiev.ua
COMMENT= A Warlords II clone
LIB_DEPENDS= glademm-2.4:${PORTSDIR}/devel/libglademm24
LIB_DEPENDS= glademm-2.4:${PORTSDIR}/devel/libglademm24 \
gnet-2.0:${PORTSDIR}/net/gnet2
USE_GZIP= yes
USE_GETTEXT= yes

View File

@ -1,3 +1,3 @@
MD5 (lordsawar-0.0.8.tar.gz) = dfe83aea8517d9760d9cd8e268efef8d
SHA256 (lordsawar-0.0.8.tar.gz) = 9786394b856beeee45fcfe0ca74befed573b5b5f201086f8bc73d3d54a3d28e1
SIZE (lordsawar-0.0.8.tar.gz) = 13340263
MD5 (lordsawar-0.0.9.tar.gz) = 4e072bce1fe77f61a97c67d766a64c9e
SHA256 (lordsawar-0.0.9.tar.gz) = d87cf2c5c51dd169757020ffb679ce5f9b7b102fc792daca327c57fefa1f5fdd
SIZE (lordsawar-0.0.9.tar.gz) = 14364630

View File

@ -1,5 +1,5 @@
Index: configure
@@ -4622,7 +4622,7 @@
@@ -4577,7 +4577,7 @@
LDFLAGS="$LDFLAGS -lSDL_mixer"
LIBS="-lSDL_mixer $LIBS"
@ -8,7 +8,18 @@ Index: configure
if test "$cross_compiling" = yes; then
{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
@@ -13798,8 +13798,7 @@
@@ -4655,8 +4655,8 @@
_ACEOF
else
- CFLAGS=$ac_save_CFLAGS
- LDFLAGS="$ac_save_LDFLAGS"
+ CFLAGS=$ac_save_cflags
+ LDFLAGS="$ac_save_ldflags"
LIBS="$ac_save_libs"
fi
@@ -12271,8 +12271,7 @@
rm -f src/main.o
@ -17,4 +28,4 @@ Index: configure
+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"
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/Makef ile dat/map/Makefile dat/music/Makefile dat/glade/Makefile dat/glade/editor/Makefile intl/Makefile po/Makefile.in po/Makefile Makefile src/Makefile doc/Makefile src/editor/Makefile src/gui/Makefile"

View File

@ -1,98 +1,10 @@
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);
@@ -1042,7 +1042,7 @@
}
else
{
- SDL_Delay(250);
+ //SDL_Delay(250);
}
+
+ 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;
}

View File

@ -0,0 +1,94 @@
Index: src/herotemplates.cpp
@@ -64,15 +64,6 @@
int HeroTemplates::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;
@@ -83,48 +74,37 @@
{
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, true);
- 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;
}
-

View File

@ -1,7 +1,7 @@
bin/lordsawar
bin/lordsawar-army-editor
bin/lordsawar-editor
bin/lordsawar_server
bin/lordsawar-tile-editor
share/applications/lordsawar.desktop
%%DATADIR%%/citynames
%%DATADIR%%/heronames
@ -103,6 +103,7 @@ share/applications/lordsawar.desktop
%%DATADIR%%/various/editor/button_1x1.png
%%DATADIR%%/various/editor/button_2x2.png
%%DATADIR%%/various/editor/button_3x3.png
%%DATADIR%%/various/editor/button_6x6.png
%%DATADIR%%/various/editor/button_castle.png
%%DATADIR%%/various/editor/button_erase.png
%%DATADIR%%/various/editor/button_blank.png
@ -113,8 +114,10 @@ share/applications/lordsawar.desktop
%%DATADIR%%/various/editor/button_stack.png
%%DATADIR%%/various/editor/button_bridge.png
%%DATADIR%%/various/editor/button_port.png
%%DATADIR%%/various/editor/tilestyles.png
%%DATADIR%%/various/arrows.png
%%DATADIR%%/various/waypoints.png
%%DATADIR%%/various/win.png
%%DATADIR%%/various/buttons.png
%%DATADIR%%/various/city_occupied.png
%%DATADIR%%/various/items.png
@ -125,15 +128,7 @@ share/applications/lordsawar.desktop
%%DATADIR%%/various/ruin_1.png
%%DATADIR%%/various/ruin_2.png
%%DATADIR%%/various/splash_screen.jpg
%%DATADIR%%/various/about_screen.jpg
%%DATADIR%%/various/network_screen.jpg
%%DATADIR%%/various/stats.png
%%DATADIR%%/various/win.jpg
%%DATADIR%%/various/win_mask.png
%%DATADIR%%/various/freelords.png
%%DATADIR%%/various/lordsawar_logo.png
%%DATADIR%%/various/freelords_editor.png
%%DATADIR%%/various/editor.png
%%DATADIR%%/various/hero.png
%%DATADIR%%/various/prodshieldset.png
%%DATADIR%%/various/smallruinedcity.png
@ -142,6 +137,7 @@ share/applications/lordsawar.desktop
%%DATADIR%%/various/smallunexploredstronghold.png
%%DATADIR%%/various/smallexploredruin.png
%%DATADIR%%/various/smalltemple.png
%%DATADIR%%/various/castle_icon.png
%%DATADIR%%/various/cursors.png
%%DATADIR%%/various/smallupkeep.png
%%DATADIR%%/various/smallincome.png
@ -149,6 +145,9 @@ share/applications/lordsawar.desktop
%%DATADIR%%/various/smallcity.png
%%DATADIR%%/various/diplomacy-small.png
%%DATADIR%%/various/diplomacy-large.png
%%DATADIR%%/various/parley_offered.png
%%DATADIR%%/various/parley_refused.png
%%DATADIR%%/various/tileset_icon.png
%%DATADIR%%/map/2ndPunic37.map
%%DATADIR%%/music/back1.ogg
%%DATADIR%%/music/defeat.ogg
@ -161,6 +160,7 @@ share/applications/lordsawar.desktop
%%DATADIR%%/glade/army-gains-level-dialog.glade
%%DATADIR%%/glade/army-info-window.glade
%%DATADIR%%/glade/stack-info-window.glade
%%DATADIR%%/glade/stack-info-dialog.glade
%%DATADIR%%/glade/buy-production-dialog.glade
%%DATADIR%%/glade/city-defeated-dialog.glade
%%DATADIR%%/glade/city-looted-dialog.glade
@ -173,10 +173,13 @@ share/applications/lordsawar.desktop
%%DATADIR%%/glade/player-died-dialog.glade
%%DATADIR%%/glade/game-over-dialog.glade
%%DATADIR%%/glade/game-preferences-dialog.glade
%%DATADIR%%/glade/about-dialog.glade
%%DATADIR%%/glade/game-quit-dialog.glade
%%DATADIR%%/glade/game-window.glade
%%DATADIR%%/glade/hero-dialog.glade
%%DATADIR%%/glade/hero-offer-dialog.glade
%%DATADIR%%/glade/surrender-dialog.glade
%%DATADIR%%/glade/surrender-refused-dialog.glade
%%DATADIR%%/glade/sage-dialog.glade
%%DATADIR%%/glade/ruin-rewarded-dialog.glade
%%DATADIR%%/glade/ruin-report-dialog.glade
@ -211,15 +214,24 @@ share/applications/lordsawar.desktop
%%DATADIR%%/glade/diplomacy-dialog.glade
%%DATADIR%%/glade/treachery-dialog.glade
%%DATADIR%%/glade/editor/main-window.glade
%%DATADIR%%/glade/editor/tileset-window.glade
%%DATADIR%%/glade/editor/signpost-dialog.glade
%%DATADIR%%/glade/editor/temple-dialog.glade
%%DATADIR%%/glade/editor/reward-dialog.glade
%%DATADIR%%/glade/editor/reward-list-dialog.glade
%%DATADIR%%/glade/editor/ruin-dialog.glade
%%DATADIR%%/glade/editor/select-hidden-ruin-dialog.glade
%%DATADIR%%/glade/editor/stack-dialog.glade
%%DATADIR%%/glade/editor/select-army-dialog.glade
%%DATADIR%%/glade/editor/players-dialog.glade
%%DATADIR%%/glade/editor/city-dialog.glade
%%DATADIR%%/glade/editor/map-info-dialog.glade
%%DATADIR%%/glade/editor/tileset-info-dialog.glade
%%DATADIR%%/glade/editor/new-map-dialog.glade
%%DATADIR%%/glade/editor/itemlist-dialog.glade
%%DATADIR%%/glade/editor/tile-preview-dialog.glade
%%DATADIR%%/glade/editor/select-item-dialog.glade
%%DATADIR%%/glade/editor/select-reward-dialog.glade
%%DATADIR%%/glade/editor/armyset-window.glade
%%DATADIR%%/glade/editor/armyset-info-dialog.glade
%%DATADIR%%/shield/default/default.xml