All's Well That Ends Well
Shakespeare homepage | All's Well That Ends Well | Act 2, Scene 1
Previous scene | Next scene
SCENE I. Paris. The KING's palace.
Flourish of cornets. Enter the KING, attended with divers young Lords taking leave for the Florentine war; BERTRAM, and PAROLLES
KING
Farewell, young lords; these warlike principles
Do not throw from you: and you, my lords, farewell:
Share the advice betwixt you; if both gain, all
The gift doth stretch itself as 'tis received,
And is enough for both.
First Lord
'Tis our hope, sir,
After well enter'd soldiers, to return
And find your grace in health.
KING
No, no, it cannot be; and yet my heart
Will not confess he owes the malady
That doth my life besiege. Farewell, young lords;
Whether I live or die, be you the sons
Of worthy Frenchmen: let higher Italy,--
Those bated that inherit but the fall
Of the last monarchy,--see that you come
Not to woo honour, but to wed it; when
The bravest questant shrinks, find what you seek,
That fame may cry you loud: I say, farewell.
Second Lord
Health, at your bidding, serve your majesty!
KING
Those girls of Italy, take heed of them:
They say, our French lack language to deny,
If they demand: beware of being captives,
Before you serve.
Both
Our hearts receive your warnings.
KING
Farewell. Come hither to me.
Exit, attended
First Lord
O, my sweet lord, that you will stay behind us!
PAROLLES
'Tis not his fault, the spark.
Second Lord
O, 'tis brave wars!
PAROLLES
Most admirable: I have seen those wars.
BERTRAM
I am commanded here, and kept a coil with
'Too young' and 'the next year' and ''tis too early.'
PAROLLES
An thy mind stand to't, boy, steal away bravely.
BERTRAM
I shall stay here the forehorse to a smock,
Creaking my shoes on the plain masonry,
Till honour be bought up and no sword worn
But one to dance with! By heaven, I'll steal away.
First Lord
There's honour in the theft.
PAROLLES
Commit it, count.
Second Lord
I am your accessary; and so, farewell.
BERTRAM
I grow to you, and our parting is a tortured body.
First Lord
Farewell, captain.
Second Lord
Sweet Monsieur Parolles!
PAROLLES
Noble heroes, my sword and yours are kin. Good
sparks and lustrous, a word, good metals: you shall
find in the regiment of the Spinii one Captain
Spurio, with his cicatrice, an emblem of war, here
on his sinister cheek; it was this very sword
entrenched it: say to him, I live; and observe his
reports for me.
First Lord
We shall, noble captain.
Exeunt Lords
PAROLLES
Mars dote on you for his novices! what will ye do?
BERTRAM
Stay: the king.
Re-enter KING. BERTRAM and PAROLLES retire
PAROLLES
[To BERTRAM] Use a more spacious ceremony to the
noble lords; you have restrained yourself within the
list of too cold an adieu: be more expressive to
them: for they wear themselves in the cap of the
time, there do muster true gait, eat, speak, and
move under the influence of the most received star;
and though the devil lead the measure, such are to
be followed: after them, and take a more dilated farewell.
BERTRAM
And I will do so.
PAROLLES
Worthy fellows; and like to prove most sinewy sword-men.
Exeunt BERTRAM and PAROLLES
Enter LAFEU
LAFEU
[Kneeling] Pardon, my lord, for me and for my tidings.
KING
I'll fee thee to stand up.
LAFEU
Then here's a man stands, that has brought his pardon.
I would you had kneel'd, my lord, to ask me mercy,
And that at my bidding you could so stand up.
KING
I would I had; so I had broke thy pate,
And ask'd thee mercy for't.
LAFEU
Good faith, across: but, my good lord 'tis thus;
Will you be cured of your infirmity?
KING
No.
LAFEU
O, will you eat no grapes, my royal fox?
Yes, but you will my noble grapes, an if
My royal fox could reach them: I have seen a medicine
That's able to breathe life into a stone,
Quicken a rock, and make you dance canary
With spritely fire and motion; whose simple touch,
Is powerful to araise King Pepin, nay,
To give great Charlemain a pen in's hand,
And write to her a love-line.
KING
What 'her' is this?
LAFEU
Why, Doctor She: my lord, there's one arrived,
If you will see her: now, by my faith and honour,
If seriously I may convey my thoughts
In this my light deliverance, I have spoke
With one that, in her sex, her years, profession,
Wisdom and constancy, hath amazed me more
Than I dare blame my weakness: will you see her
For that is her demand, and know her business?
That done, laugh well at me.
KING
Now, good Lafeu,
Bring in the admiration; that we with thee
May spend our wonder too, or take off thine
By wondering how thou took'st it.
LAFEU
Nay, I'll fit you,
And not be all day neither.
Exit
KING
Thus he his special nothing ever prologues.
Re-enter LAFEU, with HELENA
LAFEU
Nay, come your ways.
KING
This haste hath wings indeed.
LAFEU
Nay, come your ways:
This is his majesty; say your mind to him:
A traitor you do look like; but such traitors
His majesty seldom fears: I am Cressid's uncle,
That dare leave two together; fare you well.
Exit
KING
Now, fair one, does your business follow us?
HELENA
Ay, my good lord.
Gerard de Narbon was my father;
In what he did profess, well found.
KING
I knew him.
HELENA
The rather will I spare my praises towards him:
Knowing him is enough. On's bed of death
Many receipts he gave me: chiefly one.
Which, as the dearest issue of his practise,
And of his old experience the oily darling,
He bade me store up, as a triple eye,
Safer than mine own two, more dear; I have so;
And hearing your high majesty is touch'd
With that malignant cause wherein the honour
Of my dear father's gift stands chief in power,
I come to tender it and my appliance
With all bound humbleness.
KING
We thank you, maiden;
But may not be so credulous of cure,
When our most learned doctors leave us and
The congregated college have concluded
That labouring art can never ransom nature
From her inaidible estate; I say we must not
So stain our judgment, or corrupt our hope,
To prostitute our past-cure malady
To empirics, or to dissever so
Our great self and our credit, to esteem
A senseless help when help past sense we deem.
HELENA
My duty then shall pay me for my pains:
I will no more enforce mine office on you.
Humbly entreating from your royal thoughts
A modest one, to bear me back a again.
KING
I cannot give thee less, to be call'd grateful:
Thou thought'st to help me; and such thanks I give
As one near death to those that wish him live:
But what at full I know, thou know'st no part,
I knowing all my peril, thou no art.
HELENA
What I can do can do no hurt to try,
Since you set up your rest 'gainst remedy.
He that of greatest works is finisher
Oft does them by the weakest minister:
So holy writ in babes hath judgment shown,
When judges have been babes; great floods have flown
From simple sources, and great seas have dried
When miracles have by the greatest been denied.
Oft expectation fails and most oft there
Where most it promises, and oft it hits
Where hope is coldest and despair most fits.
KING
I must not hear thee; fare thee well, kind maid;
Thy pains not used must by thyself be paid:
Proffers not took reap thanks for their reward.
HELENA
Inspired merit so by breath is barr'd:
It is not so with Him that all things knows
As 'tis with us that square our guess by shows;
But most it is presumption in us when
The help of heaven we count the act of men.
Dear sir, to my endeavours give consent;
Of heaven, not me, make an experiment.
I am not an impostor that proclaim
Myself against the level of mine aim;
But know I think and think I know most sure
My art is not past power nor you past cure.
KING
Are thou so confident? within what space
Hopest thou my cure?
HELENA
The great'st grace lending grace
Ere twice the horses of the sun shall bring
Their fiery torcher his diurnal ring,
Ere twice in murk and occidental damp
Moist Hesperus hath quench'd his sleepy lamp,
Or four and twenty times the pilot's glass
Hath told the thievish minutes how they pass,
What is infirm from your sound parts shall fly,
Health shall live free and sickness freely die.
KING
Upon thy certainty and confidence
What darest thou venture?
HELENA
Tax of impudence,
A strumpet's boldness, a divulged shame
Traduced by odious ballads: my maiden's name
Sear'd otherwise; nay, worse--if worse--extended
With vilest torture let my life be ended.
KING
Methinks in thee some blessed spirit doth speak
His powerful sound within an organ weak:
And what impossibility would slay
In common sense, sense saves another way.
Thy life is dear; for all that life can rate
Worth name of life in thee hath estimate,
Youth, beauty, wisdom, courage, all
That happiness and prime can happy call:
Thou this to hazard needs must intimate
Skill infinite or monstrous desperate.
Sweet practiser, thy physic I will try,
That ministers thine own death if I die.
HELENA
If I break time, or flinch in property
Of what I spoke, unpitied let me die,
And well deserved: not helping, death's my fee;
But, if I help, what do you promise me?
KING
Make thy demand.
HELENA
But will you make it even?
KING
Ay, by my sceptre and my hopes of heaven.
HELENA
Then shalt thou give me with thy kingly hand
What husband in thy power I will command:
Exempted be from me the arrogance
To choose from forth the royal blood of France,
My low and humble name to propagate
With any branch or image of thy state;
But such a one, thy vassal, whom I know
Is free for me to ask, thee to bestow.
KING
Here is my hand; the premises observed,
Thy will by my performance shall be served:
So make the choice of thy own time, for I,
Thy resolved patient, on thee still rely.
More should I question thee, and more I must,
Though more to know could not be more to trust,
From whence thou camest, how tended on: but rest
Unquestion'd welcome and undoubted blest.
Give me some help here, ho! If thou proceed
As high as word, my deed shall match thy meed.
Flourish. Exeunt
Shakespeare homepage | All's Well That Ends Well | Act 2, Scene 1
Previous scene | Next scene
All's Well That Ends Well
Shakespeare homepage | All's Well That Ends Well | Act 1, Scene 3
Previous scene | Next scene
SCENE III. Rousillon. The COUNT's palace.
Enter COUNTESS, Steward, and Clown
COUNTESS
I will now hear; what say you of this gentlewoman?
Steward
Madam, the care I have had to even your content, I
wish might be found in the calendar of my past
endeavours; for then we wound our modesty and make
foul the clearness of our deservings, when of
ourselves we publish them.
COUNTESS
What does this knave here? Get you gone, sirrah:
the complaints I have heard of you I do not all
believe: 'tis my slowness that I do not; for I know
you lack not folly to commit them, and have ability
enough to make such knaveries yours.
Clown
'Tis not unknown to you, madam, I am a poor fellow.
COUNTESS
Well, sir.
Clown
No, madam, 'tis not so well that I am poor, though
many of the rich are damned: but, if I may have
your ladyship's good will to go to the world, Isbel
the woman and I will do as we may.
COUNTESS
Wilt thou needs be a beggar?
Clown
I do beg your good will in this case.
COUNTESS
In what case?
Clown
In Isbel's case and mine own. Service is no
heritage: and I think I shall never have the
blessing of God till I have issue o' my body; for
they say barnes are blessings.
COUNTESS
Tell me thy reason why thou wilt marry.
Clown
My poor body, madam, requires it: I am driven on
by the flesh; and he must needs go that the devil drives.
COUNTESS
Is this all your worship's reason?
Clown
Faith, madam, I have other holy reasons such as they
are.
COUNTESS
May the world know them?
Clown
I have been, madam, a wicked creature, as you and
all flesh and blood are; and, indeed, I do marry
that I may repent.
COUNTESS
Thy marriage, sooner than thy wickedness.
Clown
I am out o' friends, madam; and I hope to have
friends for my wife's sake.
COUNTESS
Such friends are thine enemies, knave.
Clown
You're shallow, madam, in great friends; for the
knaves come to do that for me which I am aweary of.
He that ears my land spares my team and gives me
leave to in the crop; if I be his cuckold, he's my
drudge: he that comforts my wife is the cherisher
of my flesh and blood; he that cherishes my flesh
and blood loves my flesh and blood; he that loves my
flesh and blood is my friend: ergo, he that kisses
my wife is my friend. If men could be contented to
be what they are, there were no fear in marriage;
for young Charbon the Puritan and old Poysam the
Papist, howsome'er their hearts are severed in
religion, their heads are both one; they may jowl
horns together, like any deer i' the herd.
COUNTESS
Wilt thou ever be a foul-mouthed and calumnious knave?
Clown
A prophet I, madam; and I speak the truth the next
way:
For I the ballad will repeat,
Which men full true shall find;
Your marriage comes by destiny,
Your cuckoo sings by kind.
COUNTESS
Get you gone, sir; I'll talk with you more anon.
Steward
May it please you, madam, that he bid Helen come to
you: of her I am to speak.
COUNTESS
Sirrah, tell my gentlewoman I would speak with her;
Helen, I mean.
Clown
Was this fair face the cause, quoth she,
Why the Grecians sacked Troy?
Fond done, done fond,
Was this King Priam's joy?
With that she sighed as she stood,
With that she sighed as she stood,
And gave this sentence then;
Among nine bad if one be good,
Among nine bad if one be good,
There's yet one good in ten.
COUNTESS
What, one good in ten? you corrupt the song, sirrah.
Clown
One good woman in ten, madam; which is a purifying
o' the song: would God would serve the world so all
the year! we'ld find no fault with the tithe-woman,
if I were the parson. One in ten, quoth a'! An we
might have a good woman born but one every blazing
star, or at an earthquake, 'twould mend the lottery
well: a man may draw his heart out, ere a' pluck
one.
COUNTESS
You'll be gone, sir knave, and do as I command you.
Clown
That man should be at woman's command, and yet no
hurt done! Though honesty be no puritan, yet it
will do no hurt; it will wear the surplice of
humility over the black gown of a big heart. I am
going, forsooth: the business is for Helen to come hither.
Exit
COUNTESS
Well, now.
Steward
I know, madam, you love your gentlewoman entirely.
COUNTESS
Faith, I do: her father bequeathed her to me; and
she herself, without other advantage, may lawfully
make title to as much love as she finds: there is
more owing her than is paid; and more shall be paid
her than she'll demand.
Steward
Madam, I was very late more near her than I think
she wished me: alone she was, and did communicate
to herself her own words to her own ears; she
thought, I dare vow for her, they touched not any
stranger sense. Her matter was, she loved your son:
Fortune, she said, was no goddess, that had put
such difference betwixt their two estates; Love no
god, that would not extend his might, only where
qualities were level; Dian no queen of virgins, that
would suffer her poor knight surprised, without
rescue in the first assault or ransom afterward.
This she delivered in the most bitter touch of
sorrow that e'er I heard virgin exclaim in: which I
held my duty speedily to acquaint you withal;
sithence, in the loss that may happen, it concerns
you something to know it.
COUNTESS
You have discharged this honestly; keep it to
yourself: many likelihoods informed me of this
before, which hung so tottering in the balance that
I could neither believe nor misdoubt. Pray you,
leave me: stall this in your bosom; and I thank you
for your honest care: I will speak with you further anon.
Exit Steward
Enter HELENA
Even so it was with me when I was young:
If ever we are nature's, these are ours; this thorn
Doth to our rose of youth rightly belong;
Our blood to us, this to our blood is born;
It is the show and seal of nature's truth,
Where love's strong passion is impress'd in youth:
By our remembrances of days foregone,
Such were our faults, or then we thought them none.
Her eye is sick on't: I observe her now.
HELENA
What is your pleasure, madam?
COUNTESS
You know, Helen,
I am a mother to you.
HELENA
Mine honourable mistress.
COUNTESS
Nay, a mother:
Why not a mother? When I said 'a mother,'
Methought you saw a serpent: what's in 'mother,'
That you start at it? I say, I am your mother;
And put you in the catalogue of those
That were enwombed mine: 'tis often seen
Adoption strives with nature and choice breeds
A native slip to us from foreign seeds:
You ne'er oppress'd me with a mother's groan,
Yet I express to you a mother's care:
God's mercy, maiden! does it curd thy blood
To say I am thy mother? What's the matter,
That this distemper'd messenger of wet,
The many-colour'd Iris, rounds thine eye?
Why? that you are my daughter?
HELENA
That I am not.
COUNTESS
I say, I am your mother.
HELENA
Pardon, madam;
The Count Rousillon cannot be my brother:
I am from humble, he from honour'd name;
No note upon my parents, his all noble:
My master, my dear lord he is; and I
His servant live, and will his vassal die:
He must not be my brother.
COUNTESS
Nor I your mother?
HELENA
You are my mother, madam; would you were,--
So that my lord your son were not my brother,--
Indeed my mother! or were you both our mothers,
I care no more for than I do for heaven,
So I were not his sister. Can't no other,
But, I your daughter, he must be my brother?
COUNTESS
Yes, Helen, you might be my daughter-in-law:
God shield you mean it not! daughter and mother
So strive upon your pulse. What, pale again?
My fear hath catch'd your fondness: now I see
The mystery of your loneliness, and find
Your salt tears' head: now to all sense 'tis gross
You love my son; invention is ashamed,
Against the proclamation of thy passion,
To say thou dost not: therefore tell me true;
But tell me then, 'tis so; for, look thy cheeks
Confess it, th' one to th' other; and thine eyes
See it so grossly shown in thy behaviors
That in their kind they speak it: only sin
And hellish obstinacy tie thy tongue,
That truth should be suspected. Speak, is't so?
If it be so, you have wound a goodly clew;
If it be not, forswear't: howe'er, I charge thee,
As heaven shall work in me for thine avail,
Tell me truly.
HELENA
Good madam, pardon me!
COUNTESS
Do you love my son?
HELENA
Your pardon, noble mistress!
COUNTESS
Love you my son?
HELENA
Do not you love him, madam?
COUNTESS
Go not about; my love hath in't a bond,
Whereof the world takes note: come, come, disclose
The state of your affection; for your passions
Have to the full appeach'd.
HELENA
Then, I confess,
Here on my knee, before high heaven and you,
That before you, and next unto high heaven,
I love your son.
My friends were poor, but honest; so's my love:
Be not offended; for it hurts not him
That he is loved of me: I follow him not
By any token of presumptuous suit;
Nor would I have him till I do deserve him;
Yet never know how that desert should be.
I know I love in vain, strive against hope;
Yet in this captious and intenible sieve
I still pour in the waters of my love
And lack not to lose still: thus, Indian-like,
Religious in mine error, I adore
The sun, that looks upon his worshipper,
But knows of him no more. My dearest madam,
Let not your hate encounter with my love
For loving where you do: but if yourself,
Whose aged honour cites a virtuous youth,
Did ever in so true a flame of liking
Wish chastely and love dearly, that your Dian
Was both herself and love: O, then, give pity
To her, whose state is such that cannot choose
But lend and give where she is sure to lose;
That seeks not to find that her search implies,
But riddle-like lives sweetly where she dies!
COUNTESS
Had you not lately an intent,--speak truly,--
To go to Paris?
HELENA
Madam, I had.
COUNTESS
Wherefore? tell true.
HELENA
I will tell truth; by grace itself I swear.
You know my father left me some prescriptions
Of rare and proved effects, such as his reading
And manifest experience had collected
For general sovereignty; and that he will'd me
In heedfull'st reservation to bestow them,
As notes whose faculties inclusive were
More than they were in note: amongst the rest,
There is a remedy, approved, set down,
To cure the desperate languishings whereof
The king is render'd lost.
COUNTESS
This was your motive
For Paris, was it? speak.
HELENA
My lord your son made me to think of this;
Else Paris and the medicine and the king
Had from the conversation of my thoughts
Haply been absent then.
COUNTESS
But think you, Helen,
If you should tender your supposed aid,
He would receive it? he and his physicians
Are of a mind; he, that they cannot help him,
They, that they cannot help: how shall they credit
A poor unlearned virgin, when the schools,
Embowell'd of their doctrine, have left off
The danger to itself?
HELENA
There's something in't,
More than my father's skill, which was the greatest
Of his profession, that his good receipt
Shall for my legacy be sanctified
By the luckiest stars in heaven: and, would your honour
But give me leave to try success, I'ld venture
The well-lost life of mine on his grace's cure
By such a day and hour.
COUNTESS
Dost thou believe't?
HELENA
Ay, madam, knowingly.
COUNTESS
Why, Helen, thou shalt have my leave and love,
Means and attendants and my loving greetings
To those of mine in court: I'll stay at home
And pray God's blessing into thy attempt:
Be gone to-morrow; and be sure of this,
What I can help thee to thou shalt not miss.
Exeunt
Shakespeare homepage | All's Well That Ends Well | Act 1, Scene 3
Previous scene | Next scene
All's Well That Ends Well
Shakespeare homepage | All's Well That Ends Well | Act 1, Scene 1
Next scene
SCENE I. Rousillon. The COUNT's palace.
Enter BERTRAM, the COUNTESS of Rousillon, HELENA, and LAFEU, all in black
COUNTESS
In delivering my son from me, I bury a second husband.
BERTRAM
And I in going, madam, weep o'er my father's death
anew: but I must attend his majesty's command, to
whom I am now in ward, evermore in subjection.
LAFEU
You shall find of the king a husband, madam; you,
sir, a father: he that so generally is at all times
good must of necessity hold his virtue to you; whose
worthiness would stir it up where it wanted rather
than lack it where there is such abundance.
COUNTESS
What hope is there of his majesty's amendment?
LAFEU
He hath abandoned his physicians, madam; under whose
practises he hath persecuted time with hope, and
finds no other advantage in the process but only the
losing of hope by time.
COUNTESS
This young gentlewoman had a father,--O, that
'had'! how sad a passage 'tis!--whose skill was
almost as great as his honesty; had it stretched so
far, would have made nature immortal, and death
should have play for lack of work. Would, for the
king's sake, he were living! I think it would be
the death of the king's disease.
LAFEU
How called you the man you speak of, madam?
COUNTESS
He was famous, sir, in his profession, and it was
his great right to be so: Gerard de Narbon.
LAFEU
He was excellent indeed, madam: the king very
lately spoke of him admiringly and mourningly: he
was skilful enough to have lived still, if knowledge
could be set up against mortality.
BERTRAM
What is it, my good lord, the king languishes of?
LAFEU
A fistula, my lord.
BERTRAM
I heard not of it before.
LAFEU
I would it were not notorious. Was this gentlewoman
the daughter of Gerard de Narbon?
COUNTESS
His sole child, my lord, and bequeathed to my
overlooking. I have those hopes of her good that
her education promises; her dispositions she
inherits, which makes fair gifts fairer; for where
an unclean mind carries virtuous qualities, there
commendations go with pity; they are virtues and
traitors too; in her they are the better for their
simpleness; she derives her honesty and achieves her goodness.
LAFEU
Your commendations, madam, get from her tears.
COUNTESS
'Tis the best brine a maiden can season her praise
in. The remembrance of her father never approaches
her heart but the tyranny of her sorrows takes all
livelihood from her cheek. No more of this, Helena;
go to, no more; lest it be rather thought you affect
a sorrow than have it.
HELENA
I do affect a sorrow indeed, but I have it too.
LAFEU
Moderate lamentation is the right of the dead,
excessive grief the enemy to the living.
COUNTESS
If the living be enemy to the grief, the excess
makes it soon mortal.
BERTRAM
Madam, I desire your holy wishes.
LAFEU
How understand we that?
COUNTESS
Be thou blest, Bertram, and succeed thy father
In manners, as in shape! thy blood and virtue
Contend for empire in thee, and thy goodness
Share with thy birthright! Love all, trust a few,
Do wrong to none: be able for thine enemy
Rather in power than use, and keep thy friend
Under thy own life's key: be cheque'd for silence,
But never tax'd for speech. What heaven more will,
That thee may furnish and my prayers pluck down,
Fall on thy head! Farewell, my lord;
'Tis an unseason'd courtier; good my lord,
Advise him.
LAFEU
He cannot want the best
That shall attend his love.
COUNTESS
Heaven bless him! Farewell, Bertram.
Exit
BERTRAM
[To HELENA] The best wishes that can be forged in
your thoughts be servants to you! Be comfortable
to my mother, your mistress, and make much of her.
LAFEU
Farewell, pretty lady: you must hold the credit of
your father.
Exeunt BERTRAM and LAFEU
HELENA
O, were that all! I think not on my father;
And these great tears grace his remembrance more
Than those I shed for him. What was he like?
I have forgot him: my imagination
Carries no favour in't but Bertram's.
I am undone: there is no living, none,
If Bertram be away. 'Twere all one
That I should love a bright particular star
And think to wed it, he is so above me:
In his bright radiance and collateral light
Must I be comforted, not in his sphere.
The ambition in my love thus plagues itself:
The hind that would be mated by the lion
Must die for love. 'Twas pretty, though plague,
To see him every hour; to sit and draw
His arched brows, his hawking eye, his curls,
In our heart's table; heart too capable
Of every line and trick of his sweet favour:
But now he's gone, and my idolatrous fancy
Must sanctify his reliques. Who comes here?
Enter PAROLLES
Aside
One that goes with him: I love him for his sake;
And yet I know him a notorious liar,
Think him a great way fool, solely a coward;
Yet these fixed evils sit so fit in him,
That they take place, when virtue's steely bones
Look bleak i' the cold wind: withal, full oft we see
Cold wisdom waiting on superfluous folly.
PAROLLES
Save you, fair queen!
HELENA
And you, monarch!
PAROLLES
No.
HELENA
And no.
PAROLLES
Are you meditating on virginity?
HELENA
Ay. You have some stain of soldier in you: let me
ask you a question. Man is enemy to virginity; how
may we barricado it against him?
PAROLLES
Keep him out.
HELENA
But he assails; and our virginity, though valiant,
in the defence yet is weak: unfold to us some
warlike resistance.
PAROLLES
There is none: man, sitting down before you, will
undermine you and blow you up.
HELENA
Bless our poor virginity from underminers and
blowers up! Is there no military policy, how
virgins might blow up men?
PAROLLES
Virginity being blown down, man will quicklier be
blown up: marry, in blowing him down again, with
the breach yourselves made, you lose your city. It
is not politic in the commonwealth of nature to
preserve virginity. Loss of virginity is rational
increase and there was never virgin got till
virginity was first lost. That you were made of is
metal to make virgins. Virginity by being once lost
may be ten times found; by being ever kept, it is
ever lost: 'tis too cold a companion; away with 't!
HELENA
I will stand for 't a little, though therefore I die a virgin.
PAROLLES
There's little can be said in 't; 'tis against the
rule of nature. To speak on the part of virginity,
is to accuse your mothers; which is most infallible
disobedience. He that hangs himself is a virgin:
virginity murders itself and should be buried in
highways out of all sanctified limit, as a desperate
offendress against nature. Virginity breeds mites,
much like a cheese; consumes itself to the very
paring, and so dies with feeding his own stomach.
Besides, virginity is peevish, proud, idle, made of
self-love, which is the most inhibited sin in the
canon. Keep it not; you cannot choose but loose
by't: out with 't! within ten year it will make
itself ten, which is a goodly increase; and the
principal itself not much the worse: away with 't!
HELENA
How might one do, sir, to lose it to her own liking?
PAROLLES
Let me see: marry, ill, to like him that ne'er it
likes. 'Tis a commodity will lose the gloss with
lying; the longer kept, the less worth: off with 't
while 'tis vendible; answer the time of request.
Virginity, like an old courtier, wears her cap out
of fashion: richly suited, but unsuitable: just
like the brooch and the tooth-pick, which wear not
now. Your date is better in your pie and your
porridge than in your cheek; and your virginity,
your old virginity, is like one of our French
withered pears, it looks ill, it eats drily; marry,
'tis a withered pear; it was formerly better;
marry, yet 'tis a withered pear: will you anything with it?
HELENA
Not my virginity yet [ ]
There shall your master have a thousand loves,
A mother and a mistress and a friend,
A phoenix, captain and an enemy,
A guide, a goddess, and a sovereign,
A counsellor, a traitress, and a dear;
His humble ambition, proud humility,
His jarring concord, and his discord dulcet,
His faith, his sweet disaster; with a world
Of pretty, fond, adoptious christendoms,
That blinking Cupid gossips. Now shall he--
I know not what he shall. God send him well!
The court's a learning place, and he is one--
PAROLLES
What one, i' faith?
HELENA
That I wish well. 'Tis pity--
PAROLLES
What's pity?
HELENA
That wishing well had not a body in't,
Which might be felt; that we, the poorer born,
Whose baser stars do shut us up in wishes,
Might with effects of them follow our friends,
And show what we alone must think, which never
Return us thanks.
Enter Page
Page
Monsieur Parolles, my lord calls for you.
Exit
PAROLLES
Little Helen, farewell; if I can remember thee, I
will think of thee at court.
HELENA
Monsieur Parolles, you were born under a charitable star.
PAROLLES
Under Mars, I.
HELENA
I especially think, under Mars.
PAROLLES
Why under Mars?
HELENA
The wars have so kept you under that you must needs
be born under Mars.
PAROLLES
When he was predominant.
HELENA
When he was retrograde, I think, rather.
PAROLLES
Why think you so?
HELENA
You go so much backward when you fight.
PAROLLES
That's for advantage.
HELENA
So is running away, when fear proposes the safety;
but the composition that your valour and fear makes
in you is a virtue of a good wing, and I like the wear well.
PAROLLES
I am so full of businesses, I cannot answer thee
acutely. I will return perfect courtier; in the
which, my instruction shall serve to naturalize
thee, so thou wilt be capable of a courtier's
counsel and understand what advice shall thrust upon
thee; else thou diest in thine unthankfulness, and
thine ignorance makes thee away: farewell. When
thou hast leisure, say thy prayers; when thou hast
none, remember thy friends; get thee a good husband,
and use him as he uses thee; so, farewell.
Exit
HELENA
Our remedies oft in ourselves do lie,
Which we ascribe to heaven: the fated sky
Gives us free scope, only doth backward pull
Our slow designs when we ourselves are dull.
What power is it which mounts my love so high,
That makes me see, and cannot feed mine eye?
The mightiest space in fortune nature brings
To join like likes and kiss like native things.
Impossible be strange attempts to those
That weigh their pains in sense and do suppose
What hath been cannot be: who ever strove
So show her merit, that did miss her love?
The king's disease--my project may deceive me,
But my intents are fix'd and will not leave me.
Exit
Shakespeare homepage | All's Well That Ends Well | Act 1, Scene 1
Next scene
All's Well That Ends Well
Shakespeare homepage | All's Well That Ends Well | Act 1, Scene 2
Previous scene | Next scene
SCENE II. Paris. The KING's palace.
Flourish of cornets. Enter the KING of France, with letters, and divers Attendants
KING
The Florentines and Senoys are by the ears;
Have fought with equal fortune and continue
A braving war.
First Lord
So 'tis reported, sir.
KING
Nay, 'tis most credible; we here received it
A certainty, vouch'd from our cousin Austria,
With caution that the Florentine will move us
For speedy aid; wherein our dearest friend
Prejudicates the business and would seem
To have us make denial.
First Lord
His love and wisdom,
Approved so to your majesty, may plead
For amplest credence.
KING
He hath arm'd our answer,
And Florence is denied before he comes:
Yet, for our gentlemen that mean to see
The Tuscan service, freely have they leave
To stand on either part.
Second Lord
It well may serve
A nursery to our gentry, who are sick
For breathing and exploit.
KING
What's he comes here?
Enter BERTRAM, LAFEU, and PAROLLES
First Lord
It is the Count Rousillon, my good lord,
Young Bertram.
KING
Youth, thou bear'st thy father's face;
Frank nature, rather curious than in haste,
Hath well composed thee. Thy father's moral parts
Mayst thou inherit too! Welcome to Paris.
BERTRAM
My thanks and duty are your majesty's.
KING
I would I had that corporal soundness now,
As when thy father and myself in friendship
First tried our soldiership! He did look far
Into the service of the time and was
Discipled of the bravest: he lasted long;
But on us both did haggish age steal on
And wore us out of act. It much repairs me
To talk of your good father. In his youth
He had the wit which I can well observe
To-day in our young lords; but they may jest
Till their own scorn return to them unnoted
Ere they can hide their levity in honour;
So like a courtier, contempt nor bitterness
Were in his pride or sharpness; if they were,
His equal had awaked them, and his honour,
Clock to itself, knew the true minute when
Exception bid him speak, and at this time
His tongue obey'd his hand: who were below him
He used as creatures of another place
And bow'd his eminent top to their low ranks,
Making them proud of his humility,
In their poor praise he humbled. Such a man
Might be a copy to these younger times;
Which, follow'd well, would demonstrate them now
But goers backward.
BERTRAM
His good remembrance, sir,
Lies richer in your thoughts than on his tomb;
So in approof lives not his epitaph
As in your royal speech.
KING
Would I were with him! He would always say--
Methinks I hear him now; his plausive words
He scatter'd not in ears, but grafted them,
To grow there and to bear,--'Let me not live,'--
This his good melancholy oft began,
On the catastrophe and heel of pastime,
When it was out,--'Let me not live,' quoth he,
'After my flame lacks oil, to be the snuff
Of younger spirits, whose apprehensive senses
All but new things disdain; whose judgments are
Mere fathers of their garments; whose constancies
Expire before their fashions.' This he wish'd;
I after him do after him wish too,
Since I nor wax nor honey can bring home,
I quickly were dissolved from my hive,
To give some labourers room.
Second Lord
You are loved, sir:
They that least lend it you shall lack you first.
KING
I fill a place, I know't. How long is't, count,
Since the physician at your father's died?
He was much famed.
BERTRAM
Some six months since, my lord.
KING
If he were living, I would try him yet.
Lend me an arm; the rest have worn me out
With several applications; nature and sickness
Debate it at their leisure. Welcome, count;
My son's no dearer.
BERTRAM
Thank your majesty.
Exeunt. Flourish
Shakespeare homepage | All's Well That Ends Well | Act 1, Scene 2
Previous scene | Next scene
Arensito Layout
The Development Of The Arensito Layout
Introduction
As I was working with LaTeX in the autumn of 2000, I found out that
the qwerty layout was incredible difficult to use when I wrote a lot
of special chars (like '\', '^', '_', numbers, ...). So instead of
working with the project, as I should have, I started to improve my
keyboard layout. As of 1. of January 2001 I now have and use a layout
I am very satisfied with.
The alphabet layed out
All my desicion on layout has statistical foundation; One of the
first things I did when I started out was collecting written documents
(text files) so I could analyse the english language. I searched the
net and found the below texts, which you may download as a compressed
archive data.tar.bz2 :
$ ls -lh data.tar.bz2
-rw------- 1 hakon users 1.1M 2004-09-11 20:17 data.tar.bz2
$ tar jvtf data.tar.bz2
drwx------ hakon/users 0 2004-09-11 20:17:18 data/
-rw------- hakon/users 135781 2004-02-17 14:53:09 data/thesis.text
-rw------- hakon/users 146442 2004-02-17 14:53:09 data/Sophal.text
-rw------- hakon/users 21036 2004-02-17 14:53:09 data/dissent.text
-rw------- hakon/users 174347 2004-02-17 14:53:09 data/chap2.text
-rw------- hakon/users 77806 2004-02-17 14:53:10 data/ego.text
-rw------- hakon/users 1389452 2004-02-17 14:53:10 data/slxen.text
-rw------- hakon/users 1775681 2004-02-17 14:53:10 data/ppdel10.text
-rw------- hakon/users 38978 2004-02-17 14:53:10 data/putnam.text
-rw------- hakon/users 723937 2004-02-17 14:53:10 data/prin1.text
There are probably better collections representing the english
language, but I hope (and think) they will not alter the results in any way.
From the above texts, the distribution of letters are as follows:
The 8 most used letters total up to 65 % of the letters (See figure).
These most frequent letters are a r e n s i t o .
Note also that these 8 letters are far more used than the 9'nth most
used character, the h . For information, the letters
'.' and ',' are also shown in the figure. Other special characters
(the most frequent is ' " ') are at most as frequent as z ,
j and q . So the basic layout will consist of the
26 english letters, and also '.' and ','. I decided to allow 5
characters on the index-finger, and 3 characters on the rest of
the fingers. The basic layout is:
Left Hand Right Hand
Upper row: u u u u u u u u
Home row: H H H H h h H H H H
Lower row: l l l l l l l l l l
Where the capital H's are some permutation of arensito . The
layout found by trial and error and exclusion principles satisfies:
It was the layout that minimized the probability of using the
same finger for two consecutive keypresses.
The work done by the pinkies are far less than the work on the
other fingers.
The amount of work is evenly disributed between the left and
right hand.
Within the above restrictions, I finally wanted to maximize the
probability of having two consecutive keystrokes happen next to
each other. This keeps the fingers rolling and increases
the typing speed (Dvorak was wrong!).
Left Hand Right Hand
Upper row: q l , p f u d k
Home row: a r e n b g s i t o
Lower row: z w . h j v c y m x
| | | | | | | |
| | | | | | | |
| | | |
P(column) 7.4 15.3 13.9 8.6
in percent 11.9 15.5 12.2 15.2
(50.1 %) (49.9 %)
The special characters layed out
These characters will now be layed out: # | & { } , ? [ ] _ <
> $ % `
' / - 0 : \ 1 ( ) = ^ ~ " 6 7 8 ! . 9 + @ * 2 3 4 and 5 . For no other
reason than being three cool symbols I included ±, « and » to the final
layout , though these have
been given no priority in the layout, and are added after the layout of
these other special characters are set. I wanted to have a layout of the
special chars that would put the most frequently used close to my fingers.
This is achieved by using Alt Gr . For instance, in my final layout
Alt Gr + a produces a ; . To layout the chars I collected
a lot of textfiles/programs that where written in
C/C++ (253217 Bytes)
Java (1883475 Bytes)
Latex (6509190 Bytes)
SuSE Linux user manual (1389452 Bytes)
Matlab (748324 Bytes)
Lots of numbers (39075189 Bytes)
Perl (857046 Bytes)
Python (1063558 Bytes)
Xml (524207 Bytes)
and averaged over the frequency of the extracted special chars. I also
compared this to frequencies in ordinary text. As , . " ' where
used frequently in ordinary text, these are found on the final layout in
unmodified states. The most frequent special chars are (in sequence of
decreasing frequency) - 1 0 ( ) / = ; : 2 3 < \ 9 _ 5 > 4 * 6 7 8
+ {} [ ] # $ %@ ! ? & ` ^ | ~ . We should not only place the
special characters by their order of frequency, but in such a way that
the final layout is easy to use and remember. The placement of the
digits are quite important. 1. They should be placed on as many
fingers as possible to increase the typing speed. 2. There should be
some kind of consistent ordering and placement of them, since that
would make it easier to remember where the digits are. 3. Characters
that are often typed together with digits should be near, especially
the . but also the + - / * ( ) = < > and
% . The resulting layout, in the Alt Gr modified
state:
Left Hand Right Hand
Upper row: { } [ ] _ < > $
Home row: ; / - 0 : \ 1 ( ) =
Lower row: 6 7 8 9 + * 2 3 4 5
A note to the above: The Enter will be placed on the right hand,
and characters that often are followed by Enter (especially { }
; and : ) have therefore been placed on the left hand.
Because of the many special characters, one has to introduce more keys. I
have added one next to the pinky on each hand, and two others (that will
appear in the final layout). The above layout lets you have the most used
special characters under your fingertips!
The control characters and the modifiers keys
These include Escape, Page Up, Up, Down, Page Down, Home,
Right, Left, End, Backspace, Delete, Enter, Tab, Back Tab, Control,
Alt/Meta, Space, Alt Gr and Shift . I wanted espesially
to have Backspace and Return closer than they are
in an ordinary keyboard. My hope was to get the keys Backspace, Delete,
Enter, Control, Alt/Meta, Space, Alt Gr and Shift on my
thumbs, but with the keyboard produced today this is impossible ( except for
special keyboards like the Kinesis or the Maltron ). The Space of
the ordinary keyboard could be split into five keys, but ...
why on earth is the Space key that large ?? What it means for my
layout of the modifier keys is that these will be put under the palm. A
not-so-elegant solution, but it works for me.
Final Layout
The image of final keyboard layout may be downloaded as .jpg or .xcf (for layers).
You should save your old key layout definitions as a file loadable by
xmodmap before trying the layout.
It is simplest using the xkeycaps program. When that is done
download the arensito file and just
run xmodmap arensito .
If you are as comfortable as I with the new layout, making a link
ln -s arensito .Xmodmap will ensure you allways start up
with this layout.
Second Version (2001-08-08)
After som thought, I have found an alternative layout that places more
keys under the thumbs. The benefits of this layout is that you do not
have to move your whole palm as much as one needed in version 1, when
Control , Alt and Shift where
placed under the palm. Also, the placement of the Alt Gr
caused some pain when I was programming alot. But I have noticed that
it is now more strainfull to use the arrows, Pg Up, etc. Which keys
should be put under the thumbs? All keys that are used before/after
any character (space, delete, backspace, enter, tab, esc )
or used in combination with any key (alt, control, alt gr, shift ).
On the Kinesis keyboard each thumb access 6 keys, while on the
Maltron keyboard each access 8 keys, so on these two physical layouts
we could put these keys on the thumbs.
But it seems to me that the thumbs cannot effectively access all
these, for instance space is frequently used before/after
shift/alt gr , shift/alt gr is frequently used
before/after backspace/delete and backspace/delete
is frequently used before/after space . In my second version
of the layout I am able to
let the thumbs access 5 physical keys.
The new
layout may be downloaded as
.jpg or
.xcf
( ).
The file loadable by xmodmap is called
arensito2 . On my keyboard,
I have removed the keys that I do
not use in the layout. In order for your thumbs to have easy access to the
Alt- , Shift- , Space- and Control-
keys, remove the spacebar and replace it by a normalsized key. On my
keyboard I have just removed the spacebar, as I am able to push the
spacebar-button without replacing any physical keys.
Last modified: Sat Sep 11 20:21:02 CEST 2004
/*
Finger class
holds information about a typing finger
author: JAM (Jon A. Maxwell)
email: jmaxwell@acm.vt.edu
date: Mar 20 1998
*/
class Finger {
// constants
public static final int LEFTHAND = 1;
public static final int RIGHTHAND = 2;
//
public static final int THUMB = 4; // 0..3 other fingers
int row, col, hand, finger;
// Constructor
public Finger(int _row, int _col, int _hand, int _finger) {
row = _row;
col = _col;
hand = _hand;
finger = _finger;
}
// methods
public int getHand() { return hand; }
public int getFingerNum() { return finger; } // which finger
}
/*
KeyStats class
calculates statistics on typing text using a keyboard
displays a summary of the statistics
author: JAM (Jon A. Maxwell)
email: jmaxwell@acm.vt.edu
date: Mar 20 1998
*/
import java.awt.*;
import java.util.Vector;
public class KeyStats extends Panel {
// labels (xxxL description, xxxD data)
Label distanceL, distanceD;
Label sameHandL, sameHandD;
Label sameFingerL, sameFingerD;
Label totalKeysL, totalKeysD;
Label rowL[], rowD[];
Label fingerL, fingerD;
Vector allLabels;
// data used to display stats
double distanceTotal;
int rowTotal[] = new int[Keyboard.ROWS];
int lhTotal[] = new int[5]; //fingers on lh
int rhTotal[] = new int[5];
int sameHandTotal;
int sameFingerTotal;
int keysTotal;
// Constructor: setup gui
public KeyStats() {
allLabels = new Vector();
// make labels
distanceL = makeLabel("Distance:",Label.RIGHT);
distanceD = makeLabel("",Label.RIGHT);
sameHandL = makeLabel("Same hand:",Label.RIGHT);
sameHandD = makeLabel("",Label.RIGHT);
sameFingerL = makeLabel("Same finger:",Label.RIGHT);
sameFingerD = makeLabel("",Label.RIGHT);
totalKeysL = makeLabel("Total keys:",Label.RIGHT);
totalKeysD = makeLabel("", Label.RIGHT);
rowL = new Label[4];
rowL[0] = makeLabel("Number row:", Label.RIGHT);
rowL[1] = makeLabel("Top row:", Label.RIGHT);
rowL[2] = makeLabel("Home row:", Label.RIGHT);
rowL[3] = makeLabel("Bottom row:", Label.RIGHT);
rowD = new Label[4];
for (int i=0; i<4; i++) rowD[i] = makeLabel("",Label.RIGHT);
fingerL = makeLabel("Finger:",Label.RIGHT);
fingerD = makeLabel("",Label.LEFT);
// label fonts
Font labelFont = new Font("Dialog", Font.PLAIN, 12);
for (int i=0; i < allLabels.size(); i++) {
try {
Label l = (Label) allLabels.elementAt(i);
l.setFont(labelFont);
l.setForeground(Color.WHITE);
} catch (ArrayIndexOutOfBoundsException a) {System.err.println(a);}
}
Font fingerFont = new Font("Courier", Font.PLAIN, 10);
fingerD.setFont(fingerFont);
// suggest how to get this layout with gridbag! (or something)
// labels for left column
Panel leftLabelP = new Panel();
leftLabelP.setLayout(new GridLayout(4,1));
leftLabelP.add(distanceL);
leftLabelP.add(sameHandL);
leftLabelP.add(sameFingerL);
leftLabelP.add(totalKeysL);
// data labels for left column
Panel leftDataP = new Panel();
leftDataP.setLayout(new GridLayout(4,1));
leftDataP.add(distanceD);
leftDataP.add(sameHandD);
leftDataP.add(sameFingerD);
leftDataP.add(totalKeysD);
// labels for right column
Panel rightLabelP = new Panel();
rightLabelP.setLayout(new GridLayout(4,1));
for (int i=0; i<4; i++) rightLabelP.add(rowL[i]);
// data labels for right column
Panel rightDataP = new Panel();
rightDataP.setLayout(new GridLayout(4,1));
for (int i=0; i<4; i++) rightDataP.add(rowD[i]);
// left column (labels + data)
Panel leftColumnP = new Panel();
leftColumnP.setLayout(new BorderLayout());
leftColumnP.add("West", leftLabelP);
leftColumnP.add("Center", leftDataP);
// right column (label + data)
Panel rightColumnP = new Panel();
rightColumnP.setLayout(new BorderLayout());
rightColumnP.add("West", rightLabelP);
rightColumnP.add("Center", rightDataP);
//
Panel bothColumnsP = new Panel();
bothColumnsP.setLayout(new GridLayout(1,2));
bothColumnsP.add(leftColumnP);
bothColumnsP.add(rightColumnP);
// finger area
Panel fingerP = new Panel();
fingerP.setLayout(new FlowLayout(FlowLayout.LEFT));
fingerP.add(fingerL);
fingerP.add(fingerD);
setLayout(new BorderLayout());
add("Center", bothColumnsP);
add("South", fingerP);
}
// new Label() and add it to the list of all labels
private Label makeLabel(String s, int flags) {
Label label = new Label(s,flags);
allLabels.addElement(label);
return label;
}
// size of KeyStats panel
Dimension size = new Dimension(290,120);
public Dimension getPreferredSize() { return size; }
public Dimension getMinimumSize() { return size; }
// calculate stats variables
void calculate(String text, Keyboard keyboard) {
// reset counters
distanceTotal = sameHandTotal = sameFingerTotal = keysTotal = 0;
for (int i=0; i < Keyboard.ROWS; i++) rowTotal[i] = 0;
for (int i=0; i < 5; i++) { lhTotal[i] = rhTotal[i] = 0; }
//
double distancePrev = 0.0;
int row, col;
int rowPrev = -1, colPrev = -1;
Finger finger;
Finger fingerPrev = null;
int fingerNum;
int fingerNumPrev = -1;
for (int i=0; i < text.length(); i++) {
Point k = keyboard.locate(text.charAt(i));
if (k == null) continue;
row = k.y;
col = k.x;
finger = keyboard.closestFinger(row, col);
fingerNum = finger.getFingerNum();
// keysTotal
keysTotal++;
// rowTotal
rowTotal[row]++;
// rhTotal
if (finger.getHand() == Finger.RIGHTHAND)
rhTotal[fingerNum]++;
// lhTotal
if (finger.getHand() == Finger.LEFTHAND)
lhTotal[fingerNum]++;
// sameHandTotal
if (null != fingerPrev)
// repeated key doesn't count toward same hand
if (row != rowPrev || col != colPrev)
if (finger.getHand() == fingerPrev.getHand())
// thumb doesn't count as either hand
if (fingerNum != Finger.THUMB && fingerNumPrev != Finger.THUMB)
sameHandTotal++;
// sameFingerTotal
if (null != fingerPrev)
// repeated key doesn't count toward same finger
// (and so thumb won't ever count since it only hits space)
if (row != rowPrev || col != colPrev)
if (finger == fingerPrev)
sameFingerTotal++;
// distanceTotal
double distance = keyboard.distanceTo(row, col);
if (finger != fingerPrev) {
distanceTotal += distancePrev; // prev finger moves back to home
distanceTotal += distance; // and this finger moves to key
} else {
// same finger, so it moves from prev key to this key
// note that distancePrev is always the distance from home row
// finger to previous key not the distance between these two
distanceTotal += keyboard.distanceTo(row,col,rowPrev, colPrev);
}
// set prev from current
distancePrev = distance;
fingerPrev = finger;
fingerNumPrev = fingerNum;
rowPrev = row;
colPrev = col;
} // for each char
displayStats();
}
// convert stats into labels
private void displayStats() {
// total non-space (row 5) keys
int top4rowTotal = rowTotal[0] + rowTotal[1] + rowTotal[2] + rowTotal[3];
// keysTotal
totalKeysD.setText(Integer.toString(keysTotal));
// row percents
// percent of non-space keys
for (int i=0; i<4; i++) {
if (top4rowTotal > 0) rowD[i].setText( toPercent((double)rowTotal[i]/top4rowTotal,5) );
else rowD[i].setText("0%");
}
// finger percents: lhTotal, rhTotal
// percent of non-space keys
if (top4rowTotal > 0) {
String s = "";
for (int i=0; i<4; i++) {s = s.concat(truncLeft(" "+Integer.toString(100*lhTotal[i]/top4rowTotal),3)+"%");}
s = s.concat(" -- ");
for (int i=0; i<4; i++) {s = s.concat(truncLeft(" "+Integer.toString(100*rhTotal[i]/top4rowTotal),3)+"%");}
fingerD.setText(s);
} else {
fingerD.setText(" 0% 0% 0% 0% -- 0% 0% 0% 0%");
}
// distanceTotal
distanceD.setText( trunc(Double.toString(distanceTotal),5) + "m");
// same hand percent, same finger percent
// percent of non-space keys
if (top4rowTotal > 0) {
sameHandD.setText( toPercent((double)sameHandTotal/top4rowTotal,5) );
sameFingerD.setText( toPercent((double)sameFingerTotal/top4rowTotal,5) );
} else {
sameHandD.setText( "0%" );
sameFingerD.setText( "0%" );
}
}
// make a len-digit percent from a ratio
private String toPercent(double r, int len) {
return (trunc(Double.toString(100.0 * r),len) + "%");
}
// truncate a string at len length or less
private String trunc(String s, int len) {
int l = s.length();
if (len < l) {
try {
return s.substring(0,len);
}
catch (StringIndexOutOfBoundsException e) {System.err.println(e);}
}
return s;
}
// tuncate (from left) a string to len length or less
private String truncLeft(String s, int len) {
int l = s.length();
if (len < l) {
try {
return s.substring(l-len);
}
catch (StringIndexOutOfBoundsException e) {System.err.println(e);}
}
return s;
}
}
/*
Keyboard class
displays a settable keyboard
provides information about keys, fingering, distances
requires a specific keyboard image for display
author: JAM (Jon A. Maxwell)
email: jmaxwell@acm.vt.edu
date: Mar 20 1998
*/
import java.util.*;
import java.awt.*;
//import java.lang.NullPointerException;
public class Keyboard extends Panel {
// constants
public static final int UPPERCASE = 1;
public static final int LOWERCASE = 0;
public static final int HOMEROW = 2;
public static final int ROWS = 5;
public static final int COLUMNS = 15;
// defaults
protected static final String defKeyFontName = "Courier";
protected static final int defKeyFontSize = 10;
protected static final String defaultKeyboard[] =
{ // lowercase, uppercase
"`1234567890-=\\", "~!@#$%^&*()_+|" ,
" qwertyuiop[]" , " QWERTYUIOP{}" ,
" asdfghjkl;'\n" , " ASDFGHJKL:\"\n",
" zxcvbnm,./" , " ZXCVBNM<>?" ,
" " , ""
};
protected static final String defaultFingering[] =
{ // left: 0123 right: 4567 thumb: 8
"00123344567777" ,
" 012334456777" ,
" 012334456777" ,
" 0123344567" ,
" 8"
};
// data
protected Image keyboardImage;
protected Font keyFont;
protected FontMetrics keyFontMetrics;
protected Hashtable charToIndex; // convert from char to key index as Point(col,row)
protected char key[][][] = new char[ROWS][COLUMNS][2 /*shift*/ ];
protected Rectangle keyArea[][] = new Rectangle[ROWS][COLUMNS]; // area of image
protected Finger keyFinger[][] = new Finger[ROWS][COLUMNS]; // finger used for key
protected Finger finger[]; // 0..3 left hand, 4..7 right hand, 8 thumb
// constructor
public Keyboard(Image image) {
keyboardImage = image;
keyFont = new Font(defKeyFontName, Font.PLAIN, defKeyFontSize);
charToIndex = new Hashtable(200);
setupKeys();
setupKeyAreas();
setupFingers();
}
// public methods
// lookup the finger used for a key
public Finger closestFinger(int row, int col) {
return keyFinger[row][col];
}
// locate the key index (Point(col,row)) of a character
public Point locate(char value) {
return (Point) charToIndex.get( new Character(value) );
}
// locate the key index (Point(col,row)) of a point on the keyboard image
public Point locate(Point point) {
// find letter at that point
// .. use a better search if heavily used
for (int row = 0; row rowEnd[row]) return false;
return true;
}
// draw the keys
protected void drawKeys(Graphics g) {
// future: draw into offscreen image
g.setColor(Color.black);
g.setFont(keyFont);
keyFontMetrics = g.getFontMetrics();
for (int row = 0; row < ROWS; row++)
for (int col = 0; col < COLUMNS; col++)
drawKey(g, row, col);
}
protected void drawKey(Graphics g, int row, int col) {
Rectangle area = keyArea[row][col];
Point drawAt = new Point(0,0);
char buf[] = new char[1];
if (key[row][col][0] == 0 && key[row][col][1] == 0) return;
int topY = area.y + 2;
int bottomY = area.y + keyHeight - 4;
Point center = new Point(area.x + keyWidth/2 ,(topY + bottomY) / 2);
if (Character.toUpperCase(key[row][col][0]) == key[row][col][1]) {
// draw in middle
buf[0] = key[row][col][1];
drawAt = new Point(center.x - keyFontMetrics.charWidth(buf[0])/2,
center.y + keyFontMetrics.getHeight()/2 );
g.drawChars(buf,0,1,drawAt.x, drawAt.y);
} else {
// draw upper
buf[0] = key[row][col][1];
drawAt = new Point(center.x - keyFontMetrics.charWidth(buf[0])/2,
center.y - 1 );
g.drawChars(buf,0,1,drawAt.x, drawAt.y);
// draw lower
buf[0] = key[row][col][0];
drawAt = new Point(center.x - keyFontMetrics.charWidth(buf[0])/2,
bottomY );
g.drawChars(buf,0,1,drawAt.x, drawAt.y);
}
}
// setup
// create fingers, assign keys a finger
private void setupFingers() {
int i;
finger = new Finger[9];
for (i=0; i<4; i++) {finger[i] = new Finger(HOMEROW, i+1, Finger.LEFTHAND, i);}
for (i=4; i<8; i++) {finger[i] = new Finger(HOMEROW, i+3, Finger.RIGHTHAND, i-4);}
finger[8] = new Finger(HOMEROW+2, 1, Finger.RIGHTHAND, Finger.THUMB); //thumb on spacebar
for (int row = 0; row < defaultFingering.length; row++)
for (int col = 0; col < defaultFingering[row].length(); col++) {
char c = defaultFingering[row].charAt(col);
if (!Character.isDigit(c)) keyFinger[row][col] = null;
else keyFinger[row][col] = finger[Character.digit(c,10)];
}
}
// assign the default keymap
private void setupKeys() {
for (int i=0; i < defaultKeyboard.length; i+=2) {
setRow(i/2,Keyboard.LOWERCASE, defaultKeyboard[i]);
setRow(i/2,Keyboard.UPPERCASE, defaultKeyboard[i+1]);
}
}
// image-specific setup
// Keyboard image data
// upper-leftmost key
private static final int row0X = 12;
private static final int row0Y = 45;
private static final Dimension imageDim = new Dimension(300,200);
//
private static final int keyHeight = 22;
private static final int keyWidth = 18;
private static final int tabWidth = 28;
private static final int lockWidth = 34;
private static final int shiftWidth = 26;
private static final int toSpaceWidth = 72;
//
private static final int spaceWidth = 126; //about 7*keyWidth
private static final int returnWidth = 36; //about 2*keyWidth
// pixel distance in meters
static final double DISTANCE_XPIXEL = 0.018 / keyWidth;
static final double DISTANCE_YPIXEL = 0.018 / keyHeight;
// set up image regions for keys
private void setupKeyAreas() {
keyArea[0][0] = new Rectangle(row0X, row0Y , keyWidth , keyHeight);
keyArea[1][0] = new Rectangle(row0X, row0Y + keyHeight, tabWidth , keyHeight);
keyArea[2][0] = new Rectangle(row0X, row0Y+2*keyHeight, lockWidth , keyHeight);
keyArea[3][0] = new Rectangle(row0X, row0Y+3*keyHeight, shiftWidth , keyHeight);
keyArea[4][0] = new Rectangle(row0X, row0Y+4*keyHeight, toSpaceWidth, keyHeight);
//spacebar
keyArea[4][1] = new Rectangle(keyArea[4][0].x + keyArea[4][0].width, keyArea[4][0].y, spaceWidth, keyHeight);
for (int row = 0; row < ROWS; row++)
for (int col = 1; col < COLUMNS; col++)
if (keyArea[row][col] == null) {
keyArea[row][col] = new Rectangle(
keyArea[row][col-1].x + keyArea[row][col-1].width,
keyArea[row][col-1].y,
keyWidth,
keyHeight
);
}
//return
keyArea[2][12]= new Rectangle(keyArea[2][11].x + keyArea[2][11].width, keyArea[2][11].y, returnWidth, keyHeight);
}
}
/*
KeyboardApplet class
accepts user input text
displays statistics on typing text with layout2 and layout1 keyboards
loads keyboard image used for layout2 and layout1 keyboards
author: JAM (Jon A. Maxwell)
email: jmaxwell@acm.vt.edu
date: Mar 20 1998
modification: Addition of 6 more layouts.
Michael Capewell
smozoma@yahoo.com
June 19, 2005
*/
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class KeyboardApplet extends Applet implements ActionListener {
TextArea text = new TextArea(5, 80);
Button calc = new Button("Calculate");
Keyboard layout1, layout2, layout3, layout4, layout5, layout6, layout7, layout8;
KeyStats layout1Stats, layout2Stats, layout3Stats, layout4Stats, layout5Stats,
layout6Stats, layout7Stats, layout8Stats;
String layout1Keymap[] = { /* QWERTY */
"`1234567890-=\\", "~!@#$%^&*()_+|" ,
" qwertyuiop[]" , " QWERTYUIOP{}" ,
" asdfghjkl;'\n" , " ASDFGHJKL:\"\n",
" zxcvbnm,./" , " ZXCVBNM<>?" ,
" " , ""
};
String layout2Keymap[] = { /* Colemak */
"`1234567890-=\\", "~!@#$%^&*()_+|" ,
" qwfpgjluy;[]" , " QWFPGJLUY:{}" ,
" arstdhneio'\n" , " ARSTDHNEIO\"\n",
" zxcvbkm,./" , " ZXCVBKM<>?" ,
" " , ""
};
String layout3Keymap[] = { /* Dvorak */
"`1234567890[]\\", "~!@#$%^&*(){}|",
" ',.pyfgcrl/=" , " \"<>PYFGCRL?+",
" aoeuidhtns-\n" , " AOEUIDHTNS_\n",
" ;qjkxbmwvz" , " :QJKXBMWVZ",
" " , ""
};
String layout4Keymap[] = { /* arensito */
"`1234567890-=\\", "~!@#$%^&*()_+|" ,
" ql,p; fudk[]" , " QLHJVCYMX" ,
" " , ""
};
String layout5Keymap[] = { /* Amuseum */
"`1234567890-=\\", "~!@#$%^&*()_+|" ,
" -,.mfplcu'q[]" , " _<>MFPLCU\"Q{}" ,
" saetdhnoirz\n" , " SAETDHNOIRZ\n",
" ;kwgjxybv/" , " :KWGJXYBV?" ,
" " , ""
};
String layout6Keymap[] = { /* unused */
"`1234567890-=\\", "~!@#$%^&*()_+|" ,
" qwertyuiop[]" , " QWERTYUIOP{}" ,
" asdfghjkl;'\n" , " ASDFGHJKL:\"\n",
" zxcvbnm,./" , " ZXCVBNM<>?" ,
" " , ""
};
String layout7Keymap[] = { /* unused */
"`1234567890-=\\", "~!@#$%^&*()_+|" ,
" qwertyuiop[]" , " QWERTYUIOP{}" ,
" asdfghjkl;'\n" , " ASDFGHJKL:\"\n",
" zxcvbnm,./" , " ZXCVBNM<>?" ,
" " , ""
};
String layout8Keymap[] = { /* unused */
"`1234567890-=\\", "~!@#$%^&*()_+|" ,
" qwertyuiop[]" , " QWERTYUIOP{}" ,
" asdfghjkl;'\n" , " ASDFGHJKL:\"\n",
" zxcvbnm,./" , " ZXCVBNM<>?" ,
" " , ""
};
// setup applet gui, keyboards
public void init() {
// load images
Image layout1Image = null;
Image layout2Image = null;
Image layout3Image = null;
Image layout4Image = null;
Image layout5Image = null;
Image layout6Image = null;
Image layout7Image = null;
Image layout8Image = null;
try {
layout1Image = Toolkit.getDefaultToolkit().getImage( getClass().getClassLoader().getResource("keyboard.jpg"));
layout2Image = layout1Image;
layout3Image = layout1Image;
layout4Image = layout1Image;
layout5Image = layout1Image;
layout6Image = layout1Image;
layout7Image = layout1Image;
layout8Image = layout1Image;
}
catch (Exception ex) {
}
// layout2, layout1 keyboard
layout1 = new Keyboard(layout1Image);
layout2 = new Keyboard(layout2Image);
layout3 = new Keyboard(layout3Image);
layout4 = new Keyboard(layout4Image);
layout5 = new Keyboard(layout5Image);
layout6 = new Keyboard(layout6Image);
layout7 = new Keyboard(layout7Image);
layout8 = new Keyboard(layout8Image);
for (int i=0; i < layout1Keymap.length; i+=2) {
layout1.setRow(i/2,Keyboard.LOWERCASE, layout1Keymap[i]);
layout1.setRow(i/2,Keyboard.UPPERCASE, layout1Keymap[i+1]);
}
for (int i=0; i < layout1Keymap.length; i+=2) {
layout2.setRow(i/2,Keyboard.LOWERCASE, layout2Keymap[i]);
layout2.setRow(i/2,Keyboard.UPPERCASE, layout2Keymap[i+1]);
}
for (int i=0; i < layout1Keymap.length; i+=2) {
layout3.setRow(i/2,Keyboard.LOWERCASE, layout3Keymap[i]);
layout3.setRow(i/2,Keyboard.UPPERCASE, layout3Keymap[i+1]);
}
for (int i=0; i < layout1Keymap.length; i+=2) {
layout4.setRow(i/2,Keyboard.LOWERCASE, layout4Keymap[i]);
layout4.setRow(i/2,Keyboard.UPPERCASE, layout4Keymap[i+1]);
}
for (int i=0; i < layout1Keymap.length; i+=2) {
layout5.setRow(i/2,Keyboard.LOWERCASE, layout5Keymap[i]);
layout5.setRow(i/2,Keyboard.UPPERCASE, layout5Keymap[i+1]);
}
for (int i=0; i < layout1Keymap.length; i+=2) {
layout6.setRow(i/2,Keyboard.LOWERCASE, layout6Keymap[i]);
layout6.setRow(i/2,Keyboard.UPPERCASE, layout6Keymap[i+1]);
}
for (int i=0; i < layout1Keymap.length; i+=2) {
layout7.setRow(i/2,Keyboard.LOWERCASE, layout7Keymap[i]);
layout7.setRow(i/2,Keyboard.UPPERCASE, layout7Keymap[i+1]);
}
for (int i=0; i < layout1Keymap.length; i+=2) {
layout8.setRow(i/2,Keyboard.LOWERCASE, layout8Keymap[i]);
layout8.setRow(i/2,Keyboard.UPPERCASE, layout8Keymap[i+1]);
}
// stats
layout1Stats = new KeyStats();
layout1Stats.calculate("", layout1);
layout2Stats = new KeyStats();
layout2Stats.calculate("", layout2);
layout3Stats = new KeyStats();
layout3Stats.calculate("", layout3);
layout4Stats = new KeyStats();
layout4Stats.calculate("", layout4);
layout5Stats = new KeyStats();
layout5Stats.calculate("", layout5);
layout6Stats = new KeyStats();
layout6Stats.calculate("", layout6);
layout7Stats = new KeyStats();
layout7Stats.calculate("", layout7);
layout8Stats = new KeyStats();
layout8Stats.calculate("", layout8);
// gui
this.setBackground(new Color(0,0,0));
resize(950,500);
// I know, I know, GridbagLayout... or something
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
// textPanel: text area and calculate button
Panel calcPanel = new Panel();
calcPanel.setLayout( new FlowLayout() );
calcPanel.add(calc);
//
Panel textPanel = new Panel();
textPanel.setLayout( new BorderLayout() );
textPanel.add("Center",text);
textPanel.add("South",calcPanel);
//========================================================
// layout1StatsPanel: layout1 label and layout1Stats
Panel layout1StatsPanel = new Panel();
Label layout1Label = new Label("QWERTY", Label.LEFT);
layout1Label.setFont(new Font("Dialog", Font.BOLD, 16));
layout1StatsPanel.setLayout( new BorderLayout() );
layout1StatsPanel.add("Center", layout1Stats);
layout1StatsPanel.add("North", layout1Label);
// layout2StatsPanel: layout2 label and layout2Stats
Panel layout2StatsPanel = new Panel();
Label layout2Label = new Label("Colemak", Label.LEFT);
layout2Label.setFont(new Font("Dialog", Font.BOLD, 16));
layout2StatsPanel.setLayout( new BorderLayout() );
layout2StatsPanel.add("Center", layout2Stats);
layout2StatsPanel.add("North", layout2Label);
// layout3StatsPanel: layout3 label and layout3Stats
Panel layout3StatsPanel = new Panel();
Label layout3Label = new Label("Dvorak", Label.LEFT);
layout3Label.setFont(new Font("Dialog", Font.BOLD, 16));
layout3StatsPanel.setLayout( new BorderLayout() );
layout3StatsPanel.add("Center", layout3Stats);
layout3StatsPanel.add("North", layout3Label);
// layout4StatsPanel: layout4 label and layout4Stats
Panel layout4StatsPanel = new Panel();
Label layout4Label = new Label("Arensito", Label.LEFT);
layout4Label.setFont(new Font("Dialog", Font.BOLD, 16));
layout4StatsPanel.setLayout( new BorderLayout() );
layout4StatsPanel.add("Center", layout4Stats);
layout4StatsPanel.add("North", layout4Label);
// layout5StatsPanel: layout5 label and layout5Stats
Panel layout5StatsPanel = new Panel();
Label layout5Label = new Label("Amuseum", Label.LEFT);
layout5Label.setFont(new Font("Dialog", Font.BOLD, 16));
layout5StatsPanel.setLayout( new BorderLayout() );
layout5StatsPanel.add("Center", layout5Stats);
layout5StatsPanel.add("North", layout5Label);
// layout6StatsPanel: layout6 label and layout6Stats
Panel layout6StatsPanel = new Panel();
Label layout6Label = new Label("layout6", Label.LEFT);
layout6Label.setFont(new Font("Dialog", Font.BOLD, 16));
layout6StatsPanel.setLayout( new BorderLayout() );
layout6StatsPanel.add("Center", layout6Stats);
layout6StatsPanel.add("North", layout6Label);
// layout6StatsPanel: layout7 label and layout7Stats
Panel layout7StatsPanel = new Panel();
Label layout7Label = new Label("Capewell (Adjacent)", Label.LEFT);
layout7Label.setFont(new Font("Dialog", Font.BOLD, 16));
layout7StatsPanel.setLayout( new BorderLayout() );
layout7StatsPanel.add("Center", layout7Stats);
layout7StatsPanel.add("North", layout7Label);
// layout6StatsPanel: layout6 label and layout6Stats
Panel layout8StatsPanel = new Panel();
Label layout8Label = new Label("Capewell (Close)", Label.LEFT);
layout8Label.setFont(new Font("Dialog", Font.BOLD, 16));
layout8StatsPanel.setLayout( new BorderLayout() );
layout8StatsPanel.add("Center", layout8Stats);
layout8StatsPanel.add("North", layout8Label);
//========================================================
// layout1Panel: layout1StatsPanel and layout1 keyboard
Panel layout1Panel = new Panel();
layout1Panel.setLayout( new BorderLayout() );
layout1Panel.add("North", layout1StatsPanel);
layout1Panel.add("Center",layout1);
// layout2Panel: layout2StatsPanel and layout2 keyboard
Panel layout2Panel = new Panel();
layout2Panel.setLayout( new BorderLayout() );
layout2Panel.add("North", layout2StatsPanel);
layout2Panel.add("Center",layout2);
// layout3Panel: layout3StatsPanel and layout3 keyboard
Panel layout3Panel = new Panel();
layout3Panel.setLayout( new BorderLayout() );
layout3Panel.add("North", layout3StatsPanel);
layout3Panel.add("Center",layout3);
// layout4Panel: layout4StatsPanel and layout4 keyboard
Panel layout4Panel = new Panel();
layout4Panel.setLayout( new BorderLayout() );
layout4Panel.add("North", layout4StatsPanel);
layout4Panel.add("Center",layout4);
// layout5Panel: layout5StatsPanel and layout5 keyboard
Panel layout5Panel = new Panel();
layout5Panel.setLayout( new BorderLayout() );
layout5Panel.add("North", layout5StatsPanel);
layout5Panel.add("Center",layout5);
// layout6Panel: layout6StatsPanel and layout6 keyboard
Panel layout6Panel = new Panel();
layout6Panel.setLayout( new BorderLayout() );
layout6Panel.add("North", layout6StatsPanel);
layout6Panel.add("Center",layout6);
// layout6Panel: layout7StatsPanel and layout7 keyboard
Panel layout7Panel = new Panel();
layout7Panel.setLayout( new BorderLayout() );
layout7Panel.add("North", layout7StatsPanel);
layout7Panel.add("Center",layout7);
// layout8Panel: layout8StatsPanel and layout8 keyboard
Panel layout8Panel = new Panel();
layout8Panel.setLayout( new BorderLayout() );
layout8Panel.add("North", layout8StatsPanel);
layout8Panel.add("Center",layout8);
//========================================================
// displayPanel: layout1Panel and layout2Panel
Panel displayPanel = new Panel();
displayPanel.setLayout( new FlowLayout() );
displayPanel.add("West",layout1Panel);
displayPanel.add("East",layout2Panel);
displayPanel.add("West",layout3Panel);
displayPanel.add("East",layout4Panel);
displayPanel.add("West",layout5Panel);
displayPanel.add("East",layout6Panel);
displayPanel.add("West",layout7Panel);
displayPanel.add("East",layout8Panel);
//*/
// this panel: textPanel and displayPanel
setLayout( new BorderLayout() );
add("North",textPanel);
add("Center",displayPanel);
// eventListeners
calc.addActionListener(this);
}
// calculate
public void actionPerformed(ActionEvent event) {
calc.setEnabled(false);
layout1Stats.calculate(text.getText(), layout1);
layout2Stats.calculate(text.getText(), layout2);
layout3Stats.calculate(text.getText(), layout3);
layout4Stats.calculate(text.getText(), layout4);
layout5Stats.calculate(text.getText(), layout5);
layout6Stats.calculate(text.getText(), layout6);
layout7Stats.calculate(text.getText(), layout7);
layout8Stats.calculate(text.getText(), layout8);
calc.setEnabled(true);
}
}
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
from CvPythonExtensions import *
import CvUtil
import CvScreensInterface
import ScreenInput
import CvEventInterface
import CvScreenEnums
import time
import Popup as PyPopup
gc = CyGlobalContext()
ArtFileMgr = CyArtFileMgr()
localText = CyTranslator()
class CvWorldBuilderScreen:
"World Builder Screen"
def __init__ (self) :
self.m_normalPlayerTabCtrl = 0
self.m_normalMapTabCtrl = 0
self.m_tabCtrlEdit = 0
self.m_flyoutMenu = 0
self.m_bCtrlEditUp = False
self.m_bUnitEdit = False
self.m_bCityEdit = False
self.m_bNormalPlayer = True
self.m_bNormalMap = False
self.m_bReveal = False
self.m_bDiplomacy = False
self.m_bLandmark = False
self.m_bEraseAll = False
self.m_bUnitEditCtrl = False
self.m_bCityEditCtrl = False
self.m_bShowBigBrush = False
self.m_bLeftMouseDown = False
self.m_bRightMouseDown = False
self.m_bChangeFocus = False
self.m_iNormalPlayerCurrentIndexes = []
self.m_iNormalMapCurrentIndexes = []
self.m_iNormalMapCurrentList = []
self.m_iCurrentPlayer = 0
self.m_iCurrentTeam = 0
self.m_iCurrentUnitPlayer = 0
self.m_iCurrentUnit = 0
self.m_iCurrentX = -1
self.m_iCurrentY = -1
self.m_pCurrentPlot = 0
self.m_pActivePlot = 0
self.m_pRiverStartPlot = -1
self.m_iUnitTabID = -1
self.m_iBuildingTabID = -1
self.m_iTechnologyTabID = -1
self.m_iImprovementTabID = -1
self.m_iBonusTabID = -1
self.m_iImprovementListID = -1
self.m_iBonusListID = -1
self.m_iTerrainTabID = -1
self.m_iTerrainListID = -1
self.m_iFeatureListID = -1
self.m_iPlotTypeListID = -1
self.m_iRouteListID = -1
self.m_iBrushSizeTabID = -1
self.m_iBrushWidth = 1
self.m_iBrushHeight = 1
self.m_iFlyoutEditUnit = 1
self.m_iFlyoutEditCity = 0
self.m_iFlyoutAddScript = -1
self.m_iFlyoutChangeStartYear = -2
self.m_pFlyoutPlot = 0
self.m_bFlyout = False
self.m_pUnitToScript = -1
self.m_pCityToScript = -1
self.m_pPlotToScript = -1
self.m_iUnitEditCheckboxID = -1
self.m_iCityEditCheckboxID = -1
self.m_iNormalPlayerCheckboxID = -1
self.m_iNormalMapCheckboxID = -1
self.m_iRevealTileCheckboxID = -1
self.m_iDiplomacyCheckboxID = -1
self.m_iLandmarkCheckboxID = -1
self.m_iEraseCheckboxID = -1
self.iScreenWidth = 228
def interfaceScreen (self):
# This is the main interface screen, create it as such
self.initVars()
screen = CyGInterfaceScreen( "WorldBuilderScreen", CvScreenEnums.WORLDBUILDER_SCREEN )
screen.setCloseOnEscape(False)
screen.setAlwaysShown(True)
self.setSideMenu()
self.refreshSideMenu()
#add interface items
self.refreshPlayerTabCtrl()
self.m_normalMapTabCtrl = getWBToolNormalMapTabCtrl()
self.m_normalMapTabCtrl.setNumColumns((gc.getNumBonusInfos()/10)+1);
self.m_normalMapTabCtrl.addTabSection(localText.getText("TXT_KEY_WB_IMPROVEMENTS",()));
self.m_iImprovementTabID = 0
self.m_iNormalMapCurrentIndexes.append(0)
self.m_iNormalMapCurrentList.append(0)
self.m_iImprovementListID = 0
self.m_normalMapTabCtrl.addTabSection(localText.getText("TXT_KEY_WB_BONUSES", ()));
self.m_iBonusTabID = 1
self.m_iNormalMapCurrentIndexes.append(0)
self.m_iNormalMapCurrentList.append(0)
self.m_iBonusListID = 0
self.m_normalMapTabCtrl.setNumColumns((gc.getNumTerrainInfos()/10)+1);
self.m_normalMapTabCtrl.addTabSection(localText.getText("TXT_KEY_WB_TERRAINS",()))
self.m_iTerrainTabID = 2
self.m_iNormalMapCurrentIndexes.append(0)
self.m_iNormalMapCurrentList.append(0)
self.m_iTerrainListID = 0
self.m_iPlotTypeListID = 1
self.m_iFeatureListID = 2
self.m_iRouteListID = 3
# This should be a forced redraw screen
screen.setForcedRedraw( True )
screen.setDimensions( 0, 0, screen.getXResolution(), screen.getYResolution() )
# This should show the screen immidiately and pass input to the game
screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, True)
setWBInitialCtrlTabPlacement()
return 0
def killScreen(self):
if (self.m_tabCtrlEdit != 0):
self.m_tabCtrlEdit.destroy()
self.m_tabCtrlEdit = 0
screen = CyGInterfaceScreen( "WorldBuilderScreen", CvScreenEnums.WORLDBUILDER_SCREEN )
screen.hideScreen()
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER)
CvScreensInterface.hideWorldBuilderDiplomacyScreen()
def handleInput (self, inputClass):
if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED) and inputClass.isShiftKeyDown() and inputClass.isCtrlKeyDown():
return 1
elif (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CHARACTER):
key = inputClass.getData()
if key == int(InputTypes.KB_ESCAPE):
if (self.m_bDiplomacy):
self.normalPlayerTabModeCB()
return 1
elif (inputClass.getNotifyCode() == NotifyCode.NOTIFY_LISTBOX_ITEM_SELECTED):
if (inputClass.getFunctionName() == "WorldBuilderPlayerChoice"):
self.handlePlayerUnitPullDownCB(inputClass.getData())
elif(inputClass.getFunctionName() == "WorldBuilderTechByEra"):
self.handleWorldBuilderTechByEraPullDownCB(inputClass.getData())
elif(inputClass.getFunctionName() == "WorldBuilderBrushSize"):
self.handleBrushHeightCB(inputClass.getData())
self.handleBrushWidthCB(inputClass.getData())
elif(inputClass.getFunctionName() == "WorldBuilderTeamChoice"):
self.handleSelectTeamPullDownCB(inputClass.getData())
return 1
def mouseOverPlot (self, argsList):
if (self.m_bReveal):
if (self.m_pCurrentPlot != 0):
self.showMultipleReveal()
self.m_pCurrentPlot = CyInterface().getMouseOverPlot()
if (CyInterface().isLeftMouseDown() and self.m_bLeftMouseDown):
self.setMultipleReveal(True)
elif(CyInterface().isRightMouseDown() and self.m_bRightMouseDown):
self.setMultipleReveal(False)
else: #if ((self.m_tabCtrlEdit == 0) or (not self.m_tabCtrlEdit.isEnabled())):
self.m_pCurrentPlot = CyInterface().getMouseOverPlot()
self.m_iCurrentX = self.m_pCurrentPlot.getX()
self.m_iCurrentY = self.m_pCurrentPlot.getY()
if (CyInterface().isLeftMouseDown() and self.m_bLeftMouseDown):
if (self.useLargeBrush()):
self.placeMultipleObjects()
else:
self.placeObject()
elif (CyInterface().isRightMouseDown() and self.m_bRightMouseDown):
if (not (self.m_bCityEdit or self.m_bUnitEdit)):
if (self.useLargeBrush()):
self.removeMultipleObjects()
else:
self.removeObject()
return
def getHighlightPlot (self, argsList):
if ((self.m_pCurrentPlot != 0) and not self.m_bShowBigBrush and not self.m_bDiplomacy and isMouseOverGameSurface()):
return (self.m_pCurrentPlot.getX(), self.m_pCurrentPlot.getY())
else:
return []
def leftMouseDown (self, argsList):
bShift, bCtrl, bAlt = argsList
self.m_bLeftMouseDown = True
if (bAlt and bCtrl) or (self.m_bUnitEdit):
if (self.m_pCurrentPlot.getNumUnits() > 0):
self.m_iCurrentUnit = 0
self.setUnitEditInfo(False)
return 1
elif (bCtrl) or (self.m_bCityEdit):
if (self.m_pCurrentPlot.isCity()):
self.initCityEditScreen()
return 1
elif (self.m_bReveal):
if (self.m_pCurrentPlot != 0):
self.setMultipleReveal(True)
elif (bShift and not bCtrl and not bAlt):
self.createFlyoutMenu()
return 1
if (self.useLargeBrush()):
self.placeMultipleObjects()
else:
self.placeObject()
return 1
def rightMouseDown (self, argsList):
self.m_bRightMouseDown = True
if (self.m_bCityEdit or self.m_bUnitEdit):
self.createFlyoutMenu()
elif (self.m_bReveal):
if (self.m_pCurrentPlot != 0):
self.setMultipleReveal(False)
else:
if (self.useLargeBrush()):
self.removeMultipleObjects()
else:
self.removeObject()
return 1
def update(self, fDelta):
if (not CyInterface().isLeftMouseDown()):
self.m_bLeftMouseDown = False
if (not CyInterface().isRightMouseDown()):
self.m_bRightMouseDown = False
if (not self.m_bChangeFocus) and (not isMouseOverGameSurface()):
self.m_bChangeFocus = True
if (self.m_bChangeFocus and isMouseOverGameSurface() and (not self.m_bUnitEdit and not self.m_bCityEdit)):
self.m_bChangeFocus = False
setFocusToCVG()
return
# Will update the screen (every 250 MS)
def updateScreen(self):
screen = CyInterfaceScreen( "WorldBuilderScreen", CvScreenEnums.WORLDBUILDER_SCREEN )
if (self.useLargeBrush()):
self.m_bShowBigBrush = True
else:
self.m_bShowBigBrush = False
if (self.m_bCtrlEditUp):
if ( (not self.m_bUnitEdit) and (not self.m_bCityEdit) and (not self.m_tabCtrlEdit.isEnabled())):
if (self.m_bNormalMap):
self.m_normalMapTabCtrl.enable(True)
if (self.m_bNormalPlayer):
self.m_normalPlayerTabCtrl.enable(True)
self.m_bCtrlEditUp = False
return 0
if ((self.m_bNormalMap) and(self.m_normalMapTabCtrl.getActiveTab() == self.m_iTerrainTabID) and (self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iRouteListID)):
if (self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()] == gc.getNumRouteInfos()):
if (self.m_pRiverStartPlot != -1):
self.setRiverHighlights()
return 0
self.highlightBrush()
return 0
def redraw( self ):
return 0
def resetTechButtons( self ) :
for i in range (gc.getNumTechInfos()):
strName = "Tech_%s" %(i,)
self.m_normalPlayerTabCtrl.setCheckBoxState("Technologies", gc.getTechInfo(i).getDescription(), gc.getTeam(gc.getPlayer(self.m_iCurrentPlayer).getTeam()).isHasTech(i))
return 1
def handleAllPlotsCB ( self, popupReturn ) :
iButton = popupReturn.getButtonClicked()
if (iButton < PlotTypes.NUM_PLOT_TYPES):
iTempVal = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()] = iButton
self.setAllPlots()
self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()] = iTempVal
if (not (self.m_bUnitEdit or self.m_bCityEdit)):
self.m_normalPlayerTabCtrl.enable(self.m_bNormalPlayer)
self.m_normalMapTabCtrl.enable(self.m_bNormalMap)
else:
self.m_normalPlayerTabCtrl.enable(False)
self.m_normalMapTabCtrl.enable(False)
return 1
def allPlotsCB(self):
self.m_normalPlayerTabCtrl.enable(False)
self.m_normalMapTabCtrl.enable(False)
if (self.m_tabCtrlEdit != 0):
self.m_tabCtrlEdit.enable(False)
popup=PyPopup.PyPopup(CvUtil.EventWBAllPlotsPopup, EventContextTypes.EVENTCONTEXT_ALL)
iPopupWidth = 200
iPopupHeight = 50*PlotTypes.NUM_PLOT_TYPES
popup.setSize(iPopupWidth, iPopupHeight)
popup.setHeaderString(localText.getText("TXT_KEY_WB_CHANGE_ALL_PLOTS",()))
for i in range (PlotTypes.NUM_PLOT_TYPES):
if (i==0):
popup.addButton(localText.getText("TXT_KEY_WB_ADD_MOUNTAIN",()))
elif(i==1):
popup.addButton(localText.getText("TXT_KEY_WB_ADD_HILL",()))
elif(i==2):
popup.addButton(localText.getText("TXT_KEY_WB_ADD_GRASS",()))
elif(i==3):
popup.addButton(localText.getText("TXT_KEY_WB_ADD_OCEAN",()))
popup.addButton(localText.getText("TXT_KEY_SCREEN_CANCEL", ()))
popup.launch(False)
return 1
def refreshReveal ( self ) :
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
for i in range (CyMap().getGridWidth()):
for j in range (CyMap().getGridHeight()):
pPlot = CyMap().plot(i,j)
if (not pPlot.isNone()):
self.showRevealed(pPlot)
return 1
def setAllPlots ( self ) :
iPlotType = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
CyMap().setAllPlotTypes(iPlotType)
#for i in range (CyMap().getGridWidth()):
#for j in range (CyMap().getGridHeight()):
#CyMap().plot(i,j).setPlotType(PlotTypes(iPlotType), True, True)
return 1
def handleUnitEditExperienceCB (self, argsList) :
iNewXP = int(argsList[0])
self.m_pActivePlot.getUnit(self.m_iCurrentUnit).setExperience(iNewXP,-1)
return 1
def handleUnitEditLevelCB (self, argsList) :
iNewLevel = int(argsList[0])
self.m_pActivePlot.getUnit(self.m_iCurrentUnit).setLevel(iNewLevel)
return 1
def handleUnitEditNameCB (self, argsList) :
if ((len(argsList[0]) < 1) or (self.m_pActivePlot == 0) or (self.m_iCurrentUnit < 0) or (self.m_pActivePlot.getNumUnits() <= self.m_iCurrentUnit)):
return 1
szNewName = str(argsList[0])
unit = self.m_pActivePlot.getUnit(self.m_iCurrentUnit)
if (unit):
unit.setName(szNewName)
return 1
def handleCityEditPopulationCB (self, argsList) :
iNewPop = int(argsList[0])
self.m_pActivePlot.getPlotCity().setPopulation(iNewPop)
return 1
def handleCityEditCultureCB (self, argsList) :
iNewCulture = int(argsList[0])
self.m_pActivePlot.getPlotCity().setCulture(self.m_pActivePlot.getPlotCity().getOwner(), iNewCulture, True)
return 1
def handleCityEditGoldCB (self, argsList) :
iNewGold = int(argsList[0])
gc.getPlayer(self.m_iCurrentPlayer).setGold(iNewGold)
return 1
def handleCityEditNameCB (self, argsList) :
if ((len(argsList[0]) < 1) or (not self.m_pActivePlot.isCity())):
return 1
szNewName = str(argsList[0])
city = self.m_pActivePlot.getPlotCity()
if (city):
city.setName(szNewName, False)
return 1
def handleUnitEditPullDownCB ( self, argsList ) :
self.m_iCurrentUnit = int(argsList[0])
self.m_iCurrentUnitPlayer = self.m_pActivePlot.getUnit(self.m_iCurrentUnit).getOwner()
self.setUnitEditInfo(True)
self.setEditUnitTabs()
return 1
def handleUnitAITypeEditPullDownCB ( self, argsList ) :
iNewAIType = int(argsList[0])
self.m_pActivePlot.getUnit(self.m_iCurrentUnit).setUnitAIType(iNewAIType)
return 1
def handlePlayerEditPullDownCB ( self, argsList ) :
self.m_iCurrentUnitPlayer = int(argsList[0])
return 1
def handlePlayerUnitPullDownCB ( self, argsList ) :
iIndex = int(argsList)
iCount = -1
for i in range( gc.getMAX_CIV_PLAYERS() ):
if ( gc.getPlayer(i).isEverAlive() ):
iCount = iCount + 1
if (iCount == iIndex):
self.m_iCurrentPlayer = i
self.refreshPlayerTabCtrl()
return 1
i = i + 1
self.m_iCurrentPlayer = i
self.refreshPlayerTabCtrl()
return 1
def handleWorldBuilderTechByEraPullDownCB ( self, argsList ) :
iIndex = int(argsList)
for i in range (gc.getNumTechInfos()):
if (gc.getTechInfo(i).getEra() == iIndex):
gc.getTeam(gc.getPlayer(self.m_iCurrentPlayer).getTeam()).setHasTech(i, True, self.m_iCurrentPlayer, False, False)
self.refreshPlayerTabCtrl()
return 1
def handleSelectTeamPullDownCB ( self, argsList ) :
iIndex = int(argsList)
iCount = -1
for i in range( gc.getMAX_CIV_TEAMS() ):
if ( gc.getTeam(i).isEverAlive() ):
iCount = iCount + 1
if (iCount == iIndex):
self.m_iCurrentTeam = i
self.refreshReveal()
return 1
def handlePromotionCB ( self, iNewPromotion ) :
bOn = not self.m_pActivePlot.getUnit(self.m_iCurrentUnit).isHasPromotion(iNewPromotion)
self.m_pActivePlot.getUnit(self.m_iCurrentUnit).setHasPromotion(iNewPromotion,bOn)
return 1
def hasPromotion(self, iPromotion):
return self.m_pActivePlot.getUnit(self.m_iCurrentUnit).isHasPromotion(iPromotion)
def hasTech(self, iTech):
return gc.getTeam(gc.getPlayer(self.m_iCurrentPlayer).getTeam()).isHasTech(iTech)
def hasBuilding(self, iBuilding):
return self.m_pActivePlot.getPlotCity().hasBuilding(iBuilding)
def hasReligion(self, iReligion):
return self.m_pActivePlot.getPlotCity().isHasReligion(iReligion)
def hasHolyCity(self, iReligion):
return self.m_pActivePlot.getPlotCity().isHolyCityByType(iReligion)
def handleTechCB (self, argsList) :
bOn, strName = argsList
if ((strName.find("_") != -1) and (self.m_iCurrentPlayer >= 0)):
iTech = int(strName[strName.find("_")+1:])
gc.getTeam(gc.getPlayer(self.m_iCurrentPlayer).getTeam()).setHasTech(iTech, bOn, self.m_iCurrentPlayer, False, False)
self.resetTechButtons()
return 1
def handleEditCityBuildingCB (self, argsList) :
bOn, strName = argsList
iNewBuilding = int(strName[strName.find("_")+1:])
self.m_pActivePlot.getPlotCity().setHasRealBuilding(iNewBuilding, bOn)
return 1
def handleBrushWidthCB (self, argsList):
if (int(argsList) == 0):
self.m_iBrushWidth = int(1)
elif (int(argsList) == 1):
self.m_iBrushWidth = int(2)
elif (int(argsList) == 2):
self.m_iBrushWidth = int(3)
return 1
def handleBrushHeightCB (self, argsList):
if (int(argsList) == 0):
self.m_iBrushHeight = int(1)
elif (int(argsList) == 1):
self.m_iBrushHeight = int(2)
elif (int(argsList) == 2):
self.m_iBrushHeight = int(3)
return 1
def handleLandmarkCB (self, argsList):
return 1
def placeObject( self ) :
if ((self.m_iNormalPlayerCurrentIndexes[self.m_normalPlayerTabCtrl.getActiveTab()] == -1) or (self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()] == -1) or (self.m_iCurrentX == -1) or (self.m_iCurrentY == -1) or (self.m_iCurrentPlayer == -1)):
return 1
if (self.m_bEraseAll):
self.eraseAll()
elif ((self.m_bNormalPlayer) and (self.m_normalPlayerTabCtrl.getActiveTab() == self.m_iUnitTabID)):
iUnitType = self.m_iNormalPlayerCurrentIndexes[self.m_normalPlayerTabCtrl.getActiveTab()]
pPlayer = gc.getPlayer(self.m_iCurrentPlayer)
iPlotX = self.m_iCurrentX
iPlotY = self.m_iCurrentY
pPlayer.initUnit(iUnitType, iPlotX, iPlotY, UnitAITypes.NO_UNITAI)
elif ((self.m_bNormalPlayer) and (self.m_normalPlayerTabCtrl.getActiveTab() == self.m_iBuildingTabID)):
iBuildingType = self.m_iNormalPlayerCurrentIndexes[self.m_normalPlayerTabCtrl.getActiveTab()]
if ((self.m_pCurrentPlot.isCity()) and (iBuildingType != 0)):
self.m_pCurrentPlot.getPlotCity().setHasRealBuilding(iBuildingType-1, True)
if (iBuildingType == 0):
if (not self.m_pCurrentPlot.isCity()):
pPlayer = gc.getPlayer(self.m_iCurrentPlayer)
iX = self.m_pCurrentPlot.getX()
iY = self.m_pCurrentPlot.getY()
pPlayer.initCity(iX, iY)
elif ((self.m_bNormalMap) and (self.m_normalMapTabCtrl.getActiveTab() == self.m_iImprovementTabID)):
iImprovementType = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
iIndex = -1
iCounter = -1
while ((iIndex < iImprovementType) and (iCounter < gc.getNumImprovementInfos())):
iCounter = iCounter + 1
if (not gc.getImprovementInfo(iCounter).isGraphicalOnly()):
iIndex = iIndex + 1
if (iIndex > -1):
self.m_pCurrentPlot.setImprovementType(iCounter)
elif ((self.m_bNormalMap) and (self.m_normalMapTabCtrl.getActiveTab() == self.m_iBonusTabID)):
iBonusType = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
self.m_pCurrentPlot.setBonusType(iBonusType)
elif ((self.m_bNormalMap) and (self.m_normalMapTabCtrl.getActiveTab() == self.m_iTerrainTabID)):
if (self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iTerrainListID):
iTerrainType = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
self.m_pCurrentPlot.setTerrainType(iTerrainType, True, True)
elif (self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iFeatureListID):
iButtonIndex = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
iCount = -1
for i in range (gc.getNumFeatureInfos()):
for j in range (gc.getFeatureInfo(i).getNumVarieties()):
iCount = iCount + 1
if (iCount == iButtonIndex):
self.m_pCurrentPlot.setFeatureType(i, j)
elif (self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iPlotTypeListID):
iPlotType = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
if (iPlotType >= 0) and (iPlotType < PlotTypes.NUM_PLOT_TYPES):
self.m_pCurrentPlot.setPlotType(PlotTypes(iPlotType), True, True)
elif (self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iRouteListID):
iRouteType = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
if (iRouteType == gc.getNumRouteInfos()):
if (self.m_pRiverStartPlot == self.m_pCurrentPlot):
self.m_pRiverStartPlot = -1
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
return 1
if (self.m_pRiverStartPlot != -1):
iXDiff = 0
iYDiff = 0
if (self.m_pRiverStartPlot.getX() < self.m_pCurrentPlot.getX()):
iXDiff = self.m_pCurrentPlot.getX() - self.m_pRiverStartPlot.getX()
elif (self.m_pRiverStartPlot.getX() > self.m_pCurrentPlot.getX()):
iXDiff = self.m_pRiverStartPlot.getX() - self.m_pCurrentPlot.getX()
if (self.m_pRiverStartPlot.getY() < self.m_pCurrentPlot.getY()):
iYDiff = self.m_pCurrentPlot.getY() - self.m_pRiverStartPlot.getY()
elif (self.m_pRiverStartPlot.getY() > self.m_pCurrentPlot.getY()):
iYDiff = self.m_pRiverStartPlot.getY() - self.m_pCurrentPlot.getY()
if ((iXDiff == iYDiff) and (iXDiff == 1) and (self.m_pRiverStartPlot.getX() > self.m_pCurrentPlot.getX()) and (self.m_pRiverStartPlot.getY() < self.m_pCurrentPlot.getY())):
self.placeRiverNW(True)
self.m_pRiverStartPlot = CyMap().plot(self.m_pRiverStartPlot.getX()-1, self.m_pRiverStartPlot.getY()+1)
elif ((iXDiff == 0) and (iYDiff == 1) and (self.m_pRiverStartPlot.getY() < self.m_pCurrentPlot.getY())):
self.placeRiverN(True)
self.m_pRiverStartPlot = self.m_pCurrentPlot
elif ((iXDiff == iYDiff) and (iXDiff == 1) and (self.m_pRiverStartPlot.getX() < self.m_pCurrentPlot.getX()) and (self.m_pRiverStartPlot.getY() < self.m_pCurrentPlot.getY())):
self.placeRiverNE(True)
self.m_pRiverStartPlot = self.m_pCurrentPlot
elif ((iXDiff == 1) and (iYDiff == 0) and (self.m_pRiverStartPlot.getX() > self.m_pCurrentPlot.getX())):
self.placeRiverW(True)
self.m_pRiverStartPlot = self.m_pCurrentPlot
elif ((iXDiff == 1) and (iYDiff == 0) and (self.m_pRiverStartPlot.getX() < self.m_pCurrentPlot.getX())):
self.placeRiverE(True)
self.m_pRiverStartPlot = self.m_pCurrentPlot
elif ((iXDiff == iYDiff) and (iXDiff == 1) and (self.m_pRiverStartPlot.getX() > self.m_pCurrentPlot.getX()) and (self.m_pRiverStartPlot.getY() > self.m_pCurrentPlot.getY())):
self.placeRiverSW(True)
self.m_pRiverStartPlot = self.m_pCurrentPlot
elif ((iXDiff == 0) and (iYDiff == 1) and (self.m_pRiverStartPlot.getY() > self.m_pCurrentPlot.getY())):
self.placeRiverS(True)
self.m_pRiverStartPlot = self.m_pCurrentPlot
elif ((iXDiff == iYDiff) and (iXDiff == 1) and (self.m_pRiverStartPlot.getX() < self.m_pCurrentPlot.getX()) and (self.m_pRiverStartPlot.getY() > self.m_pCurrentPlot.getY())):
self.placeRiverSE(True)
self.m_pRiverStartPlot = self.m_pCurrentPlot
else:
self.m_pRiverStartPlot = self.m_pCurrentPlot
else:
self.m_pRiverStartPlot = self.m_pCurrentPlot
else:
self.m_pCurrentPlot.setRouteType(iRouteType)
elif (self.m_bLandmark):
CvEventInterface.beginEvent(CvUtil.EventWBLandmarkPopup)
return 1
def removeObject( self ):
if ((self.m_iNormalPlayerCurrentIndexes[self.m_normalPlayerTabCtrl.getActiveTab()] == -1) or (self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()] == -1) or (self.m_iCurrentX == -1) or (self.m_iCurrentY == -1) or (self.m_iCurrentPlayer == -1)):
return 1
if (self.m_bEraseAll):
self.eraseAll()
elif ((self.m_bNormalPlayer) and (self.m_normalPlayerTabCtrl.getActiveTab() == self.m_iUnitTabID)):
for i in range (self.m_pCurrentPlot.getNumUnits()):
pUnit = self.m_pCurrentPlot.getUnit(i)
if (pUnit.getUnitType() == self.m_iNormalPlayerCurrentIndexes[self.m_normalPlayerTabCtrl.getActiveTab()]):
pUnit.kill(false, PlayerTypes.NO_PLAYER)
return 1
if (self.m_pCurrentPlot.getNumUnits() > 0):
pUnit = self.m_pCurrentPlot.getUnit(0)
pUnit.kill(false, PlayerTypes.NO_PLAYER)
return 1
elif ((self.m_bNormalPlayer) and (self.m_normalPlayerTabCtrl.getActiveTab() == self.m_iBuildingTabID)):
if (self.m_pCurrentPlot.isCity()):
iBuildingType = self.m_iNormalPlayerCurrentIndexes[self.m_normalPlayerTabCtrl.getActiveTab()]
if (iBuildingType == 0) :
self.m_pCurrentPlot.getPlotCity().kill()
else:
self.m_pCurrentPlot.getPlotCity().setHasRealBuilding(iBuildingType-1, False)
elif ((self.m_bNormalMap) and (self.m_normalMapTabCtrl.getActiveTab() == self.m_iImprovementTabID)):
self.m_pCurrentPlot.setImprovementType(-1)
return 1
elif ((self.m_bNormalMap) and (self.m_normalMapTabCtrl.getActiveTab() == self.m_iBonusTabID)):
iBonusType = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
self.m_pCurrentPlot.setBonusType(-1)
return 1
elif ((self.m_bNormalMap) and (self.m_normalMapTabCtrl.getActiveTab() == self.m_iTerrainTabID)):
if (self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iTerrainListID):
return 1
elif (self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iFeatureListID):
iFeatureType = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
self.m_pCurrentPlot.setFeatureType(FeatureTypes.NO_FEATURE, -1)
return 1
elif (self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iPlotTypeListID):
return 1
elif (self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iRouteListID):
iRouteType = self.m_iNormalMapCurrentIndexes[self.m_normalMapTabCtrl.getActiveTab()]
if (iRouteType == gc.getNumRouteInfos()):
if (self.m_pRiverStartPlot != -1):
self.m_pRiverStartPlot = -1
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
else:
self.m_pCurrentPlot.setNOfRiver(False, CardinalDirectionTypes.NO_CARDINALDIRECTION)
self.m_pCurrentPlot.setWOfRiver(False, CardinalDirectionTypes.NO_CARDINALDIRECTION)
else:
self.m_pCurrentPlot.setRouteType(-1)
elif (self.m_bLandmark):
self.removeLandmarkCB()
return 1
def handleClicked( self ):
return
def setEditUnitTabs ( self ):
self.m_tabCtrlEdit.setDropDownSelection("Choose Unit", "Current_Unit", self.m_iCurrentUnit)
self.m_tabCtrlEdit.setDropDownSelection("Choose Unit", "Unit_AI_Type", self.m_pActivePlot.getUnit(self.m_iCurrentUnit).getUnitAIType())
return
def isIntString ( self, arg ):
for i in range (len(arg)):
if (arg[i] > '9') :
return False
elif (arg[i] < '0') :
return False
return True
def placeRiverNW ( self, bUseCurrent ):
if (bUseCurrent):
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_WEST)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX()-1, self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_NORTH)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX()-1, self.m_pRiverStartPlot.getY()+1)
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_NORTH)
return
def placeRiverN ( self, bUseCurrent ):
if (bUseCurrent):
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_NORTH)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY()+1)
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_NORTH)
return
def placeRiverNE ( self, bUseCurrent ):
if (bUseCurrent):
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_EAST)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX()+1, self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_EAST)
pRiverStepPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_NORTH)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX()+1, self.m_pRiverStartPlot.getY()+1)
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_NORTH)
return
def placeRiverW ( self, bUseCurrent ):
if (bUseCurrent):
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_WEST)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX()-1, self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_WEST)
return
def placeRiverE ( self, bUseCurrent ):
if (bUseCurrent):
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_EAST)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX()+1, self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_EAST)
return
def placeRiverSW ( self, bUseCurrent ):
if (bUseCurrent):
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_WEST)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX()-1, self.m_pRiverStartPlot.getY()-1)
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_SOUTH)
return
def placeRiverS ( self, bUseCurrent ):
if (bUseCurrent):
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_SOUTH)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY()-1)
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_SOUTH)
return
def placeRiverSE ( self, bUseCurrent ):
if (bUseCurrent):
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_EAST)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX()+1, self.m_pRiverStartPlot.getY())
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setNOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_EAST)
pRiverStepPlot = CyMap().plot(self.m_pRiverStartPlot.getX()+1, self.m_pRiverStartPlot.getY()-1)
if (not pRiverStepPlot.isNone()):
pRiverStepPlot.setWOfRiver(True, CardinalDirectionTypes.CARDINALDIRECTION_SOUTH)
return
def setUnitEditInfo(self, bSamePlot):
initWBToolEditCtrl()
self.m_tabCtrlEdit = getWBToolEditTabCtrl()
self.m_bUnitEditCtrl = True
self.m_bCityEditCtrl = False
if (self.m_bFlyout):
self.m_bFlyout = False
self.m_pCurrentPlot = self.m_pFlyoutPlot
if (not bSamePlot):
self.m_pActivePlot = self.m_pCurrentPlot
self.m_tabCtrlEdit.setNumColumns((gc.getNumPromotionInfos()/10)+1)
self.m_tabCtrlEdit.setColumnLength(20)
self.m_tabCtrlEdit.addTabSection(localText.getText("TXT_KEY_WB_CHOOSE_UNIT",()))
strTest = ()
for i in range(self.m_pActivePlot.getNumUnits()):
if (len(self.m_pActivePlot.getUnit(i).getNameNoDesc())):
strTest = strTest + (self.m_pActivePlot.getUnit(i).getNameNoDesc(),)
else:
strTest = strTest + (self.m_pActivePlot.getUnit(i).getName(),)
self.m_tabCtrlEdit.addSectionDropdown("Current_Unit", strTest, "CvScreensInterface", "WorldBuilderHandleUnitEditPullDownCB", "UnitEditPullDown", 0, self.m_iCurrentUnit)
if (len(self.m_pActivePlot.getUnit(self.m_iCurrentUnit).getNameNoDesc())):
strName = str(self.m_pActivePlot.getUnit(self.m_iCurrentUnit).getNameNoDesc())
else:
strName = str(self.m_pActivePlot.getUnit(self.m_iCurrentUnit).getName())
self.m_tabCtrlEdit.addSectionEditCtrl(strName, "CvScreensInterface", "WorldBuilderHandleUnitEditNameCB", "UnitEditName", 0)
self.m_tabCtrlEdit.addSectionLabel(localText.getText("TXT_KEY_WB_EXPERIENCE",()), 0)
strExperience = str("UnitEditExperienceCB")
self.m_tabCtrlEdit.addSectionSpinner(
strExperience,
"CvScreensInterface",
"WorldBuilderHandleUnitEditExperienceCB",
"UnitEditExperience",
0,
0.0,
1000.0,
1.0,
self.m_pActivePlot.getUnit(self.m_iCurrentUnit).getExperience(),
0,
0)
self.m_tabCtrlEdit.addSectionLabel(localText.getText("TXT_KEY_WB_LEVEL",()), 0)
strLevel = str("UnitEditLevelCB")
self.m_tabCtrlEdit.addSectionSpinner(
strLevel,
"CvScreensInterface",
"WorldBuilderHandleUnitEditLevelCB",
"UnitEditLevel",
0,
1.0,
1000.0,
1.0,
self.m_pActivePlot.getUnit(self.m_iCurrentUnit).getLevel(),
0,
0)
strTest = ()
for i in range(UnitAITypes.NUM_UNITAI_TYPES):
strTest = strTest + (gc.getUnitAIInfo(i).getDescription(),)
self.m_tabCtrlEdit.addSectionDropdown("Unit_AI_Type", strTest, "CvScreensInterface", "WorldBuilderHandleUnitAITypeEditPullDownCB", "UnitAITypeEditPullDown", 0, self.m_pActivePlot.getUnit(self.m_iCurrentUnit).getUnitAIType())
self.m_tabCtrlEdit.addSectionButton(localText.getText("TXT_KEY_WB_ADD_SCRIPT",()), "CvScreensInterface", "WorldBuilderHandleUnitEditAddScriptCB", "UnitEditAddScript", 0)
initWBToolEditCtrlTab(True)
if (not self.m_tabCtrlEdit.isNone()):
self.m_normalPlayerTabCtrl.enable(False)
self.m_normalMapTabCtrl.enable(False)
self.m_bCtrlEditUp = True
return
def setCityEditInfo(self):
self.m_bUnitEditCtrl = False
self.m_bCityEditCtrl = True
if (self.m_bFlyout):
self.m_bFlyout = False
self.m_pCurrentPlot = self.m_pFlyoutPlot
initWBToolEditCtrl()
self.m_tabCtrlEdit = getWBToolEditTabCtrl()
self.m_pActivePlot = self.m_pCurrentPlot
self.m_tabCtrlEdit.setNumColumns((gc.getNumBuildingInfos()/10)+2)
self.m_tabCtrlEdit.setColumnLength(20)
self.m_tabCtrlEdit.addTabSection(localText.getText("TXT_KEY_WB_ADD_BUILDINGS",()))
strName = str(self.m_pActivePlot.getPlotCity().getName())
self.m_tabCtrlEdit.addSectionEditCtrl(strName, "CvScreensInterface", "WorldBuilderHandleCityEditNameCB", "CityEditName", 0)
self.m_tabCtrlEdit.addSectionLabel(localText.getText("TXT_KEY_WB_POPULATION",()), 0)
strPopulation = str("CityEditPopulationCB")
self.m_tabCtrlEdit.addSectionSpinner(
strPopulation,
"CvScreensInterface",
"WorldBuilderHandleCityEditPopulationCB",
"CityEditPopulation",
0,
1.0,
1000.0,
1.0,
self.m_pActivePlot.getPlotCity().getPopulation(),
0,
0)
self.m_tabCtrlEdit.addSectionLabel(localText.getText("TXT_KEY_WB_CULTURE",()), 0)
strCulture = str("CityEditCultureCB")
self.m_tabCtrlEdit.addSectionSpinner(
strCulture,
"CvScreensInterface",
"WorldBuilderHandleCityEditCultureCB",
"CityEditCulture",
0,
1.0,
# FU edit next line from 1000.0 to 1000000.0
1000000.0,
1.0,
self.m_pActivePlot.getPlotCity().getCulture(self.m_pActivePlot.getPlotCity().getOwner()),
0,
0)
self.m_tabCtrlEdit.addSectionLabel(localText.getText("TXT_KEY_WB_GOLD",()), 0)
strGold = str("CityEditGoldCB")
self.m_tabCtrlEdit.addSectionSpinner(
strGold,
"CvScreensInterface",
"WorldBuilderHandleCityEditGoldCB",
"CityEditGold",
0,
-1000.0,
5000.0,
1.0,
gc.getPlayer(self.m_iCurrentPlayer).getGold(),
0,
0)
self.m_tabCtrlEdit.addSectionButton(localText.getText("TXT_KEY_WB_ADD_SCRIPT",()), "CvScreensInterface", "WorldBuilderHandleCityEditAddScriptCB", "CityEditAddScript", 0)
initWBToolEditCtrlTab(False)
if (not self.m_tabCtrlEdit.isNone()):
self.m_normalPlayerTabCtrl.enable(False)
self.m_normalMapTabCtrl.enable(False)
self.m_bCtrlEditUp = True
return
def initCityEditScreen(self):
self.setCityEditInfo()
return
def toggleUnitEditCB(self):
self.m_bUnitEdit = True
self.m_bCityEdit = False
self.m_bNormalPlayer = False
self.m_bNormalMap = False
self.m_bReveal = False
self.m_bDiplomacy = False
self.m_bLandmark = False
self.m_bEraseAll = False
CvScreensInterface.hideWorldBuilderDiplomacyScreen()
if (self.m_tabCtrlEdit != 0):
self.m_tabCtrlEdit.enable(False)
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER)
self.refreshSideMenu()
self.setCurrentModeCheckbox(self.m_iUnitEditCheckboxID)
self.m_normalPlayerTabCtrl.enable(False)
self.m_normalMapTabCtrl.enable(False)
if (self.m_tabCtrlEdit != 0):
self.m_tabCtrlEdit.destroy()
return
def toggleCityEditCB(self):
self.m_bCityEdit = True
self.m_bUnitEdit = False
self.m_bNormalPlayer = False
self.m_bNormalMap = False
self.m_bReveal = False
self.m_bDiplomacy = False
self.m_bLandmark = False
self.m_bEraseAll = False
CvScreensInterface.hideWorldBuilderDiplomacyScreen()
if (self.m_tabCtrlEdit != 0):
self.m_tabCtrlEdit.enable(False)
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER)
self.refreshSideMenu()
self.setCurrentModeCheckbox(self.m_iCityEditCheckboxID)
self.m_normalPlayerTabCtrl.enable(False)
self.m_normalMapTabCtrl.enable(False)
if (self.m_tabCtrlEdit != 0):
self.m_tabCtrlEdit.destroy()
return
def normalPlayerTabModeCB(self):
self.m_bCityEdit = False
self.m_bUnitEdit = False
self.m_bNormalPlayer = True
self.m_bNormalMap = False
self.m_bReveal = False
self.m_bDiplomacy = False
self.m_bLandmark = False
self.m_bEraseAll = False
CvScreensInterface.hideWorldBuilderDiplomacyScreen()
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER)
self.refreshSideMenu()
self.setCurrentModeCheckbox(self.m_iNormalPlayerCheckboxID)
if (self.m_normalMapTabCtrl):
self.m_normalMapTabCtrl.enable(False)
if (not self.m_normalPlayerTabCtrl.isEnabled()):
self.m_normalPlayerTabCtrl.enable(True)
if (self.m_tabCtrlEdit):
self.m_tabCtrlEdit.enable(False)
self.m_bCtrlEditUp = False
return
def normalMapTabModeCB(self):
self.m_bCityEdit = False
self.m_bUnitEdit = False
self.m_bNormalPlayer = False
self.m_bNormalMap = True
self.m_bReveal = False
self.m_bDiplomacy = False
self.m_bLandmark = False
self.m_bEraseAll = False
CvScreensInterface.hideWorldBuilderDiplomacyScreen()
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER)
self.refreshSideMenu()
self.setCurrentModeCheckbox(self.m_iNormalMapCheckboxID)
if (self.m_normalPlayerTabCtrl):
self.m_normalPlayerTabCtrl.enable(False)
if (not self.m_normalMapTabCtrl.isEnabled()):
self.m_normalMapTabCtrl.enable(True)
if (self.m_tabCtrlEdit):
self.m_tabCtrlEdit.enable(False)
self.m_bCtrlEditUp = False
return
def revealTabModeCB(self):
self.m_bCtrlEditUp = False
self.m_bCityEdit = False
self.m_bUnitEdit = False
self.m_bNormalPlayer = False
self.m_bNormalMap = False
self.m_bReveal = True
self.m_bDiplomacy = False
self.m_bLandmark = False
self.m_bEraseAll = False
CvScreensInterface.hideWorldBuilderDiplomacyScreen()
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER)
self.refreshReveal()
self.refreshSideMenu()
self.setCurrentModeCheckbox(self.m_iRevealTileCheckboxID)
if (self.m_normalPlayerTabCtrl):
self.m_normalPlayerTabCtrl.enable(False)
if (self.m_normalMapTabCtrl):
self.m_normalMapTabCtrl.enable(False)
if (self.m_tabCtrlEdit):
self.m_tabCtrlEdit.enable(False)
return
def diplomacyModeCB(self):
self.m_bCtrlEditUp = False
self.m_bCityEdit = False
self.m_bUnitEdit = False
self.m_bNormalPlayer = False
self.m_bNormalMap = False
self.m_bReveal = False
self.m_bDiplomacy = True
self.m_bLandmark = False
self.m_bEraseAll = False
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER)
self.refreshSideMenu()
self.setCurrentModeCheckbox(self.m_iDiplomacyCheckboxID)
if (self.m_normalPlayerTabCtrl != 0):
self.m_normalPlayerTabCtrl.enable(False)
if (self.m_normalMapTabCtrl != 0):
self.m_normalMapTabCtrl.enable(False)
if (self.m_tabCtrlEdit != 0):
self.m_tabCtrlEdit.enable(False)
CvScreensInterface.showWorldBuilderDiplomacyScreen()
return
def landmarkModeCB(self):
self.m_bCtrlEditUp = False
self.m_bCityEdit = False
self.m_bUnitEdit = False
self.m_bNormalPlayer = False
self.m_bNormalMap = False
self.m_bReveal = False
self.m_bDiplomacy = False
self.m_bLandmark = True
self.m_bEraseAll = False
CvScreensInterface.hideWorldBuilderDiplomacyScreen()
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER)
self.refreshSideMenu()
self.setCurrentModeCheckbox(self.m_iLandmarkCheckboxID)
if (self.m_normalPlayerTabCtrl != 0):
self.m_normalPlayerTabCtrl.enable(False)
if (self.m_normalMapTabCtrl != 0):
self.m_normalMapTabCtrl.enable(False)
if (self.m_tabCtrlEdit != 0):
self.m_tabCtrlEdit.enable(False)
return
def eraseCB(self):
self.m_bCtrlEditUp = False
self.m_bCityEdit = False
self.m_bUnitEdit = False
self.m_bNormalPlayer = False
self.m_bNormalMap = False
self.m_bReveal = False
self.m_bDiplomacy = False
self.m_bLandmark = False
self.m_bEraseAll = True
self.m_pRiverStartPlot = -1
CvScreensInterface.hideWorldBuilderDiplomacyScreen()
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER)
self.refreshSideMenu()
self.setCurrentModeCheckbox(self.m_iEraseCheckboxID)
if (self.m_normalPlayerTabCtrl != 0):
self.m_normalPlayerTabCtrl.enable(False)
if (self.m_normalMapTabCtrl != 0):
self.m_normalMapTabCtrl.enable(False)
if (self.m_tabCtrlEdit != 0):
self.m_tabCtrlEdit.enable(False)
return
def createFlyoutMenu(self):
if (self.m_pCurrentPlot == 0):
return
self.m_flyoutMenu = CyGFlyoutMenu()
self.m_pFlyoutPlot = self.m_pCurrentPlot
if (self.m_pFlyoutPlot.getNumUnits() > 0):
for i in range( self.m_pFlyoutPlot.getNumUnits() ):
if (len(self.m_pFlyoutPlot.getUnit(i).getNameNoDesc())):
strName = str(self.m_pFlyoutPlot.getUnit(i).getNameNoDesc())
else:
strName = str(self.m_pFlyoutPlot.getUnit(i).getName())
self.m_flyoutMenu.addTextItem(strName, "CvScreensInterface", "WorldBuilderHandleFlyoutMenuCB", i+1)
if (self.m_pFlyoutPlot.isCity()):
self.m_flyoutMenu.addTextItem(localText.getText("TXT_KEY_WB_EDIT_CITY",()), "CvScreensInterface", "WorldBuilderHandleFlyoutMenuCB", self.m_iFlyoutEditCity)
self.m_flyoutMenu.addTextItem(localText.getText("TXT_KEY_WB_ADD_SCRIPT_TO_PLOT",()), "CvScreensInterface", "WorldBuilderHandleFlyoutMenuCB", self.m_iFlyoutAddScript)
self.m_flyoutMenu.addTextItem(localText.getText("TXT_KEY_WB_CHANGE_START_YEAR",()), "CvScreensInterface", "WorldBuilderHandleFlyoutMenuCB", self.m_iFlyoutChangeStartYear)
self.m_flyoutMenu.show()
return
def destroyFlyoutMenu(self):
if (self.m_flyoutMenu != 0):
self.m_flyoutMenu.destroy()
self.m_flyoutMenu = 0
return
def handleFlyoutMenuCB ( self, argsList ) :
iFlyoutIndex = int(argsList[0])
if (self.m_tabCtrlEdit != 0):
self.m_tabCtrlEdit.enable(False)
if (iFlyoutIndex == self.m_iFlyoutAddScript):
self.m_pPlotToScript = self.m_pFlyoutPlot
self.getScript()
elif (iFlyoutIndex == self.m_iFlyoutChangeStartYear):
self.getNewStartYear()
elif (iFlyoutIndex == self.m_iFlyoutEditCity):
self.m_normalPlayerTabCtrl.enable(False)
self.m_normalMapTabCtrl.enable(False)
self.m_bFlyout = True
self.initCityEditScreen()
else:
self.m_normalPlayerTabCtrl.enable(False)
self.m_normalMapTabCtrl.enable(False)
self.m_iCurrentUnit = iFlyoutIndex-1
self.m_bFlyout = True
self.setUnitEditInfo(False)
return 1
def setCurrentNormalPlayerIndex(self, argsList):
iIndex = int(argsList)
if (self.m_normalPlayerTabCtrl.getActiveTab() != self.m_iTechnologyTabID):
self.m_iNormalPlayerCurrentIndexes [self.m_normalPlayerTabCtrl.getActiveTab()] = int(argsList)
else:
bOn = gc.getTeam(gc.getPlayer(self.m_iCurrentPlayer).getTeam()).isHasTech(iIndex)
bOn = not bOn
gc.getTeam(gc.getPlayer(self.m_iCurrentPlayer).getTeam()).setHasTech(iIndex, bOn, self.m_iCurrentPlayer, False, False)
return 1
def setCurrentNormalMapIndex(self, argsList):
iIndex = int(argsList)
self.m_iNormalMapCurrentIndexes [self.m_normalMapTabCtrl.getActiveTab()] = int(argsList)
return 1
def setCurrentNormalMapList(self, argsList):
self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] = int(argsList)
return 1
def setEditButtonClicked(self, argsList):
iIndex = int(argsList)
if (self.m_bUnitEditCtrl):
bOn = not self.m_pActivePlot.getUnit(self.m_iCurrentUnit).isHasPromotion(iIndex)
self.m_pActivePlot.getUnit(self.m_iCurrentUnit).setHasPromotion(iIndex, bOn)
elif (self.m_bCityEditCtrl):
bOn = not self.m_pActivePlot.getPlotCity().hasBuilding(iIndex)
self.m_pActivePlot.getPlotCity().setHasRealBuilding(iIndex, bOn)
return 1
def setEditReligionSelected(self, argsList):
iReligion = int(argsList)
bOn = not self.m_pActivePlot.getPlotCity().isHasReligion(iReligion)
self.m_pActivePlot.getPlotCity().setHasReligion(iReligion, bOn, False, False)
if (not bOn):
gc.getGame().clearHolyCity(iReligion)
self.refreshPlayerTabCtrl()
refreshWBEditCtrlReligionButtons(True)
return 1
def setEditHolyCitySelected(self, argsList):
iReligion = int(argsList)
if (self.m_pActivePlot.getPlotCity().isHolyCityByType(iReligion)):
gc.getGame().clearHolyCity(iReligion)
else:
gc.getGame().setHolyCity(iReligion, self.m_pActivePlot.getPlotCity(), False)
refreshWBEditCtrlReligionButtons(False)
return 1
def getUnitTabID(self):
return self.m_iUnitTabID
def getBuildingTabID(self):
return self.m_iBuildingTabID
def getTechnologyTabID(self):
return self.m_iTechnologyTabID
def getImprovementTabID(self):
return self.m_iImprovementTabID
def getBonusTabID(self):
return self.m_iBonusTabID
def getImprovementListID(self):
return self.m_iImprovementListID
def getBonusListID(self):
return self.m_iBonusListID
def getTerrainTabID(self):
return self.m_iTerrainTabID
def getTerrainListID(self):
return self.m_iTerrainListID
def getFeatureListID(self):
return self.m_iFeatureListID
def getPlotTypeListID(self):
return self.m_iPlotTypeListID
def getRouteListID(self):
return self.m_iRouteListID
def highlightBrush(self):
if (self.m_bShowBigBrush):
if (self.m_pCurrentPlot == 0):
return
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER)
CyEngine().addColoredPlotAlt(self.m_pCurrentPlot.getX(), self.m_pCurrentPlot.getY(), PlotStyles.PLOT_STYLE_BOX_OUTLINE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER, "COLOR_GREEN", 1)
for i in range( (self.m_iBrushWidth-1) ):
for j in range((self.m_iBrushHeight)):
pPlot = CyMap().plot(self.m_pCurrentPlot.getX()-(i+1), self.m_pCurrentPlot.getY()-(j))
if (not pPlot.isNone()):
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_BOX_OUTLINE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER, "COLOR_GREEN", 1)
pPlot = CyMap().plot(self.m_pCurrentPlot.getX(), self.m_pCurrentPlot.getY()-(j))
if (not pPlot.isNone()):
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_BOX_OUTLINE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER, "COLOR_GREEN", 1)
pPlot = CyMap().plot(self.m_pCurrentPlot.getX()+(i+1), self.m_pCurrentPlot.getY()-(j))
if (not pPlot.isNone()):
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_BOX_OUTLINE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER, "COLOR_GREEN", 1)
pPlot = CyMap().plot(self.m_pCurrentPlot.getX()-(i+1), self.m_pCurrentPlot.getY()+(j))
if (not pPlot.isNone()):
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_BOX_OUTLINE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER, "COLOR_GREEN", 1)
pPlot = CyMap().plot(self.m_pCurrentPlot.getX(), self.m_pCurrentPlot.getY()+(j))
if (not pPlot.isNone()):
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_BOX_OUTLINE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER, "COLOR_GREEN", 1)
pPlot = CyMap().plot(self.m_pCurrentPlot.getX()+(i+1), self.m_pCurrentPlot.getY()+(j))
if (not pPlot.isNone()):
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_BOX_OUTLINE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER, "COLOR_GREEN", 1)
if (not self.m_iBrushWidth):
pPlot = CyMap().plot(self.m_pCurrentPlot.getX(), self.m_pCurrentPlot.getY())
if (not pPlot.isNone()):
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_BOX_OUTLINE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER, "COLOR_GREEN", 1)
for j in range((self.m_iBrushHeight)):
pPlot = CyMap().plot(self.m_pCurrentPlot.getX(), self.m_pCurrentPlot.getY()-(j))
if (not pPlot.isNone()):
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_BOX_OUTLINE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER, "COLOR_GREEN", 1)
pPlot = CyMap().plot(self.m_pCurrentPlot.getX(), self.m_pCurrentPlot.getY()-(j))
if (not pPlot.isNone()):
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_BOX_OUTLINE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_WORLD_BUILDER, "COLOR_GREEN", 1)
return
def placeMultipleObjects(self):
bInsideForLoop = False
permCurrentPlot = self.m_pCurrentPlot
for i in range( (self.m_iBrushWidth-1) ):
for j in range((self.m_iBrushHeight)):
bInsideForLoop = True
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()-(i+1), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.placeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.placeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()+(i+1), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.placeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()-(i+1), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.placeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.placeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()+(i+1), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.placeObject()
if (not bInsideForLoop):
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY())
if (not self.m_pCurrentPlot.isNone()):
self.placeObject()
for j in range((self.m_iBrushHeight)):
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.placeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.placeObject()
self.m_pCurrentPlot = permCurrentPlot
return
def removeMultipleObjects(self):
bInsideForLoop = False
permCurrentPlot = self.m_pCurrentPlot
for i in range( (self.m_iBrushWidth-1) ):
for j in range((self.m_iBrushHeight)):
bInsideForLoop = True
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()-(i+1), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.removeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.removeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()+(i+1), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.removeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()-(i+1), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.removeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.removeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()+(i+1), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.removeObject()
if (not bInsideForLoop):
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY())
if (not self.m_pCurrentPlot.isNone()):
self.removeObject()
for j in range((self.m_iBrushHeight)):
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.removeObject()
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.removeObject()
self.m_pCurrentPlot = permCurrentPlot
return
def showMultipleReveal(self):
bInsideForLoop = False
permCurrentPlot = self.m_pCurrentPlot
for i in range( (self.m_iBrushWidth-1) ):
for j in range((self.m_iBrushHeight)):
bInsideForLoop = True
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()-(i+1), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.showRevealed(self.m_pCurrentPlot)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.showRevealed(self.m_pCurrentPlot)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()+(i+1), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.showRevealed(self.m_pCurrentPlot)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()-(i+1), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.showRevealed(self.m_pCurrentPlot)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.showRevealed(self.m_pCurrentPlot)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()+(i+1), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.showRevealed(self.m_pCurrentPlot)
if (not bInsideForLoop):
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY())
if (not self.m_pCurrentPlot.isNone()):
self.showRevealed(self.m_pCurrentPlot)
for j in range((self.m_iBrushHeight)):
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.showRevealed(self.m_pCurrentPlot)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.showRevealed(self.m_pCurrentPlot)
self.m_pCurrentPlot = permCurrentPlot
return
def setMultipleReveal(self, bReveal):
bInsideForLoop = False
permCurrentPlot = self.m_pCurrentPlot
for i in range( (self.m_iBrushWidth-1) ):
for j in range((self.m_iBrushHeight)):
bInsideForLoop = True
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()-(i+1), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.RevealCurrentPlot(bReveal)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.RevealCurrentPlot(bReveal)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()+(i+1), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.RevealCurrentPlot(bReveal)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()-(i+1), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.RevealCurrentPlot(bReveal)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.RevealCurrentPlot(bReveal)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX()+(i+1), permCurrentPlot.getY()+(j))
if (not self.m_pCurrentPlot.isNone()):
self.RevealCurrentPlot(bReveal)
if (not bInsideForLoop):
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY())
if (not self.m_pCurrentPlot.isNone()):
self.RevealCurrentPlot(bReveal)
for j in range((self.m_iBrushHeight)):
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.RevealCurrentPlot(bReveal)
self.m_pCurrentPlot = CyMap().plot(permCurrentPlot.getX(), permCurrentPlot.getY()-(j))
if (not self.m_pCurrentPlot.isNone()):
self.RevealCurrentPlot(bReveal)
self.m_pCurrentPlot = permCurrentPlot
self.showMultipleReveal()
return
def useLargeBrush(self):
if (
(
(self.m_bNormalMap) and
(not self.m_bUnitEdit) and
(not self.m_bCityEdit)
)
and
(
(
(self.m_normalMapTabCtrl.getActiveTab() == self.m_iTerrainTabID) and
(
(self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iTerrainListID) or
(self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iFeatureListID) or
(self.m_iNormalMapCurrentList[self.m_normalMapTabCtrl.getActiveTab()] == self.m_iPlotTypeListID)
)
)
or
(
(self.m_normalMapTabCtrl.getActiveTab() == self.m_iBonusTabID)
)
)
):
return True
elif (self.m_bReveal):
return True
else:
return False
def clearSideMenu(self):
screen = CyGInterfaceScreen( "WorldBuilderScreen", CvScreenEnums.WORLDBUILDER_SCREEN )
screen.deleteWidget("WorldBuilderMainPanel")
screen.deleteWidget("WorldBuilderBackgroundPanel")
screen.deleteWidget("WorldBuilderSaveButton")
screen.deleteWidget("WorldBuilderLoadButton")
screen.deleteWidget("WorldBuilderAllPlotsButton")
screen.deleteWidget("WorldBuilderExitButton")
screen.deleteWidget("WorldBuilderUnitEditMode")
screen.deleteWidget("WorldBuilderCityEditMode")
screen.deleteWidget("WorldBuilderNormalPlayerMode")
screen.deleteWidget("WorldBuilderNormalMapMode")
screen.deleteWidget("WorldBuilderRevealMode")
screen.deleteWidget("WorldBuilderPlayerChoice")
screen.deleteWidget("WorldBuilderTechByEra")
screen.deleteWidget("WorldBuilderBrushSize")
screen.deleteWidget("WorldBuilderRegenerateMap")
screen.deleteWidget("WorldBuilderTeamChoice")
screen.deleteWidget("WorldBuilderRevealAll")
screen.deleteWidget("WorldBuilderUnrevealAll")
screen.deleteWidget("WorldBuilderRevealPanel")
screen.deleteWidget("WorldBuilderBackgroundBottomPanel")
return
def setSideMenu(self):
screen = CyGInterfaceScreen( "WorldBuilderScreen", CvScreenEnums.WORLDBUILDER_SCREEN )
iMaxScreenWidth = screen.getXResolution()
iMaxScreenHeight = screen.getYResolution()
iScreenHeight = 10+37+37
screen.addPanel( "WorldBuilderBackgroundPanel", "", "", True, True, iMaxScreenWidth-self.iScreenWidth, 0, self.iScreenWidth, iScreenHeight, PanelStyles.PANEL_STYLE_MAIN )
screen.addScrollPanel( "WorldBuilderMainPanel", "", iMaxScreenWidth-self.iScreenWidth, 0, self.iScreenWidth, iScreenHeight, PanelStyles.PANEL_STYLE_MAIN )
iPanelWidth = 35*6
screen.attachPanelAt(
"WorldBuilderMainPanel",
"WorldBuilderLoadSavePanel",
"",
"",
False,
True,
PanelStyles.PANEL_STYLE_CITY_TANSHADE,
70,
0,
iPanelWidth-70,
35,
WidgetTypes.WIDGET_GENERAL, -1, -1)
iButtonWidth = 32
iButtonHeight = 32
iButtonX = 0
iButtonY = 0
screen.setImageButtonAt( "WorldBuilderAllPlotsButton", "WorldBuilderLoadSavePanel", ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_CHANGE_ALL_PLOTS").getPath(), iButtonX, iButtonY, iButtonWidth, iButtonHeight, WidgetTypes.WIDGET_WB_ALL_PLOTS_BUTTON, -1, -1)
iButtonX = iButtonX + 35
screen.setImageButtonAt( "WorldBuilderSaveButton", "WorldBuilderLoadSavePanel", ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_SAVE").getPath(), iButtonX, iButtonY, iButtonWidth, iButtonHeight, WidgetTypes.WIDGET_WB_SAVE_BUTTON, -1, -1)
iButtonX = iButtonX + 35
screen.setImageButtonAt( "WorldBuilderLoadButton", "WorldBuilderLoadSavePanel", ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_LOAD").getPath(), iButtonX, iButtonY, iButtonWidth, iButtonHeight, WidgetTypes.WIDGET_WB_LOAD_BUTTON, -1, -1)
iButtonX = iButtonX + 35
screen.setImageButtonAt( "WorldBuilderExitButton", "WorldBuilderLoadSavePanel", ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_EXIT").getPath(), iButtonX, iButtonY, iButtonWidth, iButtonHeight, WidgetTypes.WIDGET_WB_EXIT_BUTTON, -1, -1)
iButtonWidth = 32
iButtonHeight = 32
iButtonX = 0
iButtonY = 0
self.m_iUnitEditCheckboxID = 0
screen.addCheckBoxGFC(
"WorldBuilderUnitEditModeButton",
ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_TOGGLE_UNIT_EDIT_MODE").getPath(),
ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(),
(iMaxScreenWidth-self.iScreenWidth)+8+iButtonX,
(10+36),
iButtonWidth,
iButtonHeight,
WidgetTypes.WIDGET_WB_UNIT_EDIT_BUTTON, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
iButtonX = iButtonX + 35
self.m_iCityEditCheckboxID = 1
screen.addCheckBoxGFC(
"WorldBuilderCityEditModeButton",
ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_TOGGLE_CITY_EDIT_MODE").getPath(),
ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(),
(iMaxScreenWidth-self.iScreenWidth)+8+iButtonX,
(10+36),
iButtonWidth,
iButtonHeight,
WidgetTypes.WIDGET_WB_CITY_EDIT_BUTTON, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
iButtonX = iButtonX + 35
self.m_iNormalPlayerCheckboxID = 2
screen.addCheckBoxGFC(
"WorldBuilderNormalPlayerModeButton",
ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_NORMAL_UNIT_MODE").getPath(),
ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(),
(iMaxScreenWidth-self.iScreenWidth)+8+iButtonX,
(10+36),
iButtonWidth,
iButtonHeight,
WidgetTypes.WIDGET_WB_NORMAL_PLAYER_TAB_MODE_BUTTON, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
iButtonX = iButtonX + 35
self.m_iNormalMapCheckboxID = 3
screen.addCheckBoxGFC(
"WorldBuilderNormalMapModeButton",
ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_NORMAL_MAP_MODE").getPath(),
ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(),
(iMaxScreenWidth-self.iScreenWidth)+8+iButtonX,
(10+36),
iButtonWidth,
iButtonHeight,
WidgetTypes.WIDGET_WB_NORMAL_MAP_TAB_MODE_BUTTON, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
iButtonX = iButtonX + 35
self.m_iRevealTileCheckboxID = 4
screen.addCheckBoxGFC(
"WorldBuilderRevealTileModeButton",
ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_REVEAL_TILE_MODE").getPath(),
ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(),
(iMaxScreenWidth-self.iScreenWidth)+8+iButtonX,
(10+36),
iButtonWidth,
iButtonHeight,
WidgetTypes.WIDGET_WB_REVEAL_TAB_MODE_BUTTON, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
iButtonX = iButtonX + 35
self.m_iDiplomacyCheckboxID = 5
screen.addCheckBoxGFC(
"WorldBuilderDiplomacyModeButton",
ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_DIPLOMACY_MODE").getPath(),
ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(),
(iMaxScreenWidth-self.iScreenWidth)+8+iButtonX,
(10+36),
iButtonWidth,
iButtonHeight,
WidgetTypes.WIDGET_WB_DIPLOMACY_MODE_BUTTON, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
iButtonX = 0
self.m_iLandmarkCheckboxID = 6
screen.addCheckBoxGFC(
"WorldBuilderLandmarkButton",
ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_LANDMARK_MODE").getPath(),
ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(),
(iMaxScreenWidth-self.iScreenWidth)+8+iButtonX,
(10),
iButtonWidth,
iButtonHeight,
WidgetTypes.WIDGET_WB_LANDMARK_BUTTON, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
iButtonX = iButtonX + 35
self.m_iEraseCheckboxID = 7
screen.addCheckBoxGFC(
"WorldBuilderEraseButton",
ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_ERASE").getPath(),
ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(),
(iMaxScreenWidth-self.iScreenWidth)+8+iButtonX,
(10),
iButtonWidth,
iButtonHeight,
WidgetTypes.WIDGET_WB_ERASE_BUTTON, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
self.setCurrentModeCheckbox(self.m_iNormalPlayerCheckboxID)
return
def refreshSideMenu(self):
screen = CyGInterfaceScreen( "WorldBuilderScreen", CvScreenEnums.WORLDBUILDER_SCREEN )
screen.deleteWidget("WorldBuilderPlayerChoice")
screen.deleteWidget("WorldBuilderTechByEra")
screen.deleteWidget("WorldBuilderBrushSize")
screen.deleteWidget("WorldBuilderRegenerateMap")
screen.deleteWidget("WorldBuilderTeamChoice")
screen.deleteWidget("WorldBuilderRevealAll")
screen.deleteWidget("WorldBuilderUnrevealAll")
screen.deleteWidget("WorldBuilderRevealPanel")
screen.deleteWidget("WorldBuilderBackgroundBottomPanel")
iMaxScreenWidth = screen.getXResolution()
iMaxScreenHeight = screen.getYResolution()
iPanelWidth = 35*6
if(self.m_bReveal or (self.m_bNormalPlayer and (not self.m_bUnitEdit) and (not self.m_bCityEdit))):
screen.addPanel( "WorldBuilderBackgroundBottomPanel", "", "", True, True, iMaxScreenWidth-self.iScreenWidth, 10+32+32, self.iScreenWidth, 45+40, PanelStyles.PANEL_STYLE_MAIN )
else:
screen.addPanel( "WorldBuilderBackgroundBottomPanel", "", "", True, True, iMaxScreenWidth-self.iScreenWidth, 10+32+32, self.iScreenWidth, 45, PanelStyles.PANEL_STYLE_MAIN )
if (self.m_bNormalPlayer and (not self.m_bUnitEdit) and (not self.m_bCityEdit)):
szDropdownName = str("WorldBuilderPlayerChoice")
screen.addDropDownBoxGFC(szDropdownName, (iMaxScreenWidth-self.iScreenWidth)+8, (10+36+36), iPanelWidth, WidgetTypes.WIDGET_GENERAL, -1, -1, FontTypes.GAME_FONT)
for i in range( gc.getMAX_CIV_PLAYERS() ):
if ( gc.getPlayer(i).isEverAlive() ):
if (i == self.m_iCurrentPlayer):
screen.addPullDownString(szDropdownName, gc.getPlayer(i).getName(), i, i, True )
else:
screen.addPullDownString(szDropdownName, gc.getPlayer(i).getName(), i, i, False )
if (gc.getBARBARIAN_PLAYER() == self.m_iCurrentPlayer):
screen.addPullDownString(szDropdownName, gc.getPlayer(gc.getBARBARIAN_PLAYER()).getName(), gc.getBARBARIAN_PLAYER(), gc.getBARBARIAN_PLAYER(), True )
else:
screen.addPullDownString(szDropdownName, gc.getPlayer(gc.getBARBARIAN_PLAYER()).getName(), gc.getBARBARIAN_PLAYER(), gc.getBARBARIAN_PLAYER(), False )
# Loop through Era Infos and add names
szDropdownName = str("WorldBuilderTechByEra")
screen.addDropDownBoxGFC(szDropdownName, (iMaxScreenWidth-self.iScreenWidth)+8, (10+36+36+36), iPanelWidth, WidgetTypes.WIDGET_GENERAL, -1, -1, FontTypes.GAME_FONT)
for i in range(gc.getNumEraInfos()):
szPullDownString = localText.getText("TXT_KEY_WB_ADD_ERA_TECH", (gc.getEraInfo(i).getTextKey(), ))
screen.addPullDownString(szDropdownName, szPullDownString, i, i, True )
screen.addPullDownString(szDropdownName, localText.getText("TXT_KEY_WB_ADD_ERA_TECH_DESC",()), i, i, True )
elif(self.m_bNormalMap and (not self.m_bUnitEdit) and (not self.m_bCityEdit)):
iButtonWidth = 32
iButtonHeight = 32
iButtonX = 0
iButtonY = 0
screen.setImageButton( "WorldBuilderRegenerateMap", ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_REVEAL_ALL_TILES").getPath(), (iMaxScreenWidth-self.iScreenWidth)+8+iButtonX, (10+36+36), iButtonWidth, iButtonHeight, WidgetTypes.WIDGET_WB_REGENERATE_MAP, -1, -1)
szDropdownName = str("WorldBuilderBrushSize")
screen.addDropDownBoxGFC(szDropdownName, (iMaxScreenWidth-self.iScreenWidth)+48, (10+36+36), iPanelWidth-40, WidgetTypes.WIDGET_GENERAL, -1, -1, FontTypes.GAME_FONT)
bActive = False
if (self.m_iBrushWidth == 1):
bActive = True
else:
bActive = False
screen.addPullDownString(szDropdownName, localText.getText("TXT_KEY_WB_1_BY_1",()), 1, 1, bActive )
if (self.m_iBrushWidth == 2):
bActive = True
else:
bActive = False
screen.addPullDownString(szDropdownName, localText.getText("TXT_KEY_WB_3_BY_3",()), 2, 2, bActive )
if (self.m_iBrushWidth == 3):
bActive = True
else:
bActive = False
screen.addPullDownString(szDropdownName, localText.getText("TXT_KEY_WB_5_BY_5",()), 3, 3, bActive )
elif(self.m_bReveal):
iPanelWidth = 35*6
iButtonWidth = 32
iButtonHeight = 32
iButtonX = 0
iButtonY = 0
screen.setImageButton( "WorldBuilderRevealAll", ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_REVEAL_ALL_TILES").getPath(), (iMaxScreenWidth-self.iScreenWidth)+8+iButtonX, (10+36+36), iButtonWidth, iButtonHeight, WidgetTypes.WIDGET_WB_REVEAL_ALL_BUTTON, -1, -1)
iButtonX = iButtonX + 35
screen.setImageButton( "WorldBuilderUnrevealAll", ArtFileMgr.getInterfaceArtInfo("WORLDBUILDER_UNREVEAL_ALL_TILES").getPath(), (iMaxScreenWidth-self.iScreenWidth)+8+iButtonX, (10+36+36), iButtonWidth, iButtonHeight, WidgetTypes.WIDGET_WB_UNREVEAL_ALL_BUTTON, -1, -1)
iButtonX = iButtonX + 35
szDropdownName = str("WorldBuilderBrushSize")
screen.addDropDownBoxGFC(szDropdownName, (iMaxScreenWidth-self.iScreenWidth)+8+80, (10+36+36), iPanelWidth-80, WidgetTypes.WIDGET_GENERAL, -1, -1, FontTypes.GAME_FONT)
bActive = False
if (self.m_iBrushWidth == 1):
bActive = True
else:
bActive = False
screen.addPullDownString(szDropdownName, localText.getText("TXT_KEY_WB_1_BY_1",()), 1, 1, bActive )
if (self.m_iBrushWidth == 2):
bActive = True
else:
bActive = False
screen.addPullDownString(szDropdownName, localText.getText("TXT_KEY_WB_3_BY_3",()), 2, 2, bActive )
if (self.m_iBrushWidth == 3):
bActive = True
else:
bActive = False
screen.addPullDownString(szDropdownName, localText.getText("TXT_KEY_WB_5_BY_5",()), 3, 3, bActive )
szDropdownName = str("WorldBuilderTeamChoice")
screen.addDropDownBoxGFC(szDropdownName, (iMaxScreenWidth-self.iScreenWidth)+8, (10+36+36+36), iPanelWidth, WidgetTypes.WIDGET_GENERAL, -1, -1, FontTypes.GAME_FONT)
for i in range( gc.getMAX_CIV_TEAMS() ):
if (gc.getTeam(i).isEverAlive()):
if (i == self.m_iCurrentTeam):
screen.addPullDownString(szDropdownName, gc.getTeam(i).getName(), i, i, True )
else:
screen.addPullDownString(szDropdownName, gc.getTeam(i).getName(), i, i, False )
else:
screen.deleteWidget("WorldBuilderBackgroundBottomPanel")
return
def revealAll(self, bReveal):
for i in range (CyMap().getGridWidth()):
for j in range (CyMap().getGridHeight()):
pPlot = CyMap().plot(i,j)
if (not pPlot.isNone()):
pPlot.setRevealed(self.m_iCurrentTeam, bReveal, False, -1);
self.refreshReveal()
return
def RevealCurrentPlot(self, bReveal):
self.m_pCurrentPlot.setRevealed(self.m_iCurrentTeam, bReveal, False, -1);
return
def showRevealed(self, pPlot):
if (pPlot.isRevealed(self.m_iCurrentTeam, False)):
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_NONE, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_BLACK", .25)
else:
CyEngine().addColoredPlotAlt(pPlot.getX(), pPlot.getY(), PlotStyles.PLOT_STYLE_BOX_FILL, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_BLACK", .25)
return
def getNumPlayers(self):
iCount = 0
for i in range( gc.getMAX_CIV_PLAYERS() ):
if ( gc.getPlayer(i).isEverAlive() ):
iCount = iCount + 1
return iCount
def Exit(self):
CyInterface().setWorldBuilder(false)
return
def setLandmarkCB(self, szLandmark):
self.m_pCurrentPlot = CyInterface().getMouseOverPlot()
print "Jason3"
CyEngine().addLandmarkPopup(self.m_pCurrentPlot) # , u"%s" %(szLandmark))
print "Jason4"
return
def removeLandmarkCB(self):
self.m_pCurrentPlot = CyInterface().getMouseOverPlot()
CyEngine().removeLandmark(self.m_pCurrentPlot)
return
def refreshPlayerTabCtrl(self):
initWBToolPlayerControl()
self.m_normalPlayerTabCtrl = getWBToolNormalPlayerTabCtrl()
self.m_normalPlayerTabCtrl.setNumColumns((gc.getNumUnitInfos()/10)+2);
self.m_normalPlayerTabCtrl.addTabSection(localText.getText("TXT_KEY_WB_UNITS",()));
self.m_iUnitTabID = 0
self.m_iNormalPlayerCurrentIndexes.append(0)
self.m_normalPlayerTabCtrl.setNumColumns((gc.getNumBuildingInfos()/10)+1);
self.m_normalPlayerTabCtrl.addTabSection(localText.getText("TXT_KEY_WB_BUILDINGS",()));
self.m_iBuildingTabID = 1
self.m_iNormalPlayerCurrentIndexes.append(0)
self.m_normalPlayerTabCtrl.setNumColumns((gc.getNumTechInfos()/10)+1);
self.m_normalPlayerTabCtrl.addTabSection(localText.getText("TXT_KEY_WB_TECHNOLOGIES",()));
self.m_iTechnologyTabID = 2
self.m_iNormalPlayerCurrentIndexes.append(0)
addWBPlayerControlTabs()
return
def eraseAll(self):
# kill all units on plot if one is selected
if (self.m_pCurrentPlot != 0):
while (self.m_pCurrentPlot.getNumUnits() > 0):
pUnit = self.m_pCurrentPlot.getUnit(0)
pUnit.kill(false, PlayerTypes.NO_PLAYER)
self.m_pCurrentPlot.setBonusType(-1)
self.m_pCurrentPlot.setFeatureType(FeatureTypes.NO_FEATURE, -1)
if (self.m_pCurrentPlot.isCity()):
self.m_pCurrentPlot.getPlotCity().kill()
self.m_pCurrentPlot.setRouteType(-1)
self.m_pCurrentPlot.setNOfRiver(False, CardinalDirectionTypes.NO_CARDINALDIRECTION)
self.m_pCurrentPlot.setWOfRiver(False, CardinalDirectionTypes.NO_CARDINALDIRECTION)
self.m_pCurrentPlot.setImprovementType(-1)
self.removeLandmarkCB()
return
def getUnitScript(self):
self.m_pUnitToScript = self.m_pActivePlot.getUnit(self.m_iCurrentUnit)
self.getScript()
return
def getCityScript(self):
self.m_pCityToScript = self.m_pActivePlot.getPlotCity()
self.getScript()
return
def getScript(self):
CvEventInterface.beginEvent(CvUtil.EventWBScriptPopup)
return
def getNewStartYear(self):
CvEventInterface.beginEvent(CvUtil.EventWBStartYearPopup)
return
def setScriptCB(self, szScript):
if (self.m_pUnitToScript != -1):
self.m_pUnitToScript.setScriptData(CvUtil.convertToStr(szScript))
self.m_pUnitToScript = -1
return
if (self.m_pCityToScript != -1):
self.m_pCityToScript.setScriptData(CvUtil.convertToStr(szScript))
self.m_pCityToScript = -1
return
if (self.m_pPlotToScript != -1):
self.m_pPlotToScript.setScriptData(CvUtil.convertToStr(szScript))
self.m_pPlotToScript = -1
return
return
def setStartYearCB(self, iStartYear):
gc.getGame().setStartYear(iStartYear)
return
def getCurrentScript(self):
if (self.m_pUnitToScript != -1):
return self.m_pUnitToScript.getScriptData()
if (self.m_pCityToScript != -1):
return self.m_pCityToScript.getScriptData()
if (self.m_pPlotToScript != -1):
return self.m_pPlotToScript.getScriptData()
return ""
def setRiverHighlights(self):
CyEngine().clearColoredPlots(PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS)
CyEngine().addColoredPlotAlt(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY(), PlotStyles.PLOT_STYLE_RIVER_SOUTH, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_GREEN", 1)
fAlpha = .2
CyEngine().addColoredPlotAlt(self.m_pRiverStartPlot.getX()-1, self.m_pRiverStartPlot.getY()+1, PlotStyles.PLOT_STYLE_BOX_FILL, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_WHITE", fAlpha)
CyEngine().addColoredPlotAlt(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY()+1, PlotStyles.PLOT_STYLE_BOX_FILL, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_WHITE", fAlpha)
CyEngine().addColoredPlotAlt(self.m_pRiverStartPlot.getX()+1, self.m_pRiverStartPlot.getY()+1, PlotStyles.PLOT_STYLE_BOX_FILL, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_WHITE", fAlpha)
CyEngine().addColoredPlotAlt(self.m_pRiverStartPlot.getX()-1, self.m_pRiverStartPlot.getY(), PlotStyles.PLOT_STYLE_BOX_FILL, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_WHITE", fAlpha)
CyEngine().addColoredPlotAlt(self.m_pRiverStartPlot.getX()+1, self.m_pRiverStartPlot.getY(), PlotStyles.PLOT_STYLE_BOX_FILL, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_WHITE", fAlpha)
CyEngine().addColoredPlotAlt(self.m_pRiverStartPlot.getX()-1, self.m_pRiverStartPlot.getY()-1, PlotStyles.PLOT_STYLE_BOX_FILL, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_WHITE", fAlpha)
CyEngine().addColoredPlotAlt(self.m_pRiverStartPlot.getX(), self.m_pRiverStartPlot.getY()-1, PlotStyles.PLOT_STYLE_BOX_FILL, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_WHITE", fAlpha)
CyEngine().addColoredPlotAlt(self.m_pRiverStartPlot.getX()+1, self.m_pRiverStartPlot.getY()-1, PlotStyles.PLOT_STYLE_BOX_FILL, PlotLandscapeLayers.PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS, "COLOR_WHITE", fAlpha)
return
def setCurrentModeCheckbox(self, iButton):
screen = CyGInterfaceScreen( "WorldBuilderScreen", CvScreenEnums.WORLDBUILDER_SCREEN )
#print("iButton: %s" %(str(iButton)))
#print("m_iUnitEditCheckboxID: %s" %(str(self.m_iUnitEditCheckboxID)))
#print("m_iCityEditCheckboxID: %s" %(str(self.m_iCityEditCheckboxID)))
#print("m_iNormalPlayerCheckboxID: %s" %(str(self.m_iNormalPlayerCheckboxID)))
#print("m_iNormalMapCheckboxID: %s" %(str(self.m_iNormalMapCheckboxID)))
#print("m_iRevealTileCheckboxID: %s" %(str(self.m_iRevealTileCheckboxID)))
#print("m_iDiplomacyCheckboxID: %s" %(str(self.m_iDiplomacyCheckboxID)))
if (iButton == self.m_iUnitEditCheckboxID):
screen.setState("WorldBuilderUnitEditModeButton", True)
else:
screen.setState("WorldBuilderUnitEditModeButton", False)
if (iButton == self.m_iCityEditCheckboxID):
screen.setState("WorldBuilderCityEditModeButton", True)
else:
screen.setState("WorldBuilderCityEditModeButton", False)
if (iButton == self.m_iNormalPlayerCheckboxID):
screen.setState("WorldBuilderNormalPlayerModeButton", True)
else:
screen.setState("WorldBuilderNormalPlayerModeButton", False)
if (iButton == self.m_iNormalMapCheckboxID):
screen.setState("WorldBuilderNormalMapModeButton", True)
else:
screen.setState("WorldBuilderNormalMapModeButton", False)
if (iButton == self.m_iRevealTileCheckboxID):
screen.setState("WorldBuilderRevealTileModeButton", True)
else:
screen.setState("WorldBuilderRevealTileModeButton", False)
if (iButton == self.m_iDiplomacyCheckboxID):
screen.setState("WorldBuilderDiplomacyModeButton", True)
else:
screen.setState("WorldBuilderDiplomacyModeButton", False)
if (iButton == self.m_iLandmarkCheckboxID):
screen.setState("WorldBuilderLandmarkButton", True)
else:
screen.setState("WorldBuilderLandmarkButton", False)
if (iButton == self.m_iEraseCheckboxID):
screen.setState("WorldBuilderEraseButton", True)
else:
screen.setState("WorldBuilderEraseButton", False)
return
def initVars(self):
self.m_normalPlayerTabCtrl = 0
self.m_normalMapTabCtrl = 0
self.m_tabCtrlEdit = 0
self.m_flyoutMenu = 0
self.m_bCtrlEditUp = False
self.m_bUnitEdit = False
self.m_bCityEdit = False
self.m_bNormalPlayer = True
self.m_bNormalMap = False
self.m_bReveal = False
self.m_bDiplomacy = False
self.m_bLandmark = False
self.m_bEraseAll = False
self.m_bUnitEditCtrl = False
self.m_bCityEditCtrl = False
self.m_bShowBigBrush = False
self.m_bLeftMouseDown = False
self.m_bRightMouseDown = False
self.m_bChangeFocus = False
self.m_iNormalPlayerCurrentIndexes = []
self.m_iNormalMapCurrentIndexes = []
self.m_iNormalMapCurrentList = []
self.m_iCurrentPlayer = 0
self.m_iCurrentTeam = 0
self.m_iCurrentUnitPlayer = 0
self.m_iCurrentUnit = 0
self.m_iCurrentX = -1
self.m_iCurrentY = -1
self.m_pCurrentPlot = 0
self.m_pActivePlot = 0
self.m_pRiverStartPlot = -1
self.m_iUnitTabID = -1
self.m_iBuildingTabID = -1
self.m_iTechnologyTabID = -1
self.m_iImprovementTabID = -1
self.m_iBonusTabID = -1
self.m_iImprovementListID = -1
self.m_iBonusListID = -1
self.m_iTerrainTabID = -1
self.m_iTerrainListID = -1
self.m_iFeatureListID = -1
self.m_iPlotTypeListID = -1
self.m_iRouteListID = -1
self.m_iBrushSizeTabID = -1
self.m_iBrushWidth = 1
self.m_iBrushHeight = 1
self.m_iFlyoutEditUnit = 1
self.m_iFlyoutEditCity = 0
self.m_iFlyoutAddScript = -1
self.m_iFlyoutChangeStartYear = -2
self.m_pFlyoutPlot = 0
self.m_bFlyout = False
self.m_pUnitToScript = -1
self.m_pCityToScript = -1
self.m_pPlotToScript = -1
self.m_iUnitEditCheckboxID = -1
self.m_iCityEditCheckboxID = -1
self.m_iNormalPlayerCheckboxID = -1
self.m_iNormalMapCheckboxID = -1
self.m_iRevealTileCheckboxID = -1
self.m_iDiplomacyCheckboxID = -1
self.m_iLandmarkCheckboxID = -1
self.m_iEraseCheckboxID = -1
self.iScreenWidth = 228
return
## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
from CvPythonExtensions import *
#import Info as PyInfo
import CvUtil
gc = CyGlobalContext()
class PyPlayer:
' CyPlayer Helper Functions - Requires Player ID to initialize instance '
def __init__(self, iPlayer):
' Called whenever a new PyPlayer instance is created '
if iPlayer:
self.player = gc.getPlayer(iPlayer)
else:
self.player = gc.getPlayer(0)
def CyGet(self):
' used to get the CyUnit instance for quick calls '
return self.player
def getPlayer(self):
return self.player
def isNone(self):
' bool - Is the CyPlayer Instance Valid? '
return self.player.isNone()
def isAlive(self):
return self.player.isAlive()
def getID(self):
' int - ID # '
return self.player.getID()
def getName(self):
return self.player.getName()
# Players Team
def getTeamID(self):
' int - gets the players teamID '
return self.player.getTeam()
def getTeam(self):
' obj - returns Team Instance '
return gc.getTeam( self.getTeamID() )
def canTradeNetworkWith(self, iPlayer):
return self.player.canTradeNetworkWith(iPlayer)
# AI
def AI_getAttitude(self, iTeam):
return self.player.AI_getAttitude(iTeam)
# Players Gold
def getGold(self):
return self.player.getGold()
def changeGold(self, iGold):
self.player.changeGold(iGold)
def setGold(self, iGold):
' none - Sets Gold to iGold '
self.player.setGold( iGold )
def hasGold(self, iNumGold):
' bool - Has at least iNumGold? '
if ( self.player.getGold() >= iNumGold ):
return True
def getTotalMaintenance(self):
return self.player.getTotalMaintenance()
def calculateUnitCost(self):
return self.player.calculateUnitCost()
def calculateUnitSupply(self):
return self.player.calculateUnitSupply()
# Players Yields / Commerce
def getGoldCommerceRate(self):
' int - Players gold commerce rate '
return self.player.getCommerceRate( CommerceTypes.COMMERCE_GOLD )
def getResearchCommerceRate(self):
' int - Players research commerce rate '
return self.player.getCommerceRate( CommerceTypes.COMMERCE_RESEARCH )
def getCultureCommerceRate(self):
' int - Players culture commerce rate '
return self.player.getCommerceRate( CommerceTypes.COMMERCE_CULTURE )
def calculateResearchRate(self):
' int - Total Research Rate per Turn '
return self.player.calculateResearchRate( TechTypes.NO_TECH )
def getCommerceYieldRateModifier(self):
' int '
return self.player.getYieldRateModifier( YieldTypes.YIELD_COMMERCE )
def getFoodYieldRateModifier(self):
' int '
return self.player.getYieldRateModifier( YieldTypes.YIELD_FOOD )
def getProductionYieldRateModifier(self):
' int '
return self.player.getYieldRateModifier( YieldTypes.YIELD_PRODUCTION )
def getCommerceSeaPlotYield(self):
' int '
return self.player.getSeaPlotYield( YieldTypes.YIELD_COMMERCE )
def getFoodSeaPlotYield(self):
' int '
return self.player.getSeaPlotYield( YieldTypes.YIELD_FOOD )
def getProductionSeaPlotYield(self):
' int '
return self.player.getSeaPlotYield( YieldTypes.YIELD_PRODUCTION )
def getGoldPerTurn(self):
return self.player.getGoldPerTurn()
# Players Research
def getResearchedTechList(self):
' intlist - list of researched techs '
lTechs = []
for i in range(gc.getNumTechInfos()):
if self.hasResearchedTech(i):
lTechs.append(i)
return lTechs
def hasResearchedTech(self, iTech):
' bool - Has researched iTech '
if self.getTeam().isHasTech( iTech ):
return True
def setHasTech(self, iTech):
' gives the player iTech '
#int /*TechTypes*/ eIndex, bool bNewValue, int /*PlayerTypes*/ ePlayer, bool bFirst, bool bAnnounce
self.getTeam().setHasTech( iTech, True, self.getID(), False, False )
def getResearchTurnsLeft(self, iTech, bOverflow = 1):
' int '
return self.player.getResearchTurnsLeft( iTech, bOverflow )
def getCurrentTechName(self):
' str - Current Research Tech Name '
iTech = self.player.getCurrentResearch()
if ( iTech > 0 and iTech < gc.getNumTechInfos() ):
return str( gc.getTechInfo( iTech ).getDescription() )
# "No Research"
return "No Research"
def isBarbarian(self):
return self.player.isBarbarian()
def isMinorCiv(self):
return self.player.isMinorCiv()
def getNumTradeableBonuses(self, iBonus):
return self.player.getNumTradeableBonuses(iBonus)
def calculateInflatedCosts(self):
return self.player.calculateInflatedCosts()
def calculatePreInflatedCosts(self):
return self.player.calculatePreInflatedCosts()
def calculateGoldRate(self):
return self.player.calculateGoldRate()
# Players Civ
def getCivilizationInfo(self):
' CivilizationInfo - Civ Info instance '
return gc.getCivilizationInfo( self.player.getCivilizationType() )
def getCivDescription(self):
' str - Civ Description '
return self.player.getCivilizationDescription(0)
def getCivilizationName(self):
' str - Civ Description '
return self.player.getCivilizationDescription(0)
def getCivilizationShortDescription(self):
' str - Civ Description '
return self.player.getCivilizationShortDescription(0)
def getCivilizationAdjective(self):
' str - Civ Ajective '
return self.player.getCivilizationAdjective(0)
# Players LeaderHead
def getLeaderName(self):
return self.getLeaderHeadInfo().getDescription()
def getLeaderType(self):
return self.player.getLeaderType()
def getLeaderHeadInfo(self):
' LeaderHeadInfo - Leaders info instance '
return gc.getLeaderHeadInfo( self.player.getLeaderType() )
def getLeaderHeadDescription(self):
' str - Leader Name '
return self.getLeaderHeadInfo().getDescription()
def getLeaderHeadImage(self):
"str - location of the regular size leaderhead image"
return self.getLeaderHeadInfo().getLeaderHead()
# Players Traits
def getTraitList(self):
' intList - Trait List '
lTrait = []
for i in range( gc.getNumTraitInfos() ):
if ( self.getLeaderHeadInfo().hasTrait(i) ):
lTrait.append(i)
return lTrait
def getTraitInfos(self):
' TraitInfoList '
lTrait = []
for iTrait in self.getTraitList():
lTrait.append( gc.getTraitInfo(iTrait) )
return lTrait
# Players Civics
def getCurrentCivicByOption(self, iCivicOption):
' int - current civic for iCivicOption '
return self.player.getCivics( iCivicOption )
def getCurrentCivicList(self):
' intList - list of current Civic IDs '
lCivics = []
for i in range( CyGlobalContext().getNumCivicOptionInfos() ):
lCivics.append( self.player.getCivics( i ) )
return lCivics
def getCurrentCivicDescriptions(self):
' strList - description list of current civics '
lCivics = self.getCurrentCivicList()
for i in range( len(lCivics) ):
lCivics[i] = CyGlobalContext().getCivicInfo( lCivics[i] ).getDescription()
return lCivics
def getCivicUpkeep(self):
' int - total Civic Upkeep '
return self.player.getCivicUpkeep([], False) # pass in an empty list
# Players Units
def getUnitList(self):
' UnitList - All of the players alive units '
lUnit = []
(loopUnit, iter) = self.player.firstUnit(false)
while( loopUnit ):
if ( not loopUnit.isDead() ): #is the unit alive and valid?
lUnit.append(loopUnit) #add unit instance to list
(loopUnit, iter) = self.player.nextUnit(iter, false)
return lUnit
def getNumUnits(self):
return self.player.getNumUnits()
def getUnitByScriptData(self, scriptData):
for unit in self.getUnitList():
if unit.getScriptData() == scriptData:
return unit
return 0
def centerCameraByScriptData(self, scriptData):
unit = self.getUnitByScriptData(scriptData)
CyCamera().LookAtUnit(unit)
def initUnit(self, unitID, X, Y, iNum = 1):
"none - spawns unitIdx at X, Y - ALWAYS use default UnitAIType"
if (iNum > 1): #multiple units
for i in range(iNum):
self.player.initUnit(unitID, X, Y, UnitAITypes.NO_UNITAI)
else:
self.player.initUnit(unitID, X, Y, UnitAITypes.NO_UNITAI)
def hasUnitType(self, iUnit):
' bool - Has iUnit? '
for unit in self.getUnitList():
if ( unit.getUnitType() == iUnit ):
return True
def getUnitsOfType(self, iUnit):
' UnitList - of iUnit '
lUnits = []
for unit in self.getUnitList():
if ( unit.getUnitType() == iUnit ):
lUnits.append(unit)
return lUnits
def getNumUnitsLevel(self, iLevel):
' int - num units at iLevel '
iCounter = 0
for unit in self.getUnitList():
if ( unit.getLevel() >= iLevel ):
iCounter+=1
return iCounter
# Players Cities
def getTotalPopulation(self):
return self.player.getTotalPopulation()
def getCityList(self):
' PyCitylist - list of PyCity player owns '
lCity = []
(loopCity, iter) = self.player.firstCity(false)
while(loopCity):
cityOwner = loopCity.getOwner()
if ( not loopCity.isNone() and loopCity.getOwner() == self.getID() ): #only valid cities
city = PyCity( self.getID(), loopCity.getID() )
lCity.append(city)
(loopCity, iter) = self.player.nextCity(iter, false)
return lCity
def getNumCities(self):
return self.player.getNumCities()
def isFoundedFirstCity(self):
return self.player.isFoundedFirstCity()
def initCity(self, iX, iY):
' adds city to iX, iY '
self.player.initCity(iX, iY)
def getCapitalCity(self):
' PyCity - capital '
for city in self.getCityList():
if ( city.GetCy().isCapital() ):
return city
def getCity(self, iCity):
' PyCity - returns city iCity '
return self.player.getCityList()[iCity]
def getBuildingClassCount (self, iBuildingClass):
' int - total of building class '
return self.player.getBuildingClassCount( iBuildingClass )
# Players Plots
def getPlotList(self):
' plotList - player plots '
lPlots = []
for iIndex in self.getPlotIDList():
lPlots.append( CyMap().plotByIndex(i) )
return lPlots
def getTotalLand(self):
return self.player.getTotalLand()
def getPlotIDList(self):
' intList - player plots indexes '
lPlotIDs = []
for i in xrange( CyMap().numPlots() ):
if ( CyMap().sPlotByIndex( i ).getOwner() == self.getID() ):
lPlotIDs.append( i )
return lPlotIDs
def getNumPlots(self):
' int - numOwned plots '
return len( self.getPlotIDList() )
def getPlotsWithBonus(self, iBonus):
' plotList with iBonus '
lPlots = []
for plot in self.getPlotList():
if ( not plot.getBonusType() == BonusTypes.NO_BONUS and plot.getBonusType() == iBonus ):
lPlots.append(plot)
return lPlots
def getNumImprovementPlots(self):
' int numPlots with iImprovement '
iCounter = 0
for plot in self.getPlotList():
if ( not plot.getImprovementType() == ImprovementTypes.NO_IMPROVEMENT ):
iCounter += 1
return iCounter
class PyCity:
"requires player instance & cityID"
def __init__(self, iPlayerID, iCityID):
self.player = gc.getPlayer(iPlayerID)
self.city = self.player.getCity(iCityID)
def isNone(self):
"bool - Is the city instance valid?"
return self.city.isNone()
def GetCy(self):
' Cy instance of city '
return self.city
#################### G E N E R A L C I T Y F U N C T I O N S ####################
def getID(self):
"int - City ID"
return self.city.getID()
def getX(self):
"int - City's X Location"
return self.city.getX()
def getY(self):
"int - City's Y Location"
return self.city.getY()
def getIndex(self):
return self.city.getIndex()
def getName(self):
"str - Cities Name"
return self.city.getName()
def getNameKey(self):
"str - Cities Name"
return self.city.getNameKey()
def getScriptData(self):
"str - City's Script Data member"
return self.city.getScriptData()
def setScriptData(self, szScriptString):
"void - set City's Script Data member"
self.city.setScriptData(szScriptString)
def getOwner(self):
return self.city.getOwner()
def isBarbarian(self):
return self.city.isBarbarian()
def setName(self, newName):
"none - Set Cities Name"
return self.city.setName(newName, false)
def getPopulation(self):
"int - City Population"
return self.city.getPopulation()
def changePopulation(self, iChange):
"none - Change City Population by iChange"
return self.city.changePopulation(iChange)
def setPopulation(self, iValue):
"none - Set City Population"
return self.city.setPopulation(iValue)
def getAngryPopulation(self):
"int - Angry Population"
return self.city.angryPopulation(0)
def getHappyPopulation(self):
"int - Happy Population"
return self.city.happyLevel()
def getUnhappyPopulation(self):
"int - Unhappy Population"
return self.city.unhappyLevel(0)
def hasBuilding(self, iBuildingID):
"bool - Whether or not this city has iBuildingID"
return self.city.hasBuilding(iBuildingID)
def canTrain (self, iUnit):
return self.city.canTrain(iUnit, False, False)
def canConstruct (self, iBuilding):
return self.city.canConstruct(iBuilding, False, False, False)
def canCreate (self, iProject):
return self.city.canCreate(iProject, False, False)
def canMaintain (self, iItem):
return self.city.canMaintain(iItem, False)
def getProductionBuilding(self):
"int - What building ID this city is working on"
return self.city.getProductionBuilding()
def getProductionProject(self):
"int - What Project ID this city is working on"
return self.city.getProductionProject()
def getUnitProductionTurnsLeft (self, iUnit, iNum):
return self.city.getUnitProductionTurnsLeft(iUnit, iNum)
def getBuildingProductionTurnsLeft (self, iBuilding, iNum):
return self.city.getBuildingProductionTurnsLeft( iBuilding, iNum )
def getBuildingOriginalTime(self, iBuildingID):
return self.city.getBuildingOriginalTime(iBuildingID)
def getProjectProductionTurnsLeft (self, iProject, iNum):
return self.city.getProjectProductionTurnsLeft( iProject, iNum )
def foodConsumption(self, bAngry, iExtra):
return self.city.foodConsumption(bAngry, iExtra)
def getGreatPeopleProgress(self):
return self.city.getGreatPeopleProgress()
def getGreatPeopleRate(self):
return self.city.getGreatPeopleRate()
def getGameTurnFounded (self):
return self.city.getGameTurnFounded()
def getBaseGreatPeopleRate(self):
return self.city.getBaseGreatPeopleRate()
def getFoodRate(self):
"int - Total Food Yield"
return self.city.getYieldRate(YieldTypes.YIELD_FOOD)
def calculateGoldRate(self):
"int - Total Gold Yield"
return self.city.getYieldRate(YieldTypes.YIELD_COMMERCE)
def getProductionRate(self):
"int - Total Production Yield"
return self.city.getYieldRate(YieldTypes.YIELD_PRODUCTION)
def getResearchRate(self):
"int - Total Production Yield"
return self.city.getCommerceRate(CommerceTypes.COMMERCE_RESEARCH)
def getProductionName(self):
"str - Current Productions Name"
return self.city.getProductionName()
def getGeneralProductionTurnsLeft(self):
return self.city.getGeneralProductionTurnsLeft()
def getProductionNameKey(self):
"str - Current Productions Name"
return self.city.getProductionNameKey()
def isProductionProcess(self):
return self.city.isProductionProcess()
def getProductionTurnsLeft(self):
"int - Turns Remaining"
if self.isProductionProcess():
return "-"
return self.city.getProductionTurnsLeft()
def getCultureCommerce(self):
return self.city.getCommerceRate(CommerceTypes.COMMERCE_CULTURE)
def getCulture(self):
"int - Culture points"
return self.city.getCulture(self.player.getID())
def changeCulture(self, iChange, bPlots=True):
return self.city.changeCulture(self.player.getID(), iChange, bPlots)
def setCulture(self, iChange, bPlots=True):
self.city.setCulture(self.player.getID(), iChange, bPlots)
def getCultureThreshold(self):
return self.city.getCultureThreshold()
def getGoodHealth(self):
"int - Health rating"
return self.city.goodHealth()
def getBadHealth(self):
"int - Unhealthy rating"
return self.city.badHealth(False)
def getMaintenance(self):
"int - Maintenance rating"
return self.city.getMaintenance()
def plot(self):
"obj - Cities plot"
return self.city.plot()
def initUnit(self, iUnitID):
plot = self.plot()
gc.getActivePlayer().initUnit( iUnitID, plot.getX(), plot.getY(), UnitAITypes.NO_UNITAI )
def hasBuildingIdx(self, buildingIdx):
"bool - City has buildingIdx?"
if (self.city.hasBuilding(buildingIdx)):
return True
return False
def hasReligion(self, religionIdx):
"bool - City has religionIdx?"
if (self.city.isHasReligion(religionIdx)):
return True
return False
def isHolyCityByType(self, iReligion):
if self.city.isHolyCityByType(iReligion):
return True
return False
def getHolyCity(self):
lHolyCity = []
for i in range(gc.getNumReligionInfos()):
if self.city.isHolyCityByType(i):
lHolyCity.append(i)
return lHolyCity
def getReligions(self):
lReligions = []
for i in range(gc.getNumReligionInfos()):
if self.hasReligion(i):
lReligions.append(i)
return lReligions
def isCapital(self):
"bool - City is capital?"
if self.city.isCapital():
return True
return False
def isHealth(self):
"bool - City is healthy?"
if (self.getGoodHealth() > self.getBadHealth()):
return True
return False
def centerCamera(self):
"bool - Center camera on city"
engine = CyEngine()
plot = self.plot()
if plot:
engine.LookAt(plot.getPoint(), true)
def setHasRealBuildingIdx(self, buildingIdx, bAdd):
"none - Add or Remove (bAdd) by buildingIdx"
return self.city.setHasRealBuilding(buildingIdx, bAdd)
def getBuildingList(self):
"intList - List of all buildingIdx in the city"
numBuildingInfos = gc.getNumBuildingInfos()
buildingList=[]
for buildingIdx in range(numBuildingInfos):
if (self.hasBuildingIdx( buildingIdx )):
buildingList.append( buildingIdx )
return buildingList
def hasBonusIdx(self, iBonus):
return self.city.hasBonus(iBonus)
def getBonusList(self):
"intList - all bonuses connected to city"
lBonus = []
for i in range(gc.getNumBonusInfos()):
if self.hasBonusIdx( i ):
lBonus.append(i)
return lBonus
def getResourceSymbolList(self):
lBonus = self.getBonusList()
lBonusFound = []
lBonusString = ""
for i in range(len(lBonus)):
loopBonus = lBonus[i]
if loopBonus in lBonusFound:
continue
else:
lBonusString += "%s" %(PyInfo.BonusInfo(lBonus[i]).getSymbol())
return lBonusString
def getStateReligionHappiness(self, iReligion):
return self.city.getStateReligionHappiness(iReligion)
def getReligionInfluence(self, iReligion):
return self.city.getReligionInfluence(iReligion)
def isRevealed(self, iTeam):
return self.city.isRevealed(iTeam, false)
def isConnectedToCapital(self, iPlayer):
return self.city.isConnectedToCapital(iPlayer)
class PyGame:
"requires Nothing"
def __init__(self):
self.game = CyGame()
def isNone(self):
"bool - Is the game instance valid?"
return self.game.isNone()
#################### G E N E R A L G A M E F U N C T I O N S ####################
def getCivPlayerList(self):
"objlist - List of valid and Alive players"
playerList = []
for i in range(gc.getMAX_CIV_PLAYERS()):
if (gc.getPlayer(i).isAlive()):
loopPlayer = PyPlayer(gc.getPlayer(i).getID())
if (loopPlayer.isNone() or not loopPlayer.isAlive()):
continue
else:
playerList.append(loopPlayer)
return playerList
def getCivTeamList(self, iTeam):
team=gc.getTeam(iTeam)
teamPlayerList = []
playerList = self.getCivPlayerList()
for player in playerList:
if player.getTeam() == team.getID():
teamPlayerList.append(player)
return teamPlayerList
def canTeamTradeWith(self, team1ID, team2ID):
playersTeam1 = self.getCivTeamList(team1ID)
playersTeam2 = self.getCivTeamList(team2ID)
for i in range(len(playersTeam2)):
if playersTeam1[i].canTradeNetworkWith(playersTeam2[i].getID()):
return True
def getActivePlayer(self):
return gc.getPlayer(self.game.getActivePlayer())
def getActiveTeam(self):
"obj - active team instance"
return self.game.getActiveTeam()
def getGameTurn(self):
"int - game turn"
return self.game.getGameTurn()
def getNumCities(self):
"int - total cities"
return self.game.getNumCities()
def getTotalPopulation(self):
"int - total population"
return self.game.getTotalPopulation()
def isDebugMode(self):
"bool - debug mode?"
return self.game.isDebugMode()
def isPitbossHost(self):
"bool - Pitboss Host?"
return self.game.isPitbossHost()
def getEraTechList(self, era):
"listObj - returns a list of technology infos for a particular era"
listTechs = []
for i in range(gc.getNumTechInfos()):
loopInfo = PyInfo.TechnologyInfo(i)
if loopInfo.getiEra() == era:
listTechs.append(loopInfo)
return listTechs
def getListUniqueUnits(self):
lUniqueUnits = self.getListUniqueUnitID()
lUnitInfos = []
for i in range(len(lUniqueUnits)):
lUnitInfos.append(PyInfo.UnitInfo(lUniqueUnits[i]))
return lUnitInfos
def getListUniqueUnitID(self):
listUU = []
unitClass = []
for i in range(gc.getNumUnitInfos()):
iUnitClass = PyInfo.UnitInfo(i).getUnitClassType()
if iUnitClass in unitClass:
listUU.append(i)
else:
unitClass.append(iUnitClass)
return listUU
def getListAnimalUnits(self):
listUnits = []
for i in range(gc.getNumUnitInfos()):
loopUnit = PyInfo.UnitInfo(i)
if loopUnit.isAnimal():
listUnits.append(loopUnit)
return listUnits
def getListUnitCombatTypes(self, combatType, bUnique):
"listObj - list of unit infos of a particular combat type"
CombatTypes = {0:(0,'Neutral'),1:(1,'Recon'),2:(2,'Archery'),3:(3,'Mounted'),4:(4,'Melee'),5:(5,'Siege'),6:(6,'Gunpowder')}
listUnits = []
if bUnique:
UUidList = self.getListUniqueUnitID()
for i in range(gc.getNumUnitInfos()):
if bUnique:
if i in UUidList:
continue
loopUnit = PyInfo.UnitInfo(i)
if loopUnit.getUnitCombatType() == combatType:
listUnits.append(loopUnit)
return listUnits
def getListSeaUnits(self):
listUnits = []
for i in range(gc.getNumUnitInfos()):
loopUnit = PyInfo.UnitInfo(i)
domain = loopUnit.getDomainType()
if domain == DomainTypes.DOMAIN_SEA:
listUnits.append(loopUnit)
return listUnits
def getListAirUnits(self):
listUnits = []
for i in range(gc.getNumUnitInfos()):
loopUnit = PyInfo.UnitInfo(i)
domain = loopUnit.getDomainType()
if domain == DomainTypes.DOMAIN_AIR or domain == DomainTypes.DOMAIN_HELICOPTER:
listUnits.append(loopUnit)
return listUnits
class PyPlot:
def __init__(self, plotIdx):
self.map = CyMap()
self.plot = self.map.getPlotByID(plotIdx)
self.player = gc.getActivePlayer()
############## G E N E R A L ##############
def getX(self):
"int - X coordinate"
return self.plot.getX()
def getY(self):
"int - Y coordinate"
return self.plot.getY()
def getOwner(self):
"int - playerIdx"
return self.plot.getOwner()
def isUnit(self):
"int - unit present?"
return self.plot.isUnit()
def getNumUnits(self):
"int - number of units"
return self.plot.getNumUnits()
def isCity(self):
"bool - city present?"
return self.plot.isCity()
def getPlotCity(self):
"obj - city instance"
if (self.isCity()):
return self.plot.getPlotCity()
def getFoodYield(self):
"int - food yield"
return self.plot.getYield(YieldTypes.YIELD_FOOD)
def getProductionYield(self):
"int - production yield"
return self.plot.getYield(YieldTypes.YIELD_PRODUCTION)
def getCommerceYield(self):
"int - commerce yield"
return self.plot.getYield(YieldTypes.YIELD_COMMERCE)
############## T E R R A I N ##############
def getTerrainType(self):
"int - terrain type XML ID"
return self.plot.getTerrainType()
############## B O N U S ##############
def getBonusType(self):
"int - Bonus Xml ID"
return self.plot.getBonusType(-1)
def isBonus(self):
"bool - Any bonuses at all?"
if (self.getBonusType()):
return True
return False
############## F E A T U R E S ##############
def getFeatureType(self):
"int - Feature Type XML ID"
return self.plot.getFeatureType()
def isFeature(self):
"bool - any feature at all?"
if (self.getFeatureType()):
return True
return False
############## I M P R O V E M E N T ##############
def getImprovementType(self):
"int - Improvement Type XML ID"
return self.plot.getImprovementType()
def isImprovement(self):
"bool - Any improvements at all?"
if (self.getImprovementType()):
return True
return False
############## R O U T E ##############
def getRouteType(self):
"int - route type XML ID"
return self.plot.getRouteType()
class PyInfo:
def getInfoID(strInfoType, iID):
strInfoType = strInfoType.lower()
infoDict = InfoDictionary.get(strInfoType)
return infoDict['GET'](iID)
def getPyInfoID(strPyInfoType, iID):
PyInfoTypes = {'unit':UnitInfo,'building':BuildingInfo,'tech':TechnologyInfo}
strInfoType = strPyInfoType.lower()
return PyInfoTypes.get(strInfoType)(iID)
def getInfo(strInfoType, strInfoName): # returns info for InfoType
#set Type to lowercase
strInfoType = strInfoType.lower()
strInfoName = strInfoName.capitalize()
#get the appropriate dictionary item
infoDict = InfoDictionary.get(strInfoType)
#get the number of infos
numInfos = infoDict['NUM']()
#loop through each info
for i in range(numInfos):
loopInfo = infoDict['GET'](i)
if loopInfo.getDescription() == strInfoName:
#and return the one requested
return loopInfo
class BonusInfo:
"Bonus Info helper class"
def __init__(self, bonusID):
self.ID = bonusID
self.info = gc.getBonusInfo(self.ID)
def isNone(self):
if not self.info:
return True
return False
def isValid(self):
if self.info:
if self.ID >= 0 and self.ID < gc.getNumBonusInfos():
return True
return False
def getDescription(self):
"str - description of Bonus"
return self.info.getDescription()
def getButton(self):
return CyArtFileMgr().getBonusArtInfo(self.info.getArtDefineTag()).getButton()
def getSymbol(self):
"unicode - iChar Symbol"
return u"%c" %(self.info.getChar(),)
def getName(self):
"unicode - Bonuses Name"
return self.info.getDescription()
def getPrereqImprovementID(self):
lImprovements = []
for i in range(gc.getNumImprovementInfos()):
if self.ID in ImprovementInfo(i).getAffectedBonusIDList():
lImprovements.append(i)
return lImprovements
def getAPrereqImprovementID(self):
lImprovement = self.getPrereqImprovementID()
return lImprovement[0]
def getPrereqImprovementTechPrereqID(self):
rTech = []
reqImprovement = self.getPrereqImprovementID()
for i in range(len(reqImprovement)):
info = ImprovementInfo(reqImprovement[i])
rTech.append(info.getTechPrereq())
return rTech
def getATechPrereqID(self):
lTech = self.getPrereqImprovementTechPrereqID()
lenTech = len(lTech)
if lenTech > 0:
return lTech[0]
def getRevealTechDesc(self):
"str - Tech the bonus is revealed"
techReveal = self.info.getTechReveal()
if techReveal and not techReveal == -1:
techInfo = TechnologyInfo(techReveal)
return techInfo.getDescription()
return 0
def getRevealTechID(self):
"str - Tech the bonus is revealed"
techReveal = self.info.getTechReveal()
if techReveal and not techReveal == -1:
return techReveal
return -1
def getRevealTechButton(self):
"str - Location of button art for tech that reveals this bonus"
techReveal = self.getRevealTechID()
if techReveal and not techReveal == -1:
techInfo = TechnologyInfo(techReveal)
if techInfo:
return techInfo.getButton()
return 0
def getTradeTechDesc(self):
"str - Tech required for Trading"
techTrade = self.info.getTechCityTrade()
if techTrade and not techTrade == -1:
techInfo = TechnologyInfo(techTrade)
return techInfo.getDescription()
return 0
def getTradeTechID(self):
"str - Tech required for Trading"
techTrade = self.info.getTechCityTrade()
if techTrade and not techTrade == -1:
return techTrade
return -1
def getTradeTechButton(self):
"str - location of button art for tech that allows trading of this resource"
techTrade = self.getTradeTechID()
if techTrade and not techTrade == -1:
techInfo = TechnologyInfo(techTrade)
if techInfo:
return techInfo.getButton()
return 0
def getHappy(self):
"int - Happiness bonus"
happy = self.info.getHappiness()
if not happy == -1:
return happy
return -1
def getHealth(self):
"int - Health bonus"
health = self.info.getHealth()
if not health == -1:
return health
return -1
def getFoodBonus(self):
"int - Adjustment to Food yield"
yieldChange = self.info.getYieldChange(YieldTypes.YIELD_FOOD)
if yieldChange > 0:
return yieldChange
return 0
def getProductionBonus(self):
"int - Adjustment to Production yield"
yieldChange = self.info.getYieldChange(YieldTypes.YIELD_PRODUCTION)
if yieldChange > 0:
return yieldChange
return 0
def getCommerceBonus(self):
"int - Adjustment to Commerce yield"
yieldChange = self.info.getYieldChange(YieldTypes.YIELD_COMMERCE)
if yieldChange > 0:
return yieldChange
return 0
def checkTerrain(self,terrainID):
"bool - does the bonus appear on terrainID?"
return self.info.isTerrain(terrainID)
def getBonusTerrainList(self):
"int-list of terrainID's the bonus will spawn on"
bonusTerrainList = []
numTerrain = gc.getNumTerrainInfos()
for i in range(numTerrain):
if self.info.isTerrain(i):
bonusTerrainList.append(i)
return bonusTerrainList
def getNumPossibleTerrains(self):
"int - total terrains the bonus can appear on"
return len(self.getBonusTerrainList())
def checkFeature(self, featureID):
"bool - does the bonus spawn on featureID?"
return self.info.isFeature(featureID)
def getFeatureTerrainList(self):
"int-list of featureID's the bonus will spawn on"
featureTerrainList = []
numFeature = gc.getNumFeatureInfos()
for i in range(numFeature):
if self.info.isFeature(i):
featureTerrainList.append(i)
return featureTerrainList
def getNumPossibleFeatures(self):
"int - total features bonus can spawn on"
return len(self.getFeatureTerrainList)
def getImprovementChangeList(self):
"int-list of ImprovementID's the bonus affects"
ImprovementList = []
for i in range(gc.getNumImprovementInfos()):
loopInfo = ImprovementInfo(i)
if self.ID in loopInfo.getAffectedBonusIDList():
ImprovementList.append(loopInfo)
return ImprovementList
def getImprovementChangeIDList(self):
iList = []
for i in range(gc.getNumImprovementInfos()):
loopInfo = ImprovementInfo(i)
idList = loopInfo.getAffectedBonusIDList()
if self.ID in idList:
iList.append(i)
return iList
def getNumImprovementChanges(self):
return len(self.getImprovementChangeList())
def getImprovementModifierInfo(self):
iImprovement = self.getAPrereqImprovementID()
info = ImprovementInfo(iImprovement)
lEffects = []
for i in range(YieldTypes.NUM_YIELD_TYPES):
iResult = info.getImprovementBonusYield(self.ID, i)
lEffects.append((i, iResult))
return lEffects
def getImprovementFoodBonus(self):
return self.getImprovementModifierInfo()[0][1]
def getImprovementProductionBonus(self):
return self.getImprovementModifierInfo()[1][1]
def getImprovementCommerceBonus(self):
return self.getImprovementModifierInfo()[2][1]
def isImprovement(self, ImprovementID):
iList = self.getImprovementChangeIDList()
if ImprovementID in iList:
return True
return False
def getListImprovementButtons(self):
lButtons = []
lImprovements = self.getImprovementChangeList()
for i in range(len(lImprovements)):
lButtons.append(lImprovements[i].getButton())
return lButtons
def getScale(self):
"int - the bonuses scale"
return self.info.fScale
class UnitInfo:
"Unit Info helper class"
def __init__(self, unitTypeID):
self.unitTypeID = unitTypeID
self.info = gc.getUnitInfo(self.unitTypeID)
def isValid(self):
if self.info:
return True
return False
def getID(self):
return self.unitTypeID
def getDescription(self):
"str - Units Name"
return self.info.getDescription()
def getButton(self):
"str - Units KFM Button - DDS Format"
return CyArtFileMgr().getUnitArtInfo(self.info.getArtDefineTag(0)).getButton()
def isAnimal(self):
"bool - an animal?"
if self.info.isAnimal():
return True
return False
def isFoodProduction(self):
"bool - requires food production?"
if self.info.isFoodProduction():
return True
return False
def getCombatStrength(self):
"int - base combat strength"
return self.info.getCombat()
def getMoves(self):
"int - base unit movements"
return self.info.getMoves()
def getProductionCost(self):
"int - production cost"
return self.info.getProductionCost()
def getDomainType(self):
"int - domain type"
return self.info.getDomainType()
def getUnitClassType(self):
"str - unit class type"
return self.info.getUnitClassType()
def isUniqueUnit(self):
"bool - is this unit a unique unit"
lUniqueUnits = PyGame.PyGame().getListUniqueUnitID()
if self.unitID in lUniqueUnits:
return True
return False
def getListUnitClassID(self):
"intList - id list of all unit infos that match combat type with current unit"
lUnitClassID = []
for i in range(gc.getNumUnitInfos()):
if UnitInfo(i).getUnitClassType() == self.getUnitClassType():
lUnitClassID.append(i)
return lUnitClassID
def getUnitCombatType(self):
"int - combat type"
return self.info.getUnitCombatType()
def getUnitAITypes(self, AIType):
"objlist - list of units of AIType"
UnitAIList=[]
for i in range(UnitAITypes.NUM_UNITAI_TYPES):
if self.info.getUnitAITypes(i) == AIType:
UnitAIList.append(i)
return UnitAIList
def isTechPrereq(self,techID):
"bool - is techID a prereq of this tech?"
if techID == self.getTechPrereqID():
return True
elif techID in self.getPrereqOrTechIDList():
return True
return False
def isLatestTechPrereq(self,techID):
pTechOr = self.getPrereqOrTechIDList()
if pTechOr:
pTechOr = pTechOr.sort()
for i in range(len(pTechOr)):
if techID < pTechOr[i]:
return True
return False
def getTechPrereq(self):
"str - prerequisite technology"
pTech = self.info.getPrereqAndTech()
if pTech >= 0 and pTech < gc.getNumTechInfos():
return TechnologyInfo(pTech).getDescription()
def getTechPrereqID(self):
"int - prerequisite techs xml id"
pTech = self.info.getPrereqAndTech()
if pTech >= 0 and pTech < gc.getNumTechInfos():
return pTech
return -1
def getTechPrereqButton(self):
"str - location of techs button art"
pTech = self.getTechPrereqID()
if pTech and not pTech == 0:
return TechnologyInfo(pTech).getButton()
def getPrereqOrTechIDList(self):
"intList - IDList of multiple tech requirements"
pTechIDList = []
for i in range(gc.getDefineINT("NUM_UNIT_OR_TECH_PREREQS")):
iResult = self.info.getPrereqOrTechs(i)
if iResult >= 0:
pTechIDList.append(iResult)
return pTechIDList
def getPrereqOrTechInfoList(self):
"objList - Info list of IDList items"
pTechIDList = self.getPrereqOrTechIDList()
pTechInfos = []
for i in range(len(pTechIDList)):
pTechInfos.append(UnitInfo(pTechIDList[i]))
return pTechInfos
def getPrereqBonusID(self):
"int - required bonus ID"
if self.info.getPrereqAndBonus():
return self.info.getPrereqAndBonus()
return -1
def getPrereqBonusInfo(self):
"obj - info for required bonus ID"
pBonus = self.info.getPrereqAndBonus()
if pBonus >= 0 and pBonus <= gc.getNumBonusInfos():
return pBonus
def getPrereqBonusIcon(self):
"str - prerequisite bonus"
pBonus = self.info.getPrereqAndBonus()
if pBonus >= 0 and pBonus < gc.getNumBonusInfos():
return "%c" %(BonusInfo(pBonus).getSymbol())
return ""
def getPrereqBonusIDList(self):
"intList - ID list of multiple bonus requirements"
preqBonusIDList = []
for i in range(gc.getNUM_UNIT_PREREQ_OR_BONUSES()):
iResult = self.info.getPrereqOrBonuses(i)
if iResult >=0:
preqBonusIDList.append(iResult)
return preqBonusIDList
def getPrereqBonusInfoList(self):
"objList - Info list of multiple bonus requirements"
bInfos = []
pBonuses = self.getPrereqBonusIDList()
for item in pBonuses:
bInfos.append(UnitInfo(item))
return bInfos
def getPrereqBonusIcons(self):
"str - string with all required bonuses"
bonusIcons = ""
pBonuses = self.getPrereqBonusIDList()
for i in range(len(pBonuses)):
loopID = pBonuses[i]
loopIcon = BonusInfo(loopID).getSymbol()
bonusIcons+= loopIcon
return bonusIcons
class SpecialistInfo:
"Specialist Info helper class"
def __init__(self, specialistID):
self.specialistID = specialistID
self.info = gc.getSpecialistInfo(self.specialistID)
def isValid(self):
if self.info:
return True
return False
def getName(self):
"str - Specialist Name"
return self.info.getDescription()
def getIcon(self):
"str - Specialist Icon"
return CvUtil.getIcon('GREATPEOPLE')
def getGoldCommerce(self):
"int - generated Gold Commerce"
return self.info.getCommerceChange(CommerceTypes.COMMERCE_GOLD)
def getResearchCommerce(self):
"int - generated Research Commerce"
return self.info.getCommerceChange(CommerceTypes.COMMERCE_RESEARCH)
def getCultureCommerce(self):
"int - generated Culture Commerce"
return self.info.getCommerceChange(CommerceTypes.COMMERCE_CULTURE)
def getFoodYield(self):
"int - generated Food Yield"
return self.info.getYieldChange(YieldTypes.YIELD_FOOD)
def getProductionYield(self):
"int - generated Production Yield"
return self.info.getYieldChange(YieldTypes.YIELD_PRODUCTION)
def getCommerceYield(self):
"int - generated Commerce Yield"
return self.info.getYieldChange(YieldTypes.YIELD_COMMERCE)
def getRequiredBuildingID(self):
"int - Required Buildings XML ID"
numBuildings = gc.getNumBuildingInfos()
for i in range(numBuildings):
buildingInfo = gc.getBuildingInfo(i)
if ( buildingInfo and buildingInfo.iSpecialist == self.specialistID ):
return i
return -1
def getRequiredBuildingName(self):
"str - Required Buildings Name"
reqBuildingID = self.getRequiredBuildingID()
if not reqBuildingID == -1:
return BuildingInfo(reqBuildingID).getDescription()
def getRequiredBuildingButton(self):
"int - Required Buildings Button"
reqBuildingID = self.getRequiredBuildingID()
if not reqBuildingID == -1:
return BuildingInfo(reqBuildingID).getButton()
return 0
def getBuildingRequiredTechID(self):
"int - required buildings ID"
reqBuildingID = self.getRequiredBuildingID()
if not reqBuildingID == -1:
return BuildingInfo(reqBuildingID).getTechPrereq()
return -1
def getBuildingRequiredTechnologyButton(self):
"str - building requireds technology button path"
techID = self.getBuildingRequiredTechID()
if not techID == -1:
return TechnologyInfo(techID).getButton()
return ""
class TechnologyInfo:
"Technology Info class for easier manipulation of this object"
def __init__(self, techID):
self.techID = techID
self.info = gc.getTechInfo(techID)
def isValid(self):
if self.info:
return True
return False
def getID(self):
"int - tech instances id"
return self.techID
def getDescription(self):
"str - techs name"
return self.info.getDescription()
def getButton(self):
"str - location of kfm button"
if self.isValid():
return self.info.getButton()
return 0
def createPrereqDictionary(self):
pDict = {}
for i in range(gc.getNumTechInfos()):
TechInfo = TechnologyInfo(i)
pDict[i]=(i,"%s" %(TechInfo.getDescription()), TechInfo.getTechPreqIdxList())
return pDict
def createNamePrereqDictionary(self):
pDict = {}
f = file('TechPrereq.txt', "w")
f.write("### CIV Tech Prereq List ###\n\n")
for i in range(gc.getNumTechInfos()):
lInfo = TechnologyInfo(i)
f.write("\n (%d)%s - %s" %(i, lInfo.getDescription(), lInfo.getTechPreqDescList()))
f.close()
def getTechPreqIdxList(self):
"intList - list of prerequisite techs in nested forum ((mining,agriculture),(agriculture,thewheel))"
techInfo = self.info
preqList = []
info = ()
for i in range(4):
for j in range(4):
result = techInfo.getTechPrereqs(i,j)
if not result == -1:
info = info + (result,)
if j == 3 and not len(info) < 1:
if len(info) == 0:
pass
preqList.append(info)
info = ()
return preqList
def getTechPreqDescList(self):
lPrereqID=self.getTechPreqIdxList()
lPrereqDesc = []
lInfo = []
for i in range(len(lPrereqID)):
lGroup = lPrereqID[i]
if len(lGroup) > 0:
for j in range(len(lPrereqID[i])):
lGroup2 = lPrereqID[i][j]
lInfo.append(TechnologyInfo(lGroup2).getDescription())
lPrereqDesc.append(lInfo)
lInfo=[]
return lPrereqDesc
def getTechPreqInfoList(self):
"objList - takes the ID functions and returns them in info form"
preqList = self.getTechPreqIdxList()
infoList = []
infoGroup = ()
if preqList:
for i in range(len(preqList)):
loopGroup = preqList[i]
for j in range(len(loopGroup)):
loopID = loopGroup[j]
loopInfo = TechnologyInfo(loopID)
if loopInfo:
infoGroup = infoGroup + (loopInfo,)
if infoGroup:
infoList.append(infoGroup)
infoGroup = ()
return infoList
def getTechPreqButtonList(self):
"objList - list of preqtechs buttons locations"
pTechButtons = []
for info in self.getTechPreqInfoList():
button = info.getButton()
pTechButtons.append(button)
return pTechButtons
def getResearchCost(self):
"int - research cost"
return self.info.getResearchCost()
def getiEra(self):
"int - the techs era"
return self.info.getEra()
def isWorkerSpeedModifier(self):
"bool - tech modify worker speed?"
return self.info.iWorkerSpeedModifier
def getTradeRouteModifer(self):
"int - trade route modifier"
if self.info.iTradeRoutes:
return self.info.iTradeRoutes
return 0
def getWorkerSpeedModifier(self):
"int - how much are they modified?"
if self.info.iWorkerSpeedModifier > 0:
return self.info.iWorkerSpeedModifier
return 0
def isGoodyTech(self):
"bool - can this tech be researched from popping a goodie hut?"
if self.info.bGoodyTech:
return True
return False
def getHealthBonus(self):
if self.info.getHealth():
return self.info.getHealth()
return 0
def getUnlockedBuildingIdxList(self):
"intList - IDList of unlocked Buildings"
buildingList=[]
numBuilding = gc.getNumBuildingInfos()
for i in range(numBuilding):
loopBuilding = gc.getBuildingInfo(i)
if loopBuilding.getPrereqAndTech() == self.techID:
buildingList.append(i)
return buildingList
def getListUnlockedBuildingInfos(self):
"objList - info list of unlocked buildings"
idList = self.getUnlockedBuildingIdxList()
buildingList = []
for i in range(len(idList)):
buildingList.append(BuildingInfo(idList[i]))
return buildingList
def getUnlockedUnitIdxList(self):
"intList - IDList of unlocked Units"
unitList=[]
for i in range(gc.getNumUnitInfos()):
loopUnit = UnitInfo(i)
if loopUnit.isTechPrereq(self.techID):
unitList.append(i)
return unitList
def getNoUniqueUnlockedUnitIDList(self):
lUniqueUnits = PyGame.PyGame().getListUniqueUnitID()
lAllUnits = self.getUnlockedUnitIdxList()
lUnits = []
for i in range(len(lAllUnits)):
loopUnit = lAllUnits[i]
if loopUnit in lUniqueUnits:
continue
else:
lUnits.append(loopUnit)
return lUnits
def getListUnlockedUnitInfos(self):
"objList - info list of unlocked units"
unitList = []
for i in range(len(self.getUnlockedUnitIdxList())):
unitList.append(UnitInfo(idList[i]))
return unitList
def getNoUniqueUnlockedUnitInfoList(self):
lUnitInfos = []
for unitID in self.getNoUniqueUnlockedUnitIDList():
lUnitInfos.append(UnitInfo(unitID))
return lUnitInfos
def getUnlockedReligionIdxList(self):
"intList - IDList of unlocked Religions"
religionlist = []
for i in range(gc.getNumReligionInfos()):
if ( gc.getReligionInfo(i).getTechPrereq() == self.techID ):
religionList.append(i)
return religionList
def getReligionButton(self):
"str - religion icon"
for i in range(gc.getNumReligionInfos()):
if ( gc.getReligionInfo(i).getTechPrereq() == self.techID ):
return "%c" %(gc.getReligionInfo(i).getChar(),)
return 0
def isBuildTech(self):
"bool - unlocks build"
for i in range(gc.getNumBuildInfos()):
if ( BuildInfo(i).getTechPrereq() == self.techID ):
return True
return False
def getUnlockedBuildInfos(self):
"objList - list of build infos the tech unlocks"
lBuilds = []
for i in range(gc.getNumBuildInfos()):
if ( BuildInfo(i).getTechPrereq() == self.techID ):
lBuilds.append(BuildInfo(i))
return lBuilds
def isCivicTech(self):
"bool - tech unlocks Civic?"
for i in range(gc.getNumCivicInfos()):
if ( gc.getCivicInfo(i).getTechPrereq() == self.techID ):
return True
return False
def getUnlockedCivicInfos(self):
"objList - list of civic infos the tech unlocks"
lCivics=[]
for i in range(gc.getNumCivicInfos()):
if ( gc.getCivicInfo(i).getTechPrereq() == self.techID ):
lCivics.append(i)
return lCivics
class ImprovementInfo:
def __init__(self, improvementID):
self.ID = improvementID
self.info = gc.getImprovementInfo(self.ID)
def getID(self):
return self.ID
def getDescription(self):
return self.info.getDescription()
def getButton(self):
return CyArtFileMgr().getImprovementArtInfo(self.info.getArtDefineTag()).getButton()
def isValid(self):
if self.info:
return True
return False
# XXX Should this be isWater? - JShafer
def isFreshWater(self):
if self.info.isFreshWater():
return True
return False
def isGoody(self):
if self.info.isGoody():
return True
return False
def getTilesPerGoody(self):
return self.info.getTilesPerGoody()
def getGoodyUniqueRange(self):
return self.info.getGoodyUniqueRange()
def getUpgradeTime(self):
return self.info.getUpgradeTime()
def getPillageGold(self):
return self.info.getPillageGold()
def getImprovementUpgrade(self):
return self.info.getImprovementUpgrade()
# XXX Do these exist? - JShafer
def getScale(self):
return self.info.fScale
def canTerrain(self, iTerrain):
return self.info.getTerrain(iTerrain)
def canFeature(self, iFeature):
return self.info.getFeature(iFeature)
def getYieldChange(self, iYield):
return self.info.getYieldChange(iYield)
def getHillsYieldChange(self, iYield):
return self.info.getHillsYieldChange(iYield)
def getRiverSideYieldChange(self, iYield):
return self.info.getRiverSideYieldChange(iYield)
def getPrereqNatureYield(self, i):
return self.info.getPrereqNatureYield(i)
def getIrrigatedYieldChange(self, iYield):
return self.info.getIrrigatedYieldChange(iYield)
def getImprovementBonusYield(self, i, j):
return self.info.getImprovementBonusYield(i, j)
def getBuildInfo(self):
for i in range(gc.getNumBuildInfos()):
if gc.getBuildInfo(i).iImprovement == self.ID:
return gc.getBuildInfo(i)
def getTechPrereq(self):
return self.getBuildInfo().getTechPrereq()
def getValidTerrainIDList(self):
"intList - terrain ID's the improvement can be built on"
lTerrain = []
for i in range(gc.getNumTerrainInfos()):
if self.canTerrain(i):
lTerrain.append(i)
return lTerrain
def getValidTerrainInfoList(self):
"objList - terrain infos"
lTerrain = self.getValidTerrainIDList()
if lTerrain > 0:
for i in range(len(lTerrain)):
lTerrain[i] = gc.getTerrainInfo(i)
return lTerrain
def getValidFeatureIDList(self):
"intList - feature ID's the improvement can be built on"
lFeature = []
for i in range(gc.getNumFeatureInfos()):
if self.canFeature(i):
lFeature.append(i)
return lFeature
def getValidFeatureInfoList(self):
"objList - features info"
lFeature = self.getValidFeatureIDList()
if lFeature > 0:
for i in range(len(lFeature)):
lFeature[i] = gc.getFeatureInfo(i)
return lFeature
def getBonusList(self):
"loops through all of the bonuses and determines the effect this improvement has on it"
lBonus = []
for i in range(gc.getNumBonusInfos()):
for j in range(YieldTypes.NUM_YIELD_TYPES):
iResult = self.getImprovementBonusYield(i, j)
if iResult:
item = (i, j, iResult)
lBonus.append(item)
return lBonus
def getAffectedBonusIDList(self):
"intList - just the Bonus ID's that are affected"
lBonus = self.getBonusList()
lBonusID = []
if lBonus:
for i in range(len(lBonus)):
loopEntry = lBonus[i]
lBonusID.append(loopEntry[0])
return lBonusID
def getAffectedBonusInfoList(self):
"objList - affected bonuses infos"
lBonusID = self.getAffectedBonusIDList()
lBonus=[]
lBonusTrack = []
if lBonusID:
for i in range(len(lBonusID)):
loopID = lBonusID[i]
if loopID in lBonusTrack: #dont need multiple infos for the same bonus
continue
lBonus.append(BonusInfo(loopID))
lBonusTrack.append(loopID)
return lBonus
def getBonusInfoList(self):
lBonus = self.getBonusList()
nlBonus = []
if lBonus:
for i in range(len(lBonus)):
loopEntry = lBonus[i]
loopBonus = BonusInfo(loopEntry[0])
loopYield = gc.getYieldInfo(loopEntry[1])
loopModifier = loopEntry[2]
loopItem = (loopBonus,loopYield,loopModifier)
nlBonus.append(loopItem)
return nlBonus
def getBonusIcons(self):
lBonus = self.getAffectedBonusInfoList()
lIcons = ""
if lBonus:
for i in range(len(lBonus)):
lIcons += lBonus[i].getSymbol()
return lIcons
class CivicInfo:
def __init__(self, iCivicInfoID):
self.ID = iCivicInfoID
self.TYPE = gc.getCivicInfo(self.ID).getCivicOptionType()
self.info = gc.getCivicInfo(self.TYPE, self.ID)
def getID(self):
return self.ID
def getDescription(self):
return self.info.getDescription()
def getName(self):
return self.getDescription()
def getMaintenance(self):
if self.info.getMaintenance():
return self.info.getMaintenance()
return 0
def getButton(self):
return TechnologyInfo(self.getTechPrereq()).getButton()
def getTechPrereq(self):
return self.info.getTechPrereq()
class PromotionInfo:
def __init__(self, iPromotionID):
self.ID = iPromotionID
self.info = gc.getPromotionInfo(self.ID)
def getDescription(self):
return self.info.getDescription()
def getButton(self):
return self.info.getButton()
def getCityAttackPercent(self):
if self.info.getCityAttackPercent():
return self.info.getCityAttackPercent()
return 0
def getCityDefensePercent(self):
if self.info.getCityDefensePercent():
return self.info.getCityDefensePercent()
return 0
def getCombatPercent(self):
if self.info.getCombatPercent():
return self.info.getCombatPercent()
return 0
def getHillsDefensePercent(self):
if self.info.getHillsDefensePercent():
return self.info.getHillsDefensePercent()
return 0
def getChanceFirstStrikesChange(self):
if self.info.getChanceFirstStrikesChange():
return self.info.getChanceFirstStrikesChange()
return 0
def getCollateralDamageChange(self):
if self.info.getCollateralDamageChange():
return self.info.getCollateralDamageChange()
return 0
def getEnemyHealChange(self):
if self.info.getEnemyHealChange():
return self.info.getEnemyHealChange()
return 0
def getFirstStrikesChange(self):
if self.info.getFirstStrikesChange():
return self.info.getFirstStrikesChange()
return 0
def getFriendlyHealChange(self):
if self.info.getFriendlyHealChange():
return self.info.getFriendlyHealChange()
return 0
def getNeutralHealChange(self):
if self.info.getNeutralHealChange():
return self.info.getNeutralHealChange()
return 0
def getPrereqPromotionID(self):
return self.info.iPrereqPromotion
def getMoveDiscountChange(self):
if self.info.iMoveDiscountChange:
return self.info.iMoveDiscountChange
return 0
def getVisibilityChange(self):
if self.info.getVisibilityChange():
return self.info.getVisibilityChange()
return 0
def getWithdrawalChange(self):
if self.info.getWithdrawalChange():
return self.info.getWithdrawalChange()
return 0
def getFeatureDefensePercent(self, iFeature):
return self.info.getFeatureDefensePercent(iFeature)
def getTerrainDefensePercent(self, iTerrain):
return self.info.getTerrainDefensePercent(iTerrain)
def getFeatureDefenseIDList(self):
lFeatures = []
for i in range(gc.getNumFeatureInfos()):
if self.getFeatureDefensePercent(i):
lFeatures.append(i)
return lFeatures
def getFeatureDefenseInfoList(self):
lFeatures = self.getFeatureDefenseIDList()
lInfo = []
for i in range(len(lFeatures)):
lInfo.append(gc.getFeatureInfo(lFeatures[i]))
return lInfo
def getTerrainDefenseIDList(self):
lTerrain = []
for i in range(gc.getNumTerrainInfos()):
if self.getTerrainDefensePercent(i):
lTerrain.append(i)
return lTerrain
def getTerrainDefenseInfoList(self):
lTerrain = self.getTerrainDefenseIDList()
lInfo = []
for i in range(len(lTerrain)):
lInfo.append(gc.getTerrainInfo(lTerrain[i]))
return lInfo
class BuildingInfo:
"Building Info helper class"
def __init__(self, buildingID):
self.buildingID = buildingID
self.info = gc.getBuildingInfo(self.buildingID)
def isValid(self):
if self.info:
return True
return False
def getID(self):
return self.buildingID
def getDescription(self):
return self.info.getDescription()
def getButton(self):
return CyArtFileMgr().getBuildingArtInfo(self.info.getArtDefineTag()).getButton()
def getTechPrereq(self):
return self.info.getPrereqAndTech()
class FeatureInfo:
def __init__(self, featureID):
self.featureID = featureID
self.info = gc.getFeatureInfo(self.featureID)
def isValid(self):
"is it a valid instance?"
if self.info:
return True
return False
def getDescription(self):
"string - name of feature"
return self.info.getDescription()
def getButton(self):
"string - returns Button"
return self.info.getButton()
def getMovementCost(self):
"int - movement cost for passing through feature"
return self.info.getMovementCost()
def getDefenseModifier(self):
"float - defense modifier"
return self.info.getDefenseModifier()
def isImpassable(self):
return self.isImpassable()
def checkTerrain(self, terrainID):
"bool - can the feature appear on terrainID?"
if self.info.checkTerrain(terrainID):
return True
return False
def getFeatureTerrainList(self, terrainList):
featureTerrainList = []
numTerrain = gc.getNumTerrainInfos()
for i in range(numTerrain):
if self.info.checkTerrain(i):
featureTerrainList.append()
return featureTerrainLIst
def getFoodYieldChange(self):
return self.info.getYieldChange(YieldTypes.YIELD_FOOD)
def getProductionYieldChange(self):
return self.info.getYieldChange(YieldTypes.YIELD_PRODUCTION)
def getCommerceYieldChange(self):
return self.info.getYieldChange(YieldTypes.YIELD_COMMERCE)
def getHillsFoodYieldChange(self):
return self.info.getHillsYieldChange(YieldTypes.YIELD_FOOD)
def getHillsProductionYieldChange(self):
return self.info.getHillsProductionYieldChange(YieldTypes.YIELD_PRODUCTION)
def getHillsCommerceYieldChange(self):
return self.info.getHillsCommerceYieldChange(YieldTypes.YIELD_COMMERCE)
class TerrainInfo:
"Terrain Info helper class"
def __init__(self, terrainID):
self.terrainID = terrainID
self.info = gc.getTerrainInfo(self.terrainID)
def isValid(self):
if self.info:
return True
return False
def isWater(self):
return self.info.isWater()
def isImpassable(self):
return self.info.isbImpassable()
def getMovementCost(self):
return self.info.getMovementCost()
def getDefenseModifier(self):
return self.info.getDefenseModifier()
def getFoodYield(self):
return self.info.getYield(YieldTypes.YIELD_FOOD)
def getProductionYield(self):
return self.info.getYield(YieldTypes.YIELD_PRODUCTION)
def getCommerceYield(self):
return self.info.getYield(YieldTypes.YIELD_COMMERCE)
def getHillsFoodYieldChange(self):
return self.info.getHillsYieldChange(YieldTypes.YIELD_FOOD)
def getHillsProductionYieldChange(self):
return self.info.getHillsYieldChange(YieldTypes.YIELD_PRODUCTION)
def getHillsCommerceYieldChange(self):
return self.info.getHillsYieldChange(YieldTypes.YIELD_COMMERCE)
class BuildInfo:
def __init__(self, ID):
self.ID = ID
self.info = gc.getBuildInfo(self.ID)
def getID(self):
return self.ID
def getName(self):
return self.info.getDescription()
def getButton(self):
return self.info.getButton()
def getTechPrereq(self):
return self.info.getTechPrereq()
InfoDictionary = {
'bonus': {'NUM': gc.getNumBonusInfos, 'GET': gc.getBonusInfo},
'improvement': {'NUM': gc.getNumImprovementInfos, 'GET': gc.getImprovementInfo},
'yield': {'NUM': YieldTypes.NUM_YIELD_TYPES, 'GET': gc.getYieldInfo},
'religion': {'NUM': gc.getNumReligionInfos, 'GET': gc.getReligionInfo},
'tech': {'NUM': gc.getNumTechInfos, 'GET': TechnologyInfo},
'unit': {'NUM': gc.getNumUnitInfos, 'GET': UnitInfo},
'civic': {'NUM': gc.getNumCivicInfos, 'GET': gc.getCivicInfo},
'building': {'NUM': gc.getNumBuildingInfos, 'GET': BuildingInfo},
'terrain': {'NUM': gc.getNumTerrainInfos, 'GET': gc.getTerrainInfo},
'trait': {'NUM': gc.getNumTraitInfos, 'GET': gc.getTraitInfo},
}
// city.h
#ifndef CIV4_CITY_H
#define CIV4_CITY_H
#include "CvDLLEntity.h"
#include "LinkedList.h"
//#include "CvStructs.h"
//#include "CvEnums.h"
class CvPlot;
class CvPlotGroup;
class CvArea;
class CvGenericBuilding;
typedef std::vector RowType;
typedef std::vector PlotType;
class CvCity : public CvDLLEntity
{
public:
enum SaveBits
{
SAVEDATA_LAST_DEFENSE_DAMAGE = 0x01
};
CvCity();
virtual ~CvCity();
void init(int iID, PlayerTypes eOwner, int iX, int iY);
void uninit();
void reset(int iID = 0, PlayerTypes eOwner = NO_PLAYER, int iX = 0, int iY = 0, bool bConstructorCall = false);
void setupGraphical();
DllExport void kill(); // Exposed to Python
void doTurn();
bool isCitySelected();
DllExport bool canBeSelected() const;
DllExport void updateSelectedCity();
void updateYield();
void updateVisibility();
void createGreatPeople(UnitTypes eGreatPersonUnit, bool bIncrementThreshold); // Exposed to Python
DllExport void doTask(TaskTypes eTask, int iData1 = -1, int iData2 = -1, bool bOption = false); // Exposed to Python
DllExport void chooseProduction(UnitTypes eTrainUnit = NO_UNIT, BuildingTypes eConstructBuilding = NO_BUILDING, ProjectTypes eCreateProject = NO_PROJECT, bool bFinish = false, bool bFront = false); // Exposed to Python
DllExport int getCityPlotIndex(const CvPlot* pPlot) const; // Exposed to Python
CvPlot* getCityIndexPlot(int iIndex); // Exposed to Python
bool canWork(CvPlot* pPlot); // Exposed to Python
void verifyWorkingPlot(int iIndex);
void verifyWorkingPlots();
void clearWorkingOverride(int iIndex); // Exposed to Python
int countNumImprovedPlots(); // Exposed to Python
int countNumWaterPlots(); // Exposed to Python
int findPopulationRank(); // Exposed to Python
int findBaseYieldRateRank(YieldTypes eYield); // Exposed to Python
DllExport int findYieldRateRank(YieldTypes eYield); // Exposed to Python
DllExport int findCommerceRateRank(CommerceTypes eCommerce); // Exposed to Python
UnitTypes allUpgradesAvailable(UnitTypes eUnit, int iUpgradeCount = 0); // Exposed to Python
DllExport bool isWorldWondersMaxed(); // Exposed to Python
DllExport bool isTeamWondersMaxed(); // Exposed to Python
DllExport bool isNationalWondersMaxed(); // Exposed to Python
DllExport bool isBuildingsMaxed(); // Exposed to Python
DllExport bool canTrain(UnitTypes eUnit, bool bContinue = false, bool bTestVisible = false); // Exposed to Python
DllExport bool canConstruct(BuildingTypes eBuilding, bool bContinue = false, bool bTestVisible = false, bool bIgnoreCost = false); // Exposed to Python
DllExport bool canCreate(ProjectTypes eProject, bool bContinue = false, bool bTestVisible = false); // Exposed to Python
DllExport bool canMaintain(ProcessTypes eProcess, bool bContinue = false); // Exposed to Python
bool canJoin(); // Exposed to Python
DllExport int getFoodTurnsLeft(); // Exposed to Python
DllExport bool isProduction(); // Exposed to Python
bool isProductionLimited(); // Exposed to Python
bool isProductionUnit(); // Exposed to Python
bool isProductionBuilding(); // Exposed to Python
bool isProductionProject(); // Exposed to Python
DllExport bool isProductionProcess(); // Exposed to Python
bool canContinueProduction(OrderData order); // Exposed to Python
int getProductionExperience(UnitTypes eUnit = NO_UNIT); // Exposed to Python
void addProductionExperience(CvUnit* pUnit, bool bConscript = false); // Exposed to Python
DllExport UnitTypes getProductionUnit(); // Exposed to Python
UnitAITypes getProductionUnitAI(); // Exposed to Python
DllExport BuildingTypes getProductionBuilding(); // Exposed to Python
DllExport ProjectTypes getProductionProject(); // Exposed to Python
DllExport ProcessTypes getProductionProcess(); // Exposed to Python
DllExport const wchar* getProductionName(); // Exposed to Python
DllExport const wchar* getProductionNameKey(); // Exposed to Python
DllExport const int getGeneralProductionTurnsLeft(); // Exposed to Python
bool isFoodProduction(); // Exposed to Python
bool isFoodProduction(UnitTypes eUnit); // Exposed to Python
int getFirstUnitOrder(UnitTypes eUnit); // Exposed to Python
int getFirstBuildingOrder(BuildingTypes eBuilding); // Exposed to Python
int getFirstProjectOrder(ProjectTypes eProject); // Exposed to Python
int getNumTrainUnitAI(UnitAITypes eUnitAI); // Exposed to Python
DllExport int getProduction(); // Exposed to Python
DllExport int getProductionNeeded(); // Exposed to Python
DllExport int getProductionTurnsLeft(); // Exposed to Python
DllExport int getProductionTurnsLeft(UnitTypes eUnit, int iNum); // Exposed to Python
DllExport int getProductionTurnsLeft(BuildingTypes eBuilding, int iNum); // Exposed to Python
DllExport int getProductionTurnsLeft(ProjectTypes eProject, int iNum); // Exposed to Python
int getProductionTurnsLeft(int iProductionNeeded, int iProduction, int iFirstProductionDifference, int iProductionDifference);
void setProduction(int iNewValue); // Exposed to Python
void changeProduction(int iChange); // Exposed to Python
int getProductionModifier(); // Exposed to Python
int getProductionModifier(UnitTypes eUnit); // Exposed to Python
int getProductionModifier(BuildingTypes eBuilding); // Exposed to Python
int getProductionModifier(ProjectTypes eProject); // Exposed to Python
int getOverflowProductionDifference(int iProductionNeeded, int iProduction, int iProductionModifier, int iDiff, int iModifiedProduction);
int getProductionDifference(int iProductionNeeded, int iProduction, int iProductionModifier, bool bFoodProduction, bool bOverflow);
DllExport int getCurrentProductionDifference(bool bIgnoreFood, bool bOverflow); // Exposed to Python
int getExtraProductionDifference(int iExtra); // Exposed to Python
DllExport bool canHurry(HurryTypes eHurry, bool bTestVisible = false); // Exposed to Python
void hurry(HurryTypes eHurry); // Exposed to Python
DllExport UnitTypes getConscriptUnit(); // Exposed to Python
DllExport int getConscriptPopulation(); // Exposed to Python
int conscriptMinCityPopulation(); // Exposed to Python
int flatConscriptAngerLength(); // Exposed to Python
DllExport bool canConscript(); // Exposed to Python
void conscript(); // Exposed to Python
int getBonusHealth(BonusTypes eBonus); // Exposed to Python - getBonusHealth
int getBonusHappiness(BonusTypes eBonus); // Exposed to Python - getBonusHappiness
int getBonusPower(BonusTypes eBonus, bool bDirty); // Exposed to Python
int getBonusYieldRateModifier(YieldTypes eIndex, BonusTypes eBonus); // Exposed to Python
void processBonus(BonusTypes eBonus, int iChange);
void processBuilding(BuildingTypes eBuilding, int iChange, bool bObsolete = false);
void processProcess(ProcessTypes eProcess, int iChange);
void processSpecialist(SpecialistTypes eSpecialist, int iChange);
DllExport HandicapTypes getHandicapType(); // Exposed to Python
DllExport CivilizationTypes getCivilizationType(); // Exposed to Python
LeaderHeadTypes getPersonalityType(); // Exposed to Python
ArtStyleTypes getArtStyleType() const; // Exposed to Python
DllExport CitySizeTypes getCitySizeType(); // Exposed to Python
bool hasTrait(TraitTypes eTrait); // Exposed to Python
bool isBarbarian(); // Exposed to Python
bool isHuman(); // Exposed to Python
DllExport bool isVisible(TeamTypes eTeam, bool bDebug); // Exposed to Python
DllExport bool isCapital(); // Exposed to Python
bool isCoastal(); // Exposed to Python
DllExport bool isDisorder(); // Exposed to Python
DllExport bool isHolyCity(ReligionTypes eIndex); // Exposed to Python
DllExport bool isHolyCity(); // Exposed to Python
int getOvercrowdingPercentAnger(int iExtra = 0); // Exposed to Python
int getNoMilitaryPercentAnger(); // Exposed to Python
int getCulturePercentAnger(); // Exposed to Python
int getReligionPercentAnger(); // Exposed to Python
int getHurryPercentAnger(); // Exposed to Python
int getConscriptPercentAnger(); // Exposed to Python
int getWarWearinessPercentAnger(); // Exposed to Python
int getLargestCityHappiness(); // Exposed to Python
int unhappyLevel(int iExtra = 0); // Exposed to Python
DllExport int happyLevel(); // Exposed to Python
DllExport int angryPopulation(int iExtra = 0); // Exposed to Python
int visiblePopulation();
DllExport int totalFreeSpecialists(); // Exposed to Python
int extraPopulation(); // Exposed to Python
int extraSpecialists(); // Exposed to Python
int extraFreeSpecialists(); // Exposed to Python
DllExport int unhealthyPopulation(bool bNoAngry = false, int iExtra = 0); // Exposed to Python
int totalGoodBuildingHealth(); // Exposed to Python
DllExport int totalBadBuildingHealth(); // Exposed to Python
DllExport int goodHealth(); // Exposed to Python
DllExport int badHealth(bool bNoAngry = false, int iExtra = 0); // Exposed to Python
DllExport int healthRate(bool bNoAngry = false, int iExtra = 0); // Exposed to Python
int foodConsumption(bool bNoAngry = false, int iExtra = 0); // Exposed to Python
DllExport int foodDifference(bool bBottom = true); // Exposed to Python
DllExport int growthThreshold(); // Exposed to Python
int productionLeft(); // Exposed to Python
int hurryCost(bool bExtra); // Exposed to Python
DllExport int hurryGold(HurryTypes eHurry); // Exposed to Python
DllExport int hurryPopulation(HurryTypes eHurry); // Exposed to Python
int hurryProduction(HurryTypes eHurry); // Exposed to Python
int flatHurryAngerLength(); // Exposed to Python
int hurryAngerLength(HurryTypes eHurry); // Exposed to Python
int maxHurryPopulation(); // Exposed to Python
int cultureDistance(int iDX, int iDY); // Exposed to Python
DllExport int cultureStrength(PlayerTypes ePlayer); // Exposed to Python
DllExport int cultureGarrison(PlayerTypes ePlayer); // Exposed to Python
DllExport bool hasBuilding(BuildingTypes eIndex); // Exposed to Python
DllExport bool hasActiveBuilding(BuildingTypes eIndex); // Exposed to Python
bool hasActiveWorldWonder(); // Exposed to Python
int getReligionCount(); // Exposed to Python
DllExport int getID() const; // Exposed to Python
DllExport int getIndex() const;
DllExport IDInfo getIDInfo() const;
void setID(int iID);
DllExport int getX() const; // Exposed to Python
#ifdef _USRDLL
inline int getX_INLINE() const
{
return m_iX;
}
#endif
DllExport int getY() const; // Exposed to Python
#ifdef _USRDLL
inline int getY_INLINE() const
{
return m_iY;
}
#endif
bool at(int iX, int iY); // Exposed to Python
bool at(CvPlot* pPlot); // Exposed to Python - atPlot
DllExport CvPlot* plot() const; // Exposed to Python
CvPlotGroup* plotGroup(PlayerTypes ePlayer) const;
bool isConnectedTo(CvCity* pCity); // Exposed to Python
DllExport bool isConnectedToCapital(PlayerTypes ePlayer = NO_PLAYER); // Exposed to Python
DllExport CvArea* area() const; // Exposed to Python
CvArea* waterArea() const; // Exposed to Python
DllExport CvPlot* getRallyPlot(); // Exposed to Python
void setRallyPlot(CvPlot* pPlot);
int getGameTurnFounded(); // Exposed to Python
void setGameTurnFounded(int iNewValue);
int getGameTurnAcquired(); // Exposed to Python
void setGameTurnAcquired(int iNewValue);
DllExport int getPopulation() const; // Exposed to Python
DllExport void setPopulation(int iNewValue); // Exposed to Python
DllExport void changePopulation(int iChange); // Exposed to Python
long getRealPopulation() const; // Exposed to Python
int getHighestPopulation(); // Exposed to Python
void setHighestPopulation(int iNewValue);
int getWorkingPopulation(); // Exposed to Python
void changeWorkingPopulation(int iChange);
int getSpecialistPopulation(); // Exposed to Python
void changeSpecialistPopulation(int iChange);
int getNumGreatPeople(); // Exposed to Python
void changeNumGreatPeople(int iChange);
int getBaseGreatPeopleRate(); // Exposed to Python
int getGreatPeopleRate(); // Exposed to Python
int getTotalGreatPeopleRateModifier(); // Exposed to Python
void changeBaseGreatPeopleRate(int iChange); // Exposed to Python
int getGreatPeopleRateModifier(); // Exposed to Python
void changeGreatPeopleRateModifier(int iChange);
DllExport int getGreatPeopleProgress(); // Exposed to Python
void changeGreatPeopleProgress(int iChange); // Exposed to Python
int getNumWorldWonders(); // Exposed to Python
void changeNumWorldWonders(int iChange);
int getNumTeamWonders(); // Exposed to Python
void changeNumTeamWonders(int iChange);
int getNumNationalWonders(); // Exposed to Python
void changeNumNationalWonders(int iChange);
int getNumBuildings(); // Exposed to Python
void changeNumBuildings(int iChange);
int getGovernmentCenterCount();
DllExport bool isGovernmentCenter(); // Exposed to Python
void changeGovernmentCenterCount(int iChange);
DllExport int getMaintenance(); // Exposed to Python
void updateMaintenance();
DllExport int calculateDistanceMaintenance(); // Exposed to Python
DllExport int calculateNumCitiesMaintenance(); // Exposed to Python
int calculateBaseMaintenance(); // Exposed to Python
DllExport int getMaintenanceModifier(); // Exposed to Python
void changeMaintenanceModifier(int iChange);
int getWarWearinessModifier(); // Exposed to Python
void changeWarWearinessModifier(int iChange);
int getHealRate(); // Exposed to Python
void changeHealRate(int iChange);
int getFreshWaterGoodHealth(); // Exposed to Python
DllExport int getFreshWaterBadHealth(); // Exposed to Python
void updateFreshWaterHealth();
int getFeatureGoodHealth(); // Exposed to Python
DllExport int getFeatureBadHealth(); // Exposed to Python
void updateFeatureHealth();
int getBuildingGoodHealth(); // Exposed to Python
int getBuildingBadHealth(); // Exposed to Python
int getBuildingHealth(BuildingTypes eBuilding); // Exposed to Python
void changeBuildingGoodHealth(int iChange);
void changeBuildingBadHealth(int iChange);
int getPowerGoodHealth(); // Exposed to Python
DllExport int getPowerBadHealth(); // Exposed to Python
void updatePowerHealth();
int getBonusGoodHealth(); // Exposed to Python
DllExport int getBonusBadHealth(); // Exposed to Python
void changeBonusGoodHealth(int iChange);
void changeBonusBadHealth(int iChange);
int getMilitaryHappiness(); // Exposed to Python
int getMilitaryHappinessUnits(); // Exposed to Python
void changeMilitaryHappinessUnits(int iChange);
int getBuildingGoodHappiness(); // Exposed to Python
int getBuildingBadHappiness(); // Exposed to Python
int getBuildingHappiness(BuildingTypes eBuilding); // Exposed to Python
void changeBuildingGoodHappiness(int iChange);
void changeBuildingBadHappiness(int iChange);
int getExtraBuildingGoodHappiness(); // Exposed to Python
int getExtraBuildingBadHappiness(); // Exposed to Python
void updateExtraBuildingHappiness();
int getFeatureGoodHappiness(); // Exposed to Python
int getFeatureBadHappiness(); // Exposed to Python
void updateFeatureHappiness();
int getBonusGoodHappiness(); // Exposed to Python
int getBonusBadHappiness(); // Exposed to Python
void changeBonusGoodHappiness(int iChange);
void changeBonusBadHappiness(int iChange);
int getReligionGoodHappiness(); // Exposed to Python
int getReligionBadHappiness(); // Exposed to Python
int getReligionHappiness(ReligionTypes eReligion); // Exposed to Python
void updateReligionHappiness();
int getExtraHappiness(); // Exposed to Python
void changeExtraHappiness(int iChange); // Exposed to Python
int getHurryAngerTimer(); // Exposed to Python
void changeHurryAngerTimer(int iChange); // Exposed to Python
int getConscriptAngerTimer(); // Exposed to Python
void changeConscriptAngerTimer(int iChange); // Exposed to Python
int getNoUnhappinessCount();
bool isNoUnhappiness(); // Exposed to Python
void changeNoUnhappinessCount(int iChange);
int getNoUnhealthyPopulationCount();
bool isNoUnhealthyPopulation(); // Exposed to Python
void changeNoUnhealthyPopulationCount(int iChange);
int getBuildingOnlyHealthyCount();
bool isBuildingOnlyHealthy(); // Exposed to Python
void changeBuildingOnlyHealthyCount(int iChange);
DllExport int getFood(); // Exposed to Python
void setFood(int iNewValue); // Exposed to Python
void changeFood(int iChange); // Exposed to Python
int getFoodKept(); // Exposed to Python
void setFoodKept(int iNewValue);
void changeFoodKept(int iChange);
int getMaxFoodKeptPercent(); // Exposed to Python
void changeMaxFoodKeptPercent(int iChange);
int getOverflowProduction(); // Exposed to Python
void setOverflowProduction(int iNewValue); // Exposed to Python
void changeOverflowProduction(int iChange, int iProductionModifier);
int getMilitaryProductionModifier(); // Exposed to Python
void changeMilitaryProductionModifier(int iChange);
int getSpaceProductionModifier(); // Exposed to Python
void changeSpaceProductionModifier(int iChange);
int getExtraTradeRoutes(); // Exposed to Python
void changeExtraTradeRoutes(int iChange);
int getTradeRouteModifier(); // Exposed to Python
void changeTradeRouteModifier(int iChange);
int getBuildingDefense(); // Exposed to Python
void changeBuildingDefense(int iChange);
int getFreeExperience(); // Exposed to Python
void changeFreeExperience(int iChange);
int getCurrAirlift(); // Exposed to Python
void setCurrAirlift(int iNewValue);
void changeCurrAirlift(int iChange);
int getMaxAirlift(); // Exposed to Python
void changeMaxAirlift(int iChange);
int getAirModifier(); // Exposed to Python
void changeAirModifier(int iChange);
int getNukeModifier(); // Exposed to Python
void changeNukeModifier(int iChange);
int getFreeSpecialist(); // Exposed to Python
void changeFreeSpecialist(int iChange);
int getPowerCount();
bool isPower(); // Exposed to Python
bool isAreaCleanPower(); // Exposed to Python
int getDirtyPowerCount();
bool isDirtyPower(); // Exposed to Python
void changePowerCount(int iChange, bool bDirty);
int getDefenseDamage(); // Exposed to Python
void changeDefenseDamage(int iChange); // Exposed to Python
int getLastDefenseDamage(); // Exposed to Python
void setLastDefenseDamage(int iNewValue);
bool isBombardable(TeamTypes eTeam); // Exposed to Python
int getNaturalDefense(); // Exposed to Python
int getTotalDefense(bool bIgnoreBuilding); // Exposed to Python
int getDefenseModifier(bool bIgnoreBuilding); // Exposed to Python
DllExport int getOccupationTimer(); // Exposed to Python
DllExport bool isOccupation(); // Exposed to Python
void setOccupationTimer(int iNewValue); // Exposed to Python
void changeOccupationTimer(int iChange); // Exposed to Python
int getCitySizeBoost() const;
void setCitySizeBoost(int iBoost);
bool isNeverLost(); // Exposed to Python
void setNeverLost(bool bNewValue); // Exposed to Python
bool isBombarded(); // Exposed to Python
void setBombarded(bool bNewValue); // Exposed to Python
bool isDrafted(); // Exposed to Python
void setDrafted(bool bNewValue); // Exposed to Python
bool isAirliftTargeted(); // Exposed to Python
void setAirliftTargeted(bool bNewValue); // Exposed to Python
DllExport bool isWeLoveTheKingDay(); // Exposed to Python
void setWeLoveTheKingDay(bool bNewValue);
DllExport bool isCitizensAutomated(); // Exposed to Python
void setCitizensAutomated(bool bNewValue); // Exposed to Python
DllExport bool isProductionAutomated(); // Exposed to Python
void setProductionAutomated(bool bNewValue); // Exposed to Python
/* allows you to programatically specify a cities walls rather than having them be generated automagically */
DllExport bool isWallOverride() const;
DllExport void setWallOverride(bool bOverride);
DllExport bool isInfoDirty();
DllExport void setInfoDirty(bool bNewValue);
DllExport bool isLayoutDirty();
DllExport void setLayoutDirty(bool bNewValue);
DllExport PlayerTypes getOwner() const; // Exposed to Python
#ifdef _USRDLL
inline PlayerTypes getOwnerINLINE() const
{
return m_eOwner;
}
#endif
DllExport TeamTypes getTeam() const; // Exposed to Python
PlayerTypes getPreviousOwner() const; // Exposed to Python
void setPreviousOwner(PlayerTypes eNewValue);
PlayerTypes getOriginalOwner() const; // Exposed to Python
void setOriginalOwner(PlayerTypes eNewValue);
CultureLevelTypes getCultureLevel() const; // Exposed to Python
DllExport int getCultureThreshold(); // Exposed to Python
void setCultureLevel(CultureLevelTypes eNewValue);
void updateCultureLevel();
int getSeaPlotYield(YieldTypes eIndex); // Exposed to Python
void changeSeaPlotYield(YieldTypes eIndex, int iChange);
int getBaseYieldRate(YieldTypes eIndex); // Exposed to Python
int getBaseYieldRateModifier(YieldTypes eIndex, int iExtra = 0); // Exposed to Python
DllExport int getYieldRate(YieldTypes eIndex); // Exposed to Python
void setBaseYieldRate(YieldTypes eIndex, int iNewValue);
void changeBaseYieldRate(YieldTypes eIndex, int iChange);
int getYieldRateModifier(YieldTypes eIndex); // Exposed to Python
void changeYieldRateModifier(YieldTypes eIndex, int iChange);
int getPowerYieldRateModifier(YieldTypes eIndex); // Exposed to Python
void changePowerYieldRateModifier(YieldTypes eIndex, int iChange);
int getBonusYieldRateModifier(YieldTypes eIndex); // Exposed to Python
void changeBonusYieldRateModifier(YieldTypes eIndex, int iChange);
int getTradeYield(YieldTypes eIndex); // Exposed to Python
int totalTradeModifier(); // Exposed to Python
int calculateTradeProfit(CvCity* pCity); // Exposed to Python
int calculateTradeYield(YieldTypes eIndex, int iTradeProfit); // Exposed to Python
void setTradeYield(YieldTypes eIndex, int iNewValue);
int getExtraSpecialistYield(YieldTypes eIndex); // Exposed to Python
int getExtraSpecialistYield(YieldTypes eIndex, SpecialistTypes eSpecialist); // Exposed to Python
void updateExtraSpecialistYield(YieldTypes eYield);
void updateExtraSpecialistYield();
DllExport int getCommerceRate(CommerceTypes eIndex); // Exposed to Python
int getCommerceFromPercent(CommerceTypes eIndex, int iYieldRate); // Exposed to Python
int getBaseCommerceRate(CommerceTypes eIndex); // Exposed to Python
int getTotalCommerceRateModifier(CommerceTypes eIndex); // Exposed to Python
void updateCommerce(CommerceTypes eIndex);
void updateCommerce();
int getProductionToCommerceModifier(CommerceTypes eIndex); // Exposed to Python
void changeProductionToCommerceModifier(CommerceTypes eIndex, int iChange);
int getBuildingCommerce(CommerceTypes eIndex); // Exposed to Python
int getBuildingCommerceByBuilding(CommerceTypes eIndex, BuildingTypes eBuilding); // Exposed to Python
void updateBuildingCommerce();
int getSpecialistCommerce(CommerceTypes eIndex); // Exposed to Python
void changeSpecialistCommerce(CommerceTypes eIndex, int iChange); // Exposed to Python
int getReligionCommerce(CommerceTypes eIndex); // Exposed to Python
int getReligionCommerceByReligion(CommerceTypes eIndex, ReligionTypes eReligion); // Exposed to Python
void updateReligionCommerce(CommerceTypes eIndex);
void updateReligionCommerce();
int getCommerceRateModifier(CommerceTypes eIndex); // Exposed to Python
void changeCommerceRateModifier(CommerceTypes eIndex, int iChange);
int getCommerceHappinessPer(CommerceTypes eIndex); // Exposed to Python
int getCommerceHappinessByType(CommerceTypes eIndex); // Exposed to Python
int getCommerceHappiness(); // Exposed to Python
void changeCommerceHappinessPer(CommerceTypes eIndex, int iChange);
int getDomainFreeExperience(DomainTypes eIndex); // Exposed to Python
void changeDomainFreeExperience(DomainTypes eIndex, int iChange);
int getDomainProductionModifier(DomainTypes eIndex); // Exposed to Python
void changeDomainProductionModifier(DomainTypes eIndex, int iChange);
DllExport int getCulture(PlayerTypes eIndex); // Exposed to Python
int countTotalCulture(); // Exposed to Python
PlayerTypes findHighestCulture(); // Exposed to Python
int calculateCulturePercent(PlayerTypes eIndex); // Exposed to Python
int calculateTeamCulturePercent(TeamTypes eIndex); // Exposed to Python
void setCulture(PlayerTypes eIndex, int iNewValue, bool bPlots); // Exposed to Python
DllExport void changeCulture(PlayerTypes eIndex, int iChange, bool bPlots); // Exposed to Python
int getNumRevolts(PlayerTypes eIndex);
void changeNumRevolts(PlayerTypes eIndex, int iChange);
bool isTradeRoute(PlayerTypes eIndex); // Exposed to Python
void setTradeRoute(PlayerTypes eIndex, bool bNewValue);
bool isEverOwned(PlayerTypes eIndex); // Exposed to Python
void setEverOwned(PlayerTypes eIndex, bool bNewValue);
DllExport bool isRevealed(TeamTypes eIndex, bool bDebug); // Exposed to Python
void setRevealed(TeamTypes eIndex, bool bNewValue); // Exposed to Python
DllExport const CvWString getName(uint uiForm = 0) const; // Exposed to Python
DllExport const wchar* getNameKey() const; // Exposed to Python
DllExport void setName(const wchar* szNewValue, bool bFound = false); // Exposed to Python
void doFoundMessage();
// Script data needs to be a narrow string for pickling in Python
std::string getScriptData(); // Exposed to Python
void setScriptData(std::string szNewValue); // Exposed to Python
int getFreeBonus(BonusTypes eIndex); // Exposed to Python
void changeFreeBonus(BonusTypes eIndex, int iChange);
int getNumBonuses(BonusTypes eIndex); // Exposed to Python
DllExport bool hasBonus(BonusTypes eIndex); // Exposed to Python
void changeNumBonuses(BonusTypes eIndex, int iChange);
DllExport int getBuildingProduction(BuildingTypes eIndex); // Exposed to Python
void setBuildingProduction(BuildingTypes eIndex, int iNewValue); // Exposed to Python
void changeBuildingProduction(BuildingTypes eIndex, int iChange); // Exposed to Python
int getBuildingProductionTime(BuildingTypes eIndex); // Exposed to Python
void setBuildingProductionTime(BuildingTypes eIndex, int iNewValue); // Exposed to Python
void changeBuildingProductionTime(BuildingTypes eIndex, int iChange); // Exposed to Python
DllExport int getProjectProduction(ProjectTypes eIndex); // Exposed to Python
void setProjectProduction(ProjectTypes eIndex, int iNewValue); // Exposed to Python
void changeProjectProduction(ProjectTypes eIndex, int iChange); // Exposed to Python
int getBuildingOriginalOwner(BuildingTypes eIndex); // Exposed to Python
int getBuildingOriginalTime(BuildingTypes eIndex); // Exposed to Python
DllExport int getUnitProduction(UnitTypes eIndex); // Exposed to Python
void setUnitProduction(UnitTypes eIndex, int iNewValue); // Exposed to Python
void changeUnitProduction(UnitTypes eIndex, int iChange); // Exposed to Python
int getUnitProductionTime(UnitTypes eIndex); // Exposed to Python
void setUnitProductionTime(UnitTypes eIndex, int iNewValue); // Exposed to Python
void changeUnitProductionTime(UnitTypes eIndex, int iChange); // Exposed to Python
int getGreatPeopleUnitRate(UnitTypes eIndex); // Exposed to Python
void setGreatPeopleUnitRate(UnitTypes eIndex, int iNewValue);
void changeGreatPeopleUnitRate(UnitTypes eIndex, int iChange);
DllExport int getGreatPeopleUnitProgress(UnitTypes eIndex); // Exposed to Python
void setGreatPeopleUnitProgress(UnitTypes eIndex, int iNewValue); // Exposed to Python
void changeGreatPeopleUnitProgress(UnitTypes eIndex, int iChange); // Exposed to Python
DllExport int getSpecialistCount(SpecialistTypes eIndex); // Exposed to Python
void setSpecialistCount(SpecialistTypes eIndex, int iNewValue);
void changeSpecialistCount(SpecialistTypes eIndex, int iChange);
void alterSpecialistCount(SpecialistTypes eIndex, int iChange); // Exposed to Python
DllExport int getMaxSpecialistCount(SpecialistTypes eIndex); // Exposed to Python
bool isSpecialistValid(SpecialistTypes eIndex, int iExtra = 0); // Exposed to Python
void changeMaxSpecialistCount(SpecialistTypes eIndex, int iChange);
DllExport int getForceSpecialistCount(SpecialistTypes eIndex); // Exposed to Python
bool isSpecialistForced(); // Exposed to Python
void setForceSpecialistCount(SpecialistTypes eIndex, int iNewValue); // Exposed to Python
void changeForceSpecialistCount(SpecialistTypes eIndex, int iChange); // Exposed to Python
int getFreeSpecialistCount(SpecialistTypes eIndex); // Exposed to Python
void setFreeSpecialistCount(SpecialistTypes eIndex, int iNewValue); // Exposed to Python
void changeFreeSpecialistCount(SpecialistTypes eIndex, int iChange); // Exposed to Python
int getReligionInfluence(ReligionTypes eIndex); // Exposed to Python
void changeReligionInfluence(ReligionTypes eIndex, int iChange); // Exposed to Python
int getCurrentStateReligionHappiness(); // Exposed to Python
int getStateReligionHappiness(ReligionTypes eIndex); // Exposed to Python
void changeStateReligionHappiness(ReligionTypes eIndex, int iChange); // Exposed to Python
int getUnitCombatFreeExperience(UnitCombatTypes eIndex); // Exposed to Python
void changeUnitCombatFreeExperience(UnitCombatTypes eIndex, int iChange);
int getFreePromotionCount(PromotionTypes eIndex); // Exposed to Python
bool isFreePromotion(PromotionTypes eIndex); // Exposed to Python
void changeFreePromotionCount(PromotionTypes eIndex, int iChange);
DllExport bool isWorkingPlot(int iIndex) const; // Exposed to Python
bool isWorkingPlot(const CvPlot* pPlot) const; // Exposed to Python
void setWorkingPlot(int iIndex, bool bNewValue);
void setWorkingPlot(CvPlot* pPlot, bool bNewValue);
void alterWorkingPlot(int iIndex); // Exposed to Python
bool isHasRealBuilding(BuildingTypes eIndex); // Exposed to Python
DllExport void setHasRealBuilding(BuildingTypes eIndex, bool bNewValue); // Exposed to Python
void setHasRealBuildingTimed(BuildingTypes eIndex, bool bNewValue, bool bFirst, PlayerTypes eOriginalOwner, int iOriginalTime);
bool isFreeBuilding(BuildingTypes eIndex); // Exposed to Python
void setFreeBuilding(BuildingTypes eIndex, bool bNewValue);
DllExport bool isHasReligion(ReligionTypes eIndex);
DllExport void setHasReligion(ReligionTypes eIndex, bool bNewValue, bool bAnnounce, bool bArrows = true);
CvCity* getTradeCity(int iIndex); // Exposed to Python
int getTradeRoutes(); // Exposed to Python
void clearTradeRoutes();
void updateTradeRoutes();
void clearOrderQueue(); // Exposed to Python
DllExport void pushOrder(OrderTypes eOrder, int iData1, int iData2, bool bSave, bool bPop, bool bAppend, bool bForce = false); // Exposed to Python
DllExport void popOrder(int iNum, bool bFinish = false, bool bChoose = false); // Exposed to Python
void startHeadOrder();
void stopHeadOrder();
DllExport int getOrderQueueLength(); // Exposed to Python
DllExport OrderData* getOrderFromQueue(int iIndex); // Exposed to Python
DllExport CLLNode* nextOrderQueueNode(CLLNode* pNode);
DllExport CLLNode* headOrderQueueNode();
CLLNode* tailOrderQueueNode();
// fill the kVisible array with buildings that you want shown in city, as well as the number of generics
// This function is called whenever CvCity::setLayoutDirty() is called
DllExport void getVisibleBuildings(std::list& kVisible, int& iNumGenerics);
// Fill the kEffectNames array with references to effects in the CIV4EffectInfos.xml to have a
// city play a given set of effects. This is called whenever the interface updates the city billboard
// or when the zoom level changes
DllExport void getVisibleEffects(ZoomLevelTypes eCurrentZoom, std::vector& kEffectNames);
// Billboard appearance controls
DllExport void getCityBillboardSizeIconColors(NiColorA& kDotColor, NiColorA& kTextColor);
DllExport const TCHAR* getCityBillboardProductionIcon();
// Exposed to Python
DllExport void setWallOverridePoints(const std::vector< std::pair >& kPoints); /* points are given in world space ... i.e. PlotXToPointX, etc */
DllExport const std::vector< std::pair >& getWallOverridePoints() const;
void read(FDataStreamBase* pStream);
void write(FDataStreamBase* pStream);
virtual void AI_init() = 0;
virtual void AI_reset() = 0;
virtual void AI_doTurn() = 0;
virtual void AI_assignWorkingPlots() = 0;
virtual void AI_updateAssignWork() = 0;
virtual bool AI_avoidGrowth() = 0;
virtual int AI_specialistValue(SpecialistTypes eSpecialist, bool bAvoidGrowth, bool bRemove) = 0;
virtual void AI_chooseProduction() = 0;
virtual UnitTypes AI_bestUnit(bool bAsync = false, AdvisorTypes eIgnoreAdvisor = NO_ADVISOR, UnitAITypes* peBestUnitAI = NULL) = 0;
virtual UnitTypes AI_bestUnitAI(UnitAITypes eUnitAI, bool bAsync = false, AdvisorTypes eIgnoreAdvisor = NO_ADVISOR) = 0;
virtual BuildingTypes AI_bestBuilding(int iFocusFlags = 0, int iMaxTurns = MAX_INT, bool bAsync = false, AdvisorTypes eIgnoreAdvisor = NO_ADVISOR) = 0;
virtual int AI_buildingValue(BuildingTypes eBuilding, int iFocusFlags = 0) = 0;
virtual int AI_projectValue(ProjectTypes eProject) = 0;
virtual int AI_neededSeaWorkers() = 0;
virtual bool AI_isDefended(int iExtra = 0) = 0;
virtual bool AI_isAirDefended(int iExtra = 0) = 0;
virtual bool AI_isDanger() = 0;
virtual int AI_neededDefenders() = 0;
virtual int AI_neededAirDefenders() = 0;
virtual bool AI_isEmphasizeAvoidGrowth() = 0;
virtual bool AI_isAssignWorkDirty() = 0;
virtual CvCity* AI_getRouteToCity() const = 0;
virtual void AI_setAssignWorkDirty(bool bNewValue) = 0;
virtual bool AI_isChooseProductionDirty() = 0;
virtual void AI_setChooseProductionDirty(bool bNewValue) = 0;
virtual bool AI_isEmphasize(EmphasizeTypes eIndex) = 0; // Exposed to Python
virtual void AI_setEmphasize(EmphasizeTypes eIndex, bool bNewValue) = 0;
virtual int AI_getBestBuildValue(int iIndex) = 0;
virtual int AI_totalBestBuildValue(CvArea* pArea) = 0;
virtual int AI_countBestBuilds(CvArea* pArea) = 0; // Exposed to Python
virtual BuildTypes AI_getBestBuild(int iIndex) = 0;
protected:
int m_iID;
int m_iX;
int m_iY;
int m_iRallyX;
int m_iRallyY;
int m_iGameTurnFounded;
int m_iGameTurnAcquired;
int m_iPopulation;
int m_iHighestPopulation;
int m_iWorkingPopulation;
int m_iSpecialistPopulation;
int m_iNumGreatPeople;
int m_iBaseGreatPeopleRate;
int m_iGreatPeopleRateModifier;
int m_iGreatPeopleProgress;
int m_iNumWorldWonders;
int m_iNumTeamWonders;
int m_iNumNationalWonders;
int m_iNumBuildings;
int m_iGovernmentCenterCount;
int m_iMaintenance;
int m_iMaintenanceModifier;
int m_iWarWearinessModifier;
int m_iHealRate;
int m_iFreshWaterGoodHealth;
int m_iFreshWaterBadHealth;
int m_iFeatureGoodHealth;
int m_iFeatureBadHealth;
int m_iBuildingGoodHealth;
int m_iBuildingBadHealth;
int m_iPowerGoodHealth;
int m_iPowerBadHealth;
int m_iBonusGoodHealth;
int m_iBonusBadHealth;
int m_iHurryAngerTimer;
int m_iConscriptAngerTimer;
int m_iMilitaryHappinessUnits;
int m_iBuildingGoodHappiness;
int m_iBuildingBadHappiness;
int m_iExtraBuildingGoodHappiness;
int m_iExtraBuildingBadHappiness;
int m_iFeatureGoodHappiness;
int m_iFeatureBadHappiness;
int m_iBonusGoodHappiness;
int m_iBonusBadHappiness;
int m_iReligionGoodHappiness;
int m_iReligionBadHappiness;
int m_iExtraHappiness;
int m_iNoUnhappinessCount;
int m_iNoUnhealthyPopulationCount;
int m_iBuildingOnlyHealthyCount;
int m_iFood;
int m_iFoodKept;
int m_iMaxFoodKeptPercent;
int m_iOverflowProduction;
int m_iMilitaryProductionModifier;
int m_iSpaceProductionModifier;
int m_iExtraTradeRoutes;
int m_iTradeRouteModifier;
int m_iBuildingDefense;
int m_iFreeExperience;
int m_iCurrAirlift;
int m_iMaxAirlift;
int m_iAirModifier;
int m_iNukeModifier;
int m_iFreeSpecialist;
int m_iPowerCount;
int m_iDirtyPowerCount;
int m_iDefenseDamage;
int m_iLastDefenseDamage;
int m_iOccupationTimer;
int m_iCitySizeBoost;
bool m_bNeverLost;
bool m_bBombarded;
bool m_bDrafted;
bool m_bAirliftTargeted;
bool m_bWeLoveTheKingDay;
bool m_bCitizensAutomated;
bool m_bProductionAutomated;
bool m_bWallOverride;
bool m_bInfoDirty;
bool m_bLayoutDirty;
PlayerTypes m_eOwner;
PlayerTypes m_ePreviousOwner;
PlayerTypes m_eOriginalOwner;
CultureLevelTypes m_eCultureLevel;
int m_aiSeaPlotYield[NUM_YIELD_TYPES];
int m_aiBaseYieldRate[NUM_YIELD_TYPES];
int m_aiYieldRateModifier[NUM_YIELD_TYPES];
int m_aiPowerYieldRateModifier[NUM_YIELD_TYPES];
int m_aiBonusYieldRateModifier[NUM_YIELD_TYPES];
int m_aiTradeYield[NUM_YIELD_TYPES];
int m_aiExtraSpecialistYield[NUM_YIELD_TYPES];
int m_aiCommerceRate[NUM_COMMERCE_TYPES];
int m_aiProductionToCommerceModifier[NUM_COMMERCE_TYPES];
int m_aiBuildingCommerce[NUM_COMMERCE_TYPES];
int m_aiSpecialistCommerce[NUM_COMMERCE_TYPES];
int m_aiReligionCommerce[NUM_COMMERCE_TYPES];
int m_aiCommerceRateModifier[NUM_COMMERCE_TYPES];
int m_aiCommerceHappinessPer[NUM_COMMERCE_TYPES];
int m_aiDomainFreeExperience[NUM_DOMAIN_TYPES];
int m_aiDomainProductionModifier[NUM_DOMAIN_TYPES];
int m_aiCulture[MAX_PLAYERS];
int m_aiNumRevolts[MAX_PLAYERS];
bool m_abEverOwned[MAX_PLAYERS];
bool m_abTradeRoute[MAX_PLAYERS];
bool m_abRevealed[MAX_TEAMS];
CvWString m_szName;
CvString m_szScriptData;
int* m_paiFreeBonus;
int* m_paiNumBonuses;
int* m_paiProjectProduction;
int* m_paiBuildingProduction;
int* m_paiBuildingProductionTime;
int* m_paiBuildingOriginalOwner;
int* m_paiBuildingOriginalTime;
int* m_paiUnitProduction;
int* m_paiUnitProductionTime;
int* m_paiGreatPeopleUnitRate;
int* m_paiGreatPeopleUnitProgress;
int* m_paiSpecialistCount;
int* m_paiMaxSpecialistCount;
int* m_paiForceSpecialistCount;
int* m_paiFreeSpecialistCount;
int* m_paiReligionInfluence;
int* m_paiStateReligionHappiness;
int* m_paiUnitCombatFreeExperience;
int* m_paiFreePromotionCount;
bool* m_pabWorkingPlot;
bool* m_pabHasRealBuilding;
bool* m_pabFreeBuilding;
bool* m_pabHasReligion;
IDInfo* m_paTradeCities;
CLinkList m_orderQueue;
std::vector< std::pair < float, float> > m_kWallOverridePoints;
void doGrowth();
void doCulture();
void doPlotCulture(bool bUpdate);
void doProduction();
void doDecay();
void doReligion();
void doGreatPeople();
void doMeltdown();
virtual bool AI_addBestCitizen(bool bWorkers, bool bSpecialists) = 0;
virtual bool AI_removeWorstCitizen(SpecialistTypes eIgnoreSpecialist = NO_SPECIALIST) = 0;
};
#endif
//---------------------------------------------------------------------------------------
//
// ***************** Civilization IV ********************
//
// FILE: CvGameTextMgr.cpp
//
// AUTHOR: Jesse Smith / Mustafa Thamer 10/2004 / Jon Shafer 06/2005
//
// PURPOSE: Interfaces with GameText XML Files to manage the paths of art files
//
//---------------------------------------------------------------------------------------
// Copyright (c) 2004 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------
#include "CvGameCoreDLL.h"
#include "CvGameTextMgr.h"
#include "CvGameCoreUtils.h"
#include "CvDLLUtilityIFaceBase.h"
#include "CvDLLInterfaceIFaceBase.h"
#include "CvDLLSymbolIFaceBase.h"
#include "CvInfos.h"
#include "CvXMLLoadUtility.h"
#include "CvCity.h"
#include "CvPlayerAI.h"
#include "CvTeamAI.h"
#include "CvGameAI.h"
#include "CvSelectionGroup.h"
#include "CvMap.h"
#include "CvArea.h"
#include "CvPlot.h"
#include "CvPopupInfo.h"
// For displaying Asserts and error messages
static char* szErrorMsg;
//----------------------------------------------------------------------------
//
// FUNCTION: GetInstance()
//
// PURPOSE: Get the instance of this class.
//
//----------------------------------------------------------------------------
CvGameTextMgr& CvGameTextMgr::GetInstance()
{
static CvGameTextMgr gs_GameTextMgr;
return gs_GameTextMgr;
}
//----------------------------------------------------------------------------
//
// FUNCTION: CvGameTextMgr()
//
// PURPOSE: Constructor
//
//----------------------------------------------------------------------------
CvGameTextMgr::CvGameTextMgr() :
m_iNumDiplomacyTextInfos(0),
m_paDiplomacyTextInfo(NULL)
{
}
//----------------------------------------------------------------------------
//
// FUNCTION: Initialize()
//
// PURPOSE: Allocates memory
//
//----------------------------------------------------------------------------
void CvGameTextMgr::Initialize()
{
}
//----------------------------------------------------------------------------
//
// FUNCTION: DeInitialize()
//
// PURPOSE: Clears memory
//
//----------------------------------------------------------------------------
void CvGameTextMgr::DeInitialize()
{
}
//----------------------------------------------------------------------------
//
// FUNCTION: Reset()
//
// PURPOSE: Accesses CvXMLLoadUtility to clean global text memory and
// reload the XML files
//
//----------------------------------------------------------------------------
void CvGameTextMgr::Reset()
{
CvXMLLoadUtility pXML;
pXML.LoadGlobalText();
}
// Returns the current language
int CvGameTextMgr::getCurrentLanguage()
{
return gDLL->getCurrentLanguage();
}
void CvGameTextMgr::setDateStr(CvWString& szString, int iGameTurn, bool bSave, CalendarTypes eCalendar, int iStartYear, GameSpeedTypes eSpeed)
{
CvWString szYearBuffer;
CvWString szWeekBuffer;
int iTurnYear = getTurnYearForGame(iGameTurn, iStartYear, eCalendar, eSpeed);
if (iTurnYear < 0)
{
if (bSave)
{
szYearBuffer = gDLL->getText("TXT_KEY_TIME_BC_SAVE", CvWString::format(L"%04d", -iTurnYear).GetCString());
}
else
{
szYearBuffer = gDLL->getText("TXT_KEY_TIME_BC", -(iTurnYear));
}
}
else if (iTurnYear > 0)
{
if (bSave)
{
szYearBuffer = gDLL->getText("TXT_KEY_TIME_AD_SAVE", CvWString::format(L"%04d", iTurnYear).GetCString());
}
else
{
szYearBuffer = gDLL->getText("TXT_KEY_TIME_AD", iTurnYear);
}
}
else
{
if (bSave)
{
szYearBuffer = gDLL->getText("TXT_KEY_TIME_AD_SAVE", L"0001");
}
else
{
szYearBuffer = gDLL->getText("TXT_KEY_TIME_AD", 1);
}
}
switch (eCalendar)
{
case CALENDAR_DEFAULT:
case CALENDAR_YEARS:
szString = szYearBuffer;
break;
case CALENDAR_TURNS:
szString = gDLL->getText("TXT_KEY_TIME_TURN", (iGameTurn + 1));
break;
case CALENDAR_SEASONS:
if (bSave)
{
szString = (szYearBuffer + "-" + GC.getSeasonInfo((SeasonTypes)(iGameTurn % GC.getNumSeasonInfos())).getDescription());
}
else
{
szString = (GC.getSeasonInfo((SeasonTypes)(iGameTurn % GC.getNumSeasonInfos())).getDescription() + CvString(", ") + szYearBuffer);
}
break;
case CALENDAR_MONTHS:
if (bSave)
{
szString = (szYearBuffer + "-" + GC.getMonthInfo((MonthTypes)(iGameTurn % GC.getNumMonthInfos())).getDescription());
}
else
{
szString = (GC.getMonthInfo((MonthTypes)(iGameTurn % GC.getNumMonthInfos())).getDescription() + CvString(", ") + szYearBuffer);
}
break;
case CALENDAR_WEEKS:
szWeekBuffer = gDLL->getText("TXT_KEY_TIME_WEEK", ((iGameTurn % GC.getDefineINT("WEEKS_PER_MONTHS")) + 1));
if (bSave)
{
szString = (szYearBuffer + "-" + GC.getMonthInfo((MonthTypes)((iGameTurn / GC.getDefineINT("WEEKS_PER_MONTHS")) % GC.getNumMonthInfos())).getDescription() + "-" + szWeekBuffer);
}
else
{
szString = (szWeekBuffer + ", " + GC.getMonthInfo((MonthTypes)((iGameTurn / GC.getDefineINT("WEEKS_PER_MONTHS")) % GC.getNumMonthInfos())).getDescription() + ", " + szYearBuffer);
}
break;
default:
FAssert(false);
}
}
void CvGameTextMgr::setTimeStr(CvWString& szString, int iGameTurn, bool bSave)
{
setDateStr(szString, iGameTurn, bSave, GC.getGameINLINE().getCalendar(), GC.getGameINLINE().getStartYear(), GC.getGameINLINE().getGameSpeedType());
}
void CvGameTextMgr::setInterfaceTime(CvWString& szString, PlayerTypes ePlayer)
{
CvWString szTempBuffer;
if (GET_PLAYER(ePlayer).isGoldenAge())
{
szString.Format(L"%c(%d) ", gDLL->getSymbolID(GOLDEN_AGE_CHAR), GET_PLAYER(ePlayer).getGoldenAgeTurns());
}
else
{
clear(szString);
}
setTimeStr(szTempBuffer, GC.getGameINLINE().getGameTurn(), false);
szString += CvWString(szTempBuffer);
}
void CvGameTextMgr::setGoldStr(CvWString& szString, PlayerTypes ePlayer)
{
if (GET_PLAYER(ePlayer).getGold() < 0)
{
szString.Format(L"%c: " SETCOLR L"%d" SETCOLR, GC.getCommerceInfo(COMMERCE_GOLD).getChar(), TEXT_COLOR("COLOR_NEGATIVE_TEXT"), GET_PLAYER(ePlayer).getGold());
}
else
{
szString.Format(L"%c: %d", GC.getCommerceInfo(COMMERCE_GOLD).getChar(), GET_PLAYER(ePlayer).getGold());
}
if (GET_PLAYER(ePlayer).calculateGoldRate() < 0)
{
szString += gDLL->getText("TXT_KEY_MISC_NEG_GOLD_PER_TURN", GET_PLAYER(ePlayer).calculateGoldRate());
}
else if (GET_PLAYER(ePlayer).calculateGoldRate() > 0)
{
szString += gDLL->getText("TXT_KEY_MISC_POS_GOLD_PER_TURN", GET_PLAYER(ePlayer).calculateGoldRate());
}
if (GET_PLAYER(ePlayer).isStrike())
{
szString += gDLL->getText("TXT_KEY_MISC_STRIKE");
}
}
void CvGameTextMgr::setResearchStr(CvWString& szString, PlayerTypes ePlayer)
{
CvWString szTempBuffer;
szString = gDLL->getText("TXT_KEY_MISC_RESEARCH_STRING", GC.getTechInfo(GET_PLAYER(ePlayer).getCurrentResearch()).getTextKeyWide());
if (GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getTechCount(GET_PLAYER(ePlayer).getCurrentResearch()) > 0)
{
szTempBuffer.Format(L" %d", (GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getTechCount(GET_PLAYER(ePlayer).getCurrentResearch()) + 1));
szString+=szTempBuffer;
}
szTempBuffer.Format(L" (%d)", GET_PLAYER(ePlayer).getResearchTurnsLeft(GET_PLAYER(ePlayer).getCurrentResearch(), true));
szString+=szTempBuffer;
}
void CvGameTextMgr::setOOSSeeds(CvWString& szString, PlayerTypes ePlayer)
{
if (GET_PLAYER(ePlayer).isHuman())
{
int iNetID = GET_PLAYER(ePlayer).getNetID();
if (gDLL->isConnected(iNetID))
{
szString = gDLL->getText("TXT_KEY_PLAYER_OOS", gDLL->GetSyncOOS(iNetID), gDLL->GetOptionsOOS(iNetID));
}
}
}
void CvGameTextMgr::setNetStats(CvWString& szString, PlayerTypes ePlayer)
{
if (ePlayer != GC.getGameINLINE().getActivePlayer())
{
if (GET_PLAYER(ePlayer).isHuman())
{
if (gDLL->getInterfaceIFace()->isNetStatsVisible())
{
int iNetID = GET_PLAYER(ePlayer).getNetID();
if (gDLL->isConnected(iNetID))
{
szString = gDLL->getText("TXT_KEY_MISC_NUM_MS", gDLL->GetLastPing(iNetID));
}
else
{
szString = gDLL->getText("TXT_KEY_MISC_DISCONNECTED");
}
}
}
else
{
szString = gDLL->getText("TXT_KEY_MISC_AI");
}
}
}
void CvGameTextMgr::setMinimizePopupHelp(CvWString& szString, const CvPopupInfo & info)
{
CvCity* pCity;
UnitTypes eTrainUnit;
BuildingTypes eConstructBuilding;
ProjectTypes eCreateProject;
ReligionTypes eReligion;
CivicTypes eCivic;
switch (info.getButtonPopupType())
{
case BUTTONPOPUP_CHOOSEPRODUCTION:
pCity = GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
if (pCity != NULL)
{
eTrainUnit = NO_UNIT;
eConstructBuilding = NO_BUILDING;
eCreateProject = NO_PROJECT;
switch (info.getData2())
{
case (ORDER_TRAIN):
eTrainUnit = (UnitTypes)info.getData3();
break;
case (ORDER_CONSTRUCT):
eConstructBuilding = (BuildingTypes)info.getData3();
break;
case (ORDER_CREATE):
eCreateProject = (ProjectTypes)info.getData3();
break;
default:
break;
}
if (eTrainUnit != NO_UNIT)
{
szString += gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_PRODUCTION_UNIT", GC.getUnitInfo(eTrainUnit).getTextKeyWide(), pCity->getNameKey());
}
else if (eConstructBuilding != NO_BUILDING)
{
szString += gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_PRODUCTION_BUILDING", GC.getBuildingInfo(eConstructBuilding).getTextKeyWide(), pCity->getNameKey());
}
else if (eCreateProject != NO_PROJECT)
{
szString += gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_PRODUCTION_PROJECT", GC.getProjectInfo(eCreateProject).getTextKeyWide(), pCity->getNameKey());
}
else
{
szString += gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_PRODUCTION", pCity->getNameKey());
}
}
break;
case BUTTONPOPUP_CHANGERELIGION:
eReligion = ((ReligionTypes)(info.getData1()));
if (eReligion != NO_RELIGION)
{
szString += gDLL->getText("TXT_KEY_MINIMIZED_CHANGE_RELIGION", GC.getReligionInfo(eReligion).getTextKeyWide());
}
break;
case BUTTONPOPUP_CHOOSETECH:
if (info.getData1() > 0)
{
szString += gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_TECH_FREE");
}
else
{
szString += gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_TECH");
}
break;
case BUTTONPOPUP_CHANGECIVIC:
eCivic = ((CivicTypes)(info.getData2()));
if (eCivic != NO_CIVIC)
{
szString += gDLL->getText("TXT_KEY_MINIMIZED_CHANGE_CIVIC", GC.getCivicInfo(eCivic).getTextKeyWide());
}
break;
}
}
void CvGameTextMgr::setUnitHelp(CvWString &szString, const CvUnit* pUnit, bool bOneLine, bool bShort)
{
CvWString szTempBuffer;
BuildTypes eBuild;
int iCurrMoves;
int iI;
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR("COLOR_UNIT_TEXT"), pUnit->getName().GetCString());
szString += szTempBuffer;
szString += (L", ");
if (pUnit->getDomainType() == DOMAIN_AIR)
{
if (pUnit->airBaseCombatStr() > 0)
{
if (pUnit->isFighting())
{
szTempBuffer.Format(L"?/%d%c, ", pUnit->airBaseCombatStr(), gDLL->getSymbolID(STRENGTH_CHAR));
}
else if (pUnit->isHurt())
{
szTempBuffer.Format(L"%.1f/%d%c, ", (((float)(pUnit->airBaseCombatStr() * pUnit->currHitPoints())) / ((float)(pUnit->maxHitPoints()))), pUnit->airBaseCombatStr(), gDLL->getSymbolID(STRENGTH_CHAR));
}
else
{
szTempBuffer.Format(L"%d%c, ", pUnit->airBaseCombatStr(), gDLL->getSymbolID(STRENGTH_CHAR));
}
szString += szTempBuffer;
}
}
else
{
if (pUnit->canFight())
{
if (pUnit->isFighting())
{
szTempBuffer.Format(L"?/%d%c, ", pUnit->baseCombatStr(), gDLL->getSymbolID(STRENGTH_CHAR));
}
else if (pUnit->isHurt())
{
szTempBuffer.Format(L"%.1f/%d%c, ", (((float)(pUnit->baseCombatStr() * pUnit->currHitPoints())) / ((float)(pUnit->maxHitPoints()))), pUnit->baseCombatStr(), gDLL->getSymbolID(STRENGTH_CHAR));
}
else
{
szTempBuffer.Format(L"%d%c, ", pUnit->baseCombatStr(), gDLL->getSymbolID(STRENGTH_CHAR));
}
szString += szTempBuffer;
}
}
iCurrMoves = ((pUnit->movesLeft() / GC.getMOVE_DENOMINATOR()) + (((pUnit->movesLeft() % GC.getMOVE_DENOMINATOR()) > 0) ? 1 : 0));
if ((pUnit->baseMoves() == iCurrMoves) || (pUnit->getTeam() != GC.getGameINLINE().getActiveTeam()))
{
szTempBuffer.Format(L"%d%c", pUnit->baseMoves(), gDLL->getSymbolID(MOVES_CHAR));
}
else
{
szTempBuffer.Format(L"%d/%d%c", iCurrMoves, pUnit->baseMoves(), gDLL->getSymbolID(MOVES_CHAR));
}
szString += (szTempBuffer);
if (pUnit->airRange() > 0)
{
szString += gDLL->getText("TXT_KEY_UNIT_HELP_AIR_RANGE", pUnit->airRange());
}
eBuild = pUnit->getBuildType();
if (eBuild != NO_BUILD)
{
szString += L", ";
szTempBuffer.Format(L"%s (%d)", GC.getBuildInfo(eBuild).getDescription(), pUnit->plot()->getBuildTurnsLeft(eBuild, 0, 0));
szString += szTempBuffer;
}
/*if (!bOneLine)
{
if (pUnit->getUnitCombatType() != NO_UNITCOMBAT)
{
szTempBuffer.Format(L" (%s)", GC.getUnitCombatInfo(pUnit->getUnitCombatType()).getDescription());
szString += szTempBuffer;
}
}*/
if (GC.getGameINLINE().isDebugMode())
{
FAssertMsg(pUnit->AI_getUnitAIType() != NO_UNITAI, "pUnit's AI type expected to != NO_UNITAI");
szTempBuffer.Format(L" (%s)", GC.getUnitAIInfo(pUnit->AI_getUnitAIType()).getDescription());
szString += szTempBuffer;
}
if ((pUnit->getTeam() == GC.getGameINLINE().getActiveTeam()) || GC.getGameINLINE().isDebugMode())
{
if ((pUnit->getExperience() > 0) && !(pUnit->isFighting()))
{
szString += gDLL->getText("TXT_KEY_UNIT_HELP_LEVEL", pUnit->getExperience(), pUnit->experienceNeeded());
}
}
if (pUnit->getOwnerINLINE() != GC.getGameINLINE().getActivePlayer())
{
szString += (L", ");
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, GET_PLAYER(pUnit->getOwnerINLINE()).getPlayerTextColorR(), GET_PLAYER(pUnit->getOwnerINLINE()).getPlayerTextColorG(), GET_PLAYER(pUnit->getOwnerINLINE()).getPlayerTextColorB(), GET_PLAYER(pUnit->getOwnerINLINE()).getPlayerTextColorA(), GET_PLAYER(pUnit->getOwnerINLINE()).getName());
szString += szTempBuffer;
}
for (iI = 0; iI < GC.getNumPromotionInfos(); iI++)
{
if (pUnit->isHasPromotion((PromotionTypes)iI))
{
szTempBuffer.Format(L" ", GC.getPromotionInfo((PromotionTypes)iI).getButton());
szString += szTempBuffer;
}
}
if (!bOneLine)
{
if (pUnit->cargoSpace() > 0)
{
if (pUnit->getTeam() == GC.getGameINLINE().getActiveTeam())
{
szTempBuffer = NEWLINE + gDLL->getText("TXT_KEY_UNIT_HELP_CARGO_SPACE", pUnit->getCargo(), pUnit->cargoSpace());
}
else
{
szTempBuffer = NEWLINE + gDLL->getText("TXT_KEY_UNIT_CARGO_SPACE", pUnit->cargoSpace());
}
szString += (szTempBuffer);
if (pUnit->specialCargo() != NO_SPECIALUNIT)
{
szString += gDLL->getText("TXT_KEY_UNIT_CARRIES", GC.getSpecialUnitInfo(pUnit->specialCargo()).getTextKeyWide());
}
}
if (pUnit->fortifyModifier() != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_HELP_FORTIFY_BONUS", pUnit->fortifyModifier());
}
if (!bShort)
{
if (pUnit->nukeRange() >= 0)
{
// szTempBuffer.Format(L"\n%cCan Nuke Enemy Lands", gDLL->getSymbolID(BULLET_CHAR));
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_CAN_NUKE");
}
if (pUnit->alwaysInvisible())
{
// szTempBuffer.Format(L"\n%cInvisible to All Units", gDLL->getSymbolID(BULLET_CHAR));
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_INVISIBLE_ALL");
}
else if (pUnit->getInvisibleType() != NO_INVISIBLE)
{
// szTempBuffer.Format(L"\n%cInvisible to Most Units", gDLL->getSymbolID(BULLET_CHAR));
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_INVISIBLE_MOST");
}
if ((pUnit->getSeeInvisibleType() != NO_INVISIBLE) && (pUnit->getSeeInvisibleType() != pUnit->getInvisibleType()))
{
// szTempBuffer.Format(L"\n%cCan See %s", gDLL->getSymbolID(BULLET_CHAR), GC.getInvisibleInfo(pUnit->getSeeInvisibleType()).getDescription());
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_SEE_INVISIBLE", GC.getInvisibleInfo(pUnit->getSeeInvisibleType()).getTextKeyWide());
}
if (pUnit->canMoveImpassable())
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_CAN_MOVE_IMPASSABLE");
}
}
if (pUnit->maxFirstStrikes() > 0)
{
if (pUnit->firstStrikes() == pUnit->maxFirstStrikes())
{
if (pUnit->firstStrikes() == 1)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_ONE_FIRST_STRIKE");
}
else
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_NUM_FIRST_STRIKES", pUnit->firstStrikes());
}
}
else
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_FIRST_STRIKE_CHANCES", pUnit->firstStrikes(), pUnit->maxFirstStrikes());
}
}
if (pUnit->immuneToFirstStrikes())
{
// szTempBuffer.Format(L"\n%cImmune to First Strikes", gDLL->getSymbolID(BULLET_CHAR));
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_IMMUNE_FIRST_STRIKES");
}
if (!bShort)
{
if (pUnit->noDefensiveBonus())
{
// szTempBuffer.Format(L"\n%cDoesn't Receive Defensive Bonuses", gDLL->getSymbolID(BULLET_CHAR));
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_NO_DEFENSE_BONUSES");
}
if (pUnit->flatMovementCost())
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_FLAT_MOVEMENT");
}
if (pUnit->ignoreTerrainCost())
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_IGNORE_TERRAIN");
}
if (pUnit->isBlitz())
{
// szTempBuffer.Format(L"\n%cCan Attack Multiple Times per Turn", gDLL->getSymbolID(BULLET_CHAR));
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_BLITZ_TEXT");
}
if (pUnit->isAmphib())
{
// szTempBuffer.Format(L"\n%cNo Combat Penalty for Attacking from Sea", gDLL->getSymbolID(BULLET_CHAR));
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_AMPHIB_TEXT");
}
if (pUnit->isRiver())
{
// szTempBuffer.Format(L"\n%cNo Combat Penalty for Crossing River", gDLL->getSymbolID(BULLET_CHAR));
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_RIVER_ATTACK_TEXT");
}
if (pUnit->isEnemyRoute())
{
// szTempBuffer.Format(L"\n%cCan Use Enemy Roads", gDLL->getSymbolID(BULLET_CHAR));
szString +=NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_ENEMY_ROADS_TEXT");
}
if (pUnit->isAlwaysHeal())
{
// szTempBuffer.Format(L"\n%cCan Heal while Moving", gDLL->getSymbolID(BULLET_CHAR));
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_ALWAYS_HEAL_TEXT");
}
if (pUnit->isHillsDoubleMove())
{
// szTempBuffer.Format(L"\n%cDouble Movement in Hills", gDLL->getSymbolID(BULLET_CHAR));
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HILLS_MOVE_TEXT");
}
for (iI = 0; iI < GC.getNumTerrainInfos(); iI++)
{
if (pUnit->isTerrainDoubleMove((TerrainTypes)iI))
{
// szTempBuffer.Format(L"\n%cDouble Movement in %s", gDLL->getSymbolID(BULLET_CHAR), GC.getTerrainInfo((TerrainTypes) iI).getDescription());
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_DOUBLE_MOVE_TEXT", GC.getTerrainInfo((TerrainTypes) iI).getTextKeyWide());
}
}
for (iI = 0; iI < GC.getNumFeatureInfos(); iI++)
{
if (pUnit->isFeatureDoubleMove((FeatureTypes)iI))
{
// szTempBuffer.Format(L"\n%cDouble Movement in %s", gDLL->getSymbolID(BULLET_CHAR), GC.getFeatureInfo((FeatureTypes) iI).getDescription());
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_DOUBLE_MOVE_TEXT", GC.getFeatureInfo((FeatureTypes) iI).getTextKeyWide());
}
}
if (pUnit->getExtraVisibilityRange() != 0)
{
// szTempBuffer.Format(L"\n%c%s%d Visibility Range", gDLL->getSymbolID(BULLET_CHAR), ((pUnit->getExtraVisibilityRange() > 0) ? "+" : ""), pUnit->getExtraVisibilityRange());
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_VISIBILITY_TEXT", pUnit->getExtraVisibilityRange());
}
if (pUnit->getExtraMoveDiscount() != 0)
{
// szTempBuffer.Format(L"\n%c%s%d Terrain Movement Cost", gDLL->getSymbolID(BULLET_CHAR), ((-(pUnit->getExtraMoveDiscount()) > 0) ? "+" : ""), -(pUnit->getExtraMoveDiscount()));
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_MOVE_DISCOUNT_TEXT", -(pUnit->getExtraMoveDiscount()));
}
if (pUnit->getExtraEnemyHeal() != 0)
{
// szTempBuffer.Format(L"\n%cHeals Extra %d%% Damage/Turn in Enemy Lands", gDLL->getSymbolID(BULLET_CHAR), pUnit->getExtraEnemyHeal());
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HEALS_EXTRA_TEXT", pUnit->getExtraEnemyHeal()) + gDLL->getText("TXT_KEY_PROMOTION_ENEMY_LANDS_TEXT");
}
if (pUnit->getExtraNeutralHeal() != 0)
{
// szTempBuffer.Format(L"\n%cHeals Extra %d%% Damage/Turn in Neutral Lands", gDLL->getSymbolID(BULLET_CHAR), pUnit->getExtraNeutralHeal());
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HEALS_EXTRA_TEXT", pUnit->getExtraNeutralHeal()) + gDLL->getText("TXT_KEY_PROMOTION_NEUTRAL_LANDS_TEXT");
}
if (pUnit->getExtraFriendlyHeal() != 0)
{
// szTempBuffer.Format(L"\n%cHeals Extra %d%% Damage/Turn in Friendly Lands", gDLL->getSymbolID(BULLET_CHAR), pUnit->getExtraFriendlyHeal());
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HEALS_EXTRA_TEXT", pUnit->getExtraFriendlyHeal()) + gDLL->getText("TXT_KEY_PROMOTION_FRIENDLY_LANDS_TEXT");
}
if (pUnit->getSameTileHeal() != 0)
{
// szTempBuffer.Format(L"\n%cHeals Units in Same Tile Extra %d%% Damage/Turn", gDLL->getSymbolID(BULLET_CHAR), pUnit->getSameTileHeal());
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HEALS_SAME_TEXT", pUnit->getSameTileHeal()) + gDLL->getText("TXT_KEY_PROMOTION_DAMAGE_TURN_TEXT");
}
if (pUnit->getAdjacentTileHeal() != 0)
{
// szTempBuffer.Format(L"\n%cHeals Units in Adjacent Tiles Extra %d%% Damage/Turn", gDLL->getSymbolID(BULLET_CHAR), pUnit->getAdjacentTileHeal());
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HEALS_ADJACENT_TEXT", pUnit->getAdjacentTileHeal()) + gDLL->getText("TXT_KEY_PROMOTION_DAMAGE_TURN_TEXT");
}
}
if (pUnit->currInterceptionProbability() > 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_INTERCEPT_AIRCRAFT", pUnit->currInterceptionProbability());
}
if (pUnit->evasionProbability() > 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_EVADE_INTERCEPTION", pUnit->evasionProbability());
}
if (pUnit->withdrawalProbability() > 0)
{
if (bShort)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_WITHDRAWL_PROBABILITY_SHORT", pUnit->withdrawalProbability());
}
else
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_WITHDRAWL_PROBABILITY", pUnit->withdrawalProbability());
}
}
if (pUnit->collateralDamage() > 0)
{
if (pUnit->getExtraCollateralDamage() == 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_COLLATERAL_DAMAGE");
}
else
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_COLLATERAL_DAMAGE_EXTRA", pUnit->getExtraCollateralDamage());
}
}
if (pUnit->getExtraCombatPercent() != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_STRENGTH_TEXT", pUnit->getExtraCombatPercent());
}
if (pUnit->cityAttackModifier() == pUnit->cityDefenseModifier())
{
if (pUnit->cityAttackModifier() != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_CITY_STRENGTH_MOD", pUnit->cityAttackModifier());
}
}
else
{
if (pUnit->cityAttackModifier() != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_CITY_ATTACK_TEXT", pUnit->cityAttackModifier());
}
if (pUnit->cityDefenseModifier() != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_CITY_DEFENSE_TEXT", pUnit->cityDefenseModifier());
}
}
if (pUnit->animalCombatModifier() != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_ANIMAL_COMBAT_MOD", pUnit->animalCombatModifier());
}
if (pUnit->hillsDefenseModifier() != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_HILLS_DEFENSE", pUnit->hillsDefenseModifier());
}
for (iI = 0; iI < GC.getNumTerrainInfos(); iI++)
{
if (pUnit->terrainDefenseModifier((TerrainTypes)iI) != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_DEFENSE", pUnit->terrainDefenseModifier((TerrainTypes)iI), GC.getTerrainInfo((TerrainTypes) iI).getTextKeyWide());
}
}
for (iI = 0; iI < GC.getNumFeatureInfos(); iI++)
{
if (pUnit->featureDefenseModifier((FeatureTypes)iI) != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_DEFENSE", pUnit->featureDefenseModifier((FeatureTypes)iI), GC.getFeatureInfo((FeatureTypes) iI).getTextKeyWide());
}
}
for (iI = 0; iI < GC.getNumUnitClassInfos(); iI++)
{
if (pUnit->unitClassAttackModifier((UnitClassTypes)iI) != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_MOD_VS_TYPE", pUnit->unitClassAttackModifier((UnitClassTypes)iI), GC.getUnitInfo((UnitTypes) GC.getUnitClassInfo((UnitClassTypes) iI).getDefaultUnitIndex()).getTextKeyWide());
}
if (pUnit->unitClassDefenseModifier((UnitClassTypes)iI) != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_MOD_VS_TYPE", pUnit->unitClassDefenseModifier((UnitClassTypes)iI), GC.getUnitInfo((UnitTypes) GC.getUnitClassInfo((UnitClassTypes) iI).getDefaultUnitIndex()).getTextKeyWide());
}
}
for (iI = 0; iI < GC.getNumUnitCombatInfos(); iI++)
{
if (pUnit->unitCombatModifier((UnitCombatTypes)iI) != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_MOD_VS_TYPE", pUnit->unitCombatModifier((UnitCombatTypes)iI), GC.getUnitCombatInfo((UnitCombatTypes) iI).getTextKeyWide());
}
}
for (iI = 0; iI < NUM_DOMAIN_TYPES; iI++)
{
if (pUnit->domainModifier((DomainTypes)iI) != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_MOD_VS_TYPE", pUnit->domainModifier((DomainTypes)iI), GC.getDomainInfo((DomainTypes)iI).getTextKeyWide());
}
}
if (pUnit->bombardRate() > 0)
{
if (bShort)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_BOMBARD_RATE_SHORT", ((pUnit->bombardRate() * 100) / GC.getMAX_CITY_DEFENSE_DAMAGE()));
}
else
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_BOMBARD_RATE", ((pUnit->bombardRate() * 100) / GC.getMAX_CITY_DEFENSE_DAMAGE()));
}
}
if (!isEmpty(GC.getUnitInfo(pUnit->getUnitType()).getHelp()))
{
szString += NEWLINE;
szString += (GC.getUnitInfo(pUnit->getUnitType()).getHelp());
}
}
}
void CvGameTextMgr::setPlotListHelp(CvWString &szString, CvPlot* pPlot, bool bOneLine, bool bShort)
{
CvUnit* pLoopUnit;
bool bFirst;
int iI;
bFirst = true;
for (iI = 0; iI < pPlot->getNumUnits() && iI < 20; iI++)
{
pLoopUnit = gDLL->getInterfaceIFace()->getInterfacePlotUnit(pPlot, iI);
if (pLoopUnit != NULL)
{
if (!bFirst)
{
szString+= NEWLINE;
}
setUnitHelp(szString, pLoopUnit, bOneLine, bShort);
bFirst = false;
}
}
if ( iI == 20 )
{
szString+= NEWLINE;
szString+=L"...";
}
}
// Returns true if help was given...
bool CvGameTextMgr::setCombatPlotHelp(CvWString &szString, CvPlot* pPlot)
{
CvCity* pCity;
CvUnit* pAttacker;
CvUnit* pDefender;
CvWString szTempBuffer;
CvWString szOffenseOdds;
CvWString szDefenseOdds;
bool bValid;
int iModifier;
if (gDLL->getInterfaceIFace()->getLengthSelectionList() == 0)
{
return false;
}
bValid = false;
switch (gDLL->getInterfaceIFace()->getSelectionList()->getDomainType())
{
case DOMAIN_SEA:
bValid = pPlot->isWater();
break;
case DOMAIN_AIR:
bValid = true;
break;
case DOMAIN_LAND:
bValid = !(pPlot->isWater());
break;
case DOMAIN_IMMOBILE:
break;
default:
FAssert(false);
break;
}
if (!bValid)
{
return false;
}
pAttacker = gDLL->getInterfaceIFace()->getSelectionList()->AI_getBestGroupAttacker(pPlot, false);
if (pAttacker == NULL)
{
pAttacker = gDLL->getInterfaceIFace()->getSelectionList()->AI_getBestGroupAttacker(pPlot, false, true);
}
if (pAttacker != NULL)
{
pDefender = pPlot->getBestDefender(NO_PLAYER, pAttacker->getOwnerINLINE(), pAttacker, false, true);
if (pDefender != NULL)
{
pCity = pPlot->getPlotCity();
if (pAttacker->getDomainType() != DOMAIN_AIR)
{
szTempBuffer.Format(L"%.1f", (((float)(getCombatOdds(pAttacker, pDefender))) / 10.0f));
szString += gDLL->getText("TXT_KEY_COMBAT_PLOT_ODDS", szTempBuffer.GetCString());
}
szOffenseOdds.Format(L"%.2f", ((pAttacker->getDomainType() == DOMAIN_AIR) ? pAttacker->airCurrCombatStrFloat() : pAttacker->currCombatStrFloat(NULL, NULL)));
szDefenseOdds.Format(L"%.2f", pDefender->currCombatStrFloat(pPlot, pAttacker));
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_ODDS_VS", szOffenseOdds.GetCString(), szDefenseOdds.GetCString());
szString+=L" ";//XXX
szString += gDLL->getText("TXT_KEY_COLOR_POSITIVE");
szString+=L" ";//XXX
iModifier = pAttacker->getExtraCombatPercent();
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_EXTRA_STRENGTH", iModifier);
}
iModifier = pAttacker->unitClassAttackModifier(pDefender->getUnitClassType());
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_MOD_VS_TYPE", iModifier, GC.getUnitClassInfo(pDefender->getUnitClassType()).getTextKeyWide());
}
if (pDefender->getUnitCombatType() != NO_UNITCOMBAT)
{
iModifier = pAttacker->unitCombatModifier(pDefender->getUnitCombatType());
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_MOD_VS_TYPE", iModifier, GC.getUnitCombatInfo(pDefender->getUnitCombatType()).getTextKeyWide());
}
}
iModifier = pAttacker->domainModifier(pDefender->getDomainType());
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_MOD_VS_TYPE", iModifier, GC.getDomainInfo(pDefender->getDomainType()).getTextKeyWide());
}
if (pCity != NULL)
{
iModifier = pAttacker->cityAttackModifier();
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_CITY_MOD", iModifier);
}
}
if (!(pDefender->immuneToFirstStrikes()))
{
if (pAttacker->maxFirstStrikes() > 0)
{
if (pAttacker->firstStrikes() == pAttacker->maxFirstStrikes())
{
if (pAttacker->firstStrikes() == 1)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_ONE_FIRST_STRIKE");
}
else
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_NUM_FIRST_STRIKES", pAttacker->firstStrikes());
}
}
else
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_FIRST_STRIKE_CHANCES", pAttacker->firstStrikes(), pAttacker->maxFirstStrikes());
}
}
}
if (pAttacker->isHurt())
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_HP", pAttacker->currHitPoints(), pAttacker->maxHitPoints());
}
szString+=gDLL->getText("TXT_KEY_COLOR_REVERT");
szString+=L" ";//XXX
szString+=gDLL->getText("TXT_KEY_COLOR_NEGATIVE");
szString+=L" ";//XXX
if (!(pAttacker->isRiver()))
{
if (pAttacker->plot()->isRiverCrossing(directionXY(pAttacker->plot(), pPlot)))
{
iModifier = GC.getRIVER_ATTACK_MODIFIER();
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_RIVER_MOD", -(iModifier));
}
}
}
if (!(pAttacker->isAmphib()))
{
if (!(pPlot->isWater()) && pAttacker->plot()->isWater())
{
iModifier = GC.getAMPHIB_ATTACK_MODIFIER();
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_AMPHIB_MOD", -(iModifier));
}
}
}
iModifier = pDefender->getExtraCombatPercent();
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_EXTRA_STRENGTH", iModifier);
}
iModifier = pDefender->unitClassDefenseModifier(pAttacker->getUnitClassType());
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_MOD_VS_TYPE", iModifier, GC.getUnitClassInfo(pAttacker->getUnitClassType()).getTextKeyWide());
}
if (pAttacker->getUnitCombatType() != NO_UNITCOMBAT)
{
iModifier = pDefender->unitCombatModifier(pAttacker->getUnitCombatType());
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_MOD_VS_TYPE", iModifier, GC.getUnitCombatInfo(pAttacker->getUnitCombatType()).getTextKeyWide());
}
}
iModifier = pDefender->domainModifier(pAttacker->getDomainType());
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_MOD_VS_TYPE", iModifier, GC.getDomainInfo(pAttacker->getDomainType()).getTextKeyWide());
}
if (!(pDefender->noDefensiveBonus()))
{
iModifier = pPlot->defenseModifier((pAttacker != NULL) ? pAttacker->ignoreBuildingDefense() : true);
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_TILE_MOD", iModifier);
}
}
iModifier = pDefender->fortifyModifier();
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_FORTIFY_MOD", iModifier);
}
if (pCity != NULL)
{
iModifier = pDefender->cityDefenseModifier();
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_CITY_MOD", iModifier);
}
}
if (pPlot->isHills())
{
iModifier = pDefender->hillsDefenseModifier();
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_HILLS_MOD", iModifier);
}
}
if (pPlot->getFeatureType() != NO_FEATURE)
{
iModifier = pDefender->featureDefenseModifier(pPlot->getFeatureType());
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_UNIT_MOD", iModifier, GC.getFeatureInfo(pPlot->getFeatureType()).getTextKeyWide());
}
}
else
{
iModifier = pDefender->terrainDefenseModifier(pPlot->getTerrainType());
if (iModifier != 0)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_UNIT_MOD", iModifier, GC.getTerrainInfo(pPlot->getTerrainType()).getTextKeyWide());
}
}
if (!(pAttacker->immuneToFirstStrikes()))
{
if (pDefender->maxFirstStrikes() > 0)
{
if (pDefender->firstStrikes() == pDefender->maxFirstStrikes())
{
if (pDefender->firstStrikes() == 1)
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_ONE_FIRST_STRIKE");
}
else
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_NUM_FIRST_STRIKES", pDefender->firstStrikes());
}
}
else
{
szString += NEWLINE + gDLL->getText("TXT_KEY_UNIT_FIRST_STRIKE_CHANCES", pDefender->firstStrikes(), pDefender->maxFirstStrikes());
}
}
}
if (pDefender->isHurt())
{
szString += NEWLINE + gDLL->getText("TXT_KEY_COMBAT_PLOT_HP", pDefender->currHitPoints(), pDefender->maxHitPoints());
}
szString+=gDLL->getText("TXT_KEY_COLOR_REVERT");
return true;
}
}
return false;
}
// DO NOT REMOVE - needed for font testing - Moose
void createTestFontString(CvWString& szString)
{
int iI;
szString = L"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[?^_`abcdefghijklmnopqrstuvwxyz\n";
szString += L"{}~\\????????????????????????????????????????€"???;
for (iI=0;iIgetSymbolID(iI));
}
void CvGameTextMgr::setPlotHelp(CvWString& szString, CvPlot* pPlot)
{
int iI;
// DO NOT REMOVE - needed for font testing - Moose
if (gDLL->getTestingFont())
{
createTestFontString(szString);
return;
}
CvWString szTempBuffer;
ImprovementTypes eImprovement;
PlayerTypes eRevealOwner;
BonusTypes eBonus;
bool bShift;
bool bFound;
int iDefenseModifier;
int iYield;
int iTurns;
bShift = gDLL->shiftKey();
if (bShift && (gDLL->getChtLvl() > 0))
{
szString+=(GC.getTerrainInfo(pPlot->getTerrainType()).getDescription());
FAssert((0 < GC.getNumBonusInfos()) && "GC.getNumBonusInfos() is not greater than zero but an array is being allocated in CvInterface::updateHelpStrings");
for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
if (pPlot->isPlotGroupConnectedBonus(GC.getGameINLINE().getActivePlayer(), ((BonusTypes)iI)))
{
szString+=NEWLINE;
szString+=(GC.getBonusInfo((BonusTypes)iI).getDescription());
}
}
if (pPlot->getPlotGroup(GC.getGameINLINE().getActivePlayer()) != NULL)
{
szTempBuffer.Format(L"\n(%d, %d) group: %d", pPlot->getX_INLINE(), pPlot->getY_INLINE(), pPlot->getPlotGroup(GC.getGameINLINE().getActivePlayer())->getID());
}
else
{
szTempBuffer.Format(L"\n(%d, %d) group: (-1, -1)", pPlot->getX_INLINE(), pPlot->getY_INLINE());
}
szString+=szTempBuffer;
szTempBuffer.Format(L"\nArea: %d", pPlot->getArea());
szString+=szTempBuffer;
char tempChar = 'x';
if(pPlot->getRiverNSDirection() == CARDINALDIRECTION_NORTH)
{
tempChar = 'N';
}
else if(pPlot->getRiverNSDirection() == CARDINALDIRECTION_SOUTH)
{
tempChar = 'S';
}
szTempBuffer.Format(L"\nNSRiverFlow: %c", tempChar);
szString+=szTempBuffer;
tempChar = 'x';
if(pPlot->getRiverWEDirection() == CARDINALDIRECTION_WEST)
{
tempChar = 'W';
}
else if(pPlot->getRiverWEDirection() == CARDINALDIRECTION_EAST)
{
tempChar = 'E';
}
szTempBuffer.Format(L"\nWERiverFlow: %c", tempChar);
szString+=szTempBuffer;
if(pPlot->getRouteType() != NO_ROUTE)
{
szTempBuffer.Format(L"\nRoute: %s", GC.getRouteInfo(pPlot->getRouteType()).getDescription());
szString+=szTempBuffer;
}
if(pPlot->getRouteSymbol() != NULL)
{
szTempBuffer.Format(L"\nConnection: %i", gDLL->getRouteIFace()->getConnectionMask(pPlot->getRouteSymbol()));
szString+=szTempBuffer;
}
for (iI = 0; iI < MAX_PLAYERS; iI++)
{
if (GET_PLAYER((PlayerTypes)iI).isAlive())
{
if (pPlot->getCulture((PlayerTypes)iI) > 0)
{
szTempBuffer.Format(L"\n%s Culture: %d", GET_PLAYER((PlayerTypes)iI).getName(), pPlot->getCulture((PlayerTypes)iI));
szString+=szTempBuffer;
}
}
}
szTempBuffer.Format(L"\nFound Value: %d, %d", GET_PLAYER(GC.getGameINLINE().getActivePlayer()).AI_foundValue(pPlot->getX_INLINE(), pPlot->getY_INLINE(), -1 , true), GET_PLAYER(GC.getGameINLINE().getActivePlayer()).AI_foundValue(pPlot->getX_INLINE(), pPlot->getY_INLINE(), -1 , false));
szString+=szTempBuffer;
}
else
{
eRevealOwner = pPlot->getRevealedOwner(GC.getGameINLINE().getActiveTeam(), true);
if (eRevealOwner != NO_PLAYER)
{
if (pPlot->isActiveVisible(true))
{
szTempBuffer.Format(L"%d%% " SETCOLR L"%s" ENDCOLR, pPlot->calculateCulturePercent(eRevealOwner), GET_PLAYER(eRevealOwner).getPlayerTextColorR(), GET_PLAYER(eRevealOwner).getPlayerTextColorG(), GET_PLAYER(eRevealOwner).getPlayerTextColorB(), GET_PLAYER(eRevealOwner).getPlayerTextColorA(), GET_PLAYER(eRevealOwner).getCivilizationAdjective());
szString += szTempBuffer + NEWLINE;
}
else
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, GET_PLAYER(eRevealOwner).getPlayerTextColorR(), GET_PLAYER(eRevealOwner).getPlayerTextColorG(), GET_PLAYER(eRevealOwner).getPlayerTextColorB(), GET_PLAYER(eRevealOwner).getPlayerTextColorA(), GET_PLAYER(eRevealOwner).getCivilizationDescription());
szString += szTempBuffer + NEWLINE;
}
}
iDefenseModifier = pPlot->defenseModifier(true, true);
if (iDefenseModifier != 0)
{
szString += gDLL->getText("TXT_KEY_PLOT_BONUS", iDefenseModifier) + NEWLINE;
}
if (pPlot->getTerrainType() != NO_TERRAIN)
{
if (pPlot->isPeak())
{
szString += gDLL->getText("TXT_KEY_PLOT_PEAK");
}
else
{
if (pPlot->isWater())
{
szTempBuffer.Format(SETCOLR, TEXT_COLOR("COLOR_WATER_TEXT"));
szString+=szTempBuffer;
}
if (pPlot->isHills())
{
szString += gDLL->getText("TXT_KEY_PLOT_HILLS");
}
if (pPlot->getFeatureType() != NO_FEATURE)
{
szTempBuffer.Format(L"%s/", GC.getFeatureInfo(pPlot->getFeatureType()).getDescription());
szString+=szTempBuffer;
}
szString+=(GC.getTerrainInfo(pPlot->getTerrainType()).getDescription());
if (pPlot->isWater())
{
szString+=ENDCOLR;
}
}
}
if (pPlot->hasYield())
{
for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
iYield = pPlot->calculateYield(((YieldTypes)iI), true);
if (iYield != 0)
{
szTempBuffer.Format(L", %d%c", iYield, GC.getYieldInfo((YieldTypes) iI).getChar());
szString+=szTempBuffer;
}
}
}
if (pPlot->isFreshWater())
{
szString += NEWLINE + gDLL->getText("TXT_KEY_PLOT_FRESH_WATER");
}
if (pPlot->isLake())
{
szString += NEWLINE + gDLL->getText("TXT_KEY_PLOT_FRESH_WATER_LAKE");
}
if (pPlot->isImpassable())
{
szString += NEWLINE + gDLL->getText("TXT_KEY_PLOT_IMPASSABLE");
}
if (GC.getGameINLINE().isDebugMode())
{
eBonus = pPlot->getBonusType();
}
else
{
eBonus = pPlot->getBonusType(GC.getGameINLINE().getActiveTeam());
}
if (eBonus != NO_BONUS)
{
szTempBuffer.Format(L"%c " SETCOLR L"%s" ENDCOLR, GC.getBonusInfo(eBonus).getChar(), TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), GC.getBonusInfo(eBonus).getDescription());
szString += NEWLINE + szTempBuffer;
if (GC.getBonusInfo(eBonus).getHealth() != 0)
{
szTempBuffer.Format(L", +%d%c", abs(GC.getBonusInfo(eBonus).getHealth()), ((GC.getBonusInfo(eBonus).getHealth() > 0) ? gDLL->getSymbolID(HEALTHY_CHAR): gDLL->getSymbolID(UNHEALTHY_CHAR)));
szString+=szTempBuffer;
}
if (GC.getBonusInfo(eBonus).getHappiness() != 0)
{
szTempBuffer.Format(L", +%d%c", abs(GC.getBonusInfo(eBonus).getHappiness()), ((GC.getBonusInfo(eBonus).getHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR): gDLL->getSymbolID(UNHAPPY_CHAR)));
szString+=szTempBuffer;
}
if ((pPlot->getImprovementType() == NO_IMPROVEMENT) || !(GC.getImprovementInfo(pPlot->getImprovementType()).isImprovementBonusTrade(eBonus)))
{
if (pPlot->isCity())
{
if (!(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isHasTech((TechTypes)GC.getBonusInfo(eBonus).getTechCityTrade())))
{
szString += gDLL->getText("TXT_KEY_PLOT_RESEARCH", GC.getTechInfo((TechTypes) GC.getBonusInfo(eBonus).getTechCityTrade()).getTextKeyWide());
}
}
else
{
for (iI = 0; iI < GC.getNumBuildInfos(); iI++)
{
if (GC.getBuildInfo((BuildTypes) iI).getImprovement() != NO_IMPROVEMENT)
{
if (GC.getImprovementInfo((ImprovementTypes) GC.getBuildInfo((BuildTypes) iI).getImprovement()).isImprovementBonusTrade(eBonus))
{
if (pPlot->canHaveImprovement(((ImprovementTypes)(GC.getBuildInfo((BuildTypes) iI).getImprovement())), GC.getGameINLINE().getActiveTeam(), true))
{
if (GET_TEAM(GC.getGameINLINE().getActiveTeam()).isHasTech((TechTypes)GC.getBuildInfo((BuildTypes) iI).getTechPrereq()))
{
szString += gDLL->getText("TXT_KEY_PLOT_REQUIRES", GC.getImprovementInfo((ImprovementTypes) GC.getBuildInfo((BuildTypes) iI).getImprovement()).getTextKeyWide());
}
else
{
szString += gDLL->getText("TXT_KEY_PLOT_RESEARCH", GC.getTechInfo((TechTypes) GC.getBuildInfo((BuildTypes) iI).getTechPrereq()).getTextKeyWide());
}
break;
}
}
}
}
}
}
else if (!(pPlot->isBonusNetwork(GC.getGameINLINE().getActiveTeam())))
{
szString += gDLL->getText("TXT_KEY_PLOT_REQUIRES_ROUTE");
}
}
eImprovement = pPlot->getRevealedImprovementType(GC.getGameINLINE().getActiveTeam(), true);
if (eImprovement != NO_IMPROVEMENT)
{
szString+= NEWLINE;
szString+=(GC.getImprovementInfo(eImprovement).getDescription());
bFound = false;
for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
if (GC.getImprovementInfo(eImprovement).getIrrigatedYieldChange(iI) != 0)
{
bFound = true;
break;
}
}
if (bFound)
{
if (pPlot->isIrrigationAvailable())
{
szString += gDLL->getText("TXT_KEY_PLOT_IRRIGATED");
}
else
{
szString += gDLL->getText("TXT_KEY_PLOT_NOT_IRRIGATED");
}
}
if (GC.getImprovementInfo(eImprovement).getImprovementUpgrade() != NO_IMPROVEMENT)
{
if ((pPlot->getUpgradeProgress() > 0) || pPlot->isBeingWorked())
{
iTurns = pPlot->getUpgradeTimeLeft(eImprovement, eRevealOwner);
szString += gDLL->getText("TXT_KEY_PLOT_IMP_UPGRADE", iTurns, GC.getImprovementInfo((ImprovementTypes) GC.getImprovementInfo(eImprovement).getImprovementUpgrade()).getTextKeyWide());
}
else
{
szString += gDLL->getText("TXT_KEY_PLOT_WORK_TO_UPGRADE", GC.getImprovementInfo((ImprovementTypes) GC.getImprovementInfo(eImprovement).getImprovementUpgrade()).getTextKeyWide());
}
}
}
if (pPlot->getRevealedRouteType(GC.getGameINLINE().getActiveTeam(), true) != NO_ROUTE)
{
szString += NEWLINE;
szString += (GC.getRouteInfo(pPlot->getRevealedRouteType(GC.getGameINLINE().getActiveTeam(), true)).getDescription());
}
}
}
void CvGameTextMgr::setCityBarHelp(CvWString &szString, CvCity* pCity)
{
CvWString szTempBuffer;
bool bFirst;
int iFoodDifference;
int iProductionDiffNoFood;
int iProductionDiffJustFood;
int iRate;
int iI;
iFoodDifference = pCity->foodDifference();
szString += pCity->getName();
if (iFoodDifference == 0)
{
szString += gDLL->getText("TXT_KEY_CITY_BAR_GROWTH", pCity->getFood(), pCity->growthThreshold());
}
else
{
szString += gDLL->getText("TXT_KEY_CITY_BAR_FOOD_GROWTH", iFoodDifference, pCity->getFood(), pCity->growthThreshold(), pCity->getFoodTurnsLeft());
}
if (pCity->getProductionNeeded() != MAX_INT)
{
iProductionDiffNoFood = pCity->getCurrentProductionDifference(true, true);
iProductionDiffJustFood = (pCity->getCurrentProductionDifference(false, true) - iProductionDiffNoFood);
if (iProductionDiffJustFood > 0)
{
szString += gDLL->getText("TXT_KEY_CITY_BAR_FOOD_HAMMER_PRODUCTION", iProductionDiffJustFood, iProductionDiffNoFood, pCity->getProductionName(), pCity->getProduction(), pCity->getProductionNeeded(), pCity->getProductionTurnsLeft());
}
else if (iProductionDiffNoFood > 0)
{
szString += gDLL->getText("TXT_KEY_CITY_BAR_HAMMER_PRODUCTION", iProductionDiffNoFood, pCity->getProductionName(), pCity->getProduction(), pCity->getProductionNeeded(), pCity->getProductionTurnsLeft());
}
else
{
szString += gDLL->getText("TXT_KEY_CITY_BAR_PRODUCTION", pCity->getProductionName(), pCity->getProduction(), pCity->getProductionNeeded());
}
}
bFirst = true;
for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
{
iRate = pCity->getCommerceRate((CommerceTypes)iI);
if (iRate != 0)
{
szTempBuffer.Format(L"%d%c", iRate, GC.getCommerceInfo((CommerceTypes)iI).getChar());
setListHelp(szString, NEWLINE, szTempBuffer, L", ", bFirst);
bFirst = false;
}
}
iRate = pCity->getGreatPeopleRate();
if (iRate != 0)
{
szTempBuffer.Format(L"%d%c", iRate, gDLL->getSymbolID(GREAT_PEOPLE_CHAR));
setListHelp(szString, NEWLINE, szTempBuffer, L", ", bFirst);
bFirst = false;
}
if (!bFirst)
{
szString += gDLL->getText("TXT_KEY_PER_TURN");
}
if (pCity->getCultureLevel() != NO_CULTURELEVEL)
{
szString += gDLL->getText("TXT_KEY_CITY_BAR_CULTURE", pCity->getCulture(pCity->getOwnerINLINE()), pCity->getCultureThreshold(), GC.getCultureLevelInfo(pCity->getCultureLevel()).getTextKeyWide());
}
if (pCity->getGreatPeopleProgress() > 0)
{
szString += gDLL->getText("TXT_KEY_CITY_BAR_GREAT_PEOPLE", pCity->getGreatPeopleProgress(), GET_PLAYER(pCity->getOwnerINLINE()).greatPeopleThreshold());
}
szString += NEWLINE;
szString += gDLL->getText("TXT_KEY_CITY_BAR_SELECT", pCity->getNameKey());
szString += gDLL->getText("TXT_KEY_CITY_BAR_SELECT_CTRL");
szString += gDLL->getText("TXT_KEY_CITY_BAR_SELECT_ALT");
}
void CvGameTextMgr::parseTraits(CvWString &szHelpString, TraitTypes eTrait, CivilizationTypes eCivilization, bool bDawnOfMan)
{
wchar szTempBuffer[1024]; // Formatting
PromotionTypes eLastPromotion;
BuildingTypes eLoopBuilding;
UnitTypes eLoopUnit;
int iLast;
int iI, iJ;
CvWString szText;
if (eCivilization == NO_CIVILIZATION)
{
eCivilization = GC.getGameINLINE().getActiveCivilizationType();
}
// Trait Name
szText = GC.getTraitInfo(eTrait).getDescription();
if (bDawnOfMan)
{
swprintf(szTempBuffer, L"%s", szText.GetCString());
}
else
{
swprintf(szTempBuffer, NEWLINE SETCOLR L"%s" ENDCOLR, TEXT_COLOR("COLOR_ALT_HIGHLIGHT_TEXT"), szText.GetCString());
}
szHelpString+=szTempBuffer;
if (!bDawnOfMan)
{
// iHealth
if (GC.getTraitInfo(eTrait).getHealth() != 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_HEALTH", GC.getTraitInfo(eTrait).getHealth());
}
// iMaxAnarchy
if (GC.getTraitInfo(eTrait).getMaxAnarchy() != -1)
{
if (GC.getTraitInfo(eTrait).getMaxAnarchy() == 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_NO_ANARCHY");
}
else
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_MAX_ANARCHY", GC.getTraitInfo(eTrait).getMaxAnarchy());
}
}
// iUpkeepModifier
if (GC.getTraitInfo(eTrait).getUpkeepModifier() != 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_CIVIC_UPKEEP_MODIFIER", GC.getTraitInfo(eTrait).getUpkeepModifier());
}
// iGreatPeopleRateModifier
if (GC.getTraitInfo(eTrait).getGreatPeopleRateModifier() != 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_GREAT_PEOPLE_MODIFIER", GC.getTraitInfo(eTrait).getGreatPeopleRateModifier());
}
// Wonder Production Effects
if ((GC.getTraitInfo(eTrait).getMaxGlobalBuildingProductionModifier() != 0)
|| (GC.getTraitInfo(eTrait).getMaxTeamBuildingProductionModifier() != 0)
|| (GC.getTraitInfo(eTrait).getMaxPlayerBuildingProductionModifier() != 0))
{
if ((GC.getTraitInfo(eTrait).getMaxGlobalBuildingProductionModifier() == GC.getTraitInfo(eTrait).getMaxTeamBuildingProductionModifier())
&& (GC.getTraitInfo(eTrait).getMaxGlobalBuildingProductionModifier() == GC.getTraitInfo(eTrait).getMaxPlayerBuildingProductionModifier()))
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_WONDER_PRODUCTION_MODIFIER", GC.getTraitInfo(eTrait).getMaxGlobalBuildingProductionModifier());
}
else
{
if (GC.getTraitInfo(eTrait).getMaxGlobalBuildingProductionModifier() != 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_WORLD_WONDER_PRODUCTION_MODIFIER", GC.getTraitInfo(eTrait).getMaxGlobalBuildingProductionModifier());
}
if (GC.getTraitInfo(eTrait).getMaxTeamBuildingProductionModifier() != 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_TEAM_WONDER_PRODUCTION_MODIFIER", GC.getTraitInfo(eTrait).getMaxTeamBuildingProductionModifier());
}
if (GC.getTraitInfo(eTrait).getMaxPlayerBuildingProductionModifier() != 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_NATIONAL_WONDER_PRODUCTION_MODIFIER", GC.getTraitInfo(eTrait).getMaxPlayerBuildingProductionModifier());
}
}
}
// ExtraYieldThresholds
for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
if (GC.getTraitInfo(eTrait).getExtraYieldThreshold(iI) > 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_EXTRA_YIELD_THRESHOLDS", GC.getYieldInfo((YieldTypes) iI).getChar(), GC.getTraitInfo(eTrait).getExtraYieldThreshold(iI), GC.getYieldInfo((YieldTypes) iI).getChar());
}
// Trade Yield Modifiers
if (GC.getTraitInfo(eTrait).getTradeYieldModifier(iI) != 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_TRADE_YIELD_MODIFIERS", GC.getTraitInfo(eTrait).getTradeYieldModifier(iI), GC.getYieldInfo((YieldTypes) iI).getChar(), "YIELD");
}
}
// CommerceChanges
for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
{
if (GC.getTraitInfo(eTrait).getCommerceChange(iI) != 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_COMMERCE_CHANGES", GC.getTraitInfo(eTrait).getCommerceChange(iI), GC.getCommerceInfo((CommerceTypes) iI).getChar(), "COMMERCE");
}
if (GC.getTraitInfo(eTrait).getCommerceModifier(iI) != 0)
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_COMMERCE_MODIFIERS", GC.getTraitInfo(eTrait).getCommerceModifier(iI), GC.getCommerceInfo((CommerceTypes) iI).getChar(), "COMMERCE");
}
}
// Free Promotions
eLastPromotion = NO_PROMOTION;
for (iI = 0; iI < GC.getNumPromotionInfos(); iI++)
{
if (GC.getTraitInfo(eTrait).isFreePromotion(iI))
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_FREE_PROMOTIONS", GC.getPromotionInfo((PromotionTypes) iI).getTextKeyWide());
for (iJ = 0; iJ < GC.getNumUnitCombatInfos(); iJ++)
{
if (GC.getTraitInfo(eTrait).isFreePromotionUnitCombat(iJ))
{
swprintf(szTempBuffer, L"\n %c %s", gDLL->getSymbolID(BULLET_CHAR), GC.getUnitCombatInfo((UnitCombatTypes)iJ).getDescription());
szHelpString += szTempBuffer;
}
}
}
}
// No Civic Maintenance
for (iI = 0; iI < GC.getNumCivicOptionInfos(); iI++)
{
if (GC.getCivicOptionInfo((CivicOptionTypes) iI).getTraitNoUpkeep(eTrait))
{
szHelpString += gDLL->getText("TXT_KEY_TRAIT_NO_UPKEEP", GC.getCivicOptionInfo((CivicOptionTypes)iI).getTextKeyWide());
}
}
// Increase Building/Unit Production Speeds
iLast = 0;
for (iI = 0; iI < GC.getNumSpecialUnitInfos(); iI++)
{
if (GC.getSpecialUnitInfo((SpecialUnitTypes) iI).getProductionTraits(eTrait) != 0)
{
if (GC.getSpecialUnitInfo((SpecialUnitTypes) iI).getProductionTraits(eTrait) == 100)
{
szText = gDLL->getText("TXT_KEY_TRAIT_DOUBLE_SPEED");
}
else
{
szText = gDLL->getText("TXT_KEY_TRAIT_PRODUCTION_MODIFIER", GC.getSpecialUnitInfo((SpecialUnitTypes) iI).getProductionTraits(eTrait));
}
setListHelp(szHelpString, szText.GetCString(), GC.getSpecialUnitInfo((SpecialUnitTypes) iI).getDescription(), L", ", (GC.getSpecialUnitInfo((SpecialUnitTypes) iI).getProductionTraits(eTrait) != iLast));
iLast = GC.getSpecialUnitInfo((SpecialUnitTypes) iI).getProductionTraits(eTrait);
}
}
// Unit Classes
iLast = 0;
for (iI = 0; iI < GC.getNumUnitClassInfos();iI++)
{
if (eCivilization == NO_CIVILIZATION)
{
eLoopUnit = ((UnitTypes)(GC.getUnitClassInfo((UnitClassTypes)iI).getDefaultUnitIndex()));
}
else
{
eLoopUnit = ((UnitTypes)(GC.getCivilizationInfo(eCivilization).getCivilizationUnits(iI)));
}
if (eLoopUnit != NO_UNIT)
{
if (GC.getUnitInfo(eLoopUnit).getProductionTraits(eTrait) != 0)
{
if (GC.getUnitInfo(eLoopUnit).getProductionTraits(eTrait) == 100)
{
szText = gDLL->getText("TXT_KEY_TRAIT_DOUBLE_SPEED");
}
else
{
szText = gDLL->getText("TXT_KEY_TRAIT_PRODUCTION_MODIFIER", GC.getUnitInfo(eLoopUnit).getProductionTraits(eTrait));
}
CvWString szUnit;
szUnit.Format(L" %s", GC.getUnitInfo(eLoopUnit).getDescription());
setListHelp(szHelpString, szText.GetCString(), szUnit, L", ", (GC.getUnitInfo(eLoopUnit).getProductionTraits(eTrait) != iLast));
iLast = GC.getUnitInfo(eLoopUnit).getProductionTraits(eTrait);
}
}
}
// SpecialBuildings
iLast = 0;
for (iI = 0; iI < GC.getNumSpecialBuildingInfos(); iI++)
{
if (GC.getSpecialBuildingInfo((SpecialBuildingTypes) iI).getProductionTraits(eTrait) != 0)
{
if (GC.getSpecialBuildingInfo((SpecialBuildingTypes) iI).getProductionTraits(eTrait) == 100)
{
szText = gDLL->getText("TXT_KEY_TRAIT_DOUBLE_SPEED");
}
else
{
szText = gDLL->getText("TXT_KEY_TRAIT_PRODUCTION_MODIFIER", GC.getSpecialBuildingInfo((SpecialBuildingTypes) iI).getProductionTraits(eTrait));
}
setListHelp(szHelpString, szText.GetCString(), GC.getSpecialBuildingInfo((SpecialBuildingTypes) iI).getDescription(), L", ", (GC.getSpecialBuildingInfo((SpecialBuildingTypes) iI).getProductionTraits(eTrait) != iLast));
iLast = GC.getSpecialBuildingInfo((SpecialBuildingTypes) iI).getProductionTraits(eTrait);
}
}
// Buildings
iLast = 0;
for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
{
if (eCivilization == NO_CIVILIZATION)
{
eLoopBuilding = ((BuildingTypes)(GC.getBuildingClassInfo((BuildingClassTypes)iI).getDefaultBuildingIndex()));
}
else
{
eLoopBuilding = ((BuildingTypes)(GC.getCivilizationInfo(eCivilization).getCivilizationBuildings(iI)));
}
if (eLoopBuilding != NO_BUILDING)
{
if (GC.getBuildingInfo(eLoopBuilding).getProductionTraits(eTrait) != 0)
{
if (GC.getBuildingInfo(eLoopBuilding).getProductionTraits(eTrait) == 100)
{
szText = gDLL->getText("TXT_KEY_TRAIT_DOUBLE_SPEED");
}
else
{
szText = gDLL->getText("TXT_KEY_TRAIT_PRODUCTION_MODIFIER", GC.getBuildingInfo(eLoopBuilding).getProductionTraits(eTrait));
}
CvWString szBuilding;
szBuilding.Format(L" %s", GC.getBuildingInfo(eLoopBuilding).getDescription());
setListHelp(szHelpString, szText.GetCString(), szBuilding, L", ", (GC.getBuildingInfo(eLoopBuilding).getProductionTraits(eTrait) != iLast));
iLast = GC.getBuildingInfo(eLoopBuilding).getProductionTraits(eTrait);
}
}
}
}
// return szHelpString;
}
//
// parseLeaderTraits - SimpleCivPicker // LOCALIZATION READY
//
void CvGameTextMgr::parseLeaderTraits(CvWString &szHelpString, LeaderHeadTypes eLeader, CivilizationTypes eCivilization, bool bDawnOfMan, bool bCivilopediaText)
{
// CvWString szHelpString; // Final String Storage
wchar szTempBuffer[1024]; // Formatting
int iI;
// Build help string
if (eLeader != NO_LEADER)
{
if (!bDawnOfMan && !bCivilopediaText)
{
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), GC.getLeaderHeadInfo(eLeader).getDescription());
szHelpString+=szTempBuffer;
}
FAssert((GC.getNumTraitInfos() > 0) &&
"GC.getNumTraitInfos() is less than or equal to zero but is expected to be larger than zero in CvSimpleCivPicker::setLeaderText");
bool bFirst = true;
for (iI = 0; iI < GC.getNumTraitInfos(); iI++)
{
if (GC.getLeaderHeadInfo(eLeader).hasTrait(iI))
{
if (!bFirst)
{
if (bDawnOfMan)
{
szHelpString += L", ";
}
}
else
{
bFirst = false;
}
parseTraits(szHelpString, ((TraitTypes)iI), eCivilization, bDawnOfMan);
}
}
}
else
{
// Random leader
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), gDLL->getText("TXT_KEY_TRAIT_PLAYER_UNKNOWN").c_str());
szHelpString+=szTempBuffer;
}
// return szHelpString;
}
//
// parseLeaderTraits - SimpleCivPicker // LOCALIZATION READY
//
void CvGameTextMgr::parseLeaderShortTraits(CvWString &szHelpString, LeaderHeadTypes eLeader)
{
int iI;
// Build help string
if (eLeader != NO_LEADER)
{
FAssert((GC.getNumTraitInfos() > 0) &&
"GC.getNumTraitInfos() is less than or equal to zero but is expected to be larger than zero in CvSimpleCivPicker::setLeaderText");
bool bFirst = true;
for (iI = 0; iI < GC.getNumTraitInfos(); iI++)
{
if (GC.getLeaderHeadInfo(eLeader).hasTrait(iI))
{
if (!bFirst)
{
szHelpString += L"/";
}
szHelpString += gDLL->getText(GC.getTraitInfo((TraitTypes)iI).getShortDescription());
bFirst = false;
}
}
}
else
{
// Random leader
szHelpString += CvWString("???/???");
}
// return szHelpString;
}
//
// Build Civilization Info Help Text
//
void CvGameTextMgr::parseCivInfos(CvWString &szInfoText, CivilizationTypes eCivilization, bool bDawnOfMan)
{
wchar szBuffer[1024];
wchar szTempString[1024];
CvWString szText;
UnitTypes eDefaultUnit;
UnitTypes eUniqueUnit;
if (eCivilization != NO_CIVILIZATION)
{
if (!bDawnOfMan)
{
// Civ Name
szText = GC.getCivilizationInfo(eCivilization).getDescription();
swprintf(szBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), szText.GetCString());
szInfoText.append(szBuffer);
}
// Free Techs
szText = gDLL->getText("TXT_KEY_FREE_TECHS");
if (bDawnOfMan)
{
swprintf(szBuffer, L"%s: ", szText.GetCString());
}
else
{
swprintf(szBuffer, NEWLINE SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_ALT_HIGHLIGHT_TEXT"), szText.GetCString());
}
szInfoText.append(szBuffer);
int iCounter = 0;
for (int iI = 0; iI < GC.getNumTechInfos(); iI++)
{
if (GC.getCivilizationInfo(eCivilization).isCivilizationFreeTechs(iI))
{
iCounter++;
// Add Tech
szText = GC.getTechInfo((TechTypes) iI).getDescription();
if (bDawnOfMan)
{
if (iCounter > 1)
{
szInfoText += L", ";
}
swprintf(szBuffer, L"%s", szText.GetCString());
szInfoText.append(szBuffer);
}
else
{
swprintf(szBuffer, L"%s %c%s", NEWLINE, gDLL->getSymbolID(BULLET_CHAR), szText.GetCString());
szInfoText.append(szBuffer);
}
}
}
if (iCounter == 0)
{
iCounter++;
szText = gDLL->getText("TXT_KEY_FREE_TECHS_NO");
if (bDawnOfMan)
{
swprintf(szBuffer, L"%s", szText.GetCString());
}
else
{
swprintf(szBuffer, L"%s %s", NEWLINE, szText.GetCString());
}
szInfoText.append(szBuffer);
}
// Free Units
szText = gDLL->getText("TXT_KEY_FREE_UNITS");
if (bDawnOfMan)
{
if (iCounter > 0)
{
szInfoText += NEWLINE;
}
swprintf(szTempString, L"%s: ", szText.GetCString());
}
else
{
swprintf(szTempString, NEWLINE SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_ALT_HIGHLIGHT_TEXT"), szText.GetCString());
}
szInfoText.append(szTempString);
iCounter = 0;
for (int iI = 0; iI < GC.getNumUnitClassInfos(); iI++)
{
eDefaultUnit = ((UnitTypes)(GC.getCivilizationInfo(eCivilization).getCivilizationUnits(iI)));
eUniqueUnit = ((UnitTypes)(GC.getUnitClassInfo((UnitClassTypes) iI).getDefaultUnitIndex()));
if ((eDefaultUnit != NO_UNIT) && (eUniqueUnit != NO_UNIT))
{
if (eDefaultUnit != eUniqueUnit)
{
iCounter++;
// Add Unit
if (bDawnOfMan)
{
if (iCounter > 1)
{
szInfoText += L", ";
}
swprintf(szBuffer, L"%s - (%s)",
GC.getUnitInfo(eDefaultUnit).getDescription(),
GC.getUnitInfo(eUniqueUnit).getDescription());
}
else
{
swprintf(szBuffer, L"\n %c%s - (%s)\n", gDLL->getSymbolID(BULLET_CHAR),
GC.getUnitInfo(eDefaultUnit).getDescription(),
GC.getUnitInfo(eUniqueUnit).getDescription());
}
szInfoText.append(szBuffer);
}
}
}
if (iCounter == 0)
{
iCounter++;
szText = gDLL->getText("TXT_KEY_FREE_UNITS_NO");
if (bDawnOfMan)
{
swprintf(szTempString, L"%s", szText.GetCString());
}
else
{
swprintf(szTempString, L"%s %s", NEWLINE, szText.GetCString());
}
szInfoText.append(szTempString);
}
}
else
{
// This is a random civ, let us know here...
szText = gDLL->getText("TXT_KEY_CIV_UNKNOWN");
szInfoText.append(szText);
}
// return szInfoText;
}
void CvGameTextMgr::parseSpecialistHelp(CvWString &szHelpString, SpecialistTypes eSpecialist, CvCity* pCity, bool bCivilopediaText)
{
CvWString szText;
int aiYields[NUM_YIELD_TYPES];
int aiCommerces[NUM_COMMERCE_TYPES];
int iI;
if (eSpecialist != NO_SPECIALIST)
{
if (!bCivilopediaText)
{
szHelpString=GC.getSpecialistInfo(eSpecialist).getDescription();
}
for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
if (bCivilopediaText)
{
aiYields[iI] = GC.getSpecialistInfo(eSpecialist).getYieldChange(iI);
}
else
{
aiYields[iI] = GET_PLAYER((pCity != NULL) ? pCity->getOwnerINLINE() : GC.getGameINLINE().getActivePlayer()).specialistYield(eSpecialist, ((YieldTypes)iI));
}
}
setYieldChangeHelp(szHelpString, L"", L"", L"", aiYields);
for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
{
if (bCivilopediaText)
{
aiCommerces[iI] = GC.getSpecialistInfo(eSpecialist).getCommerceChange(iI);
}
else
{
aiCommerces[iI] = GET_PLAYER((pCity != NULL) ? pCity->getOwnerINLINE() : GC.getGameINLINE().getActivePlayer()).specialistCommerce(((SpecialistTypes)eSpecialist), ((CommerceTypes)iI));
}
}
setCommerceChangeHelp(szHelpString, L"", L"", L"", aiCommerces);
if (GC.getSpecialistInfo(eSpecialist).getGreatPeopleRateChange() != 0)
{
szHelpString += NEWLINE + gDLL->getText("TXT_KEY_SPECIALIST_BIRTH_RATE", GC.getSpecialistInfo(eSpecialist).getGreatPeopleRateChange());
}
if (!isEmpty(GC.getSpecialistInfo(eSpecialist).getHelp()) && !bCivilopediaText)
{
szHelpString += NEWLINE;
szHelpString += (GC.getSpecialistInfo(eSpecialist).getHelp());
}
}
}
//
// Promotion Help
//
void CvGameTextMgr::parsePromotionHelp(CvWString &szBuffer, PromotionTypes ePromotion)
{
CvWString szText, szText2;
int iI;
if (NO_PROMOTION == ePromotion)
{
return;
}
if (GC.getPromotionInfo(ePromotion).isBlitz())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_BLITZ_TEXT");
}
if (GC.getPromotionInfo(ePromotion).isAmphib())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_AMPHIB_TEXT");
}
if (GC.getPromotionInfo(ePromotion).isRiver())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_RIVER_ATTACK_TEXT");
}
if (GC.getPromotionInfo(ePromotion).isEnemyRoute())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_ENEMY_ROADS_TEXT");
}
if (GC.getPromotionInfo(ePromotion).isAlwaysHeal())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_ALWAYS_HEAL_TEXT");
}
if (GC.getPromotionInfo(ePromotion).isHillsDoubleMove())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HILLS_MOVE_TEXT");
}
if (GC.getPromotionInfo(ePromotion).isImmuneToFirstStrikes())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_IMMUNE_FIRST_STRIKES_TEXT");
}
for (iI = 0; iI < GC.getNumTerrainInfos(); iI++)
{
if (GC.getPromotionInfo(ePromotion).getTerrainDoubleMove(iI))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_DOUBLE_MOVE_TEXT", GC.getTerrainInfo((TerrainTypes) iI).getTextKeyWide());
}
}
for (iI = 0; iI < GC.getNumFeatureInfos(); iI++)
{
if (GC.getPromotionInfo(ePromotion).getFeatureDoubleMove(iI))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_DOUBLE_MOVE_TEXT", GC.getFeatureInfo((FeatureTypes) iI).getTextKeyWide());
}
}
if (GC.getPromotionInfo(ePromotion).getVisibilityChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_VISIBILITY_TEXT", GC.getPromotionInfo(ePromotion).getVisibilityChange());
}
if (GC.getPromotionInfo(ePromotion).getMovesChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_MOVE_TEXT", GC.getPromotionInfo(ePromotion).getMovesChange());
}
if (GC.getPromotionInfo(ePromotion).getMoveDiscountChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_MOVE_DISCOUNT_TEXT", -(GC.getPromotionInfo(ePromotion).getMoveDiscountChange()));
}
if (GC.getPromotionInfo(ePromotion).getWithdrawalChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_WITHDRAWAL_TEXT", GC.getPromotionInfo(ePromotion).getWithdrawalChange());
}
if (GC.getPromotionInfo(ePromotion).getCollateralDamageChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_COLLATERAL_DAMAGE_TEXT", GC.getPromotionInfo(ePromotion).getCollateralDamageChange());
}
if (GC.getPromotionInfo(ePromotion).getBombardRateChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_BOMBARD_TEXT", GC.getPromotionInfo(ePromotion).getBombardRateChange());
}
if (GC.getPromotionInfo(ePromotion).getFirstStrikesChange() != 0)
{
if (GC.getPromotionInfo(ePromotion).getFirstStrikesChange() == 1)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_FIRST_STRIKE_TEXT", GC.getPromotionInfo(ePromotion).getFirstStrikesChange());
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_FIRST_STRIKES_TEXT", GC.getPromotionInfo(ePromotion).getFirstStrikesChange());
}
}
if (GC.getPromotionInfo(ePromotion).getChanceFirstStrikesChange() != 0)
{
if (GC.getPromotionInfo(ePromotion).getChanceFirstStrikesChange() == 1)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_FIRST_STRIKE_CHANCE_TEXT", GC.getPromotionInfo(ePromotion).getChanceFirstStrikesChange());
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_FIRST_STRIKES_CHANCE_TEXT", GC.getPromotionInfo(ePromotion).getChanceFirstStrikesChange());
}
}
if (GC.getPromotionInfo(ePromotion).getEnemyHealChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HEALS_EXTRA_TEXT", GC.getPromotionInfo(ePromotion).getEnemyHealChange()) + gDLL->getText("TXT_KEY_PROMOTION_ENEMY_LANDS_TEXT");
}
if (GC.getPromotionInfo(ePromotion).getNeutralHealChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HEALS_EXTRA_TEXT", GC.getPromotionInfo(ePromotion).getNeutralHealChange()) + gDLL->getText("TXT_KEY_PROMOTION_NEUTRAL_LANDS_TEXT");
}
if (GC.getPromotionInfo(ePromotion).getFriendlyHealChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HEALS_EXTRA_TEXT", GC.getPromotionInfo(ePromotion).getFriendlyHealChange()) + gDLL->getText("TXT_KEY_PROMOTION_FRIENDLY_LANDS_TEXT");
}
if (GC.getPromotionInfo(ePromotion).getSameTileHealChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HEALS_SAME_TEXT", GC.getPromotionInfo(ePromotion).getSameTileHealChange()) + gDLL->getText("TXT_KEY_PROMOTION_DAMAGE_TURN_TEXT");
}
if (GC.getPromotionInfo(ePromotion).getAdjacentTileHealChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HEALS_ADJACENT_TEXT", GC.getPromotionInfo(ePromotion).getAdjacentTileHealChange()) + gDLL->getText("TXT_KEY_PROMOTION_DAMAGE_TURN_TEXT");
}
if (GC.getPromotionInfo(ePromotion).getCombatPercent() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_STRENGTH_TEXT", GC.getPromotionInfo(ePromotion).getCombatPercent());
}
if (GC.getPromotionInfo(ePromotion).getCityAttackPercent() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_CITY_ATTACK_TEXT", GC.getPromotionInfo(ePromotion).getCityAttackPercent());
}
if (GC.getPromotionInfo(ePromotion).getCityDefensePercent() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_CITY_DEFENSE_TEXT", GC.getPromotionInfo(ePromotion).getCityDefensePercent());
}
if (GC.getPromotionInfo(ePromotion).getHillsDefensePercent() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_HILLS_DEFENSE_TEXT", GC.getPromotionInfo(ePromotion).getHillsDefensePercent());
}
for (iI = 0; iI < GC.getNumTerrainInfos(); iI++)
{
if (GC.getPromotionInfo(ePromotion).getTerrainDefensePercent(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_DEFENSE_TEXT", GC.getPromotionInfo(ePromotion).getTerrainDefensePercent(iI), GC.getTerrainInfo((TerrainTypes) iI).getTextKeyWide());
}
}
for (iI = 0; iI < GC.getNumFeatureInfos(); iI++)
{
if (GC.getPromotionInfo(ePromotion).getFeatureDefensePercent(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_DEFENSE_TEXT", GC.getPromotionInfo(ePromotion).getFeatureDefensePercent(iI), GC.getFeatureInfo((FeatureTypes) iI).getTextKeyWide());
}
}
for (iI = 0; iI < GC.getNumUnitCombatInfos(); iI++)
{
if (GC.getPromotionInfo(ePromotion).getUnitCombatModifierPercent(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_VERSUS_TEXT", GC.getPromotionInfo(ePromotion).getUnitCombatModifierPercent(iI), GC.getUnitCombatInfo((UnitCombatTypes)iI).getTextKeyWide());
}
}
for (iI = 0; iI < NUM_DOMAIN_TYPES; iI++)
{
if (GC.getPromotionInfo(ePromotion).getDomainModifierPercent(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROMOTION_VERSUS_TEXT", GC.getPromotionInfo(ePromotion).getDomainModifierPercent(iI), GC.getDomainInfo((DomainTypes)iI).getTextKeyWide());
}
}
}
// Function: parseCivicInfo()
// Description: Will parse the civic info help
// Parameters: szHelpText -- the text to put it into
// civicInfo - what to parse
// Returns: nothing
void CvGameTextMgr::parseCivicInfo(CvWString &szHelpText, CivicTypes eCivic, bool bCivilopediaText, bool bPlayerContext, bool bSkipName)
{
wchar szFirstBuffer[1024];
bool bFound;
bool bFirst;
int iLast;
int iI, iJ;
if (NO_CIVIC == eCivic)
{
return;
}
szHelpText = "";
FAssert(GC.getGameINLINE().getActivePlayer() != NO_PLAYER || !bPlayerContext);
if (!bSkipName)
{
szHelpText += GC.getCivicInfo(eCivic).getDescription();
}
if (!bCivilopediaText)
{
if (!bPlayerContext || !(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).canDoCivics(eCivic)))
{
if (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isHasTech((TechTypes)(GC.getCivicInfo(eCivic).getTechPrereq()))))
{
if (GC.getCivicInfo(eCivic).getTechPrereq() != NO_TECH)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_REQUIRES", GC.getTechInfo((TechTypes)GC.getCivicInfo(eCivic).getTechPrereq()).getTextKeyWide());
}
}
}
}
// Special Building Not Required...
for (iI = 0; iI < GC.getNumSpecialBuildingInfos(); iI++)
{
if (GC.getCivicInfo(eCivic).isSpecialBuildingNotRequired(iI))
{
// XXX "Missionaries"??? - Now in XML
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_BUILD_MISSIONARIES", GC.getSpecialBuildingInfo((SpecialBuildingTypes)iI).getTextKeyWide());
}
}
// Valid Specialists...
bFirst = true;
for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
{
if (GC.getCivicInfo(eCivic).isSpecialistValid(iI))
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_CIVIC_UNLIMTED").c_str());
CvWString szSpecialist;
szSpecialist.Format(L" %s", GC.getSpecialistInfo((SpecialistTypes)iI).getDescription());
setListHelp(szHelpText, szFirstBuffer, szSpecialist, L", ", bFirst);
bFirst = false;
}
}
// Great People Modifier...
if (GC.getCivicInfo(eCivic).getGreatPeopleRateModifier() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_GREAT_PEOPLE_MOD", GC.getCivicInfo(eCivic).getGreatPeopleRateModifier());
}
// State Religion Great People Modifier...
if (GC.getCivicInfo(eCivic).getStateReligionGreatPeopleRateModifier() != 0)
{
if (bPlayerContext && (GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getStateReligion() != NO_RELIGION))
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_GREAT_PEOPLE_MOD_RELIGION", GC.getCivicInfo(eCivic).getStateReligionGreatPeopleRateModifier(), GC.getReligionInfo(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getStateReligion()).getChar());
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_GREAT_PEOPLE_MOD_STATE_RELIGION", GC.getCivicInfo(eCivic).getStateReligionGreatPeopleRateModifier(), gDLL->getSymbolID(RELIGION_CHAR));
}
}
// Distance Maintenance Modifer...
if (GC.getCivicInfo(eCivic).getDistanceMaintenanceModifier() != 0)
{
if (GC.getCivicInfo(eCivic).getDistanceMaintenanceModifier() <= -100)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_DISTANCE_MAINT");
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_DISTANCE_MAINT_MOD", GC.getCivicInfo(eCivic).getDistanceMaintenanceModifier());
}
}
// Num Cities Maintenance Modifer...
if (GC.getCivicInfo(eCivic).getNumCitiesMaintenanceModifier() != 0)
{
if (GC.getCivicInfo(eCivic).getNumCitiesMaintenanceModifier() <= -100)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_NO_MAINT_NUM_CITIES");
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_NO_MAINT_NUM_CITIES_MOD", GC.getCivicInfo(eCivic).getNumCitiesMaintenanceModifier());
}
}
// Extra Health
if (GC.getCivicInfo(eCivic).getExtraHealth() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_EXTRA_HEALTH", abs(GC.getCivicInfo(eCivic).getExtraHealth()), ((GC.getCivicInfo(eCivic).getExtraHealth() > 0) ? gDLL->getSymbolID(HEALTHY_CHAR): gDLL->getSymbolID(UNHEALTHY_CHAR)));
}
// Free Experience
if (GC.getCivicInfo(eCivic).getFreeExperience() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_FREE_XP", GC.getCivicInfo(eCivic).getFreeExperience());
}
// Worker speed modifier
if (GC.getCivicInfo(eCivic).getWorkerSpeedModifier() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_WORKER_SPEED", GC.getCivicInfo(eCivic).getWorkerSpeedModifier());
}
// Improvement upgrade rate modifier
if (GC.getCivicInfo(eCivic).getImprovementUpgradeRateModifier() != 0)
{
bFirst = true;
for (iI = 0; iI < GC.getNumImprovementInfos(); iI++)
{
if (GC.getImprovementInfo((ImprovementTypes)iI).getImprovementUpgrade() != NO_IMPROVEMENT)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_CIVIC_IMPROVEMENT_UPGRADE", GC.getCivicInfo(eCivic).getImprovementUpgradeRateModifier()).c_str());
CvWString szImprovement;
szImprovement.Format(L" %s", GC.getImprovementInfo((ImprovementTypes)iI).getDescription());
setListHelp(szHelpText, szFirstBuffer, szImprovement, L", ", bFirst);
bFirst = false;
}
}
}
// Military unit production modifier
if (GC.getCivicInfo(eCivic).getMilitaryProductionModifier() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_MILITARY_PRODUCTION", GC.getCivicInfo(eCivic).getMilitaryProductionModifier());
}
// Free units population percent
if ((GC.getCivicInfo(eCivic).getBaseFreeUnits() != 0) || (GC.getCivicInfo(eCivic).getFreeUnitsPopulationPercent() != 0))
{
if (bPlayerContext)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_FREE_UNITS", (GC.getCivicInfo(eCivic).getBaseFreeUnits() + ((GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getTotalPopulation() * GC.getCivicInfo(eCivic).getFreeUnitsPopulationPercent()) / 100)));
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_UNIT_SUPPORT");
}
}
// Free military units population percent
if ((GC.getCivicInfo(eCivic).getBaseFreeMilitaryUnits() != 0) || (GC.getCivicInfo(eCivic).getFreeMilitaryUnitsPopulationPercent() != 0))
{
if (bPlayerContext)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_FREE_MILITARY_UNITS", (GC.getCivicInfo(eCivic).getBaseFreeMilitaryUnits() + ((GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getTotalPopulation() * GC.getCivicInfo(eCivic).getFreeMilitaryUnitsPopulationPercent()) / 100)));
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_MILITARY_UNIT_SUPPORT");
}
}
// Happiness per military unit
if (GC.getCivicInfo(eCivic).getHappyPerMilitaryUnit() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_UNIT_HAPPINESS", GC.getCivicInfo(eCivic).getHappyPerMilitaryUnit(), ((GC.getCivicInfo(eCivic).getHappyPerMilitaryUnit() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)));
}
// Military units produced with food
if (GC.getCivicInfo(eCivic).isMilitaryFoodProduction())
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_MILITARY_FOOD");
}
// Conscription
if (getWorldSizeMaxConscript(eCivic) != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_CONSCRIPTION", getWorldSizeMaxConscript(eCivic));
}
// Population Unhealthiness
if (GC.getCivicInfo(eCivic).isNoUnhealthyPopulation())
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_NO_POP_UNHEALTHY");
}
// Building Unhealthiness
if (GC.getCivicInfo(eCivic).isBuildingOnlyHealthy())
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_NO_BUILDING_UNHEALTHY");
}
// War Weariness
if (GC.getCivicInfo(eCivic).getWarWearinessModifier() != 0)
{
if (GC.getCivicInfo(eCivic).getWarWearinessModifier() <= -100)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_NO_WAR_WEARINESS");
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_EXTRA_WAR_WEARINESS", GC.getCivicInfo(eCivic).getWarWearinessModifier());
}
}
// Free specialists
if (GC.getCivicInfo(eCivic).getFreeSpecialist() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_FREE_SPECIALISTS", GC.getCivicInfo(eCivic).getFreeSpecialist());
}
// Trade routes
if (GC.getCivicInfo(eCivic).getTradeRoutes() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_TRADE_ROUTES", GC.getCivicInfo(eCivic).getTradeRoutes());
}
// No Foreign Trade
if (GC.getCivicInfo(eCivic).isNoForeignTrade())
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_NO_FOREIGN_TRADE");
}
// Freedom Anger
if (GC.getCivicInfo(eCivic).getCivicPercentAnger() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_FREEDOM_ANGER", GC.getCivicInfo(eCivic).getTextKeyWide());
}
if (!(GC.getCivicInfo(eCivic).isStateReligion()))
{
bFound = false;
for (iI = 0; iI < GC.getNumCivicInfos(); iI++)
{
if ((GC.getCivicInfo((CivicTypes) iI).getCivicOptionType() == GC.getCivicInfo(eCivic).getCivicOptionType()) && (GC.getCivicInfo((CivicTypes) iI).isStateReligion()))
{
bFound = true;
}
}
if (bFound)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_NO_STATE_RELIGION");
}
}
if (GC.getCivicInfo(eCivic).getStateReligionHappiness() != 0)
{
if (bPlayerContext && (GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getStateReligion() != NO_RELIGION))
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_STATE_RELIGION_HAPPINESS", abs(GC.getCivicInfo(eCivic).getStateReligionHappiness()), ((GC.getCivicInfo(eCivic).getStateReligionHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)), GC.getReligionInfo(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getStateReligion()).getChar());
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_RELIGION_HAPPINESS", abs(GC.getCivicInfo(eCivic).getStateReligionHappiness()), ((GC.getCivicInfo(eCivic).getStateReligionHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)));
}
}
if (GC.getCivicInfo(eCivic).getNonStateReligionHappiness() != 0)
{
if (GC.getCivicInfo(eCivic).isStateReligion())
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_NON_STATE_REL_HAPPINESS_NO_STATE");
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_NON_STATE_REL_HAPPINESS_WITH_STATE", abs(GC.getCivicInfo(eCivic).getNonStateReligionHappiness()), ((GC.getCivicInfo(eCivic).getNonStateReligionHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)));
}
}
// State Religion Unit Production Modifier
if (GC.getCivicInfo(eCivic).getStateReligionUnitProductionModifier() != 0)
{
if (bPlayerContext && (GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getStateReligion() != NO_RELIGION))
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_REL_TRAIN_BONUS", GC.getReligionInfo(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getStateReligion()).getChar(), GC.getCivicInfo(eCivic).getStateReligionUnitProductionModifier());
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_STATE_REL_TRAIN_BONUS", GC.getCivicInfo(eCivic).getStateReligionUnitProductionModifier());
}
}
// State Religion Building Production Modifier
if (GC.getCivicInfo(eCivic).getStateReligionBuildingProductionModifier() != 0)
{
if (bPlayerContext && (GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getStateReligion() != NO_RELIGION))
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_REL_BUILDING_BONUS", GC.getReligionInfo(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getStateReligion()).getChar(), GC.getCivicInfo(eCivic).getStateReligionBuildingProductionModifier());
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_STATE_REL_BUILDING_BONUS", GC.getCivicInfo(eCivic).getStateReligionBuildingProductionModifier());
}
}
// State Religion Free Experience
if (GC.getCivicInfo(eCivic).getStateReligionFreeExperience() != 0)
{
if (bPlayerContext && (GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getStateReligion() != NO_RELIGION))
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_REL_FREE_XP", GC.getCivicInfo(eCivic).getStateReligionFreeExperience(), GC.getReligionInfo(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getStateReligion()).getChar());
}
else
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_STATE_REL_FREE_XP", GC.getCivicInfo(eCivic).getStateReligionFreeExperience());
}
}
if (GC.getCivicInfo(eCivic).isNoNonStateReligionSpread())
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_NO_NON_STATE_SPREAD");
}
// Yield Modifiers
setYieldChangeHelp(szHelpText, L"", L"", gDLL->getText("TXT_KEY_CIVIC_IN_ALL_CITIES").GetCString(), GC.getCivicInfo(eCivic).getYieldModifierArray(), true);
// Capital Yield Modifiers
setYieldChangeHelp(szHelpText, L"", L"", gDLL->getText("TXT_KEY_CIVIC_IN_CAPITAL").GetCString(), GC.getCivicInfo(eCivic).getCapitalYieldModifierArray(), true);
// Trade Yield Modifiers
setYieldChangeHelp(szHelpText, L"", L"", gDLL->getText("TXT_KEY_CIVIC_FROM_TRADE_ROUTES").GetCString(), GC.getCivicInfo(eCivic).getTradeYieldModifierArray(), true);
// Commerce Modifier
setCommerceChangeHelp(szHelpText, L"", L"", gDLL->getText("TXT_KEY_CIVIC_IN_ALL_CITIES").GetCString(), GC.getCivicInfo(eCivic).getCommerceModifierArray(), true);
// Capital Commerce Modifiers
setCommerceChangeHelp(szHelpText, L"", L"", gDLL->getText("TXT_KEY_CIVIC_IN_CAPITAL").GetCString(), GC.getCivicInfo(eCivic).getCapitalCommerceModifierArray(), true);
// Specialist Commerce
setCommerceChangeHelp(szHelpText, L"", L"", gDLL->getText("TXT_KEY_CIVIC_PER_SPECIALIST").GetCString(), GC.getCivicInfo(eCivic).getSpecialistExtraCommerceArray());
// Largest City Happiness
if (GC.getCivicInfo(eCivic).getLargestCityHappiness() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_LARGEST_CITIES_HAPPINESS", GC.getCivicInfo(eCivic).getLargestCityHappiness(), ((GC.getCivicInfo(eCivic).getLargestCityHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)), GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getTargetNumCities());
}
// Improvement Yields
for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
iLast = 0;
for (iJ = 0; iJ < GC.getNumImprovementInfos(); iJ++)
{
if (GC.getCivicInfo(eCivic).getImprovementYieldChanges(iJ, iI) != 0)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_CIVIC_IMPROVEMENT_YIELD_CHANGE", GC.getCivicInfo(eCivic).getImprovementYieldChanges(iJ, iI), GC.getYieldInfo((YieldTypes)iI).getChar()).c_str());
CvWString szImprovement;
szImprovement.Format(L" %s", GC.getImprovementInfo((ImprovementTypes)iJ).getDescription());
setListHelp(szHelpText, szFirstBuffer, szImprovement, L", ", (GC.getCivicInfo(eCivic).getImprovementYieldChanges(iJ, iI) != iLast));
iLast = GC.getCivicInfo(eCivic).getImprovementYieldChanges(iJ, iI);
}
}
}
// Building Happiness
for (iI = 0; iI < GC.getNumBuildingInfos(); iI++)
{
if (GC.getCivicInfo(eCivic).getBuildingHappinessChanges(iI) != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_BUILDING_HAPPINESS", GC.getCivicInfo(eCivic).getBuildingHappinessChanges(iI), ((GC.getCivicInfo(eCivic).getBuildingHappinessChanges(iI) > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)), GC.getBuildingInfo((BuildingTypes)iI).getTextKeyWide());
}
}
// Feature Happiness
iLast = 0;
for (iI = 0; iI < GC.getNumFeatureInfos(); iI++)
{
if (GC.getCivicInfo(eCivic).getFeatureHappinessChanges(iI) != 0)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_CIVIC_FEATURE_HAPPINESS", GC.getCivicInfo(eCivic).getFeatureHappinessChanges(iI), ((GC.getCivicInfo(eCivic).getFeatureHappinessChanges(iI) > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR))).c_str());
CvWString szFeature;
szFeature.Format(L" %s", GC.getFeatureInfo((FeatureTypes)iI).getDescription());
setListHelp(szHelpText, szFirstBuffer, szFeature, L", ", (GC.getCivicInfo(eCivic).getFeatureHappinessChanges(iI) != iLast));
iLast = GC.getCivicInfo(eCivic).getFeatureHappinessChanges(iI);
}
}
// Hurry types
for (iI = 0; iI < GC.getNumHurryInfos(); iI++)
{
if (GC.getCivicInfo(eCivic).isHurry(iI))
{
szHelpText += CvWString::format(L"%s%c%s", NEWLINE, gDLL->getSymbolID(BULLET_CHAR), GC.getHurryInfo((HurryTypes)iI).getDescription());
}
}
// Gold cost per unit
if (GC.getCivicInfo(eCivic).getGoldPerUnit() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_SUPPORT_COSTS", (GC.getCivicInfo(eCivic).getGoldPerUnit() > 0), GC.getCommerceInfo(COMMERCE_GOLD).getChar());
}
// Gold cost per military unit
if (GC.getCivicInfo(eCivic).getGoldPerMilitaryUnit() != 0)
{
szHelpText += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_MILITARY_SUPPORT_COSTS", (GC.getCivicInfo(eCivic).getGoldPerMilitaryUnit() > 0), GC.getCommerceInfo(COMMERCE_GOLD).getChar());
}
}
void CvGameTextMgr::setTechHelp(CvWString &szBuffer, TechTypes eTech, bool bCivilopediaText, bool bPlayerContext, bool bStrategyText, bool bTreeInfo, TechTypes eFromTech)
{
wchar szFirstBuffer[1024];
wchar szTempBuffer[1024];
BuildingTypes eLoopBuilding;
UnitTypes eLoopUnit;
bool bFirst;
int iI;
if (NO_TECH == eTech)
{
return;
}
// Tech Name
if (!bCivilopediaText && (!bTreeInfo || (NO_TECH == eFromTech)))
{
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_TECH_TEXT"), GC.getTechInfo(eTech).getDescription());
szBuffer += szTempBuffer;
}
FAssert(GC.getGameINLINE().getActivePlayer() != NO_PLAYER || !bPlayerContext);
if (bTreeInfo && (NO_TECH != eFromTech))
{
buildTechTreeString(szBuffer, eTech, bPlayerContext, eFromTech);
}
// Obsolete Buildings
for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
{
if (!bPlayerContext || (GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getBuildingClassCount((BuildingClassTypes)iI) > 0))
{
if (GC.getGameINLINE().getActivePlayer() != NO_PLAYER)
{
eLoopBuilding = (BuildingTypes)GC.getCivilizationInfo(GC.getGameINLINE().getActiveCivilizationType()).getCivilizationBuildings(iI);
}
else
{
eLoopBuilding = (BuildingTypes)GC.getBuildingClassInfo((BuildingClassTypes)iI).getDefaultBuildingIndex();
}
if (eLoopBuilding != NO_BUILDING)
{
// Obsolete Buildings Check...
if (GC.getBuildingInfo(eLoopBuilding).getObsoleteTech() == eTech)
{
buildObsoleteString(szBuffer, eLoopBuilding, true);
}
}
}
}
// Obsolete Bonuses
for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
if (GC.getBonusInfo((BonusTypes)iI).getTechObsolete() == eTech)
{
buildObsoleteBonusString(szBuffer, iI, true);
}
}
for (iI = 0; iI < GC.getNumSpecialBuildingInfos(); iI++)
{
if (GC.getSpecialBuildingInfo((SpecialBuildingTypes) iI).getObsoleteTech() == eTech)
{
buildObsoleteSpecialString(szBuffer, iI, true);
}
}
// Route movement change...
buildMoveString(szBuffer, eTech, true, bPlayerContext);
// Creates a free unit...
buildFreeUnitString(szBuffer, eTech, true, bPlayerContext);
// Increases feature production...
buildFeatureProductionString(szBuffer, eTech, true, bPlayerContext);
// Increases worker build rate...
buildWorkerRateString(szBuffer, eTech, true, bPlayerContext);
// Trade Routed per city change...
buildTradeRouteString(szBuffer, eTech, true, bPlayerContext);
// Promotion Help
for ( iI = 0; iI < GC.getNumPromotionInfos(); iI++ )
{
if ( GC.getPromotionInfo( (PromotionTypes) iI).getTechPrereq() == eTech )
{
parsePromotionHelp(szBuffer, (PromotionTypes) iI );
}
}
// Health increase...
buildHealthRateString(szBuffer, eTech, true, bPlayerContext);
// Happiness increase...
buildHappinessRateString(szBuffer, eTech, true, bPlayerContext);
// Free Techs...
buildFreeTechString(szBuffer, eTech, true, bPlayerContext);
// Line of Sight Bonus across water...
buildLOSString(szBuffer, eTech, true, bPlayerContext);
// Centers world map...
buildMapCenterString(szBuffer, eTech, true, bPlayerContext);
// Reveals World Map...
buildMapRevealString(szBuffer, eTech, true);
// Enables map trading...
buildMapTradeString(szBuffer, eTech, true, bPlayerContext);
// Enables tech trading...
buildTechTradeString(szBuffer, eTech, true, bPlayerContext);
// Enables gold trading...
buildGoldTradeString(szBuffer, eTech, true, bPlayerContext);
// Enables open borders...
buildOpenBordersString(szBuffer, eTech, true, bPlayerContext);
// Enables defensive pacts...
buildDefensivePactString(szBuffer, eTech, true, bPlayerContext);
// Enables permanent alliances...
buildPermanentAllianceString(szBuffer, eTech, true, bPlayerContext);
// Enables bridge building...
buildBridgeString(szBuffer, eTech, true, bPlayerContext);
// Can spread irrigation...
buildIrrigationString(szBuffer, eTech, true, bPlayerContext);
// Ignore irrigation...
buildIgnoreIrrigationString(szBuffer, eTech, true, bPlayerContext);
// Coastal work...
buildWaterWorkString(szBuffer, eTech, true, bPlayerContext);
// Build farm, irrigation, etc...
for (iI = 0; iI < GC.getNumBuildInfos(); iI++)
{
buildImprovementString(szBuffer, eTech, iI, true, bPlayerContext);
}
// Extra moves for certain domains...
for (iI = 0; iI < NUM_DOMAIN_TYPES; iI++)
{
buildDomainExtraMovesString(szBuffer, eTech, iI, true, bPlayerContext);
}
// Adjusting culture, science, etc
for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
{
buildAdjustString(szBuffer, eTech, iI, true, bPlayerContext);
}
// Enabling trade routes on water...?
for (iI = 0; iI < GC.getNumTerrainInfos(); iI++)
{
buildTerrainTradeString(szBuffer, eTech, iI, true, bPlayerContext);
}
// Special Buildings
for (iI = 0; iI < GC.getNumSpecialBuildingInfos(); iI++)
{
buildSpecialBuildingString(szBuffer, eTech, iI, true, bPlayerContext);
}
// Build farm, mine, etc...
for (iI = 0; iI < GC.getNumImprovementInfos(); iI++)
{
buildYieldChangeString(szBuffer, eTech, iI, true, bPlayerContext);
}
bFirst = true;
for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
bFirst = buildBonusRevealString(szBuffer, eTech, iI, bFirst, true, bPlayerContext);
}
bFirst = true;
for (iI = 0; iI < GC.getNumCivicInfos(); iI++)
{
bFirst = buildCivicRevealString(szBuffer, eTech, iI, bFirst, true, bPlayerContext);
}
if (!bCivilopediaText)
{
bFirst = true;
for (iI = 0; iI < GC.getNumUnitClassInfos(); iI++)
{
if (!bPlayerContext || !(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).isProductionMaxedUnitClass((UnitClassTypes)iI)))
{
if (GC.getGameINLINE().getActivePlayer() != NO_PLAYER)
{
eLoopUnit = (UnitTypes)GC.getCivilizationInfo(GC.getGameINLINE().getActiveCivilizationType()).getCivilizationUnits(iI);
}
else
{
eLoopUnit = (UnitTypes)GC.getUnitClassInfo((UnitClassTypes)iI).getDefaultUnitIndex();
}
if (eLoopUnit != NO_UNIT)
{
if (!bPlayerContext || !(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).canTrain(eLoopUnit)))
{
if (GC.getUnitInfo(eLoopUnit).getPrereqAndTech() == eTech)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_TECH_CAN_TRAIN").c_str());
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_UNIT_TEXT"), GC.getUnitInfo(eLoopUnit).getDescription());
setListHelp(szBuffer, szFirstBuffer, szTempBuffer, L", ", bFirst);
bFirst = false;
}
}
}
}
}
bFirst = true;
for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
{
if (!bPlayerContext || !(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).isProductionMaxedBuildingClass((BuildingClassTypes)iI)))
{
if (GC.getGameINLINE().getActivePlayer() != NO_PLAYER)
{
eLoopBuilding = (BuildingTypes)GC.getCivilizationInfo(GC.getGameINLINE().getActiveCivilizationType()).getCivilizationBuildings(iI);
}
else
{
eLoopBuilding = (BuildingTypes)GC.getBuildingClassInfo((BuildingClassTypes)iI).getDefaultBuildingIndex();
}
if (eLoopBuilding != NO_BUILDING)
{
if (!bPlayerContext || !(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).canConstruct(eLoopBuilding, false, true)))
{
if (GC.getBuildingInfo(eLoopBuilding).getPrereqAndTech() == eTech)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_TECH_CAN_CONSTRUCT").c_str());
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR , TEXT_COLOR("COLOR_BUILDING_TEXT"), GC.getBuildingInfo(eLoopBuilding).getDescription());
setListHelp(szBuffer, szFirstBuffer, szTempBuffer, L", ", bFirst);
bFirst = false;
}
}
}
}
}
bFirst = true;
for (iI = 0; iI < GC.getNumProjectInfos(); iI++)
{
if (!bPlayerContext || !(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).isProductionMaxedProject((ProjectTypes)iI)))
{
if (!bPlayerContext || !(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).canCreate(((ProjectTypes)iI), false, true)))
{
if (GC.getProjectInfo((ProjectTypes)iI).getTechPrereq() == eTech)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_TECH_CAN_CREATE").c_str());
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_PROJECT_TEXT"), GC.getProjectInfo((ProjectTypes)iI).getDescription());
setListHelp(szBuffer, szFirstBuffer, szTempBuffer, L", ", bFirst);
bFirst = false;
}
}
}
}
}
bFirst = true;
for (iI = 0; iI < GC.getNumProcessInfos(); iI++)
{
bFirst = buildProcessInfoString(szBuffer, eTech, iI, bFirst, true, bPlayerContext);
}
bFirst = true;
for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
if (!bPlayerContext || !(GC.getGameINLINE().isReligionFounded((ReligionTypes)iI)))
{
bFirst = buildFoundReligionString(szBuffer, eTech, iI, bFirst, true, bPlayerContext);
}
}
if (bTreeInfo && NO_TECH == eFromTech)
{
buildSingleLineTechTreeString(szBuffer, eTech, bPlayerContext);
}
if (!isEmpty(GC.getTechInfo(eTech).getHelp()))
{
szBuffer += CvWString::format(L"%s%s", NEWLINE, GC.getTechInfo(eTech).getHelp()).c_str();
}
if (!bCivilopediaText)
{
if (GC.getGameINLINE().getActivePlayer() == NO_PLAYER)
{
swprintf(szTempBuffer, L"\n%d%c", GC.getTechInfo(eTech).getResearchCost(), GC.getCommerceInfo(COMMERCE_RESEARCH).getChar());
szBuffer += szTempBuffer;
}
else if (GET_TEAM(GC.getGameINLINE().getActiveTeam()).isHasTech(eTech))
{
swprintf(szTempBuffer, L"\n%d%c", GET_TEAM(GC.getGameINLINE().getActiveTeam()).getResearchCost(eTech), GC.getCommerceInfo(COMMERCE_RESEARCH).getChar());
szBuffer += szTempBuffer;
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_TECH_NUM_TURNS", GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getResearchTurnsLeft(eTech, (gDLL->ctrlKey() || !(gDLL->shiftKey()))));
swprintf(szTempBuffer, L" (%d/%d %c)", GET_TEAM(GC.getGameINLINE().getActiveTeam()).getResearchProgress(eTech), GET_TEAM(GC.getGameINLINE().getActiveTeam()).getResearchCost(eTech), GC.getCommerceInfo(COMMERCE_RESEARCH).getChar());
szBuffer += szTempBuffer;
}
}
if (bStrategyText)
{
if (!isEmpty(GC.getTechInfo(eTech).getStrategy()))
{
if ((GC.getGameINLINE().getActivePlayer() == NO_PLAYER) || GET_PLAYER(GC.getGameINLINE().getActivePlayer()).isOption(PLAYEROPTION_ADVISOR_HELP))
{
szBuffer += SEPARATOR;
szBuffer += NEWLINE;
szBuffer += gDLL->getText("TXT_KEY_SIDS_TIPS");
szBuffer += L"\"";
szBuffer += GC.getTechInfo(eTech).getStrategy();
szBuffer += L"\"";
}
}
}
}
void CvGameTextMgr::setBasicUnitHelp(CvWString &szBuffer, UnitTypes eUnit, bool bCivilopediaText)
{
wchar szTempBuffer[1024];
bool bFirst;
int iCount;
int iI;
if (NO_UNIT == eUnit)
{
return;
}
if (!bCivilopediaText)
{
szBuffer += NEWLINE;
if (GC.getUnitInfo(eUnit).getDomainType() == DOMAIN_AIR)
{
if (GC.getUnitInfo(eUnit).getAirCombat() > 0)
{
swprintf(szTempBuffer, L"%d%c, ", GC.getUnitInfo(eUnit).getAirCombat(), gDLL->getSymbolID(STRENGTH_CHAR));
szBuffer += szTempBuffer;
}
}
else
{
if (GC.getUnitInfo(eUnit).getCombat() > 0)
{
swprintf(szTempBuffer, L"%d%c, ", GC.getUnitInfo(eUnit).getCombat(), gDLL->getSymbolID(STRENGTH_CHAR));
szBuffer += szTempBuffer;
}
}
swprintf(szTempBuffer, L"%d%c", GC.getUnitInfo(eUnit).getMoves(), gDLL->getSymbolID(MOVES_CHAR));
szBuffer += szTempBuffer;
if (GC.getUnitInfo(eUnit).getAirRange() > 0)
{
szBuffer += L", " + gDLL->getText("TXT_KEY_UNIT_AIR_RANGE", GC.getUnitInfo(eUnit).getAirRange());
}
}
if (GC.getUnitInfo(eUnit).getCargoSpace() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_CARGO_SPACE", GC.getUnitInfo(eUnit).getCargoSpace());
if (GC.getUnitInfo(eUnit).getSpecialCargo() != NO_SPECIALUNIT)
{
szBuffer += gDLL->getText("TXT_KEY_UNIT_CARRIES", GC.getSpecialUnitInfo((SpecialUnitTypes) GC.getUnitInfo(eUnit).getSpecialCargo()).getTextKeyWide());
}
}
swprintf(szTempBuffer, L"%s%s ", NEWLINE, gDLL->getText("TXT_KEY_UNIT_CANNOT_ENTER").GetCString());
bFirst = true;
for (iI = 0; iI < GC.getNumTerrainInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getTerrainImpassable(iI))
{
CvWString szTerrain;
szTerrain.Format(L" %s", GC.getTerrainInfo((TerrainTypes)iI).getDescription());
setListHelp(szBuffer, szTempBuffer, szTerrain, L", ", bFirst);
bFirst = false;
}
}
for (iI = 0; iI < GC.getNumFeatureInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getFeatureImpassable(iI))
{
CvWString szFeature;
szFeature.Format(L" %s", GC.getFeatureInfo((FeatureTypes)iI).getDescription());
setListHelp(szBuffer, szTempBuffer, szFeature, L", ", bFirst);
bFirst = false;
}
}
if (GC.getUnitInfo(eUnit).isInvisible())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_INVISIBLE_ALL");
}
else if (GC.getUnitInfo(eUnit).getInvisibleType() != NO_INVISIBLE)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_INVISIBLE_MOST");
}
if ((GC.getUnitInfo(eUnit).getSeeInvisibleType() != NO_INVISIBLE) && (bCivilopediaText || (GC.getUnitInfo(eUnit).getSeeInvisibleType() != GC.getUnitInfo(eUnit).getInvisibleType())))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_SEE_INVISIBLE", GC.getInvisibleInfo((InvisibleTypes) GC.getUnitInfo(eUnit).getSeeInvisibleType()).getTextKeyWide());
}
if (GC.getUnitInfo(eUnit).isCanMoveImpassable())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_CAN_MOVE_IMPASSABLE");
}
if (GC.getUnitInfo(eUnit).isNoBadGoodies())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_NO_BAD_GOODIES");
}
if (GC.getUnitInfo(eUnit).isOnlyDefensive())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_ONLY_DEFENSIVE");
}
if (GC.getUnitInfo(eUnit).isNoCapture())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_CANNOT_CAPTURE");
}
if (GC.getUnitInfo(eUnit).isRivalTerritory())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_EXPLORE_RIVAL");
}
if (GC.getUnitInfo(eUnit).isFound())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_FOUND_CITY");
}
if (GC.getUnitInfo(eUnit).isGoldenAge())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_GOLDEN_AGE");
}
if ((GC.getUnitInfo(eUnit).getBaseDiscover() > 0) || (GC.getUnitInfo(eUnit).getDiscoverMultiplier() > 0))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_DISCOVER_TECH");
}
if ((GC.getUnitInfo(eUnit).getBaseHurry() > 0) || (GC.getUnitInfo(eUnit).getHurryMultiplier() > 0))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_HURRY_PRODUCTION");
}
if ((GC.getUnitInfo(eUnit).getBaseTrade() > 0) || (GC.getUnitInfo(eUnit).getTradeMultiplier() > 0))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_TRADE_MISSION");
}
if (GC.getUnitInfo(eUnit).getGreatWorkCulture() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_GREAT_WORK", GC.getUnitInfo(eUnit).getGreatWorkCulture());
}
iCount = 0;
for (iI = 0; iI < GC.getNumBuildInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getBuilds(iI))
{
iCount++;
}
}
if (iCount > ((GC.getNumBuildInfos() * 3) / 4))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_IMPROVE_PLOTS");
}
else
{
bFirst = true;
for (iI = 0; iI < GC.getNumBuildInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getBuilds(iI))
{
swprintf(szTempBuffer, L"%s%s ", NEWLINE, gDLL->getText("TXT_KEY_UNIT_CAN").c_str());
setListHelp(szBuffer, szTempBuffer, GC.getBuildInfo((BuildTypes) iI).getDescription(), L", ", bFirst);
bFirst = false;
}
}
}
if (GC.getUnitInfo(eUnit).getNukeRange() != -1)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_CAN_NUKE");
}
if (GC.getUnitInfo(eUnit).isCounterSpy())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_EXPOSE_SPIES");
}
if ((GC.getUnitInfo(eUnit).getFirstStrikes() + GC.getUnitInfo(eUnit).getChanceFirstStrikes()) > 0)
{
if (GC.getUnitInfo(eUnit).getChanceFirstStrikes() == 0)
{
if (GC.getUnitInfo(eUnit).getFirstStrikes() == 1)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_ONE_FIRST_STRIKE");
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_NUM_FIRST_STRIKES", GC.getUnitInfo(eUnit).getFirstStrikes());
}
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_FIRST_STRIKE_CHANCES", GC.getUnitInfo(eUnit).getFirstStrikes(), GC.getUnitInfo(eUnit).getFirstStrikes() + GC.getUnitInfo(eUnit).getChanceFirstStrikes());
}
}
if (GC.getUnitInfo(eUnit).isFirstStrikeImmune())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_IMMUNE_FIRST_STRIKES");
}
if (GC.getUnitInfo(eUnit).isNoDefensiveBonus())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_NO_DEFENSE_BONUSES");
}
if (GC.getUnitInfo(eUnit).isFlatMovementCost())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_FLAT_MOVEMENT");
}
if (GC.getUnitInfo(eUnit).isIgnoreTerrainCost())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_IGNORE_TERRAIN");
}
if (GC.getUnitInfo(eUnit).getInterceptionProbability() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_INTERCEPT_AIRCRAFT", GC.getUnitInfo(eUnit).getInterceptionProbability());
}
if (GC.getUnitInfo(eUnit).getEvasionProbability() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_EVADE_INTERCEPTION", GC.getUnitInfo(eUnit).getEvasionProbability());
}
if (GC.getUnitInfo(eUnit).getWithdrawalProbability() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_WITHDRAWL_PROBABILITY", GC.getUnitInfo(eUnit).getWithdrawalProbability());
}
if (GC.getUnitInfo(eUnit).getCollateralDamage() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_COLLATERAL_DAMAGE");
}
if (GC.getUnitInfo(eUnit).getCityAttackModifier() == GC.getUnitInfo(eUnit).getCityDefenseModifier())
{
if (GC.getUnitInfo(eUnit).getCityAttackModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_CITY_STRENGTH_MOD", GC.getUnitInfo(eUnit).getCityAttackModifier());
}
}
else
{
if (GC.getUnitInfo(eUnit).getCityAttackModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_CITY_ATTACK_MOD", GC.getUnitInfo(eUnit).getCityAttackModifier());
}
if (GC.getUnitInfo(eUnit).getCityDefenseModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_CITY_DEFENSE_MOD", GC.getUnitInfo(eUnit).getCityDefenseModifier());
}
}
if (GC.getUnitInfo(eUnit).getAnimalCombatModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_ANIMAL_COMBAT_MOD", GC.getUnitInfo(eUnit).getAnimalCombatModifier());
}
if (GC.getUnitInfo(eUnit).getHillsDefenseModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_HILLS_DEFENSE", GC.getUnitInfo(eUnit).getHillsDefenseModifier());
}
for (iI = 0; iI < GC.getNumTerrainInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getTerrainDefenseModifier(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_DEFENSE", GC.getUnitInfo(eUnit).getTerrainDefenseModifier(iI), GC.getTerrainInfo((TerrainTypes) iI).getTextKeyWide());
}
}
for (iI = 0; iI < GC.getNumFeatureInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getFeatureDefenseModifier(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_DEFENSE", GC.getUnitInfo(eUnit).getFeatureDefenseModifier(iI), GC.getFeatureInfo((FeatureTypes) iI).getTextKeyWide());
}
}
for (iI = 0; iI < GC.getNumUnitClassInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getUnitClassAttackModifier(iI) == GC.getUnitInfo(eUnit).getUnitClassDefenseModifier(iI))
{
if (GC.getUnitInfo(eUnit).getUnitClassAttackModifier(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_MOD_VS_TYPE", GC.getUnitInfo(eUnit).getUnitClassAttackModifier(iI), GC.getUnitClassInfo((UnitClassTypes)iI).getTextKeyWide());
}
}
else
{
if (GC.getUnitInfo(eUnit).getUnitClassAttackModifier(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_ATTACK_MOD_VS_CLASS", GC.getUnitInfo(eUnit).getUnitClassAttackModifier(iI), GC.getUnitClassInfo((UnitClassTypes)iI).getTextKeyWide());
}
if (GC.getUnitInfo(eUnit).getUnitClassDefenseModifier(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_DEFENSE_MOD_VS_CLASS", GC.getUnitInfo(eUnit).getUnitClassDefenseModifier(iI), GC.getUnitClassInfo((UnitClassTypes) iI).getTextKeyWide());
}
}
}
for (iI = 0; iI < GC.getNumUnitCombatInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getUnitCombatModifier(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_MOD_VS_TYPE", GC.getUnitInfo(eUnit).getUnitCombatModifier(iI), GC.getUnitCombatInfo((UnitCombatTypes) iI).getTextKeyWide());
}
}
for (iI = 0; iI < NUM_DOMAIN_TYPES; iI++)
{
if (GC.getUnitInfo(eUnit).getDomainModifier(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_MOD_VS_TYPE_NO_LINK", GC.getUnitInfo(eUnit).getDomainModifier(iI), GC.getDomainInfo((DomainTypes)iI).getTextKeyWide());
}
}
if (GC.getUnitInfo(eUnit).getBombRate() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_BOMB_RATE", ((GC.getUnitInfo(eUnit).getBombRate() * 100) / GC.getMAX_CITY_DEFENSE_DAMAGE()));
}
if (GC.getUnitInfo(eUnit).getBombardRate() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_BOMBARD_RATE", ((GC.getUnitInfo(eUnit).getBombardRate() * 100) / GC.getMAX_CITY_DEFENSE_DAMAGE()));
}
bFirst = true;
for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getReligionSpreads(iI))
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_UNIT_CAN_SPREAD").c_str());
CvWString szReligion;
szReligion.Format(L" %s", GC.getReligionInfo((ReligionTypes) iI).getDescription());
setListHelp(szBuffer, szTempBuffer, szReligion, L", ", bFirst);
bFirst = false;
}
}
bFirst = true;
for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getGreatPeoples(iI))
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_UNIT_CAN_JOIN").c_str());
setListHelp(szBuffer, szTempBuffer, GC.getSpecialistInfo((SpecialistTypes) iI).getDescription(), L", ", bFirst);
bFirst = false;
}
}
bFirst = true;
for (iI = 0; iI < GC.getNumBuildingInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getBuildings(iI) || GC.getUnitInfo(eUnit).getForceBuildings(iI))
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_UNIT_CAN_CONSTRUCT").c_str());
setListHelp(szBuffer, szTempBuffer, GC.getBuildingInfo((BuildingTypes) iI).getDescription(), L", ", bFirst);
bFirst = false;
}
}
bFirst = true;
for (iI = 0; iI < GC.getNumPromotionInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getFreePromotions(iI))
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_UNIT_STARTS_WITH").c_str());
setListHelp(szBuffer, szTempBuffer, GC.getPromotionInfo((PromotionTypes) iI).getDescription(), L", ", bFirst);
bFirst = false;
}
}
if (GC.getUnitInfo(eUnit).getExtraCost() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_EXTRA_COST", GC.getUnitInfo(eUnit).getExtraCost());
}
if (!isEmpty(GC.getUnitInfo(eUnit).getHelp()))
{
szBuffer += NEWLINE;
szBuffer += GC.getUnitInfo(eUnit).getHelp();
}
}
void CvGameTextMgr::setUnitHelp(CvWString &szBuffer, UnitTypes eUnit, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CvCity* pCity)
{
wchar szTempBuffer[1024];
PlayerTypes ePlayer;
bool bFirst;
int iProduction;
int iI;
if (NO_UNIT == eUnit)
{
return;
}
if (pCity != NULL)
{
ePlayer = pCity->getOwnerINLINE();
}
else
{
ePlayer = GC.getGameINLINE().getActivePlayer();
}
if (!bCivilopediaText)
{
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_UNIT_TEXT"), GC.getUnitInfo(eUnit).getDescription());
szBuffer += szTempBuffer;
if (GC.getUnitInfo(eUnit).getUnitCombatType() != NO_UNITCOMBAT)
{
swprintf(szTempBuffer, L" (%s)", GC.getUnitCombatInfo((UnitCombatTypes) GC.getUnitInfo(eUnit).getUnitCombatType()).getDescription());
szBuffer += szTempBuffer;
}
}
// test for unique unit
UnitClassTypes eUnitClass = (UnitClassTypes)GC.getUnitInfo(eUnit).getUnitClassType();
UnitTypes eDefaultUnit = (UnitTypes)GC.getUnitClassInfo(eUnitClass).getDefaultUnitIndex();
if (NO_UNIT != eDefaultUnit && eDefaultUnit != eUnit)
{
for (iI = 0; iI < GC.getNumCivilizationInfos(); iI++)
{
UnitTypes eUniqueUnit = (UnitTypes)GC.getCivilizationInfo((CivilizationTypes)iI).getCivilizationUnits((int)eUnitClass);
if (eUniqueUnit == eUnit)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIQUE_UNIT", GC.getCivilizationInfo((CivilizationTypes)iI).getTextKeyWide());
}
}
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_REPLACES_UNIT", GC.getUnitInfo(eDefaultUnit).getTextKeyWide());
}
if (isWorldUnitClass(eUnitClass))
{
if (pCity == NULL)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_WORLD_UNIT_ALLOWED", GC.getUnitClassInfo(eUnitClass).getMaxGlobalInstances());
}
else
{
szBuffer += gDLL->getText("TXT_KEY_UNIT_WORLD_UNIT_LEFT", (GC.getUnitClassInfo(eUnitClass).getMaxGlobalInstances() - (ePlayer != NO_PLAYER ? GC.getGameINLINE().getUnitClassCreatedCount(eUnitClass) + GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getUnitClassMaking(eUnitClass) : 0)));
}
}
if (isTeamUnitClass(eUnitClass))
{
if (pCity == NULL)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_TEAM_UNIT_ALLOWED", GC.getUnitClassInfo(eUnitClass).getMaxTeamInstances());
}
else
{
szBuffer += gDLL->getText("TXT_KEY_UNIT_TEAM_UNIT_LEFT", (GC.getUnitClassInfo(eUnitClass).getMaxTeamInstances() - (ePlayer != NO_PLAYER ? GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getUnitClassCountPlusMaking(eUnitClass) : 0)));
}
}
if (isNationalUnitClass(eUnitClass))
{
if (pCity == NULL)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_NATIONAL_UNIT_ALLOWED", GC.getUnitClassInfo(eUnitClass).getMaxPlayerInstances());
}
else
{
szBuffer += gDLL->getText("TXT_KEY_UNIT_NATIONAL_UNIT_LEFT", (GC.getUnitClassInfo(eUnitClass).getMaxPlayerInstances() - (ePlayer != NO_PLAYER ? GET_PLAYER(ePlayer).getUnitClassCountPlusMaking(eUnitClass) : 0)));
}
}
setBasicUnitHelp(szBuffer, eUnit, bCivilopediaText);
if ((pCity == NULL) || !(pCity->canTrain(eUnit)))
{
if (pCity != NULL)
{
if (GC.getGameINLINE().isNoNukes())
{
if (GC.getUnitInfo(eUnit).getNukeRange() != -1)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_NO_NUKES");
}
}
}
if (GC.getUnitInfo(eUnit).getHolyCity() != NO_RELIGION)
{
if ((pCity == NULL) || !(pCity->isHolyCity((ReligionTypes)(GC.getUnitInfo(eUnit).getHolyCity()))))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_REQUIRES_HOLY_CITY", GC.getReligionInfo((ReligionTypes)(GC.getUnitInfo(eUnit).getHolyCity())).getChar());
}
}
bFirst = true;
if (GC.getUnitInfo(eUnit).getSpecialUnitType() != NO_SPECIALUNIT)
{
if ((pCity == NULL) || !(GC.getGameINLINE().isSpecialUnitValid((SpecialUnitTypes)(GC.getUnitInfo(eUnit).getSpecialUnitType()))))
{
for (iI = 0; iI < GC.getNumProjectInfos(); iI++)
{
if (GC.getProjectInfo((ProjectTypes)iI).getEveryoneSpecialUnit() == GC.getUnitInfo(eUnit).getSpecialUnitType())
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_REQUIRES").c_str());
CvWString szProject;
szProject.Format(L" %s", GC.getProjectInfo((ProjectTypes)iI).getDescription());
setListHelp(szBuffer, szTempBuffer, szProject, gDLL->getText("TXT_KEY_OR").c_str(), bFirst);
bFirst = false;
}
}
}
}
if (!bFirst)
{
szBuffer += ENDCOLR;
}
if (!bCivilopediaText)
{
if (GC.getUnitInfo(eUnit).getPrereqBuilding() != NO_BUILDING)
{
if ((pCity == NULL) || !(pCity->hasBuilding((BuildingTypes)(GC.getUnitInfo(eUnit).getPrereqBuilding()))))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_REQUIRES_STRING", GC.getBuildingInfo((BuildingTypes)(GC.getUnitInfo(eUnit).getPrereqBuilding())).getTextKeyWide());
}
}
if (!bTechChooserText)
{
if (GC.getUnitInfo(eUnit).getPrereqAndTech() != NO_TECH)
{
if (GC.getGameINLINE().getActivePlayer() == NO_PLAYER || !(GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isHasTech((TechTypes)(GC.getUnitInfo(eUnit).getPrereqAndTech()))))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_REQUIRES_STRING", GC.getTechInfo((TechTypes)(GC.getUnitInfo(eUnit).getPrereqAndTech())).getTextKeyWide());
}
}
}
bFirst = true;
for (iI = 0; iI < GC.getDefineINT("NUM_UNIT_AND_TECH_PREREQS"); iI++)
{
if (GC.getUnitInfo(eUnit).getPrereqAndTechs(iI) != NO_TECH)
{
if (bTechChooserText || GC.getGameINLINE().getActivePlayer() == NO_PLAYER || !(GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isHasTech((TechTypes)(GC.getUnitInfo(eUnit).getPrereqAndTechs(iI)))))
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_REQUIRES").c_str());
setListHelp(szBuffer, szTempBuffer, GC.getTechInfo(((TechTypes)(GC.getUnitInfo(eUnit).getPrereqAndTechs(iI)))).getDescription(), gDLL->getText("TXT_KEY_AND").c_str(), bFirst);
bFirst = false;
}
}
}
if (!bFirst)
{
szBuffer += ENDCOLR;
}
if (GC.getUnitInfo(eUnit).getPrereqAndBonus() != NO_BONUS)
{
if ((pCity == NULL) || !(pCity->hasBonus((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus())))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_REQUIRES_STRING", GC.getBonusInfo((BonusTypes)(GC.getUnitInfo(eUnit).getPrereqAndBonus())).getTextKeyWide());
}
}
bFirst = true;
for (iI = 0; iI < GC.getNUM_UNIT_PREREQ_OR_BONUSES(); iI++)
{
if (GC.getUnitInfo(eUnit).getPrereqOrBonuses(iI) != NO_BONUS)
{
if ((pCity == NULL) || !(pCity->hasBonus((BonusTypes)GC.getUnitInfo(eUnit).getPrereqOrBonuses(iI))))
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_REQUIRES").c_str());
setListHelp(szBuffer, szTempBuffer, GC.getBonusInfo((BonusTypes) GC.getUnitInfo(eUnit).getPrereqOrBonuses(iI)).getDescription(), gDLL->getText("TXT_KEY_OR").c_str(), bFirst);
bFirst = false;
}
}
}
if (!bFirst)
{
szBuffer += ENDCOLR;
}
}
}
if (!bCivilopediaText && GC.getGameINLINE().getActivePlayer() != NO_PLAYER)
{
if (pCity == NULL)
{
swprintf(szTempBuffer, L"%s%d%c", NEWLINE, GET_PLAYER(ePlayer).getProductionNeeded(eUnit), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
szBuffer += szTempBuffer;
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_TURNS", pCity->getProductionTurnsLeft(eUnit, ((gDLL->ctrlKey() || !(gDLL->shiftKey())) ? 0 : pCity->getOrderQueueLength())), GET_PLAYER(ePlayer).getProductionNeeded(eUnit), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
iProduction = pCity->getUnitProduction(eUnit);
if (iProduction > 0)
{
swprintf(szTempBuffer, L" - %d/%d%c", iProduction, GET_PLAYER(ePlayer).getProductionNeeded(eUnit), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
szBuffer += szTempBuffer;
}
else
{
swprintf(szTempBuffer, L" - %d%c", GET_PLAYER(ePlayer).getProductionNeeded(eUnit), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
szBuffer += szTempBuffer;
}
}
}
for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
if (GC.getUnitInfo(eUnit).getBonusProductionModifier(iI) != 0)
{
if (pCity != NULL)
{
if (pCity->hasBonus((BonusTypes)iI))
{
szBuffer += gDLL->getText("TXT_KEY_COLOR_POSITIVE");
}
else
{
szBuffer += gDLL->getText("TXT_KEY_COLOR_NEGATIVE");
}
}
if (!bCivilopediaText)
{
szBuffer += L" (";
}
else
{
swprintf(szTempBuffer, L"%s%c", NEWLINE, gDLL->getSymbolID(BULLET_CHAR), szTempBuffer);
szBuffer += szTempBuffer;
}
if (GC.getUnitInfo(eUnit).getBonusProductionModifier(iI) == 100)
{
szBuffer += gDLL->getText("TXT_KEY_UNIT_DOUBLE_SPEED", GC.getBonusInfo((BonusTypes)iI).getTextKeyWide());
}
else
{
szBuffer += gDLL->getText("TXT_KEY_UNIT_BUILDS_FASTER", GC.getUnitInfo(eUnit).getBonusProductionModifier(iI), GC.getBonusInfo((BonusTypes)iI).getTextKeyWide());
}
if (!bCivilopediaText)
{
szBuffer += L")";
}
if (pCity != NULL)
{
szBuffer += gDLL->getText("TXT_KEY_COLOR_REVERT");
}
}
}
if (bStrategyText)
{
if (!isEmpty(GC.getUnitInfo(eUnit).getStrategy()))
{
if ((ePlayer == NO_PLAYER) || GET_PLAYER(ePlayer).isOption(PLAYEROPTION_ADVISOR_HELP))
{
szBuffer += SEPARATOR;
szBuffer += NEWLINE;
szBuffer += gDLL->getText("TXT_KEY_SIDS_TIPS");
szBuffer += L"\"";
szBuffer += GC.getUnitInfo(eUnit).getStrategy();
szBuffer += L"\"";
}
}
}
}
void CvGameTextMgr::setBuildingHelp(CvWString &szBuffer, BuildingTypes eBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CvCity* pCity)
{
wchar szFirstBuffer[1024];
wchar szTempBuffer[1024];
BuildingTypes eLoopBuilding;
UnitTypes eGreatPeopleUnit;
PlayerTypes ePlayer;
bool bFirst;
int iProduction;
int iLast;
int iI;
if (NO_BUILDING == eBuilding)
{
return;
}
if (pCity != NULL)
{
ePlayer = pCity->getOwnerINLINE();
}
else
{
ePlayer = GC.getGameINLINE().getActivePlayer();
}
if (!bCivilopediaText)
{
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR , TEXT_COLOR("COLOR_BUILDING_TEXT"), GC.getBuildingInfo(eBuilding).getDescription());
szBuffer += szTempBuffer;
if (GC.getBuildingInfo(eBuilding).getHappiness() != 0)
{
swprintf(szTempBuffer, L", +%d%c", GC.getBuildingInfo(eBuilding).getHappiness(), ((GC.getBuildingInfo(eBuilding).getHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)));
szBuffer += szTempBuffer;
}
if (GC.getBuildingInfo(eBuilding).getHealth() != 0)
{
swprintf(szTempBuffer, L", +%d%c", abs(GC.getBuildingInfo(eBuilding).getHealth()), ((GC.getBuildingInfo(eBuilding).getHealth() > 0) ? gDLL->getSymbolID(HEALTHY_CHAR): gDLL->getSymbolID(UNHEALTHY_CHAR)));
szBuffer += szTempBuffer;
}
setYieldChangeHelp(szBuffer, L", ", L"", L"", GC.getBuildingInfo(eBuilding).getYieldChangeArray(), false, false);
setCommerceChangeHelp(szBuffer, L", ", L"", L"", GC.getBuildingInfo(eBuilding).getCommerceChangeArray(), false, false);
setCommerceChangeHelp(szBuffer, L", ", L"", L"", GC.getBuildingInfo(eBuilding).getObsoleteSafeCommerceChangeArray(), false, false); // XXX what if building gives gold... does that make it in the Civilopedia?
}
setYieldChangeHelp(szBuffer, ((bCivilopediaText) ? L"" : L", "), L"", L"", GC.getBuildingInfo(eBuilding).getYieldModifierArray(), true, bCivilopediaText);
setCommerceChangeHelp(szBuffer, ((bCivilopediaText) ? L"" : L", "), L"", L"", GC.getBuildingInfo(eBuilding).getCommerceModifierArray(), true, bCivilopediaText);
if (!bCivilopediaText)
{
if (GC.getBuildingInfo(eBuilding).getGreatPeopleRateChange() != 0)
{
swprintf(szTempBuffer, L", %s%d%c", ((GC.getBuildingInfo(eBuilding).getGreatPeopleRateChange() > 0) ? "+" : ""), GC.getBuildingInfo(eBuilding).getGreatPeopleRateChange(), gDLL->getSymbolID(GREAT_PEOPLE_CHAR));
szBuffer += szTempBuffer;
if (GC.getBuildingInfo(eBuilding).getGreatPeopleUnitClass() != NO_UNITCLASS)
{
if (ePlayer != NO_PLAYER)
{
eGreatPeopleUnit = ((UnitTypes)(GC.getCivilizationInfo(GET_PLAYER(ePlayer).getCivilizationType()).getCivilizationUnits(GC.getBuildingInfo(eBuilding).getGreatPeopleUnitClass())));
}
else
{
eGreatPeopleUnit = (UnitTypes)GC.getUnitClassInfo((UnitClassTypes)GC.getBuildingInfo(eBuilding).getGreatPeopleUnitClass()).getDefaultUnitIndex();
}
if (eGreatPeopleUnit != NO_UNIT)
{
swprintf(szTempBuffer, L" (%s)", GC.getUnitInfo(eGreatPeopleUnit).getDescription());
szBuffer += szTempBuffer;
}
}
}
if (isWorldWonderClass((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())))
{
if (pCity == NULL || ePlayer == NO_PLAYER)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_WORLD_WONDER_ALLOWED", GC.getBuildingClassInfo((BuildingClassTypes) GC.getBuildingInfo(eBuilding).getBuildingClassType()).getMaxGlobalInstances());
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_WORLD_WONDER_LEFT", (GC.getBuildingClassInfo((BuildingClassTypes) GC.getBuildingInfo(eBuilding).getBuildingClassType()).getMaxGlobalInstances() - GC.getGameINLINE().getBuildingClassCreatedCount((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())) - GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getBuildingClassMaking((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType()))));
}
}
if (isTeamWonderClass((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())))
{
if (pCity == NULL || ePlayer == NO_PLAYER)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_TEAM_WONDER_ALLOWED", GC.getBuildingClassInfo((BuildingClassTypes) GC.getBuildingInfo(eBuilding).getBuildingClassType()).getMaxTeamInstances());
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_TEAM_WONDER_LEFT", (GC.getBuildingClassInfo((BuildingClassTypes) GC.getBuildingInfo(eBuilding).getBuildingClassType()).getMaxTeamInstances() - GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getBuildingClassCountPlusMaking((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType()))));
}
}
if (isNationalWonderClass((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())))
{
if (pCity == NULL || ePlayer == NO_PLAYER)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_NATIONAL_WONDER_ALLOWED", GC.getBuildingClassInfo((BuildingClassTypes) GC.getBuildingInfo(eBuilding).getBuildingClassType()).getMaxPlayerInstances());
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_NATIONAL_WONDER_LEFT", (GC.getBuildingClassInfo((BuildingClassTypes) GC.getBuildingInfo(eBuilding).getBuildingClassType()).getMaxPlayerInstances() - GET_PLAYER(ePlayer).getBuildingClassCountPlusMaking((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType()))));
}
}
}
if (GC.getBuildingInfo(eBuilding).getGlobalReligionCommerce() != NO_RELIGION)
{
swprintf(szFirstBuffer, gDLL->getText("TXT_KEY_BUILDING_PER_CITY_WITH", GC.getReligionInfo((ReligionTypes) GC.getBuildingInfo(eBuilding).getGlobalReligionCommerce()).getChar()).c_str());
setCommerceChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getReligionInfo((ReligionTypes) GC.getBuildingInfo(eBuilding).getGlobalReligionCommerce()).getGlobalReligionCommerceArray());
}
if (GC.getBuildingInfo(eBuilding).getFreeBonus() != NO_BONUS)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_PROVIDES", GC.getGameINLINE().getNumFreeBonuses(eBuilding), GC.getBonusInfo((BonusTypes) GC.getBuildingInfo(eBuilding).getFreeBonus()).getTextKeyWide(), GC.getBonusInfo((BonusTypes) GC.getBuildingInfo(eBuilding).getFreeBonus()).getChar());
if (GC.getBonusInfo((BonusTypes)(GC.getBuildingInfo(eBuilding).getFreeBonus())).getHealth() != 0)
{
swprintf(szTempBuffer, L", +%d%c", abs(GC.getBonusInfo((BonusTypes) GC.getBuildingInfo(eBuilding).getFreeBonus()).getHealth()), ((GC.getBonusInfo((BonusTypes)(GC.getBuildingInfo(eBuilding).getFreeBonus())).getHealth() > 0) ? gDLL->getSymbolID(HEALTHY_CHAR): gDLL->getSymbolID(UNHEALTHY_CHAR)));
szBuffer += szTempBuffer;
}
if (GC.getBonusInfo((BonusTypes)(GC.getBuildingInfo(eBuilding).getFreeBonus())).getHappiness() != 0)
{
swprintf(szTempBuffer, L", +%d%c", abs(GC.getBonusInfo((BonusTypes) GC.getBuildingInfo(eBuilding).getFreeBonus()).getHappiness()), ((GC.getBonusInfo((BonusTypes)(GC.getBuildingInfo(eBuilding).getFreeBonus())).getHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)));
szBuffer += szTempBuffer;
}
}
if (GC.getBuildingInfo(eBuilding).getFreeBuilding() != NO_BUILDING)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_IN_CITY", GC.getBuildingInfo((BuildingTypes) GC.getBuildingInfo(eBuilding).getFreeBuilding()).getTextKeyWide());
}
if (GC.getBuildingInfo(eBuilding).getFreePromotion() != NO_PROMOTION)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_PROMOTION", GC.getPromotionInfo((PromotionTypes)(GC.getBuildingInfo(eBuilding).getFreePromotion())).getTextKeyWide());
}
if (GC.getBuildingInfo(eBuilding).getCivicOption() != NO_CIVICOPTION)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_ENABLES_CIVICS", GC.getCivicOptionInfo((CivicOptionTypes)(GC.getBuildingInfo(eBuilding).getCivicOption())).getTextKeyWide());
}
if (GC.getBuildingInfo(eBuilding).isPower())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_PROVIDES_POWER");
if (GC.getBuildingInfo(eBuilding).isDirtyPower() && (GC.getDefineINT("DIRTY_POWER_HEALTH_CHANGE") != 0))
{
swprintf(szTempBuffer, L" (+%d%c)", abs(GC.getDefineINT("DIRTY_POWER_HEALTH_CHANGE")), ((GC.getDefineINT("DIRTY_POWER_HEALTH_CHANGE") > 0) ? gDLL->getSymbolID(HEALTHY_CHAR): gDLL->getSymbolID(UNHEALTHY_CHAR)));
szBuffer += szTempBuffer;
}
}
if (GC.getBuildingInfo(eBuilding).isAreaCleanPower())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_PROVIDES_AREA_CLEAN_POWER");
}
if (GC.getBuildingInfo(eBuilding).isDiploVote())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_DIPLO_VOTE");
}
if (GC.getBuildingInfo(eBuilding).isForceTeamVoteEligible())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_ELECTION_ELIGIBILITY");
}
if (GC.getBuildingInfo(eBuilding).isCapital())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_CAPITAL");
}
if (GC.getBuildingInfo(eBuilding).isGovernmentCenter())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_REDUCES_MAINTENANCE");
}
if (GC.getBuildingInfo(eBuilding).isGoldenAge())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_GOLDEN_AGE");
}
if (GC.getBuildingInfo(eBuilding).isMapCentering())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_CENTERS_MAP");
}
if (GC.getBuildingInfo(eBuilding).isNoUnhappiness())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_NO_UNHAPPY");
}
if (GC.getBuildingInfo(eBuilding).isNoUnhealthyPopulation())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_NO_UNHEALTHY_POP");
}
if (GC.getBuildingInfo(eBuilding).isBuildingOnlyHealthy())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_NO_UNHEALTHY_BUILDINGS");
}
if (GC.getBuildingInfo(eBuilding).getGreatPeopleRateModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_BIRTH_RATE_MOD", GC.getBuildingInfo(eBuilding).getGreatPeopleRateModifier());
}
if (GC.getBuildingInfo(eBuilding).getGlobalGreatPeopleRateModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_BIRTH_RATE_MOD_ALL_CITIES", GC.getBuildingInfo(eBuilding).getGlobalGreatPeopleRateModifier());
}
if (GC.getBuildingInfo(eBuilding).getAnarchyModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_ANARCHY_MOD", GC.getBuildingInfo(eBuilding).getAnarchyModifier());
}
if (GC.getBuildingInfo(eBuilding).getGlobalHurryModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_HURRY_MOD", GC.getBuildingInfo(eBuilding).getGlobalHurryModifier());
}
if (GC.getBuildingInfo(eBuilding).getFreeExperience() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_XP_UNITS", GC.getBuildingInfo(eBuilding).getFreeExperience());
}
if (GC.getBuildingInfo(eBuilding).getGlobalFreeExperience() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_XP_ALL_CITIES", GC.getBuildingInfo(eBuilding).getGlobalFreeExperience());
}
if (GC.getBuildingInfo(eBuilding).getFoodKept() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_STORES_FOOD", GC.getBuildingInfo(eBuilding).getFoodKept());
}
if (GC.getBuildingInfo(eBuilding).getAirlift() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_AIRLIFT", GC.getBuildingInfo(eBuilding).getAirlift());
}
if (GC.getBuildingInfo(eBuilding).getAirModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_AIR_DAMAGE_MOD", GC.getBuildingInfo(eBuilding).getAirModifier());
}
if (GC.getBuildingInfo(eBuilding).getNukeModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_NUKE_DAMAGE_MOD", GC.getBuildingInfo(eBuilding).getNukeModifier());
}
if (GC.getBuildingInfo(eBuilding).getNukeExplosionRand() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_NUKE_EXPLOSION_CHANCE");
}
if (GC.getBuildingInfo(eBuilding).getFreeSpecialist() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_SPECIALISTS", GC.getBuildingInfo(eBuilding).getFreeSpecialist());
}
if (GC.getBuildingInfo(eBuilding).getAreaFreeSpecialist() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_SPECIALISTS_CONT", GC.getBuildingInfo(eBuilding).getAreaFreeSpecialist());
}
if (GC.getBuildingInfo(eBuilding).getGlobalFreeSpecialist() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_SPECIALISTS_ALL_CITIES", GC.getBuildingInfo(eBuilding).getGlobalFreeSpecialist());
}
if (GC.getBuildingInfo(eBuilding).getMaintenanceModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_MAINT_MOD", GC.getBuildingInfo(eBuilding).getMaintenanceModifier());
}
if (GC.getBuildingInfo(eBuilding).getWarWearinessModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_WAR_WEAR_MOD", GC.getBuildingInfo(eBuilding).getWarWearinessModifier());
}
if (GC.getBuildingInfo(eBuilding).getGlobalWarWearinessModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_WAR_WEAR_MOD_ALL_CITIES", GC.getBuildingInfo(eBuilding).getGlobalWarWearinessModifier());
}
if (GC.getBuildingInfo(eBuilding).getHealRateChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_HEAL_MOD", GC.getBuildingInfo(eBuilding).getHealRateChange());
}
if (GC.getBuildingInfo(eBuilding).getAreaHealth() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_HEALTH_CHANGE_CONT", abs(GC.getBuildingInfo(eBuilding).getAreaHealth()), ((GC.getBuildingInfo(eBuilding).getAreaHealth() > 0) ? gDLL->getSymbolID(HEALTHY_CHAR): gDLL->getSymbolID(UNHEALTHY_CHAR)));
}
if (GC.getBuildingInfo(eBuilding).getGlobalHealth() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_HEALTH_CHANGE_ALL_CITIES", abs(GC.getBuildingInfo(eBuilding).getGlobalHealth()), ((GC.getBuildingInfo(eBuilding).getGlobalHealth() > 0) ? gDLL->getSymbolID(HEALTHY_CHAR): gDLL->getSymbolID(UNHEALTHY_CHAR)));
}
if (GC.getBuildingInfo(eBuilding).getAreaHappiness() > 0)
{
// swprintf(szTempBuffer, L"\n%c+%d%c in All Cities on this Continent", gDLL->getSymbolID(BULLET_CHAR), GC.getBuildingInfo(eBuilding).getAreaHappiness(), ((GC.getBuildingInfo(eBuilding).getAreaHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)));
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_HAPPY_CHANGE_CONT", GC.getBuildingInfo(eBuilding).getAreaHappiness(), ((GC.getBuildingInfo(eBuilding).getAreaHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)));
}
if (GC.getBuildingInfo(eBuilding).getGlobalHappiness() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_HAPPY_CHANGE_ALL_CITIES", GC.getBuildingInfo(eBuilding).getGlobalHappiness(), ((GC.getBuildingInfo(eBuilding).getGlobalHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)));
}
if (GC.getBuildingInfo(eBuilding).getStateReligionHappiness() > 0)
{
if (GC.getBuildingInfo(eBuilding).getReligionType() != NO_RELIGION)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_RELIGION_HAPPINESS", GC.getBuildingInfo(eBuilding).getStateReligionHappiness(), ((GC.getBuildingInfo(eBuilding).getStateReligionHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)), GC.getReligionInfo((ReligionTypes)(GC.getBuildingInfo(eBuilding).getReligionType())).getChar());
}
}
if (GC.getBuildingInfo(eBuilding).getWorkerSpeedModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_WORKER_MOD", GC.getBuildingInfo(eBuilding).getWorkerSpeedModifier());
}
if (GC.getBuildingInfo(eBuilding).getMilitaryProductionModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_MILITARY_MOD", GC.getBuildingInfo(eBuilding).getMilitaryProductionModifier());
}
if (GC.getBuildingInfo(eBuilding).getSpaceProductionModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_SPACESHIP_MOD", GC.getBuildingInfo(eBuilding).getSpaceProductionModifier());
}
if (GC.getBuildingInfo(eBuilding).getGlobalSpaceProductionModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_SPACESHIP_MOD_ALL_CITIES", GC.getBuildingInfo(eBuilding).getGlobalSpaceProductionModifier());
}
if (GC.getBuildingInfo(eBuilding).getTradeRoutes() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_TRADE_ROUTES", GC.getBuildingInfo(eBuilding).getTradeRoutes());
}
if (GC.getBuildingInfo(eBuilding).getCoastalTradeRoutes() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_COASTAL_TRADE_ROUTES", GC.getBuildingInfo(eBuilding).getCoastalTradeRoutes());
}
if (GC.getBuildingInfo(eBuilding).getGlobalTradeRoutes() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_TRADE_ROUTES_ALL_CITIES", GC.getBuildingInfo(eBuilding).getGlobalTradeRoutes());
}
if (GC.getBuildingInfo(eBuilding).getTradeRouteModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_TRADE_ROUTE_MOD", GC.getBuildingInfo(eBuilding).getTradeRouteModifier());
}
if (GC.getBuildingInfo(eBuilding).getGlobalPopulationChange() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_GLOBAL_POP", GC.getBuildingInfo(eBuilding).getGlobalPopulationChange());
}
if (GC.getBuildingInfo(eBuilding).getFreeTechs() != 0)
{
if (GC.getBuildingInfo(eBuilding).getFreeTechs() == 1)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_TECH");
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_TECHS", GC.getBuildingInfo(eBuilding).getFreeTechs());
}
}
if (GC.getBuildingInfo(eBuilding).getDefenseModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_DEFENSE_MOD", GC.getBuildingInfo(eBuilding).getDefenseModifier());
}
if (GC.getBuildingInfo(eBuilding).getAllCityDefenseModifier() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_DEFENSE_MOD_ALL_CITIES", GC.getBuildingInfo(eBuilding).getAllCityDefenseModifier());
}
setYieldChangeHelp(szBuffer, gDLL->getText("TXT_KEY_BUILDING_WATER_PLOTS").c_str(), L": ", L"", GC.getBuildingInfo(eBuilding).getSeaPlotYieldChangeArray());
setYieldChangeHelp(szBuffer, gDLL->getText("TXT_KEY_BUILDING_WATER_PLOTS_ALL_CITIES").c_str(), L": ", L"", GC.getBuildingInfo(eBuilding).getGlobalSeaPlotYieldChangeArray());
setYieldChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_BUILDING_WITH_POWER").c_str(), GC.getBuildingInfo(eBuilding).getPowerYieldModifierArray(), true);
setYieldChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_BUILDING_ALL_CITIES_THIS_CONTINENT").c_str(), GC.getBuildingInfo(eBuilding).getAreaYieldModifierArray(), true);
setYieldChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_BUILDING_ALL_CITIES").c_str(), GC.getBuildingInfo(eBuilding).getGlobalYieldModifierArray(), true);
setCommerceChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_BUILDING_ALL_CITIES").c_str(), GC.getBuildingInfo(eBuilding).getGlobalCommerceModifierArray(), true);
setCommerceChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_BUILDING_PER_SPECIALIST_ALL_CITIES").c_str(), GC.getBuildingInfo(eBuilding).getSpecialistExtraCommerceArray());
if (ePlayer != NO_PLAYER && GET_PLAYER(ePlayer).getStateReligion() != NO_RELIGION)
{
swprintf(szTempBuffer, gDLL->getText("TXT_KEY_BUILDING_FROM_ALL_REL_BUILDINGS", GC.getReligionInfo(GET_PLAYER(ePlayer).getStateReligion()).getChar()).c_str());
}
else
{
wcscpy(szTempBuffer, gDLL->getText("TXT_KEY_BUILDING_STATE_REL_BUILDINGS").c_str());
}
setCommerceChangeHelp(szBuffer, L"", L"", szTempBuffer, GC.getBuildingInfo(eBuilding).getStateReligionCommerceArray());
for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
{
if (GC.getBuildingInfo(eBuilding).getCommerceHappiness(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_PER_LEVEL", ((GC.getBuildingInfo(eBuilding).getCommerceHappiness(iI) > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)), (100 / GC.getBuildingInfo(eBuilding).getCommerceHappiness(iI)), GC.getCommerceInfo((CommerceTypes)iI).getChar());
}
if (GC.getBuildingInfo(eBuilding).isCommerceFlexible(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_ADJUST_COMM_RATE", GC.getCommerceInfo((CommerceTypes) iI).getChar());
}
}
for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
{
swprintf(szFirstBuffer, gDLL->getText("TXT_KEY_BUILDING_FROM_IN_ALL_CITIES", GC.getSpecialistInfo((SpecialistTypes) iI).getTextKeyWide()).c_str());
setYieldChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getBuildingInfo(eBuilding).getSpecialistYieldChangeArray(iI));
}
for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
swprintf(szFirstBuffer, gDLL->getText("TXT_KEY_BUILDING_WITH_BONUS", GC.getBonusInfo((BonusTypes) iI).getTextKeyWide()).c_str());
setYieldChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getBuildingInfo(eBuilding).getBonusYieldModifierArray(iI), true);
}
for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
if (GC.getBuildingInfo(eBuilding).getReligionChange(iI) > 0)
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_BUILDING_SPREADS_RELIGION", GC.getReligionInfo((ReligionTypes) iI).getChar()).c_str());
szBuffer += szTempBuffer;
}
}
for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
{
if (GC.getBuildingInfo(eBuilding).getSpecialistCount(iI) > 0)
{
if (GC.getBuildingInfo(eBuilding).getSpecialistCount(iI) == 1)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_TURN_CITIZEN_INTO", GC.getSpecialistInfo((SpecialistTypes) iI).getTextKeyWide());
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_TURN_CITIZENS_INTO", GC.getBuildingInfo(eBuilding).getSpecialistCount(iI), GC.getSpecialistInfo((SpecialistTypes) iI).getTextKeyWide());
}
}
if (GC.getBuildingInfo(eBuilding).getFreeSpecialistCount(iI) > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_SPECIALIST", GC.getBuildingInfo(eBuilding).getFreeSpecialistCount(iI), GC.getSpecialistInfo((SpecialistTypes) iI).getTextKeyWide());
}
}
iLast = 0;
for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
if (GC.getBuildingInfo(eBuilding).getBonusHealthChanges(iI) != 0)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_BUILDING_HEALTH_HAPPINESS_CHANGE", GC.getBuildingInfo(eBuilding).getBonusHealthChanges(iI), ((GC.getBuildingInfo(eBuilding).getBonusHealthChanges(iI) > 0) ? gDLL->getSymbolID(HEALTHY_CHAR): gDLL->getSymbolID(UNHEALTHY_CHAR))).c_str());
swprintf(szTempBuffer, L" %s", GC.getBonusInfo((BonusTypes)iI).getDescription());
setListHelp(szBuffer, szFirstBuffer, szTempBuffer, L", ", (GC.getBuildingInfo(eBuilding).getBonusHealthChanges(iI) != iLast));
iLast = GC.getBuildingInfo(eBuilding).getBonusHealthChanges(iI);
}
}
iLast = 0;
for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
if (GC.getBuildingInfo(eBuilding).getBonusHappinessChanges(iI) != 0)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_BUILDING_HEALTH_HAPPINESS_CHANGE", GC.getBuildingInfo(eBuilding).getBonusHappinessChanges(iI), ((GC.getBuildingInfo(eBuilding).getBonusHappinessChanges(iI) > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR))).c_str());
swprintf(szTempBuffer, L" %s", GC.getBonusInfo((BonusTypes)iI).getDescription());
setListHelp(szBuffer, szFirstBuffer, szTempBuffer, L", ", (GC.getBuildingInfo(eBuilding).getBonusHappinessChanges(iI) != iLast));
iLast = GC.getBuildingInfo(eBuilding).getBonusHappinessChanges(iI);
}
}
for (iI = 0; iI < GC.getNumUnitCombatInfos(); iI++)
{
if (GC.getBuildingInfo(eBuilding).getUnitCombatFreeExperience(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_XP", GC.getUnitCombatInfo((UnitCombatTypes)iI).getTextKeyWide(), GC.getBuildingInfo(eBuilding).getUnitCombatFreeExperience(iI));
}
}
for (iI = 0; iI < NUM_DOMAIN_TYPES; iI++)
{
if (GC.getBuildingInfo(eBuilding).getDomainFreeExperience(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_XP", GC.getDomainInfo((DomainTypes)iI).getTextKeyWide(), GC.getBuildingInfo(eBuilding).getDomainFreeExperience(iI));
}
}
for (iI = 0; iI < NUM_DOMAIN_TYPES; iI++)
{
if (GC.getBuildingInfo(eBuilding).getDomainProductionModifier(iI) != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_BUILDS_FASTER_DOMAIN", GC.getDomainInfo((DomainTypes)iI).getTextKeyWide(), GC.getBuildingInfo(eBuilding).getDomainProductionModifier(iI));
}
}
bFirst = true;
for (iI = 0; iI < GC.getNumUnitInfos(); iI++)
{
if (GC.getUnitInfo((UnitTypes)iI).getPrereqBuilding() == eBuilding)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_BUILDING_REQUIRED_TO_TRAIN").c_str());
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR , TEXT_COLOR("COLOR_UNIT_TEXT"), GC.getUnitInfo((UnitTypes)iI).getDescription());
setListHelp(szBuffer, szFirstBuffer, szTempBuffer, L", ", bFirst);
bFirst = false;
}
}
iLast = 0;
for (iI = 0; iI < GC.getNumBuildingInfos(); iI++)
{
if (GC.getBuildingInfo(eBuilding).getBuildingHappinessChanges(iI) != 0)
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_BUILDING_HAPPINESS_CHANGE", GC.getBuildingInfo(eBuilding).getBuildingHappinessChanges(iI),
((GC.getBuildingInfo(eBuilding).getBuildingHappinessChanges(iI) > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR))).c_str());
CvWString szBuilding;
szBuilding.Format(L" %s", GC.getBuildingInfo((BuildingTypes)iI).getDescription());
setListHelp(szBuffer, szTempBuffer, szBuilding, L", ", (GC.getBuildingInfo(eBuilding).getBuildingHappinessChanges(iI) != iLast));
iLast = GC.getBuildingInfo(eBuilding).getBuildingHappinessChanges(iI);
}
}
if (GC.getBuildingInfo(eBuilding).getPowerBonus() != NO_BONUS)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_PROVIDES_POWER_WITH", GC.getBonusInfo((BonusTypes)GC.getBuildingInfo(eBuilding).getPowerBonus()).getTextKeyWide());
if (GC.getBuildingInfo(eBuilding).isDirtyPower() && (GC.getDefineINT("DIRTY_POWER_HEALTH_CHANGE") != 0))
{
swprintf(szTempBuffer, L" (+%d%c)", abs(GC.getDefineINT("DIRTY_POWER_HEALTH_CHANGE")), ((GC.getDefineINT("DIRTY_POWER_HEALTH_CHANGE") > 0) ? gDLL->getSymbolID(HEALTHY_CHAR): gDLL->getSymbolID(UNHEALTHY_CHAR)));
szBuffer += szTempBuffer;
}
}
bFirst = true;
for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
{
if (ePlayer != NO_PLAYER)
{
eLoopBuilding = ((BuildingTypes)(GC.getCivilizationInfo(GET_PLAYER(ePlayer).getCivilizationType()).getCivilizationBuildings(iI)));
}
else
{
eLoopBuilding = (BuildingTypes)GC.getBuildingClassInfo((BuildingClassTypes)iI).getDefaultBuildingIndex();
}
if (eLoopBuilding != NO_BUILDING)
{
if (GC.getBuildingInfo(eLoopBuilding).isBuildingClassNeededInCity(GC.getBuildingInfo(eBuilding).getBuildingClassType()))
{
if ((pCity == NULL) || pCity->canConstruct(eLoopBuilding, false, true))
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_BUILDING_REQUIRED_TO_BUILD").c_str());
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR, TEXT_COLOR("COLOR_BUILDING_TEXT"), GC.getBuildingInfo(eLoopBuilding).getDescription());
setListHelp(szBuffer, szFirstBuffer, szTempBuffer, L", ", bFirst);
bFirst = false;
}
}
}
}
if (bCivilopediaText)
{
if (GC.getBuildingInfo(eBuilding).getGreatPeopleUnitClass() != NO_UNITCLASS)
{
if (ePlayer != NO_PLAYER)
{
eGreatPeopleUnit = ((UnitTypes)(GC.getCivilizationInfo(GET_PLAYER(ePlayer).getCivilizationType()).getCivilizationUnits(GC.getBuildingInfo(eBuilding).getGreatPeopleUnitClass())));
}
else
{
eGreatPeopleUnit = (UnitTypes)GC.getUnitClassInfo((UnitClassTypes)GC.getBuildingInfo(eBuilding).getGreatPeopleUnitClass()).getDefaultUnitIndex();
}
if (eGreatPeopleUnit!= NO_UNIT)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_LIKELY_TO_GENERATE", GC.getUnitInfo(eGreatPeopleUnit).getTextKeyWide());
}
}
if (GC.getBuildingInfo(eBuilding).getFreeStartEra() != NO_ERA)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_FREE_START_ERA", GC.getEraInfo((EraTypes)GC.getBuildingInfo(eBuilding).getFreeStartEra()).getTextKeyWide());
}
}
if (!isEmpty(GC.getBuildingInfo(eBuilding).getHelp()))
{
szBuffer += NEWLINE;
szBuffer += GC.getBuildingInfo(eBuilding).getHelp();
}
if ((pCity == NULL) || !(pCity->canConstruct(eBuilding)))
{
if (GC.getBuildingInfo(eBuilding).getHolyCity() != NO_RELIGION)
{
if ((pCity == NULL) || !(pCity->isHolyCity((ReligionTypes)(GC.getBuildingInfo(eBuilding).getHolyCity()))))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_REQUIRES_HOLY_CITY", GC.getReligionInfo((ReligionTypes) GC.getBuildingInfo(eBuilding).getHolyCity()).getChar());
}
}
bFirst = true;
if (GC.getBuildingInfo(eBuilding).getSpecialBuildingType() != NO_SPECIALBUILDING)
{
if ((pCity == NULL) || !(GC.getGameINLINE().isSpecialBuildingValid((SpecialBuildingTypes)(GC.getBuildingInfo(eBuilding).getSpecialBuildingType()))))
{
for (iI = 0; iI < GC.getNumProjectInfos(); iI++)
{
if (GC.getProjectInfo((ProjectTypes)iI).getEveryoneSpecialBuilding() == GC.getBuildingInfo(eBuilding).getSpecialBuildingType())
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_REQUIRES").c_str());
CvWString szProject;
szProject.Format(L" %s", GC.getProjectInfo((ProjectTypes)iI).getDescription());
setListHelp(szBuffer, szTempBuffer, szProject, gDLL->getText("TXT_KEY_OR").c_str(), bFirst);
bFirst = false;
}
}
}
}
if (!bFirst)
{
szBuffer += ENDCOLR;
}
for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
{
if (ePlayer == NO_PLAYER && GC.getBuildingInfo(eBuilding).getPrereqNumOfBuildingClass((BuildingClassTypes)iI) > 0)
{
eLoopBuilding = (BuildingTypes)GC.getBuildingClassInfo((BuildingClassTypes)iI).getDefaultBuildingIndex();
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_BUILDING_REQUIRES_NUM_SPECIAL_BUILDINGS_NO_CITY", GC.getBuildingInfo(eLoopBuilding).getTextKeyWide(), GC.getBuildingInfo(eBuilding).getPrereqNumOfBuildingClass((BuildingClassTypes)iI)).c_str());
}
else if (ePlayer != NO_PLAYER && GET_PLAYER(ePlayer).getBuildingClassPrereqBuilding(eBuilding, ((BuildingClassTypes)iI)) > 0)
{
if ((pCity == NULL) || (GET_PLAYER(ePlayer).getBuildingClassCount((BuildingClassTypes)iI) < GET_PLAYER(ePlayer).getBuildingClassPrereqBuilding(eBuilding, ((BuildingClassTypes)iI))))
{
eLoopBuilding = ((BuildingTypes)(GC.getCivilizationInfo(GET_PLAYER(ePlayer).getCivilizationType()).getCivilizationBuildings(iI)));
if (eLoopBuilding != NO_BUILDING)
{
if (pCity != NULL)
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_BUILDING_REQUIRES_NUM_SPECIAL_BUILDINGS", GC.getBuildingInfo(eLoopBuilding).getTextKeyWide(), GET_PLAYER(ePlayer).getBuildingClassCount((BuildingClassTypes)iI), GET_PLAYER(ePlayer).getBuildingClassPrereqBuilding(eBuilding, ((BuildingClassTypes)iI))).c_str());
}
else
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_BUILDING_REQUIRES_NUM_SPECIAL_BUILDINGS_NO_CITY", GC.getBuildingInfo(eLoopBuilding).getTextKeyWide(), GET_PLAYER(ePlayer).getBuildingClassPrereqBuilding(eBuilding, ((BuildingClassTypes)iI))).c_str());
}
szBuffer += szTempBuffer;
}
}
}
else if (GC.getBuildingInfo(eBuilding).isBuildingClassNeededInCity(iI))
{
if (NO_PLAYER != ePlayer)
{
eLoopBuilding = ((BuildingTypes)(GC.getCivilizationInfo(GET_PLAYER(ePlayer).getCivilizationType()).getCivilizationBuildings(iI)));
}
else
{
eLoopBuilding = (BuildingTypes)GC.getBuildingClassInfo((BuildingClassTypes)iI).getDefaultBuildingIndex();
}
if (eLoopBuilding != NO_BUILDING)
{
if ((pCity == NULL) || !(pCity->hasBuilding(eLoopBuilding)))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_REQUIRES_STRING", GC.getBuildingInfo(eLoopBuilding).getTextKeyWide());
}
}
}
}
if (GC.getBuildingInfo(eBuilding).getNumCitiesPrereq() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_REQUIRES_NUM_CITIES", GC.getBuildingInfo(eBuilding).getNumCitiesPrereq());
}
if (GC.getBuildingInfo(eBuilding).getUnitLevelPrereq() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_REQUIRES_UNIT_LEVEL", GC.getBuildingInfo(eBuilding).getUnitLevelPrereq());
}
if (GC.getBuildingInfo(eBuilding).getMinLatitude() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_MIN_LATITUDE", GC.getBuildingInfo(eBuilding).getMinLatitude());
}
if (GC.getBuildingInfo(eBuilding).getMaxLatitude() < 90)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_MAX_LATITUDE", GC.getBuildingInfo(eBuilding).getMaxLatitude());
}
if (bCivilopediaText)
{
if (GC.getBuildingInfo(eBuilding).getVictoryPrereq() != NO_VICTORY)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_REQUIRES_VICTORY", GC.getVictoryInfo((VictoryTypes)(GC.getBuildingInfo(eBuilding).getVictoryPrereq())).getTextKeyWide());
}
if (GC.getBuildingInfo(eBuilding).getMaxStartEra() != NO_ERA)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_MAX_START_ERA", GC.getEraInfo((EraTypes)GC.getBuildingInfo(eBuilding).getMaxStartEra()).getTextKeyWide());
}
if (GC.getBuildingInfo(eBuilding).getNumTeamsPrereq() > 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_REQUIRES_NUM_TEAMS", GC.getBuildingInfo(eBuilding).getNumTeamsPrereq());
}
}
else
{
if (!bTechChooserText)
{
if (GC.getBuildingInfo(eBuilding).getPrereqAndTech() != NO_TECH)
{
if (ePlayer == NO_PLAYER || !(GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isHasTech((TechTypes)(GC.getBuildingInfo(eBuilding).getPrereqAndTech()))))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_REQUIRES_STRING", GC.getTechInfo((TechTypes)(GC.getBuildingInfo(eBuilding).getPrereqAndTech())).getTextKeyWide());
}
}
}
bFirst = true;
for (iI = 0; iI < GC.getDefineINT("NUM_BUILDING_AND_TECH_PREREQS"); iI++)
{
if (GC.getBuildingInfo(eBuilding).getPrereqAndTechs(iI) != NO_TECH)
{
if (bTechChooserText || ePlayer == NO_PLAYER || !(GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isHasTech((TechTypes)(GC.getBuildingInfo(eBuilding).getPrereqAndTechs(iI)))))
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_REQUIRES").c_str());
setListHelp(szBuffer, szTempBuffer, GC.getTechInfo(((TechTypes)(GC.getBuildingInfo(eBuilding).getPrereqAndTechs(iI)))).getDescription(), gDLL->getText("TXT_KEY_AND").c_str(), bFirst);
bFirst = false;
}
}
}
if (!bFirst)
{
szBuffer += ENDCOLR;
}
if (GC.getBuildingInfo(eBuilding).getPrereqAndBonus() != NO_BONUS)
{
if ((pCity == NULL) || !(pCity->hasBonus((BonusTypes)GC.getBuildingInfo(eBuilding).getPrereqAndBonus())))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_UNIT_REQUIRES_STRING", GC.getBonusInfo((BonusTypes)GC.getBuildingInfo(eBuilding).getPrereqAndBonus()).getTextKeyWide());
}
}
bFirst = true;
for (iI = 0; iI < GC.getNUM_BUILDING_PREREQ_OR_BONUSES(); iI++)
{
if (GC.getBuildingInfo(eBuilding).getPrereqOrBonuses(iI) != NO_BONUS)
{
if ((pCity == NULL) || !(pCity->hasBonus((BonusTypes)GC.getBuildingInfo(eBuilding).getPrereqOrBonuses(iI))))
{
swprintf(szTempBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_REQUIRES").c_str());
setListHelp(szBuffer, szTempBuffer, GC.getBonusInfo((BonusTypes)GC.getBuildingInfo(eBuilding).getPrereqOrBonuses(iI)).getDescription(), gDLL->getText("TXT_KEY_OR").c_str(), bFirst);
bFirst = false;
}
}
}
if (!bFirst)
{
szBuffer += ENDCOLR;
}
}
}
if (pCity != NULL)
{
if (!(GC.getBuildingClassInfo((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())).isNoLimit()))
{
if (isWorldWonderClass((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())))
{
if (pCity->isWorldWondersMaxed())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_WORLD_WONDERS_PER_CITY", GC.getDefineINT("MAX_WORLD_WONDERS_PER_CITY"));
}
}
else if (isTeamWonderClass((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())))
{
if (pCity->isTeamWondersMaxed())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_TEAM_WONDERS_PER_CITY", GC.getDefineINT("MAX_TEAM_WONDERS_PER_CITY"));
}
}
else if (isNationalWonderClass((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())))
{
if (pCity->isNationalWondersMaxed())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_NATIONAL_WONDERS_PER_CITY", GC.getDefineINT("MAX_NATIONAL_WONDERS_PER_CITY"));
}
}
else
{
if (pCity->isBuildingsMaxed())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_NUM_PER_CITY", GC.getDefineINT("MAX_BUILDINGS_PER_CITY"));
}
}
}
}
if ((pCity == NULL) || !(pCity->isHasRealBuilding(eBuilding)))
{
if (!bCivilopediaText)
{
if (pCity == NULL)
{
swprintf(szTempBuffer, L"\n%d%c", (ePlayer != NO_PLAYER ? GET_PLAYER(ePlayer).getProductionNeeded(eBuilding) : GC.getBuildingInfo(eBuilding).getProductionCost()), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
szBuffer += szTempBuffer;
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_NUM_TURNS", pCity->getProductionTurnsLeft(eBuilding, ((gDLL->ctrlKey() || !(gDLL->shiftKey())) ? 0 : pCity->getOrderQueueLength())));
iProduction = pCity->getBuildingProduction(eBuilding);
if (iProduction > 0)
{
swprintf(szTempBuffer, L" - %d/%d%c", iProduction, GET_PLAYER(ePlayer).getProductionNeeded(eBuilding), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
szBuffer += szTempBuffer;
}
else
{
swprintf(szTempBuffer, L" - %d%c", GET_PLAYER(ePlayer).getProductionNeeded(eBuilding), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
szBuffer += szTempBuffer;
}
}
}
for (int iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
if (GC.getBuildingInfo(eBuilding).getBonusProductionModifier(iI) != 0)
{
if (pCity != NULL)
{
if (pCity->hasBonus((BonusTypes)iI))
{
szBuffer += gDLL->getText("TXT_KEY_COLOR_POSITIVE");
}
else
{
szBuffer += gDLL->getText("TXT_KEY_COLOR_NEGATIVE");
}
}
if (!bCivilopediaText)
{
szBuffer += L" (";
}
else
{
swprintf(szTempBuffer, L"\n%c", gDLL->getSymbolID(BULLET_CHAR), szTempBuffer);
szBuffer += szTempBuffer;
}
if (GC.getBuildingInfo(eBuilding).getBonusProductionModifier(iI) == 100)
{
// swprintf(szTempBuffer, L"Double Speed with %c",);
szBuffer += gDLL->getText("TXT_KEY_BUILDING_DOUBLE_SPEED_WITH", GC.getBonusInfo((BonusTypes)iI).getTextKeyWide());
}
else
{
// swprintf(szTempBuffer, L"Builds %d%% Faster with %c");
szBuffer += gDLL->getText("TXT_KEY_BUILDING_BUILDS_FASTER_WITH", GC.getBuildingInfo(eBuilding).getBonusProductionModifier(iI), GC.getBonusInfo((BonusTypes)iI).getTextKeyWide());
}
// szBuffer += szTempBuffer;
if (!bCivilopediaText)
{
szBuffer += L")";
}
if (pCity != NULL)
{
szBuffer += gDLL->getText("TXT_KEY_COLOR_REVERT");
}
}
}
if (GC.getBuildingInfo(eBuilding).getObsoleteTech() != NO_TECH)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_OBSOLETE_WITH", GC.getTechInfo((TechTypes) GC.getBuildingInfo(eBuilding).getObsoleteTech()).getTextKeyWide());
}
if (GC.getBuildingInfo(eBuilding).getSpecialBuildingType() != NO_SPECIALBUILDING)
{
if (GC.getSpecialBuildingInfo((SpecialBuildingTypes) GC.getBuildingInfo(eBuilding).getSpecialBuildingType()).getObsoleteTech() != NO_TECH)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BUILDING_OBSOLETE_WITH", GC.getTechInfo((TechTypes) GC.getSpecialBuildingInfo((SpecialBuildingTypes) GC.getBuildingInfo(eBuilding).getSpecialBuildingType()).getObsoleteTech()).getTextKeyWide());
}
}
}
if (bStrategyText)
{
if (!isEmpty(GC.getBuildingInfo(eBuilding).getStrategy()))
{
if ((ePlayer == NO_PLAYER) || GET_PLAYER(ePlayer).isOption(PLAYEROPTION_ADVISOR_HELP))
{
szBuffer += SEPARATOR;
szBuffer += NEWLINE;
szBuffer += gDLL->getText("TXT_KEY_SIDS_TIPS");
szBuffer += L"\"";
szBuffer += GC.getBuildingInfo(eBuilding).getStrategy();
szBuffer += L"\"";
}
}
}
}
void CvGameTextMgr::setProjectHelp(CvWString &szBuffer, ProjectTypes eProject, bool bCivilopediaText, CvCity* pCity)
{
wchar szTempBuffer[1024];
wchar szFirstBuffer[1024];
PlayerTypes ePlayer;
bool bFirst;
int iProduction;
int iI;
if (NO_PROJECT == eProject)
{
return;
}
if (pCity != NULL)
{
ePlayer = pCity->getOwnerINLINE();
}
else
{
ePlayer = GC.getGameINLINE().getActivePlayer();
}
if (!bCivilopediaText)
{
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR , TEXT_COLOR("COLOR_PROJECT_TEXT"), GC.getProjectInfo(eProject).getDescription());
szBuffer += szTempBuffer;
if (isWorldProject(eProject))
{
if (pCity == NULL)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_WORLD_NUM_ALLOWED", GC.getProjectInfo(eProject).getMaxGlobalInstances());
}
else
{
szBuffer += gDLL->getText("TXT_KEY_PROJECT_WORLD_NUM_LEFT", (GC.getProjectInfo(eProject).getMaxGlobalInstances() - GC.getGameINLINE().getProjectCreatedCount(eProject) - GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getProjectMaking(eProject)));
}
}
if (isTeamProject(eProject))
{
if (pCity == NULL)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_TEAM_NUM_ALLOWED", GC.getProjectInfo(eProject).getMaxTeamInstances());
}
else
{
szBuffer += gDLL->getText("TXT_KEY_PROJECT_TEAM_NUM_LEFT", (GC.getProjectInfo(eProject).getMaxTeamInstances() - GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getProjectCount(eProject) - GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getProjectMaking(eProject)));
}
}
}
if (GC.getProjectInfo(eProject).getNukeInterception() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_CHANCE_INTERCEPT_NUKES", GC.getProjectInfo(eProject).getNukeInterception());
}
if (GC.getProjectInfo(eProject).getTechShare() != 0)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_TECH_SHARE", GC.getProjectInfo(eProject).getTechShare());
}
if (GC.getProjectInfo(eProject).getEveryoneSpecialUnit() != NO_SPECIALUNIT)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_ENABLES_SPECIAL", GC.getSpecialUnitInfo((SpecialUnitTypes)(GC.getProjectInfo(eProject).getEveryoneSpecialUnit())).getTextKeyWide());
}
if (GC.getProjectInfo(eProject).getEveryoneSpecialBuilding() != NO_SPECIALBUILDING)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_ENABLES_SPECIAL", GC.getSpecialBuildingInfo((SpecialBuildingTypes)(GC.getProjectInfo(eProject).getEveryoneSpecialBuilding())).getTextKeyWide());
}
for (iI = 0; iI < GC.getNumVictoryInfos(); iI++)
{
if (GC.getProjectInfo(eProject).getVictoryThreshold((VictoryTypes)iI) > 0)
{
if ((pCity == NULL) || (GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getProjectCount(eProject) < GC.getProjectInfo(eProject).getVictoryThreshold((VictoryTypes)iI)))
{
if (pCity != NULL)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_REQUIRED_TYPE_VICTORY", GC.getVictoryInfo((VictoryTypes)iI).getTextKeyWide(), GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getProjectCount(eProject), GC.getProjectInfo(eProject).getVictoryThreshold((VictoryTypes)iI));
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_REQUIRED_STRING", GC.getVictoryInfo((VictoryTypes)iI).getTextKeyWide(), GC.getProjectInfo(eProject).getVictoryThreshold((VictoryTypes)iI));
}
}
}
}
bFirst = true;
for (iI = 0; iI < GC.getNumProjectInfos(); iI++)
{
if (GC.getProjectInfo((ProjectTypes)iI).getAnyoneProjectPrereq() == eProject)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_PROJECT_REQUIRED_TO_CREATE_ANYONE").c_str());
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR, TEXT_COLOR("COLOR_PROJECT_TEXT"), GC.getProjectInfo((ProjectTypes)iI).getDescription());
setListHelp(szBuffer, szFirstBuffer, szTempBuffer, L", ", bFirst);
bFirst = false;
}
}
bFirst = true;
for (iI = 0; iI < GC.getNumProjectInfos(); iI++)
{
if (GC.getProjectInfo((ProjectTypes)iI).getProjectsNeeded(eProject) > 0)
{
if ((pCity == NULL) || pCity->canCreate(((ProjectTypes)iI), false, true))
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_PROJECT_REQUIRED_TO_CREATE").c_str());
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR, TEXT_COLOR("COLOR_PROJECT_TEXT"), GC.getProjectInfo((ProjectTypes)iI).getDescription());
setListHelp(szBuffer, szFirstBuffer, szTempBuffer, L", ", bFirst);
bFirst = false;
}
}
}
if ((pCity == NULL) || !(pCity->canCreate(eProject)))
{
if (pCity != NULL)
{
if (GC.getGameINLINE().isNoNukes())
{
if (GC.getProjectInfo(eProject).getEveryoneSpecialUnit() != NO_SPECIALUNIT)
{
for (iI = 0; iI < GC.getNumUnitInfos(); iI++)
{
if (GC.getUnitInfo((UnitTypes)iI).getSpecialUnitType() == GC.getProjectInfo(eProject).getEveryoneSpecialUnit())
{
if (GC.getUnitInfo((UnitTypes)iI).getNukeRange() != -1)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_NO_NUKES");
}
}
}
}
}
}
if (GC.getProjectInfo(eProject).getAnyoneProjectPrereq() != NO_PROJECT)
{
if ((pCity == NULL) || (GC.getGameINLINE().getProjectCreatedCount((ProjectTypes)(GC.getProjectInfo(eProject).getAnyoneProjectPrereq())) == 0))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_REQUIRES_ANYONE", GC.getProjectInfo((ProjectTypes)GC.getProjectInfo(eProject).getAnyoneProjectPrereq()).getTextKeyWide());
}
}
for (iI = 0; iI < GC.getNumProjectInfos(); iI++)
{
if (GC.getProjectInfo(eProject).getProjectsNeeded(iI) > 0)
{
if ((pCity == NULL) || (GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getProjectCount((ProjectTypes)iI) < GC.getProjectInfo(eProject).getProjectsNeeded(iI)))
{
if (pCity != NULL)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_REQUIRES", GC.getProjectInfo((ProjectTypes)iI).getTextKeyWide(), GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getProjectCount((ProjectTypes)iI), GC.getProjectInfo(eProject).getProjectsNeeded(iI));
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_REQUIRES_NO_CITY", GC.getProjectInfo((ProjectTypes)iI).getTextKeyWide(), GC.getProjectInfo(eProject).getProjectsNeeded(iI));
}
}
}
}
if (bCivilopediaText)
{
if (GC.getProjectInfo(eProject).getVictoryPrereq() != NO_VICTORY)
{
// swprintf(szTempBuffer, L"\n%cRequires %s Victory", gDLL->getSymbolID(BULLET_CHAR), GC.getVictoryInfo((VictoryTypes)(GC.getProjectInfo(eProject).getVictoryPrereq())).getDescription());
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_REQUIRES_STRING_VICTORY", GC.getVictoryInfo((VictoryTypes)(GC.getProjectInfo(eProject).getVictoryPrereq())).getTextKeyWide());
// szBuffer += szTempBuffer;
}
}
}
if (!bCivilopediaText)
{
if (pCity == NULL)
{
if (ePlayer != NO_PLAYER)
{
swprintf(szTempBuffer, L"\n%d%c", GET_PLAYER(ePlayer).getProductionNeeded(eProject), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
}
else
{
swprintf(szTempBuffer, L"\n%d%c", GC.getProjectInfo(eProject).getProductionCost(), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
}
szBuffer += szTempBuffer;
}
else
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROJECT_NUM_TURNS", pCity->getProductionTurnsLeft(eProject, ((gDLL->ctrlKey() || !(gDLL->shiftKey())) ? 0 : pCity->getOrderQueueLength())));
iProduction = pCity->getProjectProduction(eProject);
if (iProduction > 0)
{
swprintf(szTempBuffer, L" - %d/%d%c", iProduction, GET_PLAYER(ePlayer).getProductionNeeded(eProject), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
}
else
{
swprintf(szTempBuffer, L" - %d%c", GET_PLAYER(ePlayer).getProductionNeeded(eProject), GC.getYieldInfo(YIELD_PRODUCTION).getChar());
}
szBuffer += szTempBuffer;
}
}
for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
if (GC.getProjectInfo(eProject).getBonusProductionModifier(iI) != 0)
{
if (pCity != NULL)
{
if (pCity->hasBonus((BonusTypes)iI))
{
szBuffer += gDLL->getText("TXT_KEY_COLOR_POSITIVE");
}
else
{
szBuffer += gDLL->getText("TXT_KEY_COLOR_NEGATIVE");
}
}
if (!bCivilopediaText)
{
szBuffer += L" (";
}
else
{
swprintf(szTempBuffer, L"%s%c", NEWLINE, gDLL->getSymbolID(BULLET_CHAR), szTempBuffer);
szBuffer += szTempBuffer;
}
if (GC.getProjectInfo(eProject).getBonusProductionModifier(iI) == 100)
{
// swprintf(szTempBuffer, L"Double Speed with %c", GC.getBonusInfo((BonusTypes) iI).getChar());
szBuffer += gDLL->getText("TXT_KEY_PROJECT_DOUBLE_SPEED_WITH", GC.getBonusInfo((BonusTypes)iI).getTextKeyWide());
}
else
{
// swprintf(szTempBuffer, L"Builds %d%% Faster with %c", GC.getProjectInfo(eProject).getBonusProductionModifier(iI), GC.getBonusInfo((BonusTypes) iI).getChar());
szBuffer += gDLL->getText("TXT_KEY_PROJECT_BUILDS_FASTER_WITH", GC.getProjectInfo(eProject).getBonusProductionModifier(iI), GC.getBonusInfo((BonusTypes)iI).getTextKeyWide());
}
// szBuffer += szTempBuffer;
if (!bCivilopediaText)
{
szBuffer += L")";
}
if (pCity != NULL)
{
szBuffer += gDLL->getText("TXT_KEY_COLOR_REVERT");
}
}
}
}
void CvGameTextMgr::setProcessHelp(CvWString &szBuffer, ProcessTypes eProcess)
{
int iI;
szBuffer += GC.getProcessInfo(eProcess).getDescription();
for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
{
if (GC.getProcessInfo(eProcess).getProductionToCommerceModifier(iI) != 0)
{
// swprintf(szTempBuffer, L"\n%cConverts %d%% of %c to %c", gDLL->getSymbolID(BULLET_CHAR), GC.getProcessInfo(eProcess).getProductionToCommerceModifier(iI), GC.getYieldInfo(YIELD_PRODUCTION).getChar(), GC.getCommerceInfo((CommerceTypes) iI).getChar());
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_PROCESS_CONVERTS", GC.getProcessInfo(eProcess).getProductionToCommerceModifier(iI), GC.getYieldInfo(YIELD_PRODUCTION).getChar(), GC.getCommerceInfo((CommerceTypes) iI).getChar());
// szBuffer += szTempBuffer;
}
}
}
void CvGameTextMgr::setBadHealthHelp(CvWString &szBuffer, CvCity& city)
{
CvPlot* pLoopPlot;
FeatureTypes eFeature;
int iHealth;
int iI;
if (city.badHealth() > 0)
{
iHealth = -(city.getFreshWaterBadHealth());
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Fresh Water\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_FROM_FRESH_WATER", iHealth) + NEWLINE;
}
iHealth = -(city.getFeatureBadHealth());
if (iHealth > 0)
{
eFeature = NO_FEATURE;
for (iI = 0; iI < NUM_CITY_PLOTS; iI++)
{
pLoopPlot = plotCity(city.getX_INLINE(), city.getY_INLINE(), iI);
if (pLoopPlot != NULL)
{
if (pLoopPlot->getFeatureType() != NO_FEATURE)
{
if (GC.getFeatureInfo(pLoopPlot->getFeatureType()).getHealthPercent() < 0)
{
if (eFeature == NO_FEATURE)
{
eFeature = pLoopPlot->getFeatureType();
}
else if (eFeature != pLoopPlot->getFeatureType())
{
eFeature = NO_FEATURE;
break;
}
}
}
}
}
// swprintf(szTempBuffer, "+%d%c from %s\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR), ((eFeature == NO_FEATURE) ? "Features" : GC.getFeatureInfo(eFeature).getDescription())); // XXX bad help...
szBuffer += gDLL->getText("TXT_KEY_MISC_FEAT_HEALTH", iHealth, ((eFeature == NO_FEATURE) ? L"TXT_KEY_MISC_FEATURES" : GC.getFeatureInfo(eFeature).getTextKeyWide())) + NEWLINE;
}
iHealth = -(city.getPowerBadHealth());
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Power\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_HEALTH_FROM_POWER", iHealth) + NEWLINE;
}
iHealth = -(city.getBonusBadHealth());
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Bonuses\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_HEALTH_FROM_BONUSES", iHealth) + NEWLINE;
}
iHealth = -(city.totalBadBuildingHealth());
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Buildings\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_HEALTH_FROM_BUILDINGS", iHealth) + NEWLINE;
}
iHealth = -(GET_PLAYER(city.getOwnerINLINE()).getExtraHealth());
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Civilization\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_HEALTH_FROM_CIV", iHealth) + NEWLINE;
}
iHealth = -(GC.getHandicapInfo(city.getHandicapType()).getHealthBonus());
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Handicap\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_HEALTH_FROM_HANDICAP", iHealth) + NEWLINE;
}
iHealth = city.unhealthyPopulation();
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Population\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_HEALTH_FROM_POP", iHealth) + NEWLINE;
}
szBuffer += L"-----------------------\n";
// swprintf(szTempBuffer, "%d%c Total Unhealthiness", city.badHealth(), CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_TOTAL_UNHEALTHY", city.badHealth());
}
}
void CvGameTextMgr::setGoodHealthHelp(CvWString &szBuffer, CvCity& city)
{
CvPlot* pLoopPlot;
FeatureTypes eFeature;
int iHealth;
int iI;
if (city.goodHealth() > 0)
{
iHealth = city.getFreshWaterGoodHealth();
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Fresh Water\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_HEALTH_FROM_FRESH_WATER", iHealth) + NEWLINE;
}
iHealth = city.getFeatureGoodHealth();
if (iHealth > 0)
{
eFeature = NO_FEATURE;
for (iI = 0; iI < NUM_CITY_PLOTS; iI++)
{
pLoopPlot = plotCity(city.getX_INLINE(), city.getY_INLINE(), iI);
if (pLoopPlot != NULL)
{
if (pLoopPlot->getFeatureType() != NO_FEATURE)
{
if (GC.getFeatureInfo(pLoopPlot->getFeatureType()).getHealthPercent() > 0)
{
if (eFeature == NO_FEATURE)
{
eFeature = pLoopPlot->getFeatureType();
}
else if (eFeature != pLoopPlot->getFeatureType())
{
eFeature = NO_FEATURE;
break;
}
}
}
}
}
// swprintf(szTempBuffer, "+%d%c from %s\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR), ((eFeature == NO_FEATURE) ? "Features" : GC.getFeatureInfo(eFeature).getDescription())); // XXX bad help...
szBuffer += gDLL->getText("TXT_KEY_MISC_FEAT_GOOD_HEALTH", iHealth, ((eFeature == NO_FEATURE) ? L"TXT_KEY_MISC_FEATURES" : GC.getFeatureInfo(eFeature).getTextKeyWide())) + NEWLINE;
}
iHealth = city.getPowerGoodHealth();
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Power\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_GOOD_HEALTH_FROM_POWER", iHealth) + NEWLINE;
}
iHealth = city.getBonusGoodHealth();
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Bonuses\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_GOOD_HEALTH_FROM_BONUSES", iHealth) + NEWLINE;
}
iHealth = city.totalGoodBuildingHealth();
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Buildings\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_GOOD_HEALTH_FROM_BUILDINGS", iHealth) + NEWLINE;
}
iHealth = GET_PLAYER(city.getOwnerINLINE()).getExtraHealth();
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Civilization\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_GOOD_HEALTH_FROM_CIV", iHealth) + NEWLINE;
}
iHealth = GC.getHandicapInfo(city.getHandicapType()).getHealthBonus();
if (iHealth > 0)
{
// swprintf(szTempBuffer, "+%d%c from Handicap\n", iHealth, CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_GOOD_HEALTH_FROM_HANDICAP", iHealth) + NEWLINE;
}
szBuffer += L"-----------------------\n";
// swprintf(szTempBuffer, "%d%c Total Unhealthiness", city.badHealth(), CIV.getGameFont()->getSymbolID(UNHEALTHY_CHAR));
szBuffer += gDLL->getText("TXT_KEY_MISC_TOTAL_HEALTHY", city.goodHealth());
}
}
void CvGameTextMgr::setAngerHelp(CvWString &szBuffer, CvCity& city)
{
// wchar szTempBuffer[1024];
int iOldAngerPercent;
int iNewAngerPercent;
int iOldAnger;
int iNewAnger;
int iAnger;
int iI;
if (city.isOccupation())
{
// szBuffer += "\"Viva la resistance!\"";
szBuffer += gDLL->getText("TXT_KEY_ANGER_RESISTANCE");
}
else if (GET_PLAYER(city.getOwnerINLINE()).isAnarchy())
{
// szBuffer += "Our civilization is in Anarchy!";
szBuffer += gDLL->getText("TXT_KEY_ANGER_ANARCHY");
}
else if (city.unhappyLevel() > 0)
{
iOldAngerPercent = 0;
iNewAngerPercent = 0;
iOldAnger = 0;
iNewAnger = 0;
// XXX decomp these???
iNewAngerPercent += city.getOvercrowdingPercentAnger();
iNewAnger += (((iNewAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")) - ((iOldAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_OVERCROWDING", iAnger) + NEWLINE;
}
iOldAngerPercent = iNewAngerPercent;
iOldAnger = iNewAnger;
iNewAngerPercent += city.getNoMilitaryPercentAnger();
iNewAnger += (((iNewAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")) - ((iOldAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_MILITARY_PROTECTION", iAnger) + NEWLINE;
}
iOldAngerPercent = iNewAngerPercent;
iOldAnger = iNewAnger;
iNewAngerPercent += city.getCulturePercentAnger();
iNewAnger += (((iNewAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")) - ((iOldAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_OCCUPIED", iAnger) + NEWLINE;
}
iOldAngerPercent = iNewAngerPercent;
iOldAnger = iNewAnger;
iNewAngerPercent += city.getReligionPercentAnger();
iNewAnger += (((iNewAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")) - ((iOldAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_RELIGION_FIGHT", iAnger) + NEWLINE;
}
iOldAngerPercent = iNewAngerPercent;
iOldAnger = iNewAnger;
iNewAngerPercent += city.getHurryPercentAnger();
iNewAnger += (((iNewAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")) - ((iOldAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_OPPRESSION", iAnger) + NEWLINE;
}
iOldAngerPercent = iNewAngerPercent;
iOldAnger = iNewAnger;
iNewAngerPercent += city.getConscriptPercentAnger();
iNewAnger += (((iNewAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")) - ((iOldAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_DRAFT", iAnger) + NEWLINE;
}
iOldAngerPercent = iNewAngerPercent;
iOldAnger = iNewAnger;
iNewAngerPercent += city.getWarWearinessPercentAnger();
iNewAnger += (((iNewAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")) - ((iOldAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_WAR_WEAR", iAnger) + NEWLINE;
}
iOldAngerPercent = iNewAngerPercent;
iOldAnger = iNewAnger;
for (iI = 0; iI < GC.getNumCivicInfos(); iI++)
{
iNewAngerPercent += GET_PLAYER(city.getOwnerINLINE()).getCivicPercentAnger((CivicTypes)iI);
iNewAnger += (((iNewAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")) - ((iOldAngerPercent * city.getPopulation()) / GC.getDefineINT("PERCENT_ANGER_DIVISOR")));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_DEMAND_CIVIC", iAnger, GC.getCivicInfo((CivicTypes) iI).getTextKeyWide()) + NEWLINE;
}
iOldAngerPercent = iNewAngerPercent;
iOldAnger = iNewAnger;
}
iNewAnger -= min(0, city.getLargestCityHappiness());
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_BIG_CITY", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, city.getMilitaryHappiness());
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_MILITARY_PRESENCE", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, city.getCurrentStateReligionHappiness());
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_STATE_RELIGION", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, (city.getBuildingBadHappiness() + city.getExtraBuildingBadHappiness()));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_BUILDINGS", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, city.getFeatureBadHappiness());
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_FEATURES", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, city.getBonusBadHappiness());
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_BONUS", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, city.getReligionBadHappiness());
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_RELIGIOUS_FREEDOM", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, city.getCommerceHappiness());
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_BAD_ENTERTAINMENT", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, city.area()->getBuildingHappiness(city.getOwnerINLINE()));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_BUILDINGS", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, GET_PLAYER(city.getOwnerINLINE()).getBuildingHappiness());
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_BUILDINGS", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, (city.getExtraHappiness() + GET_PLAYER(city.getOwnerINLINE()).getExtraHappiness()));
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_ARGH", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
iNewAnger -= min(0, GC.getHandicapInfo(city.getHandicapType()).getHappyBonus());
iAnger = ((iNewAnger - iOldAnger) + min(0, iOldAnger));
if (iAnger > 0)
{
szBuffer += gDLL->getText("TXT_KEY_ANGER_HANDICAP", iAnger) + NEWLINE;
}
iOldAnger = iNewAnger;
szBuffer += L"-----------------------\n";
szBuffer += gDLL->getText("TXT_KEY_ANGER_TOTAL_UNHAPPY", iOldAnger);
}
}
void CvGameTextMgr::setHappyHelp(CvWString &szBuffer, CvCity& city)
{
int iHappy;
int iTotalHappy = 0;
if (city.isOccupation() || GET_PLAYER(city.getOwnerINLINE()).isAnarchy())
{
return;
}
if (city.happyLevel() > 0)
{
iHappy = city.getLargestCityHappiness();
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_BIG_CITY", iHappy) + NEWLINE;
}
iHappy = city.getMilitaryHappiness();
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_MILITARY_PRESENCE", iHappy) + NEWLINE;
}
iHappy = city.getCurrentStateReligionHappiness();
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_STATE_RELIGION", iHappy) + NEWLINE;
}
iHappy = (city.getBuildingGoodHappiness() + city.getExtraBuildingGoodHappiness());
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_BUILDINGS", iHappy) + NEWLINE;
}
iHappy = city.getFeatureGoodHappiness();
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_FEATURES", iHappy) + NEWLINE;
}
iHappy = city.getBonusGoodHappiness();
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_BONUS", iHappy) + NEWLINE;
}
iHappy = city.getReligionGoodHappiness();
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_RELIGIOUS_FREEDOM", iHappy) + NEWLINE;
}
iHappy = city.getCommerceHappiness();
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_ENTERTAINMENT", iHappy) + NEWLINE;
}
iHappy = city.area()->getBuildingHappiness(city.getOwnerINLINE());
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_BUILDINGS", iHappy) + NEWLINE;
}
iHappy = GET_PLAYER(city.getOwnerINLINE()).getBuildingHappiness();
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_BUILDINGS", iHappy) + NEWLINE;
}
iHappy = (city.getExtraHappiness() + GET_PLAYER(city.getOwnerINLINE()).getExtraHappiness());
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_YEAH", iHappy) + NEWLINE;
}
iHappy = GC.getHandicapInfo(city.getHandicapType()).getHappyBonus();
if (iHappy > 0)
{
iTotalHappy += iHappy;
szBuffer += gDLL->getText("TXT_KEY_HAPPY_HANDICAP", iHappy) + NEWLINE;
}
szBuffer += L"-----------------------\n";
szBuffer += gDLL->getText("TXT_KEY_HAPPY_TOTAL_HAPPY", iTotalHappy);
}
}
void CvGameTextMgr::setYieldChangeHelp(CvWString &szBuffer, const CvWString& szStart, const CvWString& szSpace, const CvWString& szEnd, const int* piYieldChange, bool bPercent, bool bNewLine)
{
CvWString szTempBuffer;
bool bStarted;
int iI;
bStarted = false;
for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
if (piYieldChange[iI] != 0)
{
if (!bStarted)
{
if (bNewLine)
{
szTempBuffer.Format(L"\n%c", gDLL->getSymbolID(BULLET_CHAR));
}
szTempBuffer += CvWString::format(L"%s%s%s%d%s%c",
szStart.GetCString(),
szSpace.GetCString(),
piYieldChange[iI] > 0 ? L"+" : L"",
piYieldChange[iI],
bPercent ? L"%" : L"",
GC.getYieldInfo((YieldTypes)iI).getChar());
}
else
{
szTempBuffer.Format(L", %s%d%s%c",
piYieldChange[iI] > 0 ? L"+" : L"",
piYieldChange[iI],
bPercent ? L"%" : L"",
GC.getYieldInfo((YieldTypes)iI).getChar());
}
szBuffer += szTempBuffer;
bStarted = true;
}
}
if (bStarted)
{
szBuffer += szEnd;
}
}
void CvGameTextMgr::setCommerceChangeHelp(CvWString &szBuffer, const CvWString& szStart, const CvWString& szSpace, const CvWString& szEnd, const int* piCommerceChange, bool bPercent, bool bNewLine)
{
CvWString szTempBuffer;
bool bStarted;
int iI;
bStarted = false;
for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
{
if (piCommerceChange[iI] != 0)
{
if (!bStarted)
{
if (bNewLine)
{
szTempBuffer.Format(L"\n%c", gDLL->getSymbolID(BULLET_CHAR));
}
szTempBuffer += CvWString::format(L"%s%s%s%d%s%c", szStart.GetCString(), szSpace.GetCString(), ((piCommerceChange[iI] > 0) ? L"+" : L""), piCommerceChange[iI], ((bPercent) ? L"%" : L""), GC.getCommerceInfo((CommerceTypes) iI).getChar());
}
else
{
szTempBuffer.Format(L", %s%d%s%c", ((piCommerceChange[iI] > 0) ? L"+" : L""), piCommerceChange[iI], ((bPercent) ? L"%" : L""), GC.getCommerceInfo((CommerceTypes) iI).getChar());
}
szBuffer += szTempBuffer;
bStarted = true;
}
}
if (bStarted)
{
szBuffer += szEnd;
}
}
void CvGameTextMgr::setBonusHelp(CvWString &szBuffer, BonusTypes eBonus, bool bCivilopediaText)
{
wchar szTempBuffer[256];
if (NO_BONUS == eBonus)
{
return;
}
if (!bCivilopediaText)
{
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), GC.getBonusInfo(eBonus).getDescription());
szBuffer += szTempBuffer;
setYieldChangeHelp(szBuffer, L"", L"", L"", GC.getBonusInfo(eBonus).getYieldChangeArray());
if (GC.getBonusInfo(eBonus).getTechReveal() != NO_TECH)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BONUS_REVEALED_BY", GC.getTechInfo((TechTypes)GC.getBonusInfo(eBonus).getTechReveal()).getTextKeyWide());
}
}
ImprovementTypes eImprovement = NO_IMPROVEMENT;
for (int iLoopImprovement = 0; iLoopImprovement < GC.getNumImprovementInfos(); iLoopImprovement++)
{
if (GC.getImprovementInfo((ImprovementTypes)iLoopImprovement).isImprovementBonusMakesValid(eBonus))
{
eImprovement = (ImprovementTypes)iLoopImprovement;
break;
}
}
if (GC.getBonusInfo(eBonus).getHealth() != 0)
{
if (GC.getBonusInfo(eBonus).getHealth() > 0)
{
// swprintf(szTempBuffer, L"\nHealthy: +%d%c", GC.getBonusInfo(eBonus).getHealth(), gDLL->getSymbolID(HEALTHY_CHAR));
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BONUS_HEALTHY", GC.getBonusInfo(eBonus).getHealth());
}
else
{
// swprintf(szTempBuffer, L"\nUnhealthy: +%d%c", -GC.getBonusInfo(eBonus).getHealth(), gDLL->getSymbolID(UNHEALTHY_CHAR));
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BONUS_UNHEALTHY", -GC.getBonusInfo(eBonus).getHealth());
}
// szBuffer += szTempBuffer;
if (eImprovement != NO_IMPROVEMENT)
{
// swprintf(szTempBuffer, L"(with %s)", GC.getImprovementInfo(eImprovement).getDescription());
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BONUS_WITH_IMPROVEMENT", GC.getImprovementInfo(eImprovement).getTextKeyWide());
// szBuffer += szTempBuffer;
}
}
if (GC.getBonusInfo(eBonus).getHappiness() != 0)
{
if (GC.getBonusInfo(eBonus).getHappiness() > 0)
{
// swprintf(szTempBuffer, L"\nHappy: +%d%c", GC.getBonusInfo(eBonus).getHappiness(), gDLL->getSymbolID(HAPPY_CHAR));
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BONUS_HAPPY", GC.getBonusInfo(eBonus).getHappiness());
}
else
{
// swprintf(szTempBuffer, L"\nUnhappy: +%d%c", -GC.getBonusInfo(eBonus).getHappiness(), gDLL->getSymbolID(UNHAPPY_CHAR));
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BONUS_UNHAPPY", -GC.getBonusInfo(eBonus).getHappiness());
}
// szBuffer += szTempBuffer;
if (eImprovement != NO_IMPROVEMENT)
{
// swprintf(szTempBuffer, L"(with %s)", GC.getImprovementInfo(eImprovement).getDescription());
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_BONUS_WITH_IMPROVEMENT", GC.getImprovementInfo(eImprovement).getTextKeyWide());
// szBuffer += szTempBuffer;
}
}
}
void CvGameTextMgr::setReligionHelp(CvWString &szBuffer, ReligionTypes eReligion, bool bCivilopedia)
{
UnitTypes eFreeUnit;
if (NO_RELIGION == eReligion)
{
return;
}
CvReligionInfo& religion = GC.getReligionInfo(eReligion);
if (!bCivilopedia)
{
szBuffer += CvWString::format(SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), religion.getDescription());
}
setCommerceChangeHelp(szBuffer, gDLL->getText("TXT_KEY_RELIGION_HOLY_CITY").c_str(), L": ", L"", religion.getHolyCityCommerceArray());
setCommerceChangeHelp(szBuffer, gDLL->getText("TXT_KEY_RELIGION_ALL_CITIES").c_str(), L": ", L"", religion.getStateReligionCommerceArray());
if (!bCivilopedia)
{
if (religion.getTechPrereq() != NO_TECH)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_RELIGION_FOUNDED_FIRST", GC.getTechInfo((TechTypes)religion.getTechPrereq()).getTextKeyWide());
}
}
if (religion.getFreeUnitClass() != NO_UNITCLASS)
{
if (GC.getGameINLINE().getActivePlayer() != NO_PLAYER)
{
eFreeUnit = ((UnitTypes)(GC.getCivilizationInfo(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCivilizationType()).getCivilizationUnits(religion.getFreeUnitClass())));
}
else
{
eFreeUnit = (UnitTypes)GC.getUnitClassInfo((UnitClassTypes)religion.getFreeUnitClass()).getDefaultUnitIndex();
}
if (eFreeUnit != NO_UNIT)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_RELIGION_FOUNDER_RECEIVES", GC.getUnitInfo(eFreeUnit).getTextKeyWide());
}
}
}
void CvGameTextMgr::setReligionHelpCity(CvWString &szBuffer, ReligionTypes eReligion, CvCity *pCity, bool bCityScreen, bool bForceReligion, bool bForceState, bool bNoStateReligion)
{
int i;
CvWString szTempBuffer;
bool bHandled = false;
int iCommerce;
int iHappiness;
int iProductionModifier;
int iFreeExperience;
int iGreatPeopleRateModifier;
if (pCity == NULL)
{
return;
}
ReligionTypes eStateReligion = (bNoStateReligion ? NO_RELIGION : GET_PLAYER(pCity->getOwnerINLINE()).getStateReligion());
if (bCityScreen)
{
szBuffer += CvWString::format(SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), GC.getReligionInfo(eReligion).getDescription());
szBuffer += NEWLINE;
if (!(GC.getGameINLINE().isReligionFounded(eReligion)))
{
if (GC.getReligionInfo(eReligion).getTechPrereq() != NO_TECH)
{
szBuffer += gDLL->getText("TXT_KEY_RELIGION_FOUNDED_FIRST", GC.getTechInfo((TechTypes)(GC.getReligionInfo(eReligion).getTechPrereq())).getTextKeyWide());
}
}
}
if (!bForceReligion)
{
if (!(pCity->isHasReligion(eReligion)))
{
return;
}
}
if (eStateReligion == eReligion || eStateReligion == NO_RELIGION || bForceState)
{
for (i = 0; i < NUM_COMMERCE_TYPES; i++)
{
iCommerce = GC.getReligionInfo(eReligion).getStateReligionCommerce((CommerceTypes)i);
if (pCity->isHolyCity(eReligion))
{
iCommerce += GC.getReligionInfo(eReligion).getHolyCityCommerce((CommerceTypes)i);
}
if (iCommerce != 0)
{
if (bHandled)
{
szBuffer += L", ";
}
szTempBuffer.Format(L"%s%d%c", iCommerce > 0 ? "+" : "", iCommerce, GC.getCommerceInfo((CommerceTypes)i).getChar());
szBuffer += szTempBuffer;
bHandled = true;
}
}
}
if (eStateReligion == eReligion || bForceState)
{
iHappiness = (pCity->getStateReligionHappiness(eReligion) + GET_PLAYER(pCity->getOwnerINLINE()).getStateReligionHappiness());
if (iHappiness != 0)
{
if (bHandled)
{
szBuffer += L", ";
}
szTempBuffer.Format(L"%d%c", iHappiness, ((iHappiness > 0) ? gDLL->getSymbolID(HAPPY_CHAR) : gDLL->getSymbolID(UNHAPPY_CHAR)));
szBuffer += szTempBuffer;
bHandled = true;
}
iProductionModifier = GET_PLAYER(pCity->getOwnerINLINE()).getStateReligionBuildingProductionModifier();
if (iProductionModifier != 0)
{
if (bHandled)
{
szBuffer += L", ";
}
szBuffer += gDLL->getText("TXT_KEY_RELIGION_BUILDING_PROD_MOD", iProductionModifier);
bHandled = true;
}
iProductionModifier = GET_PLAYER(pCity->getOwnerINLINE()).getStateReligionUnitProductionModifier();
if (iProductionModifier != 0)
{
if (bHandled)
{
szBuffer += L", ";
}
szBuffer += gDLL->getText("TXT_KEY_RELIGION_UNIT_PROD_MOD", iProductionModifier);
bHandled = true;
}
iFreeExperience = GET_PLAYER(pCity->getOwnerINLINE()).getStateReligionFreeExperience();
if (iFreeExperience != 0)
{
if (bHandled)
{
szBuffer += L", ";
}
szBuffer += gDLL->getText("TXT_KEY_RELIGION_FREE_XP", iFreeExperience);
bHandled = true;
}
iGreatPeopleRateModifier = GET_PLAYER(pCity->getOwnerINLINE()).getStateReligionGreatPeopleRateModifier();
if (iGreatPeopleRateModifier != 0)
{
if (bHandled)
{
szBuffer += L", ";
}
szBuffer += gDLL->getText("TXT_KEY_RELIGION_BIRTH_RATE_MOD", iGreatPeopleRateModifier);
bHandled = true;
}
}
}
void CvGameTextMgr::buildObsoleteString(CvWString &szBuffer, int iItem, bool bList, bool bPlayerContext)
{
CvWString szTempBuffer;
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_TECH_OBSOLETES", GC.getBuildingInfo((BuildingTypes) iItem).getTextKeyWide());
}
void CvGameTextMgr::buildObsoleteBonusString(CvWString &szBuffer, int iItem, bool bList, bool bPlayerContext)
{
CvWString szTempBuffer;
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_TECH_OBSOLETES", GC.getBonusInfo((BonusTypes) iItem).getTextKeyWide());
}
void CvGameTextMgr::buildObsoleteSpecialString(CvWString &szBuffer, int iItem, bool bList, bool bPlayerContext)
{
CvWString szTempBuffer;
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_TECH_OBSOLETES_NO_LINK", GC.getSpecialBuildingInfo((SpecialBuildingTypes) iItem).getTextKeyWide());
}
void CvGameTextMgr::buildMoveString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
int iI;
int iMoveDiff;
for (iI = 0; iI < GC.getNumRouteInfos(); iI++)
{
iMoveDiff = ((GC.getMOVE_DENOMINATOR() / max(1, (GC.getRouteInfo((RouteTypes) iI).getMovementCost() + ((bPlayerContext) ? GET_TEAM(GC.getGameINLINE().getActiveTeam()).getRouteChange((RouteTypes)iI) : 0)))) - (GC.getMOVE_DENOMINATOR() / max(1, (GC.getRouteInfo((RouteTypes) iI).getMovementCost() + ((bPlayerContext) ? GET_TEAM(GC.getGameINLINE().getActiveTeam()).getRouteChange((RouteTypes)iI) : 0) + GC.getRouteInfo((RouteTypes) iI).getTechMovementChange(eTech)))));
if (iMoveDiff != 0)
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_UNIT_MOVEMENT", -(iMoveDiff), GC.getRouteInfo((RouteTypes) iI).getTextKeyWide());
bList = true;
}
}
}
void CvGameTextMgr::buildFreeUnitString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
UnitTypes eFreeUnit;
if (GC.getTechInfo(eTech).getFirstFreeUnitClass() != NO_UNITCLASS)
{
if (GC.getGameINLINE().getActivePlayer() != NO_PLAYER)
{
eFreeUnit = ((UnitTypes)(GC.getCivilizationInfo(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCivilizationType()).getCivilizationUnits(GC.getTechInfo(eTech).getFirstFreeUnitClass())));
}
else
{
eFreeUnit = (UnitTypes)GC.getUnitClassInfo((UnitClassTypes)GC.getTechInfo(eTech).getFirstFreeUnitClass()).getDefaultUnitIndex();
}
if (eFreeUnit != NO_UNIT)
{
if (!bPlayerContext || (GC.getGameINLINE().countKnownTechNumTeams(eTech) == 0))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_TECH_FIRST_RECEIVES", GC.getUnitInfo(eFreeUnit).getTextKeyWide());
}
}
}
}
void CvGameTextMgr::buildFeatureProductionString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).getFeatureProductionModifier() != 0)
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_FEATURE_PRODUCTION_MODIFIER", GC.getTechInfo(eTech).getFeatureProductionModifier());
}
}
void CvGameTextMgr::buildWorkerRateString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).getWorkerSpeedModifier() != 0)
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_UNIT_WORKERS_FASTER", GC.getTechInfo(eTech).getWorkerSpeedModifier());
}
}
void CvGameTextMgr::buildTradeRouteString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).getTradeRoutes() != 0)
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_TRADE_ROUTES", GC.getTechInfo(eTech).getTradeRoutes());
}
}
void CvGameTextMgr::buildHealthRateString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).getHealth() != 0)
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_HEALTH_ALL_CITIES", abs(GC.getTechInfo(eTech).getHealth()), ((GC.getTechInfo(eTech).getHealth() > 0) ? gDLL->getSymbolID(HEALTHY_CHAR): gDLL->getSymbolID(UNHEALTHY_CHAR)));
}
}
void CvGameTextMgr::buildHappinessRateString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).getHappiness() != 0)
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_HAPPINESS_ALL_CITIES", abs(GC.getTechInfo(eTech).getHappiness()), ((GC.getTechInfo(eTech).getHappiness() > 0) ? gDLL->getSymbolID(HAPPY_CHAR): gDLL->getSymbolID(UNHAPPY_CHAR)));
}
}
void CvGameTextMgr::buildFreeTechString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).getFirstFreeTechs() > 0)
{
if (!bPlayerContext || (GC.getGameINLINE().countKnownTechNumTeams(eTech) == 0))
{
if (bList)
{
szBuffer += NEWLINE;
}
if (GC.getTechInfo(eTech).getFirstFreeTechs() == 1)
{
szBuffer += gDLL->getText("TXT_KEY_TECH_FIRST_FREE_TECH");
}
else
{
szBuffer += gDLL->getText("TXT_KEY_TECH_FIRST_FREE_TECHS", GC.getTechInfo(eTech).getFirstFreeTechs());
}
}
}
}
void CvGameTextMgr::buildLOSString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isExtraWaterSeeFrom() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isExtraWaterSeeFrom())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_UNIT_EXTRA_SIGHT");
}
}
void CvGameTextMgr::buildMapCenterString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isMapCentering() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isMapCentering())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_CENTERS_MAP");
}
}
void CvGameTextMgr::buildMapRevealString(CvWString &szBuffer, TechTypes eTech, bool bList)
{
if (GC.getTechInfo(eTech).isMapVisible())
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_REVEALS_MAP");
}
}
void CvGameTextMgr::buildMapTradeString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isMapTrading() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isMapTrading())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_ENABLES_MAP_TRADING");
}
}
void CvGameTextMgr::buildTechTradeString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isTechTrading() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isTechTrading())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_ENABLES_TECH_TRADING");
}
}
void CvGameTextMgr::buildGoldTradeString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isGoldTrading() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isGoldTrading())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_ENABLES_GOLD_TRADING");
}
}
void CvGameTextMgr::buildOpenBordersString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isOpenBordersTrading() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isOpenBordersTrading())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_ENABLES_OPEN_BORDERS");
}
}
void CvGameTextMgr::buildDefensivePactString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isDefensivePactTrading() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isDefensivePactTrading())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_ENABLES_DEFENSIVE_PACTS");
}
}
void CvGameTextMgr::buildPermanentAllianceString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isPermanentAllianceTrading() && (!bPlayerContext || (!(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isPermanentAllianceTrading()) && GC.getGameINLINE().isOption(GAMEOPTION_PERMANENT_ALLIANCES))))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_ENABLES_PERM_ALLIANCES");
}
}
void CvGameTextMgr::buildBridgeString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isBridgeBuilding() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isBridgeBuilding())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_ENABLES_BRIDGE_BUILDING");
}
}
void CvGameTextMgr::buildIrrigationString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isIrrigation() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isIrrigation())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_SPREAD_IRRIGATION");
}
}
void CvGameTextMgr::buildIgnoreIrrigationString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isIgnoreIrrigation() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isIgnoreIrrigation())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_IRRIGATION_ANYWHERE");
}
}
void CvGameTextMgr::buildWaterWorkString(CvWString &szBuffer, TechTypes eTech, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isWaterWork() && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isWaterWork())))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_WATER_WORK");
}
}
void CvGameTextMgr::buildImprovementString(CvWString &szBuffer, TechTypes eTech, int iImprovement, bool bList, bool bPlayerContext)
{
bool bTechFound;
int iJ;
bTechFound = false;
if (GC.getBuildInfo((BuildTypes) iImprovement).getTechPrereq() == NO_TECH)
{
for (iJ = 0; iJ < GC.getNumFeatureInfos(); iJ++)
{
if (GC.getBuildInfo((BuildTypes) iImprovement).getFeatureTech(iJ) == eTech)
{
bTechFound = true;
}
}
}
else
{
if (GC.getBuildInfo((BuildTypes) iImprovement).getTechPrereq() == eTech)
{
bTechFound = true;
}
}
if (bTechFound)
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_CAN_BUILD_IMPROVEMENT", GC.getBuildInfo((BuildTypes) iImprovement).getTextKeyWide());
}
}
void CvGameTextMgr::buildDomainExtraMovesString(CvWString &szBuffer, TechTypes eTech, int iDomainType, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).getDomainExtraMoves(iDomainType) != 0)
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_EXTRA_MOVES", GC.getTechInfo(eTech).getDomainExtraMoves(iDomainType), GC.getDomainInfo((DomainTypes)iDomainType).getTextKeyWide());
}
}
void CvGameTextMgr::buildAdjustString(CvWString &szBuffer, TechTypes eTech, int iCommerceType, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isCommerceFlexible(iCommerceType) && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isCommerceFlexible((CommerceTypes)iCommerceType))))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_ADJUST_COMMERCE_RATE", GC.getCommerceInfo((CommerceTypes) iCommerceType).getChar());
}
}
void CvGameTextMgr::buildTerrainTradeString(CvWString &szBuffer, TechTypes eTech, int iTerrainType, bool bList, bool bPlayerContext)
{
if (GC.getTechInfo(eTech).isTerrainTrade(iTerrainType) && (!bPlayerContext || !(GET_TEAM(GC.getGameINLINE().getActiveTeam()).isTerrainTrade((TerrainTypes)iTerrainType))))
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_ENABLES_ON_TERRAIN", gDLL->getSymbolID(TRADE_CHAR), GC.getTerrainInfo((TerrainTypes) iTerrainType).getTextKeyWide());
}
}
void CvGameTextMgr::buildSpecialBuildingString(CvWString &szBuffer, TechTypes eTech, int iBuildingType, bool bList, bool bPlayerContext)
{
if (GC.getSpecialBuildingInfo((SpecialBuildingTypes)iBuildingType).getTechPrereq() == eTech)
{
if (bList)
{
szBuffer += NEWLINE;
}
szBuffer += gDLL->getText("TXT_KEY_MISC_CAN_CONSTRUCT_BUILDING", GC.getSpecialBuildingInfo((SpecialBuildingTypes) iBuildingType).getTextKeyWide());
}
}
void CvGameTextMgr::buildYieldChangeString(CvWString &szBuffer, TechTypes eTech, int iYieldType, bool bList, bool bPlayerContext)
{
CvWString szTempBuffer;
if (bList)
{
szTempBuffer.Format(L" %s", GC.getImprovementInfo((ImprovementTypes)iYieldType).getDescription());
}
else
{
szTempBuffer.Format(L"%c %s", gDLL->getSymbolID(BULLET_CHAR), GC.getImprovementInfo((ImprovementTypes)iYieldType).getDescription());
}
GAMETEXT.setYieldChangeHelp(szBuffer, szTempBuffer, L": ", L"", GC.getImprovementInfo((ImprovementTypes)iYieldType).getTechYieldChangesArray(eTech), false, bList);
}
bool CvGameTextMgr::buildBonusRevealString(CvWString &szBuffer, TechTypes eTech, int iBonusType, bool bFirst, bool bList, bool bPlayerContext)
{
wchar szTempBuffer[256];
szTempBuffer[0] = '\0';
if (GC.getBonusInfo((BonusTypes) iBonusType).getTechReveal() == eTech)
{
if (bList)
{
szBuffer += NEWLINE;
}
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), GC.getBonusInfo((BonusTypes) iBonusType).getDescription());
setListHelp(szBuffer, gDLL->getText("TXT_KEY_MISC_REVEALS").c_str(), szTempBuffer, L", ", bFirst);
bFirst = false;
}
return bFirst;
}
bool CvGameTextMgr::buildCivicRevealString(CvWString &szBuffer, TechTypes eTech, int iCivicType, bool bFirst, bool bList, bool bPlayerContext)
{
wchar szTempBuffer[256];
szTempBuffer[0] = '\0';
if (GC.getCivicInfo((CivicTypes) iCivicType).getTechPrereq() == eTech)
{
if (bList && bFirst)
{
szBuffer += NEWLINE;
}
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), GC.getCivicInfo((CivicTypes) iCivicType).getDescription());
setListHelp(szBuffer, gDLL->getText("TXT_KEY_MISC_ENABLES").c_str(), szTempBuffer, L", ", bFirst);
bFirst = false;
}
return bFirst;
}
bool CvGameTextMgr::buildProcessInfoString(CvWString &szBuffer, TechTypes eTech, int iProcessType, bool bFirst, bool bList, bool bPlayerContext)
{
wchar szTempBuffer[256];
szTempBuffer[0] = '\0';
if (GC.getProcessInfo((ProcessTypes) iProcessType).getTechPrereq() == eTech)
{
if (bList && bFirst)
{
szBuffer += NEWLINE;
}
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), GC.getProcessInfo((ProcessTypes) iProcessType).getDescription());
setListHelp(szBuffer, gDLL->getText("TXT_KEY_MISC_CAN_BUILD").c_str(), szTempBuffer, L", ", bFirst);
bFirst = false;
}
return bFirst;
}
bool CvGameTextMgr::buildFoundReligionString(CvWString &szBuffer, TechTypes eTech, int iReligionType, bool bFirst, bool bList, bool bPlayerContext)
{
wchar szTempBuffer[256];
szTempBuffer[0] = '\0';
if (GC.getReligionInfo((ReligionTypes) iReligionType).getTechPrereq() == eTech)
{
if (!bPlayerContext || (GC.getGameINLINE().countKnownTechNumTeams(eTech) == 0))
{
if (bList && bFirst)
{
szBuffer += NEWLINE;
}
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), GC.getReligionInfo((ReligionTypes) iReligionType).getDescription());
setListHelp(szBuffer, gDLL->getText("TXT_KEY_MISC_FIRST_DISCOVER_FOUNDS").c_str(), szTempBuffer, L", ", bFirst);
bFirst = false;
}
}
return bFirst;
}
// Displays a list of derived technologies - no distinction between AND/OR prerequisites
void CvGameTextMgr::buildSingleLineTechTreeString(CvWString &szBuffer, TechTypes eTech, bool bPlayerContext)
{
wchar szTempBuffer[1024]; // Formatting
if (NO_TECH == eTech)
{
// you need to specify a tech of origin for this method to do anything
return;
}
bool bFirst = true;
for (int iI = 0; iI < GC.getNumTechInfos(); iI++)
{
bool bTechAlreadyAccessible = false;
if (bPlayerContext)
{
bTechAlreadyAccessible = (GET_TEAM(GC.getGameINLINE().getActiveTeam()).isHasTech((TechTypes)iI) || GET_PLAYER(GC.getGameINLINE().getActivePlayer()).canResearch((TechTypes)iI));
}
if (!bTechAlreadyAccessible)
{
bool bTechFound = false;
if (!bTechFound)
{
for (int iJ = 0; iJ < GC.getDefineINT("NUM_OR_TECH_PREREQS"); iJ++)
{
if (GC.getTechInfo((TechTypes) iI).getPrereqOrTechs(iJ) == eTech)
{
bTechFound = true;
break;
}
}
}
if (!bTechFound)
{
for (int iJ = 0; iJ < GC.getDefineINT("NUM_AND_TECH_PREREQS"); iJ++)
{
if (GC.getTechInfo((TechTypes) iI).getPrereqAndTechs(iJ) == eTech)
{
bTechFound = true;
break;
}
}
}
if (bTechFound)
{
swprintf(szTempBuffer, SETCOLR L" %s" ENDCOLR , TEXT_COLOR("COLOR_TECH_TEXT"), GC.getTechInfo((TechTypes) iI).getDescription());
setListHelp(szBuffer, gDLL->getText("TXT_KEY_MISC_LEADS_TO").c_str(), szTempBuffer, L", ", bFirst);
bFirst = false;
}
}
}
}
// Information about other prerequisite technologies to eTech besides eFromTech
void CvGameTextMgr::buildTechTreeString(CvWString &szBuffer, TechTypes eTech, bool bPlayerContext, TechTypes eFromTech)
{
wchar szTempBuffer[1024]; // Formatting
if (NO_TECH == eTech || NO_TECH == eFromTech)
{
return;
}
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR, TEXT_COLOR("COLOR_TECH_TEXT"), GC.getTechInfo(eTech).getDescription());
szBuffer += szTempBuffer;
// Loop through OR prerequisites to make list
CvWString szOtherOrTechs;
int nOtherOrTechs = 0;
bool bOrTechFound = false;
for (int iJ = 0; iJ < GC.getDefineINT("NUM_OR_TECH_PREREQS"); iJ++)
{
TechTypes eTestTech = (TechTypes)GC.getTechInfo(eTech).getPrereqOrTechs(iJ);
if (eTestTech >= 0)
{
bool bTechAlreadyResearched = false;
if (bPlayerContext)
{
bTechAlreadyResearched = GET_TEAM(GC.getGameINLINE().getActiveTeam()).isHasTech(eTestTech);
}
if (!bTechAlreadyResearched)
{
if (eTestTech == eFromTech)
{
bOrTechFound = true;
}
else
{
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_TECH_TEXT"), GC.getTechInfo(eTestTech).getDescription());
setListHelp(szOtherOrTechs, L"", szTempBuffer, gDLL->getText("TXT_KEY_OR").c_str(), 0 == nOtherOrTechs);
nOtherOrTechs++;
}
}
}
}
// Loop through AND prerequisites to make list
CvWString szOtherAndTechs;
int nOtherAndTechs = 0;
bool bAndTechFound = false;
for (int iJ = 0; iJ < GC.getDefineINT("NUM_AND_TECH_PREREQS"); iJ++)
{
TechTypes eTestTech = (TechTypes)GC.getTechInfo(eTech).getPrereqAndTechs(iJ);
if (eTestTech >= 0)
{
bool bTechAlreadyResearched = false;
if (bPlayerContext)
{
bTechAlreadyResearched = GET_TEAM(GC.getGameINLINE().getActiveTeam()).isHasTech(eTestTech);
}
if (!bTechAlreadyResearched)
{
if (eTestTech == eFromTech)
{
bAndTechFound = true;
}
else
{
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_TECH_TEXT"), GC.getTechInfo(eTestTech).getDescription());
setListHelp(szOtherAndTechs, L"", szTempBuffer, L", ", 0 == nOtherAndTechs);
nOtherAndTechs++;
}
}
}
}
if (bOrTechFound || bAndTechFound)
{
if (nOtherAndTechs > 0 || nOtherOrTechs > 0)
{
szBuffer += L" ";
if (nOtherAndTechs > 0)
{
szBuffer += gDLL->getText("TXT_KEY_WITH_SPACE");
szBuffer += szOtherAndTechs;
}
if (nOtherOrTechs > 0)
{
if (bAndTechFound)
{
if (nOtherAndTechs > 0)
{
szBuffer += gDLL->getText("TXT_KEY_AND_SPACE");
}
else
{
szBuffer += gDLL->getText("TXT_KEY_WITH_SPACE");
}
szBuffer += szOtherOrTechs;
}
else if (bOrTechFound)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_MISC_ALTERNATIVELY_DERIVED", GC.getTechInfo(eTech).getTextKeyWide(), szOtherOrTechs.GetCString());
}
}
}
}
}
void CvGameTextMgr::setPromotionHelp(CvWString &szBuffer, PromotionTypes ePromotion, bool bCivilopediaText)
{
if (!bCivilopediaText)
{
wchar szTempBuffer[256];
if (NO_PROMOTION == ePromotion)
{
return;
}
CvPromotionInfo& promo = GC.getPromotionInfo(ePromotion);
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR , TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), promo.getDescription());
szBuffer += szTempBuffer;
}
parsePromotionHelp(szBuffer, ePromotion);
}
void CvGameTextMgr::setUnitCombatHelp(CvWString &szBuffer, UnitCombatTypes eUnitCombat)
{
szBuffer += GC.getUnitCombatInfo(eUnitCombat).getDescription();
}
void CvGameTextMgr::setImprovementHelp(CvWString &szBuffer, ImprovementTypes eImprovement, bool bCivilopediaText)
{
wchar szTempBuffer[256];
wchar szFirstBuffer[256];
int iTurns;
if (NO_IMPROVEMENT == eImprovement)
{
return;
}
CvImprovementInfo& info = GC.getImprovementInfo(eImprovement);
if (!bCivilopediaText)
{
swprintf(szTempBuffer, SETCOLR L"%s" ENDCOLR, TEXT_COLOR("COLOR_HIGHLIGHT_TEXT"), info.getDescription());
szBuffer += szTempBuffer;
setYieldChangeHelp(szBuffer, L", ", L"", L"", info.getYieldChangeArray(), false, false);
setYieldChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_MISC_WITH_IRRIGATION").c_str(), info.getIrrigatedYieldChangeArray());
setYieldChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_MISC_ON_HILLS").c_str(), info.getHillsYieldChangeArray());
setYieldChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_MISC_ALONG_RIVER").c_str(), info.getRiverSideYieldChangeArray());
for (int iTech = 0; iTech < GC.getNumTechInfos(); iTech++)
{
for (int iYield = 0; iYield < NUM_YIELD_TYPES; iYield++)
{
if (0 != info.getTechYieldChanges(iTech, iYield))
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_IMPROVEMENT_WITH_TECH", info.getTechYieldChanges(iTech, iYield), GC.getYieldInfo((YieldTypes)iYield).getChar(), GC.getTechInfo((TechTypes)iTech).getTextKeyWide());
}
}
}
// Civics
for (int iYield = 0; iYield < NUM_YIELD_TYPES; iYield++)
{
for (int iCivic = 0; iCivic < GC.getNumCivicInfos(); iCivic++)
{
int iChange = GC.getCivicInfo((CivicTypes)iCivic).getImprovementYieldChanges(eImprovement, iYield);
if (0 != iChange)
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_CIVIC_IMPROVEMENT_YIELD_CHANGE", iChange, GC.getYieldInfo((YieldTypes)iYield).getChar(), GC.getCivicInfo((CivicTypes)iCivic).getTextKeyWide());
}
}
}
}
if (info.isRequiresRiverSide())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_IMPROVEMENT_REQUIRES_RIVER");
}
if (info.isCarriesIrrigation())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_IMPROVEMENT_CARRIES_IRRIGATION");
}
if (bCivilopediaText)
{
if (info.isNoFreshWater())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_IMPROVEMENT_NO_BUILD_FRESH_WATER");
}
if (info.isWater())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_IMPROVEMENT_BUILD_ONLY_WATER");
}
if (info.isRequiresFlatlands())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_IMPROVEMENT_ONLY_BUILD_FLATLANDS");
}
}
if (info.getImprovementUpgrade() != NO_IMPROVEMENT)
{
iTurns = GC.getGameINLINE().getImprovementUpgradeTime(eImprovement);
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_IMPROVEMENT_EVOLVES", GC.getImprovementInfo((ImprovementTypes) info.getImprovementUpgrade()).getTextKeyWide(), iTurns);
}
int iLast = -1;
for (int iBonus = 0; iBonus < GC.getNumBonusInfos(); iBonus++)
{
int iRand = info.getImprovementBonusDiscoverRand(iBonus);
if (iRand > 0)
{
swprintf(szFirstBuffer, L"%s%s", NEWLINE, gDLL->getText("TXT_KEY_IMPROVEMENT_CHANCE_DISCOVER").c_str());
swprintf(szTempBuffer, L"%c", GC.getBonusInfo((BonusTypes) iBonus).getChar());
setListHelp(szBuffer, szFirstBuffer, szTempBuffer, L", ", iRand != iLast);
iLast = iRand;
}
}
if (info.getDefenseModifier())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_IMPROVEMENT_DEFENSE_MODIFIER", info.getDefenseModifier());
}
if (bCivilopediaText)
{
if (info.getPillageGold() > 0)
{
// swprintf(szTempBuffer, L"\n%cPillage yields %d%c on average", gDLL->getSymbolID(BULLET_CHAR), info.getPillageGold(), GC.getYieldInfo(YIELD_COMMERCE).getChar());
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_IMPROVEMENT_PILLAGE_YIELDS", info.getPillageGold());
}
}
}
void CvGameTextMgr::getDealString(CvWString& szBuffer, CvDeal& deal, PlayerTypes ePlayerPerspective)
{
PlayerTypes ePlayer1 = deal.getFirstPlayer();
PlayerTypes ePlayer2 = deal.getSecondPlayer();
if (NO_PLAYER == ePlayer1 || NO_PLAYER == ePlayer2)
{
FAssertMsg(false, "Deal needs two parties");
return;
}
CvWString szDealOne;
CLinkList* pTrades = deal.getFirstTrades();
if (NULL != pTrades && pTrades->getLength() > 0)
{
CLLNode* pTradeNode;
bool bFirst = true;
for (pTradeNode = pTrades->head(); pTradeNode; pTradeNode = pTrades->next(pTradeNode))
{
CvWString szTrade;
getTradeString(szTrade, pTradeNode->m_data, deal.getFirstPlayer(), deal.getSecondPlayer());
setListHelp(szDealOne, L"", szTrade, L", ", bFirst);
bFirst = false;
}
}
CvWString szDealTwo;
pTrades = deal.getSecondTrades();
if (NULL != pTrades && pTrades->getLength() > 0)
{
CLLNode* pTradeNode;
bool bFirst = true;
for (pTradeNode = pTrades->head(); pTradeNode; pTradeNode = pTrades->next(pTradeNode))
{
CvWString szTrade;
getTradeString(szTrade, pTradeNode->m_data, deal.getSecondPlayer(), deal.getFirstPlayer());
setListHelp(szDealTwo, L"", szTrade, L", ", bFirst);
bFirst = false;
}
}
if (!szDealOne.empty())
{
if (!szDealTwo.empty())
{
if (ePlayerPerspective == ePlayer1)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_OUR_DEAL", szDealOne.GetCString(), GET_PLAYER(ePlayer2).getNameKey(), szDealTwo.GetCString());
}
else if (ePlayerPerspective == ePlayer2)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_OUR_DEAL", szDealTwo.GetCString(), GET_PLAYER(ePlayer1).getNameKey(), szDealOne.GetCString());
}
else
{
szBuffer += gDLL->getText("TXT_KEY_MISC_DEAL", GET_PLAYER(ePlayer1).getNameKey(), szDealOne.GetCString(), GET_PLAYER(ePlayer2).getNameKey(), szDealTwo.GetCString());
}
}
else
{
if (ePlayerPerspective == ePlayer1)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_DEAL_ONESIDED_OURS", szDealOne.GetCString(), GET_PLAYER(ePlayer2).getNameKey());
}
else if (ePlayerPerspective == ePlayer2)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_DEAL_ONESIDED_THEIRS", szDealOne.GetCString(), GET_PLAYER(ePlayer1).getNameKey());
}
else
{
szBuffer += gDLL->getText("TXT_KEY_MISC_DEAL_ONESIDED", GET_PLAYER(ePlayer1).getNameKey(), szDealOne.GetCString(), GET_PLAYER(ePlayer2).getNameKey());
}
}
}
else if (!szDealTwo.empty())
{
if (ePlayerPerspective == ePlayer1)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_DEAL_ONESIDED_THEIRS", szDealTwo.GetCString(), GET_PLAYER(ePlayer2).getNameKey());
}
else if (ePlayerPerspective == ePlayer2)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_DEAL_ONESIDED_OURS", szDealTwo.GetCString(), GET_PLAYER(ePlayer1).getNameKey());
}
else
{
szBuffer += gDLL->getText("TXT_KEY_MISC_DEAL_ONESIDED", GET_PLAYER(ePlayer2).getNameKey(), szDealTwo.GetCString(), GET_PLAYER(ePlayer1).getNameKey());
}
}
}
void CvGameTextMgr::getAttitudeString(CvWString& szBuffer, PlayerTypes ePlayer, PlayerTypes eTargetPlayer)
{
CvWString szTempBuffer;
int iAttitudeChange;
int iPass;
int iI;
szBuffer += gDLL->getText("TXT_KEY_ATTITUDE_TOWARDS", GC.getAttitudeInfo(GET_PLAYER(ePlayer).AI_getAttitude(eTargetPlayer)).getTextKeyWide(), GET_PLAYER(eTargetPlayer).getNameKey());
for (iPass = 0; iPass < 2; iPass++)
{
iAttitudeChange = GET_PLAYER(ePlayer).AI_getCloseBordersAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_LAND_TARGET", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getWarAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_WAR", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getPeaceAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_PEACE", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getSameReligionAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_SAME_RELIGION", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getDifferentReligionAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_DIFFERENT_RELIGION", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getBonusTradeAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_BONUS_TRADE", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getOpenBordersAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_OPEN_BORDERS", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getDefensivePactAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_DEFENSIVE_PACT", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getRivalDefensivePactAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_RIVAL_DEFENSIVE_PACT", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getShareWarAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_SHARE_WAR", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getFavoriteCivicAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_FAVORITE_CIVIC", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getTradeAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_TRADE", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
iAttitudeChange = GET_PLAYER(ePlayer).AI_getRivalTradeAttitude(eTargetPlayer);
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_RIVAL_TRADE", iAttitudeChange).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
for (iI = 0; iI < NUM_MEMORY_TYPES; iI++)
{
iAttitudeChange = GET_PLAYER(ePlayer).AI_getMemoryAttitude(eTargetPlayer, ((MemoryTypes)iI));
if ((iPass == 0) ? (iAttitudeChange > 0) : (iAttitudeChange < 0))
{
szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR((iAttitudeChange > 0) ? "COLOR_POSITIVE_TEXT" : "COLOR_NEGATIVE_TEXT"), gDLL->getText("TXT_KEY_MISC_ATTITUDE_MEMORY", iAttitudeChange, GC.getMemoryInfo((MemoryTypes)iI).getDescription()).GetCString());
szBuffer += NEWLINE + szTempBuffer;
}
}
}
}
void CvGameTextMgr::getTradeString(CvWString& szBuffer, const TradeData& tradeData, PlayerTypes ePlayer1, PlayerTypes ePlayer2)
{
switch (tradeData.m_eItemType)
{
case TRADE_GOLD:
szBuffer += gDLL->getText("TXT_KEY_MISC_GOLD", tradeData.m_iData);
break;
case TRADE_GOLD_PER_TURN:
szBuffer += gDLL->getText("TXT_KEY_MISC_GOLD_PER_TURN", tradeData.m_iData);
break;
case TRADE_MAPS:
szBuffer += gDLL->getText("TXT_KEY_MISC_WORLD_MAP");
break;
case TRADE_OPEN_BORDERS:
szBuffer += gDLL->getText("TXT_KEY_MISC_OPEN_BORDERS");
break;
case TRADE_DEFENSIVE_PACT:
szBuffer += gDLL->getText("TXT_KEY_MISC_DEFENSIVE_PACT");
break;
case TRADE_PERMANENT_ALLIANCE:
szBuffer += gDLL->getText("TXT_KEY_MISC_PERMANENT_ALLIANCE");
break;
case TRADE_PEACE_TREATY:
szBuffer += gDLL->getText("TXT_KEY_MISC_PEACE_TREATY", GC.getDefineINT("PEACE_TREATY_LENGTH"));
break;
case TRADE_TECHNOLOGIES:
szBuffer.Format(L"%s", GC.getTechInfo((TechTypes)tradeData.m_iData).getDescription());
break;
case TRADE_RESOURCES:
szBuffer.Format(L"%s", GC.getBonusInfo((BonusTypes)tradeData.m_iData).getDescription());
break;
case TRADE_CITIES:
szBuffer.Format(L"%s", GET_PLAYER(ePlayer1).getCity(tradeData.m_iData)->getName());
break;
case TRADE_PEACE:
case TRADE_WAR:
case TRADE_EMBARGO:
szBuffer.Format(L"%s", GET_TEAM((TeamTypes)tradeData.m_iData).getName().GetCString());
break;
case TRADE_CIVIC:
szBuffer.Format(L"%s", GC.getCivicInfo((CivicTypes)tradeData.m_iData).getDescription());
break;
case TRADE_RELIGION:
szBuffer.Format(L"%s", GC.getReligionInfo((ReligionTypes)tradeData.m_iData).getDescription());
break;
default:
FAssert(false);
break;
}
}
void CvGameTextMgr::setFeatureHelp(CvWString &szBuffer, FeatureTypes eFeature, bool bCivilopediaText)
{
if (NO_FEATURE == eFeature)
{
return;
}
CvFeatureInfo& feature = GC.getFeatureInfo(eFeature);
int aiYields[NUM_YIELD_TYPES];
if (!bCivilopediaText)
{
szBuffer += feature.getDescription();
for (int iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
aiYields[iI] = feature.getYieldChange(iI);
}
setYieldChangeHelp(szBuffer, L"", L"", L"", aiYields);
}
for (int iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
aiYields[iI] = feature.getRiverYieldChange(iI);
}
setYieldChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_TERRAIN_NEXT_TO_RIVER"), aiYields);
for (int iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
aiYields[iI] = feature.getHillsYieldChange(iI);
}
setYieldChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_TERRAIN_ON_HILLS"), aiYields);
if (feature.getMovementCost() != 1)
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_MOVEMENT_COST", feature.getMovementCost());
}
CvWString szHealth;
szHealth.Format(L"%.2f", 0.01f * abs(feature.getHealthPercent()));
if (feature.getHealthPercent() > 0)
{
szBuffer += gDLL->getText("TXT_KEY_FEATURE_GOOD_HEALTH", szHealth.GetCString());
}
else if (feature.getHealthPercent() < 0)
{
szBuffer += gDLL->getText("TXT_KEY_FEATURE_BAD_HEALTH", szHealth.GetCString());
}
if (feature.getDefenseModifier() != 0)
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_DEFENSE_MODIFIER", feature.getDefenseModifier());
}
if (feature.isAddsFreshWater())
{
szBuffer += gDLL->getText("TXT_KEY_FEATURE_ADDS_FRESH_WATER");
}
if (feature.isImpassable())
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_IMPASSABLE");
}
if (feature.isNoCity())
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_NO_CITIES");
}
if (feature.isNoImprovement())
{
szBuffer += gDLL->getText("TXT_KEY_FEATURE_NO_IMPROVEMENT");
}
}
void CvGameTextMgr::setTerrainHelp(CvWString &szBuffer, TerrainTypes eTerrain, bool bCivilopediaText)
{
if (NO_TERRAIN == eTerrain)
{
return;
}
CvTerrainInfo& terrain = GC.getTerrainInfo(eTerrain);
int aiYields[NUM_YIELD_TYPES];
if (!bCivilopediaText)
{
szBuffer += terrain.getDescription();
for (int iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
aiYields[iI] = terrain.getYield(iI);
}
setYieldChangeHelp(szBuffer, L"", L"", L"", aiYields);
}
for (int iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
aiYields[iI] = terrain.getRiverYieldChange(iI);
}
setYieldChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_TERRAIN_NEXT_TO_RIVER"), aiYields);
for (int iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
aiYields[iI] = terrain.getHillsYieldChange(iI);
}
setYieldChangeHelp(szBuffer, L"", L"", gDLL->getText("TXT_KEY_TERRAIN_ON_HILLS"), aiYields);
if (terrain.getMovementCost() != 1)
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_MOVEMENT_COST", terrain.getMovementCost());
}
if (terrain.getBuildModifier() != 0)
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_BUILD_MODIFIER", terrain.getBuildModifier());
}
if (terrain.getDefenseModifier() != 0)
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_DEFENSE_MODIFIER", terrain.getDefenseModifier());
}
if (terrain.isImpassable())
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_IMPASSABLE");
}
if (!terrain.isFound())
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_NO_CITIES");
bool bFirst = true;
if (terrain.isFoundCoast())
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_COASTAL_CITIES");
bFirst = false;
}
if (!bFirst)
{
szBuffer += gDLL->getText("TXT_KEY_OR");
}
if (terrain.isFoundFreshWater())
{
szBuffer += gDLL->getText("TXT_KEY_TERRAIN_FRESH_WATER_CITIES");
bFirst = false;
}
}
}
void CvGameTextMgr::buildFinanceInflationString(CvWString& szBuffer, PlayerTypes ePlayer)
{
if (NO_PLAYER == ePlayer)
{
return;
}
CvPlayer& player = GET_PLAYER(ePlayer);
int iInflationRate = player.calculateInflationRate();
if (iInflationRate != 0)
{
int iPreInflation = player.calculatePreInflatedCosts();
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_FINANCE_ADVISOR_INFLATION", iPreInflation, iInflationRate, iInflationRate, iPreInflation, (iPreInflation * iInflationRate) / 100);
}
}
void CvGameTextMgr::buildFinanceUnitCostString(CvWString& szBuffer, PlayerTypes ePlayer)
{
if (NO_PLAYER == ePlayer)
{
return;
}
CvPlayer& player = GET_PLAYER(ePlayer);
int iFreeUnits = 0;
int iFreeMilitaryUnits = 0;
int iUnits = player.getNumUnits();
int iMilitaryUnits = player.getNumMilitaryUnits();
int iPaidUnits = iUnits;
int iPaidMilitaryUnits = iMilitaryUnits;
int iMilitaryCost = 0;
int iBaseUnitCost = 0;
int iExtraCost = 0;
int iCost = player.calculateUnitCost(iFreeUnits, iFreeMilitaryUnits, iPaidUnits, iPaidMilitaryUnits, iBaseUnitCost, iMilitaryCost, iExtraCost);
int iHandicap = iCost-iBaseUnitCost-iMilitaryCost-iExtraCost;
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_FINANCE_ADVISOR_UNIT_COST", iPaidUnits, iFreeUnits, iBaseUnitCost);
if (iPaidMilitaryUnits != 0)
{
szBuffer += gDLL->getText("TXT_KEY_FINANCE_ADVISOR_UNIT_COST_2", iPaidMilitaryUnits, iFreeMilitaryUnits, iMilitaryCost);
}
if (iExtraCost != 0)
{
szBuffer += gDLL->getText("TXT_KEY_FINANCE_ADVISOR_UNIT_COST_3", iExtraCost);
}
if (iHandicap != 0)
{
szBuffer += gDLL->getText("TXT_KEY_FINANCE_ADVISOR_HANDICAP_COST", iHandicap);
}
szBuffer += gDLL->getText("TXT_KEY_FINANCE_ADVISOR_UNIT_COST_4", iCost);
}
void CvGameTextMgr::buildFinanceAwaySupplyString(CvWString& szBuffer, PlayerTypes ePlayer)
{
if (NO_PLAYER == ePlayer)
{
return;
}
CvPlayer& player = GET_PLAYER(ePlayer);
int iPaidUnits = 0;
int iBaseCost = 0;
int iCost = player.calculateUnitSupply(iPaidUnits, iBaseCost);
int iHandicap = iCost - iBaseCost;
CvWString szHandicap;
if (iHandicap != 0)
{
szHandicap = gDLL->getText("TXT_KEY_FINANCE_ADVISOR_HANDICAP_COST", iHandicap);
}
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_FINANCE_ADVISOR_SUPPLY_COST", iPaidUnits, GC.getDefineINT("INITIAL_FREE_OUTSIDE_UNITS"), iBaseCost, szHandicap.GetCString(), iCost);
}
void CvGameTextMgr::buildFinanceCityMaintString(CvWString& szBuffer, PlayerTypes ePlayer)
{
if (NO_PLAYER == ePlayer)
{
return;
}
int iLoop;
int iDistanceMaint = 0;
CvPlayer& player = GET_PLAYER(ePlayer);
for (CvCity* pLoopCity = player.firstCity(&iLoop); pLoopCity != NULL; pLoopCity = player.nextCity(&iLoop))
{
iDistanceMaint += (pLoopCity->calculateDistanceMaintenance() * max(0, (pLoopCity->getMaintenanceModifier() + 100))) / 100;
}
int iNumCityMaint = player.getTotalMaintenance() - iDistanceMaint;
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_FINANCE_ADVISOR_CITY_MAINT_COST", iDistanceMaint, iNumCityMaint, player.getTotalMaintenance());
}
void CvGameTextMgr::buildFinanceCivicUpkeepString(CvWString& szBuffer, PlayerTypes ePlayer)
{
if (NO_PLAYER == ePlayer)
{
return;
}
CvPlayer& player = GET_PLAYER(ePlayer);
CvWString szCivicOptionCosts;
for (int iI = 0; iI < GC.getNumCivicOptionInfos(); iI++)
{
CivicTypes eCivic = player.getCivics((CivicOptionTypes)iI);
if (NO_CIVIC != eCivic)
{
CvWString szTemp;
szTemp.Format(L"%d%c: %s", player.getSingleCivicUpkeep(eCivic), GC.getCommerceInfo(COMMERCE_GOLD).getChar(), GC.getCivicInfo(eCivic).getDescription());
szCivicOptionCosts += NEWLINE + szTemp;
}
}
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_FINANCE_ADVISOR_CIVIC_UPKEEP_COST", szCivicOptionCosts.GetCString(), player.getCivicUpkeep());
}
void CvGameTextMgr::buildFinanceForeignIncomeString(CvWString& szBuffer, PlayerTypes ePlayer)
{
if (NO_PLAYER == ePlayer)
{
return;
}
CvPlayer& player = GET_PLAYER(ePlayer);
CvWString szPlayerIncome;
for (int iI = 0; iI < MAX_PLAYERS; iI++)
{
CvPlayer& otherPlayer = GET_PLAYER((PlayerTypes)iI);
if (otherPlayer.isAlive() && player.getGoldPerTurnByPlayer((PlayerTypes)iI) != 0)
{
CvWString szTemp;
szTemp.Format(L"%d%c: %s", player.getGoldPerTurnByPlayer((PlayerTypes)iI), GC.getCommerceInfo(COMMERCE_GOLD).getChar(), otherPlayer.getCivilizationShortDescription());
szPlayerIncome += szTemp;
}
}
if (!szPlayerIncome.empty())
{
szBuffer += NEWLINE + gDLL->getText("TXT_KEY_FINANCE_ADVISOR_FOREIGN_INCOME", szPlayerIncome.GetCString(), player.getGoldPerTurn());
}
}
void CvGameTextMgr::setProductionHelp(CvWString &szBuffer, CvCity& city)
{
FAssertMsg(NO_PLAYER != city.getOwnerINLINE(), "City must have an owner");
int iPastOverflow = (city.isProductionProcess() ? 0 : city.getOverflowProduction());
if (iPastOverflow != 0)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_OVERFLOW", iPastOverflow) + NEWLINE;
}
if (city.getCurrentProductionDifference(false, true) == 0)
{
return;
}
setYieldHelp(szBuffer, city, YIELD_PRODUCTION);
int iBaseProduction = city.getBaseYieldRate(YIELD_PRODUCTION) + iPastOverflow;
int iBaseModifier = city.getBaseYieldRateModifier(YIELD_PRODUCTION);
UnitTypes eUnit = city.getProductionUnit();
if (NO_UNIT != eUnit)
{
CvUnitInfo& unit = GC.getUnitInfo(eUnit);
// Domain
int iDomainMod = city.getDomainProductionModifier((DomainTypes)unit.getDomainType());
if (0 != iDomainMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_DOMAIN", iDomainMod, GC.getDomainInfo((DomainTypes)unit.getDomainType()).getTextKeyWide()) + NEWLINE;
iBaseModifier += iDomainMod;
}
// Military
if (unit.isMilitaryProduction())
{
int iMilitaryMod = city.getMilitaryProductionModifier() + GET_PLAYER(city.getOwnerINLINE()).getMilitaryProductionModifier();
if (0 != iMilitaryMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_MILITARY", iMilitaryMod) + NEWLINE;
iBaseModifier += iMilitaryMod;
}
}
// Bonus
for (int i = 0; i < GC.getNumBonusInfos(); i++)
{
if (city.hasBonus((BonusTypes)i))
{
int iBonusMod = unit.getBonusProductionModifier(i);
if (0 != iBonusMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_MOD_BONUS", iBonusMod, unit.getTextKeyWide(), GC.getBonusInfo((BonusTypes)i).getTextKeyWide()) + NEWLINE;
iBaseModifier += iBonusMod;
}
}
}
// Trait
for (int i = 0; i < GC.getNumTraitInfos(); i++)
{
if (city.hasTrait((TraitTypes)i))
{
int iTraitMod = unit.getProductionTraits(i);
if (unit.getSpecialUnitType() != NO_SPECIALUNIT)
{
iTraitMod += GC.getSpecialUnitInfo((SpecialUnitTypes) unit.getSpecialUnitType()).getProductionTraits(i);
}
if (0 != iTraitMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_TRAIT", iTraitMod, unit.getTextKeyWide(), GC.getTraitInfo((TraitTypes)i).getTextKeyWide()) + NEWLINE;
iBaseModifier += iTraitMod;
}
}
}
// Religion
if (NO_PLAYER != city.getOwnerINLINE() && NO_RELIGION != GET_PLAYER(city.getOwnerINLINE()).getStateReligion())
{
if (city.isHasReligion(GET_PLAYER(city.getOwnerINLINE()).getStateReligion()))
{
int iReligionMod = GET_PLAYER(city.getOwnerINLINE()).getStateReligionUnitProductionModifier();
if (0 != iReligionMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_RELIGION", iReligionMod, GC.getReligionInfo(GET_PLAYER(city.getOwnerINLINE()).getStateReligion()).getTextKeyWide()) + NEWLINE;
iBaseModifier += iReligionMod;
}
}
}
}
BuildingTypes eBuilding = city.getProductionBuilding();
if (NO_BUILDING != eBuilding)
{
CvBuildingInfo& building = GC.getBuildingInfo(eBuilding);
// Bonus
for (int i = 0; i < GC.getNumBonusInfos(); i++)
{
if (city.hasBonus((BonusTypes)i))
{
int iBonusMod = building.getBonusProductionModifier(i);
if (0 != iBonusMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_MOD_BONUS", iBonusMod, building.getTextKeyWide(), GC.getBonusInfo((BonusTypes)i).getTextKeyWide()) + NEWLINE;
iBaseModifier += iBonusMod;
}
}
}
// Trait
for (int i = 0; i < GC.getNumTraitInfos(); i++)
{
if (city.hasTrait((TraitTypes)i))
{
int iTraitMod = building.getProductionTraits(i);
if (building.getSpecialBuildingType() != NO_SPECIALBUILDING)
{
iTraitMod += GC.getSpecialBuildingInfo((SpecialBuildingTypes) building.getSpecialBuildingType()).getProductionTraits(i);
}
if (0 != iTraitMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_TRAIT", iTraitMod, building.getTextKeyWide(), GC.getTraitInfo((TraitTypes)i).getTextKeyWide()) + NEWLINE;
iBaseModifier += iTraitMod;
}
}
}
// Wonder
if (isWorldWonderClass((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())) && NO_PLAYER != city.getOwnerINLINE())
{
int iWonderMod = GET_PLAYER(city.getOwnerINLINE()).getMaxGlobalBuildingProductionModifier();
if (0 != iWonderMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_WONDER", iWonderMod) + NEWLINE;
iBaseModifier += iWonderMod;
}
}
// Team Wonder
if (isTeamWonderClass((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())) && NO_PLAYER != city.getOwnerINLINE())
{
int iWonderMod = GET_PLAYER(city.getOwnerINLINE()).getMaxTeamBuildingProductionModifier();
if (0 != iWonderMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_TEAM_WONDER", iWonderMod) + NEWLINE;
iBaseModifier += iWonderMod;
}
}
// National Wonder
if (isNationalWonderClass((BuildingClassTypes)(GC.getBuildingInfo(eBuilding).getBuildingClassType())) && NO_PLAYER != city.getOwnerINLINE())
{
int iWonderMod = GET_PLAYER(city.getOwnerINLINE()).getMaxPlayerBuildingProductionModifier();
if (0 != iWonderMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_NATIONAL_WONDER", iWonderMod) + NEWLINE;
iBaseModifier += iWonderMod;
}
}
// Religion
if (NO_PLAYER != city.getOwnerINLINE() && NO_RELIGION != GET_PLAYER(city.getOwnerINLINE()).getStateReligion())
{
if (city.isHasReligion(GET_PLAYER(city.getOwnerINLINE()).getStateReligion()))
{
int iReligionMod = GET_PLAYER(city.getOwnerINLINE()).getStateReligionBuildingProductionModifier();
if (0 != iReligionMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_RELIGION", iReligionMod, GC.getReligionInfo(GET_PLAYER(city.getOwnerINLINE()).getStateReligion()).getTextKeyWide()) + NEWLINE;
iBaseModifier += iReligionMod;
}
}
}
}
ProjectTypes eProject = city.getProductionProject();
if (NO_PROJECT != eProject)
{
CvProjectInfo& project = GC.getProjectInfo(eProject);
// Spaceship
if (project.isSpaceship())
{
int iSpaceshipMod = city.getSpaceProductionModifier();
if (NO_PLAYER != city.getOwnerINLINE())
{
iSpaceshipMod += GET_PLAYER(city.getOwnerINLINE()).getSpaceProductionModifier();
}
if (0 != iSpaceshipMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_SPACESHIP", iSpaceshipMod) + NEWLINE;
iBaseModifier += iSpaceshipMod;
}
}
// Bonus
for (int i = 0; i < GC.getNumBonusInfos(); i++)
{
if (city.hasBonus((BonusTypes)i))
{
int iBonusMod = project.getBonusProductionModifier(i);
if (0 != iBonusMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_MOD_BONUS", iBonusMod, project.getTextKeyWide(), GC.getBonusInfo((BonusTypes)i).getTextKeyWide()) + NEWLINE;
iBaseModifier += iBonusMod;
}
}
}
}
int iFoodProduction = (city.isFoodProduction() ? max(0, (city.getYieldRate(YIELD_FOOD) - city.foodConsumption(true))) : 0);
if (iFoodProduction > 0)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_FOOD", iFoodProduction, iFoodProduction) + NEWLINE;
}
int iModProduction = iFoodProduction + (iBaseModifier * iBaseProduction) / 100;
FAssertMsg(iModProduction == city.getCurrentProductionDifference(false, true), "Modified Production does not match actual value");
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PROD_FINAL_YIELD", iModProduction) + NEWLINE;
}
void CvGameTextMgr::parseLeaderHeadHelp(CvWString &szBuffer, PlayerTypes eThisPlayer, PlayerTypes eOtherPlayer)
{
if (NO_PLAYER == eThisPlayer)
{
return;
}
szBuffer += CvWString::format(L"%s\n", GET_PLAYER(eThisPlayer).getName());
if (eOtherPlayer != NO_PLAYER)
{
CvTeam& thisTeam = GET_TEAM(GET_PLAYER(eThisPlayer).getTeam());
if (eOtherPlayer != eThisPlayer && thisTeam.isHasMet(GET_PLAYER(eOtherPlayer).getTeam()))
{
getAttitudeString(szBuffer, eThisPlayer, eOtherPlayer);
getActiveDealsString(szBuffer, eThisPlayer, eOtherPlayer);
}
}
}
void CvGameTextMgr::parseLeaderLineHelp(CvWString &szBuffer, PlayerTypes eThisPlayer, PlayerTypes eOtherPlayer)
{
if (NO_PLAYER == eThisPlayer || NO_PLAYER == eOtherPlayer)
{
return;
}
CvTeam& thisTeam = GET_TEAM(GET_PLAYER(eThisPlayer).getTeam());
CvTeam& otherTeam = GET_TEAM(GET_PLAYER(eOtherPlayer).getTeam());
if (thisTeam.getID() == otherTeam.getID())
{
szBuffer += gDLL->getText("TXT_KEY_MISC_PERMANENT_ALLIANCE") + NEWLINE;
}
else if (thisTeam.isAtWar(otherTeam.getID()))
{
szBuffer += gDLL->getText("TXT_KEY_CONCEPT_WAR") + NEWLINE;
}
else
{
if (thisTeam.isDefensivePact(otherTeam.getID()))
{
szBuffer += gDLL->getText("TXT_KEY_MISC_DEFENSIVE_PACT") + NEWLINE;
}
if (thisTeam.isOpenBorders(otherTeam.getID()))
{
szBuffer += gDLL->getText("TXT_KEY_MISC_OPEN_BORDERS") + NEWLINE;
}
}
}
void CvGameTextMgr::getActiveDealsString(CvWString &szBuffer, PlayerTypes eThisPlayer, PlayerTypes eOtherPlayer)
{
int iIndex;
CvDeal* pDeal = GC.getGameINLINE().firstDeal(&iIndex);
while (NULL != pDeal)
{
if ((pDeal->getFirstPlayer() == eThisPlayer && pDeal->getSecondPlayer() == eOtherPlayer)
|| (pDeal->getFirstPlayer() == eOtherPlayer && pDeal->getSecondPlayer() == eThisPlayer))
{
szBuffer += NEWLINE + CvWString::format(L"%c", gDLL->getSymbolID(BULLET_CHAR));
getDealString(szBuffer, *pDeal, eThisPlayer);
}
pDeal = GC.getGameINLINE().nextDeal(&iIndex);
}
}
void CvGameTextMgr::buildHintsList(CvWString& szBuffer)
{
for (int i = 0; i < GC.getNumHints(); i++)
{
szBuffer += CvWString::format(L"%c%s", gDLL->getSymbolID(BULLET_CHAR), GC.getHints(i).getText()) + NEWLINE + NEWLINE;
}
}
void CvGameTextMgr::setCommerceHelp(CvWString &szBuffer, CvCity& city, CommerceTypes eCommerceType)
{
if (NO_COMMERCE == eCommerceType || 0 == city.getCommerceRate(eCommerceType))
{
return;
}
CvCommerceInfo& info = GC.getCommerceInfo(eCommerceType);
if (NO_PLAYER == city.getOwnerINLINE())
{
return;
}
CvPlayer& owner = GET_PLAYER(city.getOwnerINLINE());
setYieldHelp(szBuffer, city, YIELD_COMMERCE);
int iBaseCommerce = city.getBaseYieldRate(YIELD_COMMERCE);
int iBaseModifier = city.getBaseYieldRateModifier(YIELD_COMMERCE);
// Slider
int iBaseCommerceRate = city.getCommerceFromPercent(eCommerceType, city.getYieldRate(YIELD_COMMERCE));
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_SLIDER_PERCENT", owner.getCommercePercent(eCommerceType), city.getYieldRate(YIELD_COMMERCE), iBaseCommerceRate, info.getChar()) + NEWLINE;
int iProductionToCommerce = (city.getProductionToCommerceModifier(eCommerceType) * city.getBaseYieldRate(YIELD_PRODUCTION)) / 100;
if (0 != iProductionToCommerce)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_PRODUCTION_TO_COMMERCE", iProductionToCommerce, info.getChar()) + NEWLINE;
iBaseCommerceRate += iProductionToCommerce;
}
int iSpecialistCommerce = city.getSpecialistCommerce(eCommerceType) + (city.getSpecialistPopulation() + city.getNumGreatPeople()) * owner.getSpecialistExtraCommerce(eCommerceType);
if (0 != iSpecialistCommerce)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_SPECIALIST_COMMERCE", iSpecialistCommerce, info.getChar(), L"TXT_KEY_CONCEPT_SPECIALISTS") + NEWLINE;
iBaseCommerceRate += iSpecialistCommerce;
}
int iReligionCommerce = city.getReligionCommerce(eCommerceType);
if (0 != iReligionCommerce)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_RELIGION_COMMERCE", iReligionCommerce, info.getChar()) + NEWLINE;
iBaseCommerceRate += iReligionCommerce;
}
int iBuildingCommerce = city.getBuildingCommerce(eCommerceType);
if (0 != iBuildingCommerce)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_BUILDING_COMMERCE", iBuildingCommerce, info.getChar()) + NEWLINE;
iBaseCommerceRate += iBuildingCommerce;
}
int iFreeCityCommerce = owner.getFreeCityCommerce(eCommerceType);
if (0 != iFreeCityCommerce)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_FREE_CITY_COMMERCE", iFreeCityCommerce, info.getChar()) + NEWLINE;
iBaseCommerceRate += iFreeCityCommerce;
}
FAssertMsg(city.getBaseCommerceRate(eCommerceType) == iBaseCommerceRate, "Base Commerce rate does not agree with actual value");
//szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_COMMERCE_BASE", info.getTextKeyWide(), iBaseYield, info.getChar()) + NEWLINE;
int iModifier = 100;
// Buildings
int iBuildingMod = 0;
for (int i = 0; i < GC.getNumBuildingInfos(); i++)
{
CvBuildingInfo& infoBuilding = GC.getBuildingInfo((BuildingTypes)i);
if (city.hasBuilding((BuildingTypes)i) && !GET_TEAM(city.getTeam()).isObsoleteBuilding((BuildingTypes)i))
{
iBuildingMod += infoBuilding.getCommerceModifier(eCommerceType);
}
for (int j = 0; j < MAX_PLAYERS; j++)
{
if (GET_PLAYER((PlayerTypes)j).isAlive())
{
if (GET_PLAYER((PlayerTypes)j).getTeam() == owner.getTeam())
{
int iLoop;
for (CvCity* pLoopCity = GET_PLAYER((PlayerTypes)j).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER((PlayerTypes)j).nextCity(&iLoop))
{
if (pLoopCity->hasBuilding((BuildingTypes)i) && !GET_TEAM(pLoopCity->getTeam()).isObsoleteBuilding((BuildingTypes)i))
{
iBuildingMod += infoBuilding.getGlobalCommerceModifier(eCommerceType);
}
}
}
}
}
}
if (0 != iBuildingMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_YIELD_BUILDINGS", iBuildingMod, info.getChar()) + NEWLINE;
iModifier += iBuildingMod;
}
// Trait
for (int i = 0; i < GC.getNumTraitInfos(); i++)
{
if (city.hasTrait((TraitTypes)i))
{
CvTraitInfo& trait = GC.getTraitInfo((TraitTypes)i);
int iTraitMod = trait.getCommerceModifier(eCommerceType);
if (0 != iTraitMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_COMMERCE_TRAIT", iTraitMod, info.getChar(), trait.getTextKeyWide()) + NEWLINE;
iModifier += iTraitMod;
}
}
}
// Capital
int iCapitalMod = city.isCapital() ? owner.getCapitalCommerceRateModifier(eCommerceType) : 0;
if (iCapitalMod != 0)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_YIELD_CAPITAL", iCapitalMod, info.getChar()) + NEWLINE;
iModifier += iCapitalMod;
}
// Civics
int iCivicMod = 0;
for (int i = 0; i < GC.getNumCivicOptionInfos(); i++)
{
if (NO_CIVIC != owner.getCivics((CivicOptionTypes)i))
{
iCivicMod += GC.getCivicInfo(owner.getCivics((CivicOptionTypes)i)).getCommerceModifier(eCommerceType);
}
}
if (0 != iCivicMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_YIELD_CIVICS", iCivicMod, info.getChar()) + NEWLINE;
iModifier += iCivicMod;
}
int iModYield = (iModifier * iBaseCommerceRate) / 100;
FAssertMsg(iModYield == city.getCommerceRate(eCommerceType), "Commerce yield does not match actual value");
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_COMMERCE_FINAL_YIELD", info.getTextKeyWide(), iModYield, info.getChar()) + NEWLINE;
}
void CvGameTextMgr::setYieldHelp(CvWString &szBuffer, CvCity& city, YieldTypes eYieldType)
{
FAssertMsg(NO_PLAYER != city.getOwnerINLINE(), "City must have an owner");
if (NO_YIELD == eYieldType)
{
return;
}
CvYieldInfo& info = GC.getYieldInfo(eYieldType);
if (NO_PLAYER == city.getOwnerINLINE())
{
return;
}
CvPlayer& owner = GET_PLAYER(city.getOwnerINLINE());
int iBaseProduction = city.getBaseYieldRate(eYieldType);
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_BASE_YIELD", info.getTextKeyWide(), iBaseProduction, info.getChar()) + NEWLINE;
int iBaseModifier = 100;
// Buildings
int iBuildingMod = 0;
for (int i = 0; i < GC.getNumBuildingInfos(); i++)
{
CvBuildingInfo& infoBuilding = GC.getBuildingInfo((BuildingTypes)i);
if (city.hasBuilding((BuildingTypes)i) && !GET_TEAM(city.getTeam()).isObsoleteBuilding((BuildingTypes)i))
{
iBuildingMod += infoBuilding.getYieldModifier(eYieldType);
}
for (int j = 0; j < MAX_PLAYERS; j++)
{
if (GET_PLAYER((PlayerTypes)j).isAlive())
{
if (GET_PLAYER((PlayerTypes)j).getTeam() == owner.getTeam())
{
int iLoop;
for (CvCity* pLoopCity = GET_PLAYER((PlayerTypes)j).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER((PlayerTypes)j).nextCity(&iLoop))
{
if (pLoopCity->hasBuilding((BuildingTypes)i) && !GET_TEAM(pLoopCity->getTeam()).isObsoleteBuilding((BuildingTypes)i))
{
iBuildingMod += infoBuilding.getGlobalYieldModifier(eYieldType);
}
}
}
}
}
}
if (NULL != city.area())
{
iBuildingMod += city.area()->getYieldRateModifier(city.getOwnerINLINE(), eYieldType);
}
if (0 != iBuildingMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_YIELD_BUILDINGS", iBuildingMod, info.getChar()) + NEWLINE;
iBaseModifier += iBuildingMod;
}
// Power
if (city.isPower())
{
int iPowerMod = city.getPowerYieldRateModifier(eYieldType);
if (0 != iPowerMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_YIELD_POWER", iPowerMod, info.getChar()) + NEWLINE;
iBaseModifier += iPowerMod;
}
}
// Resources
int iBonusMod = city.getBonusYieldRateModifier(eYieldType);
if (0 != iBonusMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_YIELD_BONUS", iBonusMod, info.getChar()) + NEWLINE;
iBaseModifier += iBonusMod;
}
// Capital
if (city.isCapital())
{
int iCapitalMod = owner.getCapitalYieldRateModifier(eYieldType);
if (0 != iCapitalMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_YIELD_CAPITAL", iCapitalMod, info.getChar()) + NEWLINE;
iBaseModifier += iCapitalMod;
}
}
// Civics
int iCivicMod = 0;
for (int i = 0; i < GC.getNumCivicOptionInfos(); i++)
{
if (NO_CIVIC != owner.getCivics((CivicOptionTypes)i))
{
iCivicMod += GC.getCivicInfo(owner.getCivics((CivicOptionTypes)i)).getYieldModifier(eYieldType);
}
}
if (0 != iCivicMod)
{
szBuffer += gDLL->getText("TXT_KEY_MISC_HELP_YIELD_CIVICS", iCivicMod, info.getChar()) + NEWLINE;
iBaseModifier += iCivicMod;
}
FAssertMsg((iBaseModifier * iBaseProduction) / 100 == city.getYieldRate(eYieldType), "Yield Modifier in setProductionHelp does not agree with actual value");