FreeBSD Bugzilla – Attachment 88753 Details for
Bug 125590
[patch] games/lordsawar update to 0.0.9
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 9.82 KB, created by
Alex Kozlov
on 2008-07-14 06:50:03 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Alex Kozlov
Created:
2008-07-14 06:50:03 UTC
Size:
9.82 KB
patch
obsolete
>Index: games/lordsawar/files/patch-src_game.cpp >@@ -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; > } > >Index: games/lordsawar/files/patch-src_herotemplates.cpp >@@ -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; >+ } >+- >Index: games/lordsawar/Makefile >@@ -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 >Index: games/lordsawar/distinfo >@@ -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 >Index: games/lordsawar/pkg-plist >@@ -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 @@ > %%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 @@ > %%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 @@ > %%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 @@ > %%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 @@ > %%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 @@ > %%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 @@ > %%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 @@ > %%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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 125590
: 88753