Date: Fri, 14 Dec 2012 07:16:20 +0000 (UTC) From: Marcelo Araujo <araujo@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r308884 - in head/games/xevil: . files Message-ID: <201212140716.qBE7GKBo012360@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: araujo Date: Fri Dec 14 07:16:20 2012 New Revision: 308884 URL: http://svnweb.freebsd.org/changeset/ports/308884 Log: - Update MASTER_SITES. - Fix build using CLANG. - Add LICENSE. - Add MAKE_JOBS_SAFE. PR: ports/172010 Submitted by: KATO Tsuguru <tkato432@yahoo.com> Added: head/games/xevil/files/patch-cmn__coord.h (contents, props changed) head/games/xevil/files/patch-cmn__intel.h (contents, props changed) head/games/xevil/files/patch-cmn__locator.cpp (contents, props changed) head/games/xevil/files/patch-cmn__role.h (contents, props changed) head/games/xevil/files/patch-cmn__streams.h (contents, props changed) head/games/xevil/files/patch-cmn__utils.h (contents, props changed) head/games/xevil/files/patch-cmn__xetp.h (contents, props changed) head/games/xevil/files/patch-cmn__xetp_basic.cpp (contents, props changed) head/games/xevil/files/patch-cmn__xetp_basic.h (contents, props changed) head/games/xevil/files/patch-x11__draw.cpp (contents, props changed) head/games/xevil/files/patch-x11__ui.h (contents, props changed) head/games/xevil/files/patch-x11__viewport.h (contents, props changed) head/games/xevil/files/patch-x11__xdata.h (contents, props changed) Deleted: head/games/xevil/pkg-plist Modified: head/games/xevil/Makefile (contents, props changed) head/games/xevil/files/patch-ad (contents, props changed) head/games/xevil/files/patch-cmn::actual.cpp (contents, props changed) head/games/xevil/files/patch-cmn::area.cpp (contents, props changed) head/games/xevil/files/patch-cmn::game.cpp (contents, props changed) head/games/xevil/files/patch-cmn::game.h (contents, props changed) head/games/xevil/files/patch-cmn::game_style.cpp (contents, props changed) head/games/xevil/files/patch-cmn::game_style.h (contents, props changed) head/games/xevil/files/patch-cmn::intel.cpp (contents, props changed) head/games/xevil/files/patch-cmn::locator.h (contents, props changed) head/games/xevil/files/patch-cmn::physical.cpp (contents, props changed) head/games/xevil/files/patch-cmn::role.cpp (contents, props changed) head/games/xevil/files/patch-cmn::streams.cpp (contents, props changed) head/games/xevil/files/patch-cmn::utils.cpp (contents, props changed) head/games/xevil/files/patch-cmn::world.cpp (contents, props changed) head/games/xevil/files/patch-cmn::xetp.cpp (contents, props changed) head/games/xevil/files/patch-x11::l_agreement_dlg.cpp (contents, props changed) head/games/xevil/files/patch-x11::main.cpp (contents, props changed) head/games/xevil/files/patch-x11::panel.cpp (contents, props changed) head/games/xevil/files/patch-x11::serverping.cpp (contents, props changed) head/games/xevil/files/patch-x11::ui.cpp (contents, props changed) head/games/xevil/files/patch-x11::viewport.cpp (contents, props changed) head/games/xevil/files/patch-x11::xdata.cpp (contents, props changed) head/games/xevil/pkg-descr (contents, props changed) Modified: head/games/xevil/Makefile ============================================================================== --- head/games/xevil/Makefile Fri Dec 14 07:13:04 2012 (r308883) +++ head/games/xevil/Makefile Fri Dec 14 07:16:20 2012 (r308884) @@ -1,47 +1,47 @@ -# New ports collection makefile for: xevil -# Date created: 7 November 2000 -# Whom: Göran Runfeldt <goranrunfeldt@home.se> -# +# Created by: G_ran Runfeldt <goranrunfeldt@home.se> # $FreeBSD$ -# PORTNAME= xevil PORTVERSION= 2.02.r2 PORTREVISION= 2 CATEGORIES= games -MASTER_SITES= http://www.xevil.com/download/stable/ -DISTNAME= xevilsrc${PORTVERSION:S/.r/r/} +MASTER_SITES= SF/${PORTNAME}.mirror \ + http://www.xevil.com/download/stable/ +DISTNAME= ${PORTNAME}src${PORTVERSION:S/.r/r/} MAINTAINER= ports@FreeBSD.org COMMENT= A fast-action, networked, anti-social, kill-everything game -USE_ZIP= yes -USE_XORG= xpm -USE_DOS2UNIX= makefile config.mk cmn/makefile cmn/*.cpp cmn/*.h x11/makefile x11/*.cpp -MAKEFILE= makefile -ALL_TARGET= freebsd -MAKE_JOBS_UNSAFE= yes - -.include <bsd.port.pre.mk> +LICENSE= GPLv2 -# I'm not sure if this should be here -.if (${MACHINE} == "alpha") -CFLAGS+="-DXEVIL_KEYSET=UIalpha" -.endif +OPTIONS_DEFINE= DOCS -pre-extract: - @${MKDIR} ${WRKDIR}/${DISTNAME} +NO_WRKSUBDIR=yes -do-extract: - @${UNZIP_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/${DISTFILES} -d ${WRKSRC} +USE_ZIP= yes +USE_XORG= xpm +USE_DOS2UNIX= *.cpp *.h config.mk makefile +MAKEFILE= makefile +MAKE_ARGS= DEPTH="${WKRSRC}" +ALL_TARGET= ${OPSYS:L} +MAKE_JOBS_SAFE= yes + +PORTDOCS= * +PLIST_FILES= bin/${PORTNAME} + +.include <bsd.port.options.mk> + +port-patch: + @${FIND} ${WRKSRC} -name "*.xpm" | ${XARGS} ${REINPLACE_CMD} -e \ + 's|^static char|static const char|' do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/x11/FREEBSD/xevil ${PREFIX}/bin/xevil -.if !defined(NOPORTDOCS) - @${MKDIR} ${DOCSDIR} + ${INSTALL_PROGRAM} ${WRKSRC}/x11/${OPSYS:U}/${PORTNAME} ${PREFIX}/bin +.if ${PORT_OPTIONS:MDOCS} + @{MKDIR} ${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/readme.txt ${DOCSDIR} @${MKDIR} ${DOCSDIR}/instructions ${INSTALL_DATA} ${WRKSRC}/instructions/* ${DOCSDIR}/instructions .endif -.include <bsd.port.post.mk> +.include <bsd.port.mk> Modified: head/games/xevil/files/patch-ad ============================================================================== --- head/games/xevil/files/patch-ad Fri Dec 14 07:13:04 2012 (r308883) +++ head/games/xevil/files/patch-ad Fri Dec 14 07:16:20 2012 (r308884) @@ -1,6 +1,22 @@ ---- makefile.orig Sun Mar 23 00:09:08 2003 -+++ makefile Sun May 18 12:05:08 2003 -@@ -63,11 +63,6 @@ +--- makefile.orig 2012-05-27 06:39:04.000000000 +0900 ++++ makefile 2012-05-27 06:42:04.000000000 +0900 +@@ -42,9 +42,9 @@ + $(OBJ_DIR)/ui_cmn.o $(OBJ_DIR)/l_agreement_dlg.o $(OBJ_DIR)/viewport.o + + +-xevil: $(OBJ_DIR)/xevil $(OBJ_DIR)/xevil$(VERSION).$(PCKG_NAME).tar.Z ++#xevil: $(OBJ_DIR)/xevil $(OBJ_DIR)/xevil$(VERSION).$(PCKG_NAME).tar.Z + #xevil: $(OBJ_DIR)/xevil$(VERSION).$(PCKG_NAME).tar.Z +-#xevil: $(OBJ_DIR)/xevil ++xevil: $(OBJ_DIR)/xevil + + + # Build the xevil executable. +@@ -59,15 +59,9 @@ + cd $(DEPTH)/cmn; $(MAKE) + cd $(DEPTH)/x11; $(MAKE) + $(CC) $(LINK_FLAGS) $(LINK_OPT) $(LIBS_DIRS) -o $(OBJ_DIR)/xevil $(ALL_OBJS) $(LIBS) +- $(STRIP) $(OBJ_DIR)/xevil # Could also include serverping in the distribution $(OBJ_DIR)/xevil$(VERSION).$(PCKG_NAME).tar.Z:: Modified: head/games/xevil/files/patch-cmn::actual.cpp ============================================================================== --- head/games/xevil/files/patch-cmn::actual.cpp Fri Dec 14 07:13:04 2012 (r308883) +++ head/games/xevil/files/patch-cmn::actual.cpp Fri Dec 14 07:16:20 2012 (r308884) @@ -1,21 +1,208 @@ ---- cmn/actual.cpp.orig 2000-01-19 12:54:36.000000000 +0100 -+++ cmn/actual.cpp 2007-07-31 15:47:25.000000000 +0200 -@@ -32,7 +32,8 @@ +--- cmn/actual.cpp.orig 2012-05-27 06:52:29.000000000 +0900 ++++ cmn/actual.cpp 2012-05-27 06:53:11.000000000 +0900 +@@ -32,7 +32,7 @@ // Include Files #if X11 -#include <strstream.h> -+#include <strstream> -+using namespace std; ++#include <sstream> #endif #if WIN32 #include <strstrea.h> -@@ -1534,7 +1535,7 @@ +@@ -122,6 +122,7 @@ + #include "bitmaps/yeti/yeti.bitmaps" + + ++using namespace std; + + ///// Some helper macros to define creatures with certain abilities. + #define DEFINE_CREATURE_CTORS_2(CLASSNAME,ABILITY0,ability0,ABILITY1,ability1) \ +@@ -454,9 +455,9 @@ + } + } + +- ostrstream msg; +- msg << "Explosion hits " << hit << " objects." << ends; +- locator->message_enq(msg.str()); ++ stringstream msg; ++ msg << "Explosion hits " << hit << " objects."; ++ locator->message_enq(Utils::strdup(msg.str().c_str())); + + kill_self(); + Physical::act(); +@@ -1001,7 +1002,7 @@ + if (other && (other->get_class_id() != A_AltarOfSin) && + (intel = other->get_intel())) { + LocatorP locator = get_locator(); +- ostrstream str; ++ stringstream str; + + // Turned into a frog/baby seal. + if (Utils::coin_flip() && other->is_moving() && +@@ -1014,8 +1015,8 @@ + + str << intel->get_name() << " attacks the Altar of Sin and is " + << "turned into a " << (doFrog ? "frog" : "baby-seal") +- << "." << ends; +- locator->message_enq(str.str()); ++ << "."; ++ locator->message_enq(Utils::strdup(str.str().c_str())); + + other->set_intel(NULL); + if (!other->get_mapped()) { +@@ -1047,8 +1048,8 @@ + // Lose all health. + else { + str << "BLASPHMER! " << intel->get_name() << +- " loses health for daring to attack the Altar of Sin." << ends; +- locator->message_enq(str.str()); ++ " loses health for daring to attack the Altar of Sin."; ++ locator->message_enq(Utils::strdup(str.str().c_str())); + + int damage = other->get_health(); + other->corporeal_attack(this,damage); +@@ -1075,8 +1076,8 @@ + (intel = other->get_intel()) && intel->is_human()) { + int lives = intel->get_lives(); + LocatorP locator = get_locator(); +- ostrstream msg; +- ostrstream arenaMsg; ++ stringstream msg; ++ stringstream arenaMsg; + + // Choose different blessings to give. + int n = 0; +@@ -1112,8 +1113,8 @@ + } + else { + intel->set_lives(lives + 1); +- msg << intel->get_name() << " sells soul for an extra life." << ends; +- arenaMsg << "You Sold Your Soul For an Extra Life" << ends; ++ msg << intel->get_name() << " sells soul for an extra life."; ++ arenaMsg << "You Sold Your Soul For an Extra Life"; + } + break; + +@@ -1123,8 +1124,8 @@ + mod = new DoubleSpeed(); + assert(mod); + modList->append_unique(mod); +- msg << intel->get_name() << " sells soul for Double Speed." << ends; +- arenaMsg << "Double Speed" << ends; ++ msg << intel->get_name() << " sells soul for Double Speed."; ++ arenaMsg << "Double Speed"; + break; + + +@@ -1138,9 +1139,8 @@ + mod = new DoubleJump(); + assert(mod); + modList->append_unique(mod); +- msg << intel->get_name() << " sells soul for extra jumping powers." +- << ends; +- arenaMsg << "Extra Jumping Powers" << ends; ++ msg << intel->get_name() << " sells soul for extra jumping powers."; ++ arenaMsg << "Extra Jumping Powers"; + break; + + +@@ -1157,8 +1157,8 @@ + // So max health takes effect immediately. + other->heal(); + +- msg << intel->get_name() << " sells soul for Double Health." << ends; +- arenaMsg << "Double Health" << ends; ++ msg << intel->get_name() << " sells soul for Double Health."; ++ arenaMsg << "Double Health"; + break; + + +@@ -1176,8 +1176,8 @@ + // Might as well make sure they can take advantage of it now. + other->heal(); + +- msg << intel->get_name() << " sells soul for Healing Powers." << ends; +- arenaMsg << "Healing Powers" << ends; ++ msg << intel->get_name() << " sells soul for Healing Powers."; ++ arenaMsg << "Healing Powers"; + } + break; + +@@ -1193,8 +1193,8 @@ + // Already checked that other is a Creature(). + ((CreatureP)other)->add_ability(a); + +- msg << intel->get_name() << " sells soul for HellFire Powers." << ends; +- arenaMsg << "HellFire Powers" << ends; ++ msg << intel->get_name() << " sells soul for HellFire Powers."; ++ arenaMsg << "HellFire Powers"; + } + break; + +@@ -1217,8 +1217,8 @@ + // Already checked that other is a Creature(). + ((CreatureP)other)->add_ability(a); + +- msg << intel->get_name() << " sells soul for Fireballs." << ends; +- arenaMsg << "Fireballs" << ends; ++ msg << intel->get_name() << " sells soul for Fireballs."; ++ arenaMsg << "Fireballs"; + } + break; + +@@ -1241,8 +1241,8 @@ + // Already checked that other is a Creature(). + ((CreatureP)other)->add_ability(a); + +- msg << intel->get_name() << " sells soul for Flying Powers." << ends; +- arenaMsg << "Flying Powers" << ends; ++ msg << intel->get_name() << " sells soul for Flying Powers."; ++ arenaMsg << "Flying Powers"; + } + break; + +@@ -1274,8 +1274,8 @@ + // Already checked that other is a Creature(). + ((CreatureP)other)->add_ability(a); + +- msg << intel->get_name() << " sells soul for Sticky Powers." << ends; +- arenaMsg << "Sticky Powers" << ends; ++ msg << intel->get_name() << " sells soul for Sticky Powers."; ++ arenaMsg << "Sticky Powers"; + } + break; + +@@ -1285,8 +1285,8 @@ + } + } // while + +- locator->message_enq(msg.str()); +- locator->arena_message_enq(arenaMsg.str(),other); ++ locator->message_enq(Utils::strdup(msg.str().c_str())); ++ locator->arena_message_enq(Utils::strdup(arenaMsg.str().c_str()),other); + + kill_self(); + turnTaken = True; +@@ -1534,7 +1534,7 @@ void *closure) { // notThis is used to prevent transmogifying into the same class an object // already is. - ClassId notThis = (ClassId)closure; -+ ClassId notThis = (intptr_t)closure; ++ ClassId notThis = (long)closure; if (pc->classId == notThis) { return False; } +@@ -2087,10 +2087,9 @@ + PhysicalP seal = new Seal(w,l,pos); + assert(seal); + +- char sealStr[20]; +- ostrstream str(sealStr,20); +- str << "seal-" << sealsNum << ends; +- NeutralP sealIntel = new SealIntel(w,l,sealStr,homeId); ++ stringstream str; ++ str << "seal-" << sealsNum; ++ NeutralP sealIntel = new SealIntel(w,l,Utils::strdup(str.str().c_str()),homeId); + seal->set_intel(sealIntel); + l->register_neutral(sealIntel); + seals[sealsNum] = sealIntel->get_intel_id(); Modified: head/games/xevil/files/patch-cmn::area.cpp ============================================================================== --- head/games/xevil/files/patch-cmn::area.cpp Fri Dec 14 07:13:04 2012 (r308883) +++ head/games/xevil/files/patch-cmn::area.cpp Fri Dec 14 07:16:20 2012 (r308884) @@ -1,12 +1,17 @@ ---- cmn/area.cpp.orig Wed Mar 19 10:04:22 2003 -+++ cmn/area.cpp Sat Oct 25 21:39:50 2003 -@@ -34,7 +34,8 @@ +--- cmn/area.cpp.orig 2012-05-27 06:52:29.000000000 +0900 ++++ cmn/area.cpp 2012-05-27 06:53:11.000000000 +0900 +@@ -34,12 +34,13 @@ extern "C" { #include <limits.h> // For INT_MAX } -#include <iostream.h> +#include <iostream> -+using namespace std; #include "utils.h" #include "coord.h" #include "area.h" + + ++using namespace std; + + Size Area::operator - (const Area &other) const { + assert ((shape == AR_RECT) && (other.shape == AR_RECT)); Modified: head/games/xevil/files/patch-cmn::game.cpp ============================================================================== --- head/games/xevil/files/patch-cmn::game.cpp Fri Dec 14 07:13:04 2012 (r308883) +++ head/games/xevil/files/patch-cmn::game.cpp Fri Dec 14 07:16:20 2012 (r308884) @@ -1,12 +1,577 @@ ---- cmn/game.cpp.orig Sat Mar 22 22:20:00 2003 -+++ cmn/game.cpp Sat Oct 25 21:40:23 2003 -@@ -34,7 +34,8 @@ +--- cmn/game.cpp.orig 2012-05-27 06:52:29.000000000 +0900 ++++ cmn/game.cpp 2012-05-27 06:53:11.000000000 +0900 +@@ -31,16 +31,17 @@ + #include "stdafx.h" + extern "C" { + #include <string.h> ++#include <stdlib.h> } #if X11 -#include <strstream.h> -+#include <strstream> -+using namespace std; ++#include <sstream> #endif #if WIN32 #include <strstrea.h> + #endif + +-#include <iomanip.h> ++#include <iomanip> + + #include "utils.h" + #include "coord.h" +@@ -123,7 +124,7 @@ + #define SOUNDONOFF_DEFAULT True + + +-char *Game::wittySayings[Game::WITTY_SAYINGS_NUM] = { ++const char *Game::wittySayings[Game::WITTY_SAYINGS_NUM] = { + "If it moves it's a threat. If it doesn't move it's a potential threat.", + "Happy, happy. Joy, joy.", + "For the mother country!!!", +@@ -271,11 +272,19 @@ + "Prepare to Qualify.", + "I got a bad feeling about this drop.", + "Cowboys never quit!", ++ "The voices say I'm not crazy, so I'm OK!", ++ "Cure Sars!?!", ++ "Ha Ha Ha, Loser!", ++ "It's all fun and games until someone loses an eye.", ++ "Eye for an eye, tooth for a tooth.", ++ "Mo-o-m!", ++ "Timmy's touching me!", ++ "I'm not touching you! See? I'm not touching you!" + }; + + + +-char *Game::intelNames[Game::INTEL_NAMES_NUM] = { ++const char *Game::intelNames[Game::INTEL_NAMES_NUM] = { + "Dr. Pain", + "Steve", + "hardts", +@@ -350,6 +359,9 @@ + "Stan", + "Mr. Hat", + "Cid", ++ "Mr. Hankey", ++ "Michael Jackson", ++ "O.J. Simpson" + }; + + +@@ -793,7 +805,7 @@ + + // Just for tracing in the debugger. + char* version = Utils::get_OS_info(); +- delete version; ++ delete [] version; + + noUi = False; + noNewLevel = False; +@@ -1056,7 +1068,7 @@ + + Game::~Game() { + if (oneItem) { +- delete oneItem; ++ delete [] oneItem; + } + + delete ui; +@@ -1500,13 +1512,13 @@ + + if (mask & UIconnectServer) { + delete role; +- ostrstream portName; +- portName << settings.connectPort << ends; ++ stringstream portName; ++ portName << settings.connectPort; + IViewportInfo* vInfo = Ui::get_viewport_info(); +- ClientP client = new Client(settings.connectHostname,portName.str(), ++ ClientP client = new Client(settings.connectHostname, ++ Utils::strdup(portName.str().c_str()), + 0,settings.humanName,vInfo, + Connection::ADJUST_SKIP,&locator); +- delete portName.str(); + assert(client); + role = client; + ui->set_role_type(role->get_type()); +@@ -1544,10 +1556,9 @@ + } + + delete role; +- ostrstream portName; +- portName << settings.serverPort << ends; +- role = new Server(settings.localHuman,portName.str(),&locator); +- delete portName.str(); ++ stringstream portName; ++ portName << settings.serverPort; ++ role = new Server(settings.localHuman,portName.str().c_str(),&locator); + assert(role); + restartEnd = RE_RESTART; + ui->set_role_type(role->get_type()); +@@ -1573,9 +1584,9 @@ + ui->set_style(styleType); + } + +- ostrstream str; ++ stringstream str; + styleNext->describe(str); +- locator.message_enq(str.str()); ++ locator.message_enq(Utils::strdup(str.str().c_str())); + } + + +@@ -1589,9 +1600,9 @@ + human->reincarnate(); + obj->set_intel(human); + +- ostrstream msg; +- msg << human->get_name() << " is back from the dead." << ends; +- locator.message_enq(msg.str()); ++ stringstream msg; ++ msg << human->get_name() << " is back from the dead."; ++ locator.message_enq(Utils::strdup(msg.str().c_str())); + } + } + +@@ -1615,7 +1626,7 @@ + void Game::new_level_check(int enemiesPlaying) { + assert(state == gameOn); + +- ostrstream str; ++ stringstream str; + Boolean lStrChanged = False; + int val = style->new_level_check(enemiesPlaying,&world,&locator, + level,lStrChanged,str,timer, +@@ -1645,11 +1656,8 @@ + // if str has anything in it. Fucking Linux compilers. + if (lStrChanged) { + if (ui) { +- ui->set_level(str.str()); ++ ui->set_level(str.str().c_str()); + } +- // Ok to delete even if ui is NULL, str.str() will allocate the memory to +- // kill off. +- delete str.str(); + } + } + +@@ -1841,7 +1849,7 @@ + + + +-char *Game::choose_ranking(int kills) { ++const char *Game::choose_ranking(int kills) { + // Figure out the ranking set, they are listed in order. + int setNum = 0; + assert(kills >= 0 && rankingSets[0].killsMin == 0); +@@ -1876,7 +1884,7 @@ + if (showMessages) { + for (int n = 0; n < locator.humans_registered(); n++) { + HumanP human = locator.get_human(n); +- ostrstream msg; ++ stringstream msg; + + // Soups are only taken into account if you have unlimited lives. + int totalKills; +@@ -1894,11 +1902,11 @@ + totalKills = human->get_human_kills() + human->get_enemy_kills(); + } + +- char *ranking = choose_ranking(totalKills); ++ const char *ranking = choose_ranking(totalKills); + msg << totalKills << (totalKills == 1 ? "Kill" : " Kills") +- << ", Rank: " << ranking << ends; ++ << ", Rank: " << ranking; + IntelId humanIntelId = human->get_intel_id(); +- locator.arena_message_enq(msg.str(),&humanIntelId,10000); ++ locator.arena_message_enq(Utils::strdup(msg.str().c_str()),&humanIntelId,10000); + } + } + } +@@ -1919,8 +1927,8 @@ + // Will clean out non-persistent teams. + locator.level_reset(); + +- ostrstream lStr; // For level box on the side of the ui-> +- ostrstream lTitleStr; // For Ui title screen. ++ stringstream lStr; // For level box on the side of the ui-> ++ stringstream lTitleStr; // For Ui title screen. + Boolean doBonus; + + // Possibly increment level count number. +@@ -1960,7 +1968,7 @@ + if (doBonus) { + delete levelTitleStored; // If it already exists. + // Store levelTitle string for later use. +- levelTitleStored = lTitleStr.str(); ++ levelTitleStored = Utils::strdup(lTitleStr.str().c_str()); + + // Tell user about the bonus. + award_bonuses_now(); +@@ -1970,13 +1978,12 @@ + } + // Go to getBearings state. + else { +- get_bearings(lTitleStr.str()); ++ get_bearings(Utils::strdup(lTitleStr.str().c_str())); + } + + if (ui) { +- ui->set_level(lStr.str()); ++ ui->set_level(lStr.str().c_str()); + } +- delete lStr.str(); + + // Will pass in more info later. + role->new_level(this,&world,&locator); +@@ -1997,7 +2004,7 @@ + continue; + } + +- char* awardMsg = NULL; ++ const char* awardMsg = NULL; + int count = 0; + while (!awardMsg && count < AWARD_BONUS_TRIES) { + count++; +@@ -2184,9 +2191,9 @@ + + // Moved resetting world rooms to new_level(); + +- ostrstream msg; +- msg << wittySayings[Utils::choose(WITTY_SAYINGS_NUM)] << ends; +- locator.message_enq(msg.str()); ++ stringstream msg; ++ msg << wittySayings[Utils::choose(WITTY_SAYINGS_NUM)]; ++ locator.message_enq(Utils::strdup(msg.str().c_str())); + + /* Don't need to call Ui::set_* because the new values originally came + from ui-> */ +@@ -2242,41 +2249,39 @@ + { // Right keys. + right[n][which] = 0; + +- ostrstream strm; ++ stringstream strm; + if (which == 0) +- strm << "right_" << keysNames[n] << ends; ++ strm << "right_" << keysNames[n]; + else +- strm << "right_" << keysNames[n] << "_2" << ends; +- char *option = strm.str(); ++ strm << "right_" << keysNames[n] << "_2"; ++ const string & option = strm.str(); + + // Should we free value?? +- char *value = XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option); ++ char *value = XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option.c_str()); + if (value) { + KeySym keysym = XStringToKeysym(value); + if (keysym != NoSymbol) + right[n][which] = keysym; + } +- delete option; + } + + { // Left Keys. + left[n][which] = 0; + +- ostrstream strm; ++ stringstream strm; + if (which == 0) +- strm << "left_" << keysNames[n] << ends; ++ strm << "left_" << keysNames[n]; + else +- strm << "left_" << keysNames[n] << "_2" << ends; +- char *option = strm.str(); ++ strm << "left_" << keysNames[n] << "_2"; ++ const string & option = strm.str(); + + // Should we free value?? +- char *value = XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option); ++ char *value = XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option.c_str()); + if (value) { + KeySym keysym = XStringToKeysym(value); + if (keysym != NoSymbol) + left[n][which] = keysym; + } +- delete option; + } + } + +@@ -2291,10 +2296,10 @@ + void Game::parse_args(int *argc,char **argv) { + // Create a bunch of "-name<x>" strings for comparing with command-line + // args. +- ostrstream dashName[Locator::HUMANS_MAX]; ++ stringstream dashName[Locator::HUMANS_MAX]; + int n; + for (n = 0; n < Locator::HUMANS_MAX; n++) { +- dashName[n] << "-name" << n << ends; ++ dashName[n] << "-name" << n; + } + + // Defaults +@@ -2351,7 +2356,7 @@ + // Check "-name<x>" arguments. + else { + for (int j = 0; j < Locator::HUMANS_MAX; j++) { +- if ((! strcmp(dashName[j].str(),argv[n])) && (n + 1 < *argc)) { ++ if ((! strcmp(dashName[j].str().c_str(),argv[n])) && (n + 1 < *argc)) { + humanNames[j] = Utils::strdup(argv[n+1]); + n++; + } +@@ -2728,12 +2733,6 @@ + n++; + } + } // for +- +- +- // Delete memory for "-name" strings. +- for (n = 0; n < Locator::HUMANS_MAX; n++) { +- delete dashName[n].str(); +- } + } + + +@@ -2741,15 +2740,15 @@ + char **Game::display_names(int *argc,char **argv) { + + #if X11 +- ostrstream dashDisplay[UI_VIEWPORTS_MAX][2]; ++ stringstream dashDisplay[UI_VIEWPORTS_MAX][2]; + char **displayNames = new charP [UI_VIEWPORTS_MAX]; + + int n; + for (n = 0; n < UI_VIEWPORTS_MAX; n++) { + displayNames[n] = new char [Xvars::DISPLAY_NAME_LENGTH]; + strcpy(displayNames[n],""); +- dashDisplay[n][0] << "-display" << n << ends; +- dashDisplay[n][1] << "-d" << n << ends; ++ dashDisplay[n][0] << "-display" << n; ++ dashDisplay[n][1] << "-d" << n; + } + + // Loop through all command line arguments. +@@ -2765,7 +2764,7 @@ + // Set display name for one viewport. + for (int m = 0; m < UI_VIEWPORTS_MAX; m++) { + for (int which = 0; which < 2; which++) { +- if (!strcmp(argv[n],dashDisplay[m][which].str())) { ++ if (!strcmp(argv[n],dashDisplay[m][which].str().c_str())) { + assert(strlen(argv[n+1]) < Xvars::DISPLAY_NAME_LENGTH); + strcpy(displayNames[m],argv[n+1]); + } +@@ -2773,11 +2772,6 @@ + } + } + +- for (n = 0; n < UI_VIEWPORTS_MAX; n++) { +- for (int which = 0; which < 2; which++) { +- delete dashDisplay[n][which].str(); +- } +- } + return displayNames; + #endif + +@@ -2890,7 +2884,7 @@ + assert(role->get_type() != R_CLIENT); + + // Choose random name if -name was not specified for this player. +- char *nameNonPc = ++ const char *nameNonPc = + Utils::strlen(humanNames[h]) ? + humanNames[h] : + intelNames[intelNamesIndices[h % INTEL_NAMES_NUM]]; +@@ -2954,13 +2948,12 @@ + + // Put message in the status bar when the game starts up. + // Use \n in string for locator.message_enq. +- ostrstream msg; ++ stringstream msg; + msg + << "XEvil(TM) " << VERSION + << " http://www.xevil.com satan@xevil.com " << XETP::versionStr << "\n" +- << "Copyright(C) 1994,2000 Steve Hardt and Michael Judge" +- << ends; +- locator.message_enq(msg.str()); ++ << "Copyright(C) 1994,2000 Steve Hardt and Michael Judge"; ++ locator.message_enq(Utils::strdup(msg.str().c_str())); + + + // Print message to standard out. Doesn't really do anything on Windows. +@@ -3075,11 +3068,10 @@ + IntelOptions ops; + ITmask opMask = intel_options_for(ops,obj->get_class_id()); + +- ostrstream name; +- name << "Machine-" << (enemyNameCount++) << ends; +- EnemyP enemy = new Enemy(&world,&locator,name.str(),&ops,opMask); ++ stringstream name; ++ name << "Machine-" << (enemyNameCount++); ++ EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),&ops,opMask); + assert(enemy); +- delete name.str(); + locator.register_enemy(enemy); + + if (addToLocator) { +@@ -3235,14 +3227,13 @@ + switch (Utils::choose(8)) { + case 0: { // A bunch of Heros and an Alien. + for (int n = 0; n < 10; n++) { +- ostrstream name; +- name << "Enemy-" << n << ends; ++ stringstream name; ++ name << "Enemy-" << n; + IntelOptions ops; + ops.harmless = True; +- EnemyP enemy = new Enemy(&world,&locator,name.str(), ++ EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(), + &ops,ITharmless); + assert(enemy); +- delete name.str(); + locator.register_enemy(enemy); + + Pos pos = world.empty_rect(Hero::get_size_max()); +@@ -3268,16 +3259,15 @@ + + case 1: { // Hero, FThrower, and a bunch of Frogs (does not mean Frenchmen). + for (int n = 0; n < 15; n++) { +- ostrstream name; +- name << "Enemy-" << n << ends; ++ stringstream name; ++ name << "Enemy-" << n; + IntelOptions ops; + ops.psychotic = Utils::coin_flip(); +- EnemyP enemy = new Enemy(&world,&locator,name.str(), ++ EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(), + &ops,ITpsychotic); + assert(enemy); +- delete name.str(); + locator.register_enemy(enemy); +- ++ + Pos pos = world.empty_rect(Frog::get_size_max()); + PhysicalP obj = new Frog(&world,&locator,pos); + assert(obj); +@@ -3304,15 +3294,14 @@ + case 2: { // A bunch of Enforcers. + for (int n = 0; n < 10; n++) + { +- ostrstream name; +- name << "Enemy-" << n << ends; ++ stringstream name; ++ name << "Enemy-" << n; + IntelOptions ops; + ops.classFriends = False; + ops.psychotic = True; +- EnemyP enemy = new Enemy(&world,&locator,name.str(), ++ EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(), + &ops,ITclassFriends|ITpsychotic); + assert(enemy); +- delete name.str(); + locator.register_enemy(enemy); + + Pos pos = world.empty_rect(Enforcer::get_size_max()); +@@ -3327,14 +3316,13 @@ + + case 3: { // A bunch of Ninjas and a chainsaw. + for (int n = 0; n < 10; n++) { +- ostrstream name; +- name << "Enemy-" << n << ends; ++ stringstream name; ++ name << "Enemy-" << n; + IntelOptions ops; + ops.classFriends = False; +- EnemyP enemy = new Enemy(&world,&locator,name.str(), ++ EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(), + &ops,ITclassFriends); + assert(enemy); +- delete name.str(); + locator.register_enemy(enemy); + + Pos pos = world.empty_rect(Ninja::get_size_max()); +@@ -3373,12 +3361,11 @@ + } + + for (int m = 0; m < 10; m++) { +- ostrstream name; +- name << "Enemy-" << m << ends; +- EnemyP enemy = new Enemy(&world,&locator,name.str(), ++ stringstream name; ++ name << "Enemy-" << m; ++ EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(), + NULL,ITnone); + assert(enemy); +- delete name.str(); + locator.register_enemy(enemy); + + Pos pos = world.empty_rect(Hero::get_size_max()); +@@ -3414,14 +3401,13 @@ + case 5: { // Ninjas and ChopperBoys. + int n; + for (n = 0; n < 10; n++) { +- ostrstream name; +- name << "Enemy-" << n << ends; ++ stringstream name; ++ name << "Enemy-" << n; + IntelOptions ops; + ops.classFriends = False; +- EnemyP enemy = new Enemy(&world,&locator,name.str(), ++ EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(), + &ops,ITclassFriends); + assert(enemy); +- delete name.str(); + locator.register_enemy(enemy); + + PhysicalP obj; +@@ -3458,11 +3444,10 @@ + // and the scenario isn't set up yet. + + for (n = 0; n < 9; n++) { +- ostrstream name; +- name << "Dog-" << n << ends; +- EnemyP intel = new Enemy(&world,&locator,name.str(),NULL,ITnone); ++ stringstream name; ++ name << "Dog-" << n; ++ EnemyP intel = new Enemy(&world,&locator,name.str().c_str(),NULL,ITnone); + assert(intel); +- delete name.str(); + locator.register_enemy(intel); + + Pos pos = world.empty_rect(Dog::get_size_max()); +@@ -3473,13 +3458,12 @@ + } + + for (n = 0; n < 3; n++) { +- ostrstream name; +- name << "Enemy-" << n << ends; ++ stringstream name; ++ name << "Enemy-" << n; + IntelOptions ops; + ops.harmless = True; +- EnemyP enemy = new Enemy(&world,&locator,name.str(),&ops,ITharmless); ++ EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),&ops,ITharmless); + assert(enemy); +- delete name.str(); + locator.register_enemy(enemy); + + PhysicalP obj; +@@ -3510,13 +3494,12 @@ + Segmented::create_and_add_composite(ret,&world,&locator,Dragon::SEGMENTS_NUM,pos, + Dragon::create,NULL); + for (int m = 0; m < ret.length(); m++) { +- ostrstream name; +- name << "Enemy-" << n << ends; ++ stringstream name; ++ name << "Enemy-" << n; + IntelOptions ops; + ops.harmless = True; +- EnemyP enemy = new Enemy(&world,&locator,name.str(),&ops,ITharmless); ++ EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),&ops,ITharmless); + assert(enemy); +- delete name.str(); + locator.register_enemy(enemy); + PhysicalP p = (PhysicalP)ret.get(m); + p->set_intel(enemy); Modified: head/games/xevil/files/patch-cmn::game.h ============================================================================== --- head/games/xevil/files/patch-cmn::game.h Fri Dec 14 07:13:04 2012 (r308883) +++ head/games/xevil/files/patch-cmn::game.h Fri Dec 14 07:16:20 2012 (r308884) @@ -1,12 +1,51 @@ ---- cmn/game.h.dist Sat Mar 22 20:44:32 2003 -+++ cmn/game.h Sat Oct 25 21:40:54 2003 -@@ -35,7 +35,8 @@ +--- cmn/game.h.orig 2012-05-27 06:52:31.000000000 +0900 ++++ cmn/game.h 2012-05-27 06:53:11.000000000 +0900 +@@ -35,7 +35,7 @@ extern "C" { #include <time.h> } -#include <iostream.h> +#include <iostream> -+using namespace std; #include "utils.h" #include "ui.h" #include "world.h" +@@ -136,7 +136,7 @@ + struct RankingSet { + enum {RANKING_SET_MAX = 8}; // Max number of rankings in a set. + int killsMin; // Min number of kills to get this rank. +- char *rankings[RANKING_SET_MAX + 1]; // Extra for NULL. ++ const char *rankings[RANKING_SET_MAX + 1]; // Extra for NULL. + }; + + +@@ -268,8 +268,8 @@ + + private: + enum { +- WITTY_SAYINGS_NUM = 147, +- INTEL_NAMES_NUM = 74, ++ WITTY_SAYINGS_NUM = 155, ++ INTEL_NAMES_NUM = 77, + RANKING_SETS_NUM = 12, + }; + +@@ -306,7 +306,7 @@ + static Boolean potential_enemy_filter(const PhysicalContext* pc,void*); + /* EFFECTS: Filter those classes whose potentialEnemy flag is True. */ + +- char *choose_ranking(int kills); ++ const char *choose_ranking(int kills); + /* EFFECTS: Choose a rank for the player at the end of game based on the + number of kills. */ + +@@ -412,8 +412,8 @@ + SoundName currentSoundName; + //keeps track of current sound track being played: can be 0 + +- static char *wittySayings[WITTY_SAYINGS_NUM]; +- static char *intelNames[INTEL_NAMES_NUM]; ++ static const char *wittySayings[WITTY_SAYINGS_NUM]; ++ static const char *intelNames[INTEL_NAMES_NUM]; + static DifficultyLevel difficultyLevels[DIFFICULTY_LEVELS_NUM]; + static RankingSet rankingSets[RANKING_SETS_NUM]; + Modified: head/games/xevil/files/patch-cmn::game_style.cpp ============================================================================== --- head/games/xevil/files/patch-cmn::game_style.cpp Fri Dec 14 07:13:04 2012 (r308883) +++ head/games/xevil/files/patch-cmn::game_style.cpp Fri Dec 14 07:16:20 2012 (r308884) @@ -1,21 +1,911 @@ ---- cmn/game_style.cpp.orig 2003-03-22 20:47:42.000000000 +0100 -+++ cmn/game_style.cpp 2007-07-31 15:57:08.000000000 +0200 -@@ -34,7 +34,8 @@ +--- cmn/game_style.cpp.orig 2012-05-27 06:52:29.000000000 +0900 ++++ cmn/game_style.cpp 2012-05-27 06:53:11.000000000 +0900 +@@ -33,15 +33,9 @@ + #include <string.h> *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212140716.qBE7GKBo012360>