Fix Segmentation Fault & Formatting

This commit is contained in:
Anthony Calosa
2015-11-10 11:58:36 +08:00
parent 406f68ac5b
commit cd1b629191
71 changed files with 769 additions and 769 deletions
+4 -4
View File
@@ -960,12 +960,12 @@ private:
else if (s == "morethanfourcards")
{
if(card->playerTarget)
{//blackvise
{//blackvise
intValue = 0;
if ((card->playerTarget->game->hand->nb_cards - 4)>0)
intValue = (card->playerTarget->game->hand->nb_cards - 4);
}
else
else
{//viseling
intValue = 0;
if ((card->controller()->opponent()->game->hand->nb_cards - 4)>0)
@@ -1306,7 +1306,7 @@ public:
class TrcardDrawn: public Trigger
{
public:
bool thiscontroller, thisopponent;
bool thiscontroller, thisopponent;
TrcardDrawn(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc,bool once = false, bool thiscontroller = false, bool thisopponent = false) :
Trigger(observer, id, source,once, tc),thiscontroller(thiscontroller),thisopponent(thisopponent)
{
@@ -4721,7 +4721,7 @@ public:
vector<int> dontremove;
bool addNewColors;
bool remove;
bool removeCreatureSubtypes;
bool removeCreatureSubtypes;
bool removeTypes;
string menu;
+26 -26
View File
@@ -21,18 +21,18 @@ private:
string mText;
float mX;
float mY;
float mTitleResetWidth;
float mTitleResetWidth;
string mDescription;
static float mYOffset;
float mScrollerOffset;
DeckMetaData *mMetaData;
string mImageFilename;
string mImageFilename;
void checkUserClick();
public:
DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false, DeckMetaData *meta = NULL);
DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, float x, float y, bool hasFocus = false, bool autoTranslate = false, DeckMetaData *meta = NULL);
~DeckMenuItem();
virtual void Relocate(float x, float y);
@@ -44,39 +44,39 @@ public:
virtual bool ButtonPressed();
virtual ostream& toString(ostream& out) const;
virtual bool getTopLeft(float& top, float& left)
virtual bool getTopLeft(float& top, float& left)
{
top = mY + mYOffset;
left = mX;
return true;
}
// Accessors
string getImageFilename() const { return mImageFilename; };
float getY() const { return mY; };
float getX() const { return mX; };
string getDescription() const { return mDescription; };
string getText() const { return mText; };
bool hasFocus() const { return mHasFocus; };
bool hasMetaData() const { return mMetaData == NULL ? false : true;};
// Accessors
string getImageFilename() const { return mImageFilename; };
float getY() const { return mY; };
float getX() const { return mX; };
string getDescription() const { return mDescription; };
string getText() const { return mText; };
bool hasFocus() const { return mHasFocus; };
bool hasMetaData() const { return mMetaData == NULL ? false : true;};
float getWidth() const;
string getDeckName() const;
float getWidth() const;
string getDeckName() const;
string getDeckStatsSummary() const
{
if (mMetaData)
return mMetaData->getStatsSummary();
return "";
}
string getDeckStatsSummary() const
{
if (mMetaData)
return mMetaData->getStatsSummary();
return "";
}
DeckMetaData *getMetaData() const
{
return mMetaData;
}
DeckMetaData *getMetaData() const
{
return mMetaData;
}
// Setters
// Setters
void setDescription( const string& description ) { mDescription = description; }
};
+6 -6
View File
@@ -29,7 +29,7 @@ protected:
GuiAvatars * avatars;
GameObserver* observer;
MTGGamePhase* phaseHandler;
int mPlayerViewIndex;
int mPlayerViewIndex;
CardSelectorBase* mCardSelector;
public:
@@ -48,11 +48,11 @@ public:
void Remove();
int receiveEvent(WEvent * e);
float RightBoundary();
int getPlayerViewIndex(){ return mPlayerViewIndex; };
Player* getRenderedPlayer();
Player* getRenderedPlayerOpponent();
CardSelectorBase* getCardSelector() { return mCardSelector; };
GameObserver* getObserver(){ return observer; };
int getPlayerViewIndex(){ return mPlayerViewIndex; };
Player* getRenderedPlayer();
Player* getRenderedPlayerOpponent();
CardSelectorBase* getCardSelector() { return mCardSelector; };
GameObserver* getObserver(){ return observer; };
};
#include "ActionLayer.h"
+1 -1
View File
@@ -169,7 +169,7 @@ public:
class MillExileCost : public MillCost
{
public:
MillExileCost(TargetChooser *_tc = NULL);
MillExileCost(TargetChooser *_tc = NULL);
virtual int doPay();
};
+15 -15
View File
@@ -190,23 +190,23 @@ class GameObserver{
class NetworkGameObserver : public GameObserver
{
protected:
JNetwork* mpNetworkSession;
bool mSynchronized;
bool mForwardAction;
virtual void logAction(const string& s);
JNetwork* mpNetworkSession;
bool mSynchronized;
bool mForwardAction;
virtual void logAction(const string& s);
public:
// no serverIp means a server is being instantiated, otherwise a client
NetworkGameObserver(JNetwork* pNetwork, WResourceManager* output = 0, JGE* input = 0);
virtual ~NetworkGameObserver();
virtual void loadPlayer(int playerId, Player* player);
virtual void Update(float dt);
void synchronize();
static void loadPlayer(void*pThis, stringstream& in, stringstream& out);
static void sendAction(void*pThis, stringstream& in, stringstream& out);
static void synchronize(void*pThis, stringstream& in, stringstream& out);
static void checkSynchro(void*pxThis, stringstream& in, stringstream& out);
// no serverIp means a server is being instantiated, otherwise a client
NetworkGameObserver(JNetwork* pNetwork, WResourceManager* output = 0, JGE* input = 0);
virtual ~NetworkGameObserver();
virtual void loadPlayer(int playerId, Player* player);
virtual void Update(float dt);
void synchronize();
static void loadPlayer(void*pThis, stringstream& in, stringstream& out);
static void sendAction(void*pThis, stringstream& in, stringstream& out);
static void synchronize(void*pThis, stringstream& in, stringstream& out);
static void checkSynchro(void*pxThis, stringstream& in, stringstream& out);
static void ignoreResponse(void*, stringstream&, stringstream&){};
static void disconnect(void*pxThis, stringstream& in, stringstream& out);
static void disconnect(void*pxThis, stringstream& in, stringstream& out);
};
#endif
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef _GAME_STATE_H_
#define _GAME_STATE_H_
#define FADING_SPEED 350.0f
#define FADING_SPEED 350.0f
class JGE;
+2 -2
View File
@@ -16,8 +16,8 @@
using std::string;
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
const int kDismissButtonId = 10000;
const int kToggleDeckActionId = 10001;
+3 -3
View File
@@ -211,8 +211,8 @@ public:
MORPH_COST = 28,
SUSPEND_COST = 29,
COUNTERS = 30,
PUT_INTO_PLAY_WITH_KICKER = 31,
STANDARD_FIZZLER = 32,
PUT_INTO_PLAY_WITH_KICKER = 31,
STANDARD_FIZZLER = 32,
PAYZERO_COST = 33,
OVERLOAD_COST = 34,
BESTOW_COST = 35,
@@ -463,7 +463,7 @@ public:
int parseRestriction(string s);
int parseCastRestrictions(MTGCardInstance * card, Player * player, string restrictions);
Counter * parseCounter(string s, MTGCardInstance * target, Spell * spell = NULL);
int parsePowerToughness(string s, int *power, int *toughness);
int parsePowerToughness(string s, int *power, int *toughness);
int getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCardInstance * card = NULL, int id = 0, MTGGameZone * dest = NULL);
MTGAbility* parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, bool activated = false, bool forceUEOT = false, MTGGameZone * dest = NULL);
int abilityEfficiency(MTGAbility * a, Player * p, int mode = MODE_ABILITY, TargetChooser * tc = NULL,Targetable * target = NULL);
+12 -12
View File
@@ -276,21 +276,21 @@ class Constants
GRADE_UNSUPPORTED = 4,
GRADE_DANGEROUS = 5,
ASKIP_NONE=0,
ASKIP_SAFE=1,
ASKIP_FULL=2,
WHO_P=0,
WHO_O=1,
WHO_R=2,
KICKER_ALWAYS=0,
KICKER_CHOICE=1,
ASKIP_NONE=0,
ASKIP_SAFE=1,
ASKIP_FULL=2,
WHO_P=0,
WHO_O=1,
WHO_R=2,
KICKER_ALWAYS=0,
KICKER_CHOICE=1,
};
enum
{
{
NOT_CAST = 0,
CAST_NORMALLY = 1,
CAST_WITH_KICKER = 2,
+16 -16
View File
@@ -180,7 +180,7 @@ class MTGPayZeroRule: public MTGAlternativeCostRule
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
string CustomName;
string CustomName;
virtual ostream& toString(ostream& out) const;
MTGPayZeroRule(GameObserver* observer, int _id);
const string getMenuText()
@@ -436,28 +436,28 @@ private:
vector<int> pool[20];
int initialized;
public:
MTGAllCards * collection;
MTGCardInstance * genEquip(int id);
MTGAllCards * collection;
MTGCardInstance * genEquip(int id);
MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCards * _collection);
int receiveEvent(WEvent * event);
const string getMenuText()
{
return "Stone Hewer";
}
virtual ostream& toString(ostream& out) const;
virtual MTGStoneHewerRule * clone() const;
int receiveEvent(WEvent * event);
const string getMenuText()
{
return "Stone Hewer";
}
virtual ostream& toString(ostream& out) const;
virtual MTGStoneHewerRule * clone() const;
};
//Hermit Druid avatar mode
class MTGHermitRule: public PermanentAbility
{
public:
MTGHermitRule(GameObserver* observer, int _id);
int receiveEvent(WEvent * event);
const string getMenuText()
{
return "Hermit";
}
virtual MTGHermitRule * clone() const;
int receiveEvent(WEvent * event);
const string getMenuText()
{
return "Hermit";
}
virtual MTGHermitRule * clone() const;
};
//
/* LifeLink */
+16 -16
View File
@@ -54,29 +54,29 @@ public:
};
ExtraCosts * extraCosts;
ManaCost * getAlternative(){ return alternative; };
void setAlternative(ManaCost * aMana){ SAFE_DELETE(alternative); alternative = aMana;};
ManaCost * getAlternative(){ return alternative; };
void setAlternative(ManaCost * aMana){ SAFE_DELETE(alternative); alternative = aMana;};
ManaCost * getKicker(){ return kicker; };
void setKicker(ManaCost * aMana){ SAFE_DELETE(kicker); kicker = aMana;};
ManaCost * getKicker(){ return kicker; };
void setKicker(ManaCost * aMana){ SAFE_DELETE(kicker); kicker = aMana;};
ManaCost * getBuyback(){ return BuyBack; };
void setBuyback(ManaCost * aMana){ SAFE_DELETE(BuyBack); BuyBack = aMana;};
ManaCost * getBuyback(){ return BuyBack; };
void setBuyback(ManaCost * aMana){ SAFE_DELETE(BuyBack); BuyBack = aMana;};
ManaCost * getFlashback(){ return FlashBack; };
void setFlashback(ManaCost * aMana){ SAFE_DELETE(FlashBack); FlashBack = aMana;};
ManaCost * getFlashback(){ return FlashBack; };
void setFlashback(ManaCost * aMana){ SAFE_DELETE(FlashBack); FlashBack = aMana;};
ManaCost * getRetrace(){ return Retrace; };
void setRetrace(ManaCost * aMana){ SAFE_DELETE(Retrace); Retrace = aMana;};
ManaCost * getRetrace(){ return Retrace; };
void setRetrace(ManaCost * aMana){ SAFE_DELETE(Retrace); Retrace = aMana;};
ManaCost * getMorph(){ return morph; };
void setMorph(ManaCost * aMana){ SAFE_DELETE(morph); morph = aMana;};
ManaCost * getMorph(){ return morph; };
void setMorph(ManaCost * aMana){ SAFE_DELETE(morph); morph = aMana;};
ManaCost * getSuspend(){ return suspend; };
void setSuspend(ManaCost * aMana){ SAFE_DELETE(suspend); suspend = aMana;};
ManaCost * getSuspend(){ return suspend; };
void setSuspend(ManaCost * aMana){ SAFE_DELETE(suspend); suspend = aMana;};
ManaCost * getManaUsedToCast(){ return manaUsedToCast; };
void setManaUsedToCast(ManaCost * aMana){ SAFE_DELETE(manaUsedToCast); manaUsedToCast = aMana;};
ManaCost * getManaUsedToCast(){ return manaUsedToCast; };
void setManaUsedToCast(ManaCost * aMana){ SAFE_DELETE(manaUsedToCast); manaUsedToCast = aMana;};
string alternativeName;
bool isMulti;
+2 -2
View File
@@ -7,8 +7,8 @@
#include <string>
using namespace std;
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
class hgeParticleSystem;
+4 -4
View File
@@ -109,11 +109,11 @@ public:
int mFontSize;
bool mFont;
PIXEL_TYPE mFontColor;
/*Icons attributes*/
/*Icons attributes*/
int mSizeIcon;
int mIconPosX;
int mIconPosY;
string mFileName;
int mIconPosX;
int mIconPosY;
string mFileName;
ModRulesRenderCardGuiItem(string name, int posX, int posY, string formattedData, string filter, bool font, int fontSize, PIXEL_TYPE fontColor, int SizeIcon,int IconPosX,int IconPosY,string FileName);
};
+1 -1
View File
@@ -111,7 +111,7 @@ public:
std::string GetCurrentDeckStatsFile();
virtual bool parseLine(const string& s);
friend ostream& operator<<(ostream&, const Player&);
friend istream& operator>>(istream&, Player&);
friend istream& operator>>(istream&, Player&);
bool operator<(Player& aPlayer);
bool isDead();
};
+5 -5
View File
@@ -57,17 +57,17 @@ public:
};
string bg;
string filename;
string filename;
GameType gamemode;
bool hidden;
string displayName;
int unlockOption;
string displayName;
int unlockOption;
string mUnlockOptionString;
static vector<Rules *> RulesList;
static vector<Rules *> RulesList;
Rules(string bg = "");
int load(string _filename);
static int loadAllRules();
static int loadAllRules();
static void unloadAllRules();
static Rules * getRulesByFilename(string _filename);
void initPlayers(GameObserver *observer);
+5 -5
View File
@@ -15,11 +15,11 @@
using std::string;
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
#define SCALE_SHRINK 0.75f
#define SCALE_SELECTED_LARGE 1.7F
#define SCALE_LARGE_NORMAL 1.5F
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
#define SCALE_SHRINK 0.75f
#define SCALE_SELECTED_LARGE 1.7f
#define SCALE_LARGE_NORMAL 1.5f
class SimpleButton: public JGuiObject
{
+2 -2
View File
@@ -9,8 +9,8 @@
using std::string;
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
class SimpleMenuItem: public SimpleButton
{
+5 -5
View File
@@ -114,7 +114,7 @@ class ThisAttacked:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);
ThisAttacked(int attack);
ThisAttacked(int attack);
ThisAttacked * clone() const;
};
@@ -122,7 +122,7 @@ class ThisBlocked:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);
ThisBlocked(int block);
ThisBlocked(int block);
ThisBlocked * clone() const;
};
@@ -130,7 +130,7 @@ class ThisNotBlocked:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);
ThisNotBlocked(int unblocked);
ThisNotBlocked(int unblocked);
ThisNotBlocked * clone() const;
};
@@ -138,7 +138,7 @@ class ThisDamaged:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);
ThisDamaged(int wasDealtDamage);
ThisDamaged(int wasDealtDamage);
ThisDamaged * clone() const;
};
@@ -146,7 +146,7 @@ class ThisDualWield:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);
ThisDualWield(int dualWield);
ThisDualWield(int dualWield);
ThisDualWield * clone() const;
};
+13 -13
View File
@@ -151,33 +151,33 @@ struct WEventCreatureAttacker : public WEventCardUpdate {
//event when card attacks.
struct WEventCardAttacked : public WEventCardUpdate {
WEventCardAttacked(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
virtual Targetable * getTarget(int target);
};
//event when card attacks alone.
struct WEventCardAttackedAlone : public WEventCardUpdate {
WEventCardAttackedAlone(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
virtual Targetable * getTarget(int target);
};
//event when card attacks but is not blocked.
struct WEventCardAttackedNotBlocked : public WEventCardUpdate {
WEventCardAttackedNotBlocked(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
virtual Targetable * getTarget(int target);
};
//event when card attacks but is blocked.
struct WEventCardAttackedBlocked : public WEventCardUpdate {
WEventCardAttackedBlocked(MTGCardInstance * card,MTGCardInstance * opponent);
MTGCardInstance * opponent;
virtual Targetable * getTarget(int target);
virtual Targetable * getTarget(int target);
};
//event when card blocked.
struct WEventCardBlocked : public WEventCardUpdate {
WEventCardBlocked(MTGCardInstance * card,MTGCardInstance * opponent);
MTGCardInstance * opponent;
virtual Targetable * getTarget(int target);
virtual Targetable * getTarget(int target);
};
//event when card is sacrificed.
@@ -190,13 +190,13 @@ struct WEventCardSacrifice : public WEventCardUpdate {
//event when card is discarded.
struct WEventCardDiscard : public WEventCardUpdate {
WEventCardDiscard(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
virtual Targetable * getTarget(int target);
};
//event when card is cycled.
struct WEventCardCycle : public WEventCardUpdate {
WEventCardCycle(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
virtual Targetable * getTarget(int target);
};
//Event when a card's "defenser" status changes
@@ -219,9 +219,9 @@ struct WEventBlockersChosen : public WEvent {
};
struct WEventcardDraw : public WEvent {
WEventcardDraw(Player * player,int nb_cards);
Player * player;
int nb_cards;
WEventcardDraw(Player * player,int nb_cards);
Player * player;
int nb_cards;
using WEvent::getTarget;
virtual Targetable * getTarget(Player * player);
};
@@ -276,19 +276,19 @@ struct WEventEmptyManaPool : public WEvent {
//event when card-equipment unattached
struct WEventCardUnattached : public WEventCardUpdate {
WEventCardUnattached(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
virtual Targetable * getTarget(int target);
};
//event when card-equipment attached/equipped
struct WEventCardEquipped : public WEventCardUpdate {
WEventCardEquipped(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
virtual Targetable * getTarget(int target);
};
//event when card moves from player/opponent battlefield to player/opponent battlefield
struct WEventCardControllerChange : public WEventCardUpdate {
WEventCardControllerChange(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
virtual Targetable * getTarget(int target);
};
std::ostream& operator<<(std::ostream&, const WEvent&);
+1 -1
View File
@@ -173,7 +173,7 @@ protected:
int *mGBCode;
int mCurr;
PIXEL_TYPE* mCharBuffer;
PIXEL_TYPE* mCharBuffer;
virtual int PreCacheChar(const u8 *ch);
};
+15 -15
View File
@@ -21,7 +21,7 @@ enum ENUM_WRES_INFO
enum ENUM_RETRIEVE_STYLE
{
RETRIEVE_EXISTING, //Only returns a resource if it already exists. Does not lock or unlock.
RETRIEVE_EXISTING, //Only returns a resource if it already exists. Does not lock or unlock.
RETRIEVE_NORMAL, //Returns or creates a resource. Does not change lock status.
RETRIEVE_LOCK, //As above, locks cached resource. Not for quads.
RETRIEVE_UNLOCK, //As above, unlocks cached resource. Not for quads.
@@ -33,7 +33,7 @@ enum ENUM_RETRIEVE_STYLE
enum ENUM_CACHE_SUBTYPE
{
CACHE_NORMAL = (1<<0), //Use default values. Not really a flag.
CACHE_NORMAL = (1<<0), //Use default values. Not really a flag.
//CACHE_EXISTING = (1<<1), //Retrieve it only if it already exists
//Because these bits only modify how a cached resource's Attempt() is called,
@@ -51,8 +51,8 @@ enum ENUM_CACHE_ERROR
CACHE_ERROR_NONE = 0,
CACHE_ERROR_NOT_CACHED = CACHE_ERROR_NONE,
CACHE_ERROR_404,
CACHE_ERROR_BAD, //Something went wrong with item->attempt()
CACHE_ERROR_BAD_ALLOC, //Couldn't allocate item
CACHE_ERROR_BAD, //Something went wrong with item->attempt()
CACHE_ERROR_BAD_ALLOC, //Couldn't allocate item
CACHE_ERROR_LOST,
CACHE_ERROR_NOT_MANAGED,
};
@@ -69,16 +69,16 @@ public:
static void Terminate();
virtual ~WResourceManager()
{
}
{
}
virtual bool IsThreaded() = 0;
void PlaySample(const string& fileName) {
JSample*sample = RetrieveSample(fileName);
if(sample) {
JSoundSystem::GetInstance()->PlaySample(sample);
}
};
void PlaySample(const string& fileName) {
JSample*sample = RetrieveSample(fileName);
if(sample) {
JSoundSystem::GetInstance()->PlaySample(sample);
}
};
virtual JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL) = 0;
virtual JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
@@ -90,7 +90,7 @@ public:
virtual void Release(JTexture * tex) = 0;
virtual void Release(JSample * sample) = 0;
//Refreshes all files in cache, for when mode/profile changes.
//Refreshes all files in cache, for when mode/profile changes.
virtual void Refresh() = 0;
//Manual clear of the cache
@@ -132,8 +132,8 @@ protected:
** Singleton object only accessibly via Instance(), constructor is private
*/
WResourceManager()
{
}
{
}
static WResourceManager* sInstance;
};
+2 -2
View File
@@ -202,8 +202,8 @@ public:
#endif
private:
bool bThemedCards; //Does the theme have a "sets" directory for overwriting cards?
void FlattenTimes(); //To prevent bad cache timing on int overflow
bool bThemedCards; //Does the theme have a "sets" directory for overwriting cards?
void FlattenTimes(); //To prevent bad cache timing on int overflow
//For cached stuff
WCache<WCachedTexture,JTexture> textureWCache;
+1 -1
View File
@@ -79,7 +79,7 @@ public:
ostream& saveUsedRandValues(ostream& out) const;
ostream& saveLoadedRandValues(ostream& out);
int random();
void setSeed(unsigned int seed) { srand(seed); };
void setSeed(unsigned int seed) { srand(seed); };
template<typename Iter> void random_shuffle(Iter first, Iter last)
{
ptrdiff_t i, n;