forked from github/server
Merge branch 'develop' of github.com:ennorehling/eressea into develop
This commit is contained in:
commit
00459782b9
38 changed files with 456 additions and 421 deletions
2
clibs
2
clibs
|
@ -1 +1 @@
|
|||
Subproject commit f9842e07a442c5453c270badf25ab72633b4edf5
|
||||
Subproject commit 9b6e34959f77d7ca3a4ce3826cb487487f557441
|
|
@ -39,7 +39,7 @@
|
|||
"entertain.perlevel": 20,
|
||||
"taxing.perlevel": 20,
|
||||
"nmr.timeout": 5,
|
||||
"nmr.removenewbie": 0,
|
||||
"nmr.removenewbie": false,
|
||||
"GiveRestriction": 3,
|
||||
"hunger.long": true,
|
||||
"init_spells": 0,
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{
|
||||
"include": [
|
||||
"config://res/translations/strings.de.po",
|
||||
"config://res/translations/strings-e2.de.po",
|
||||
"config://res/translations/strings.en.po",
|
||||
"config://res/translations/strings-e2.en.po",
|
||||
"config://res/translations/messages.de.po",
|
||||
"config://res/translations/messages.en.po",
|
||||
"config://res/core/messages.xml"
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
"entertain.base": 0,
|
||||
"entertain.perlevel": 20,
|
||||
"nmr.timeout": 5,
|
||||
"nmr.removenewbie": 0,
|
||||
"nmr.removenewbie": false,
|
||||
"GiveRestriction": 3,
|
||||
"healing.forest": 2.0,
|
||||
"hunger.long": false,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
SCRIPTS=compress.sh send-bz2-report send-zip-report create-orders \
|
||||
run-turn sendreports.sh
|
||||
IGNORE=sendreport.sh
|
||||
run-turn sendreports.sh sendreport.sh
|
||||
|
||||
shellcheck: $(SCRIPTS)
|
||||
shellcheck $(SCRIPTS)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
(
|
||||
[ "$PREVIEW" != "yes" ] && exit
|
||||
[ -z ${ERESSEA} ] && ERESSEA=$HOME/eressea
|
||||
|
||||
|
@ -13,3 +13,5 @@ for game in 2 3 4 ; do
|
|||
${SRC}/s/preview -g ${game} run && \
|
||||
${SRC}/s/preview -g ${game} send
|
||||
done
|
||||
) | tee -a $HOME/log/preview.cron.log
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
GAME=$1
|
||||
|
||||
(
|
||||
[ "$ENABLED" != "yes" ] && exit
|
||||
[ -z ${ERESSEA} ] && ERESSEA=$HOME/eressea
|
||||
|
||||
|
@ -58,3 +58,5 @@ $BIN/compress.sh $GAME $TURN
|
|||
$BIN/sendreports.sh $GAME
|
||||
$BIN/backup-eressea $GAME $TURN
|
||||
rm -f test/execute.lock
|
||||
) | tee -a $HOME/log/eressea.cron.log
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
PATH=$ERESSEA/bin:$PATH
|
||||
|
||||
function abort() {
|
||||
if [ $# -gt 0 ]; then
|
||||
echo $@
|
||||
fi
|
||||
exit -1
|
||||
}
|
|
@ -1,11 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
if [ -z $ERESSEA ]; then
|
||||
if [ -z "$ERESSEA" ]; then
|
||||
echo "You have to define the \$ERESSEA environment variable to run $0"
|
||||
exit -2
|
||||
fi
|
||||
source $HOME/bin/functions.sh
|
||||
|
||||
function abort() {
|
||||
if [ $# -gt 0 ]; then
|
||||
echo "$@"
|
||||
fi
|
||||
exit -1
|
||||
}
|
||||
|
||||
GAME=$1
|
||||
EMAIL=$2
|
||||
|
@ -14,32 +20,33 @@ PASSWD=$4
|
|||
#echo "$GAME $EMAIL $FACTION $PASSWD" >> /tmp/report.log
|
||||
|
||||
function reply() {
|
||||
echo $@ | mutt -s "Reportnachforderung Partei ${FACTION}" $EMAIL
|
||||
abort $@
|
||||
echo "$@" | mutt -s "Reportnachforderung Partei ${FACTION}" "$EMAIL"
|
||||
abort "$@"
|
||||
}
|
||||
|
||||
LOCKFILE=$ERESSEA/.report.lock
|
||||
[ -e $LOCKFILE ] && reply "lockfile exists. wait for mail delivery to finish."
|
||||
LOCKFILE="$ERESSEA/.report.lock"
|
||||
[ -e "$LOCKFILE" ] && reply "lockfile exists. wait for mail delivery to finish."
|
||||
|
||||
REPLYTO='accounts@eressea.de'
|
||||
echo "$(date):report:$GAME:$EMAIL:$FACTION:$PASSWD" >> "$ERESSEA/request.log"
|
||||
|
||||
echo `date`:report:$GAME:$EMAIL:$FACTION:$PASSWD >> $ERESSEA/request.log
|
||||
cd "$ERESSEA" || exit
|
||||
checkpasswd.py "game-$GAME/passwd" "$FACTION" "$PASSWD" || reply "Das Passwort fuer die Partei $FACTION ist ungueltig"
|
||||
|
||||
cd $ERESSEA
|
||||
checkpasswd.py game-$GAME/passwd $FACTION $PASSWD || reply "Das Passwort fuer die Partei $FACTION ist ungueltig"
|
||||
|
||||
cd $ERESSEA/game-$GAME/reports
|
||||
if [ ! -e ${FACTION}.sh ]; then
|
||||
cd "$ERESSEA/game-$GAME/reports" || exit
|
||||
if [ ! -e "${FACTION}.sh" ]; then
|
||||
echo "Der Report für Partei $FACTION kann wegen technischer Probleme leider nicht nachgefordert werden: No such file ${FACTION}.sh" \
|
||||
| mutt -s "Reportnachforderung Partei ${FACTION}" $EMAIL
|
||||
| mutt -s "Reportnachforderung Partei ${FACTION}" "$EMAIL"
|
||||
exit
|
||||
fi
|
||||
|
||||
source ${FACTION}.sh $EMAIL || reply "Unbekannte Partei $FACTION"
|
||||
bash "${FACTION}.sh" "$EMAIL" || reply "Unbekannte Partei $FACTION"
|
||||
|
||||
if [ -e $ERESSEA/game-$GAME/eressea.db ]; then
|
||||
if [ -e "$ERESSEA/game-$GAME/eressea.db" ]; then
|
||||
SQL="select email from faction f left join faction_data fd on fd.faction_id=f.id where f.game_id=$GAME AND fd.code='$FACTION' and fd.turn=(select max(turn) from faction_data fx where fx.faction_id=f.id)"
|
||||
OWNER=$(sqlite3 $ERESSEA/game-$GAME/eressea.db "$SQL")
|
||||
echo "Der Report Deiner Partei wurde an ${EMAIL} gesandt." \
|
||||
| mutt -s "Reportnachforderung Partei ${FACTION}" $OWNER
|
||||
OWNER=$(sqlite3 "$ERESSEA/game-$GAME/eressea.db" "$SQL")
|
||||
if [ ! -z "$OWNER" ]; then
|
||||
echo "Der Report Deiner Partei wurde an ${EMAIL} gesandt." \
|
||||
| mutt -s "Reportnachforderung Partei ${FACTION}" "$OWNER"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
49
res/translations/strings-e2.de.po
Normal file
49
res/translations/strings-e2.de.po
Normal file
|
@ -0,0 +1,49 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: de\n"
|
||||
"X-Generator: Poedit 2.0.7\n"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "concealing_aura"
|
||||
msgstr "Dieser Zauber wird die gesamte Ausrüstung der Zieleinheit für einige Zeit vor den Blicken anderer verschleiern."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "raindance"
|
||||
msgstr "Dieses uralte Tanzritual ruft die Kräfte des Lebens und der Fruchtbarkeit. Die Erträge der Bauern werden für einige Wochen deutlich besser ausfallen."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#gwyrrd"
|
||||
msgstr "Die Fähigkeiten der Gwyrrd-Magier in der Viehzucht und Heilung sind bei den Bauern sehr begehrt. Gerade auf Märkten sind ihre Dienste häufig sehr gefragt. Manch einer mag auch sein Talent dazu nutzen, ein Tier für einen besseren Preis zu verkaufen. Pro Stufe kann der Magier so 50 Silber verdienen."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#draig"
|
||||
msgstr "In den dunkleren Gassen gibt es sie, die Flüche und Verhexungen auf Bestellung. Aber auch Gegenzauber hat der Jünger des Draigs natürlich im Angebot. Ob nun der Sohn des Nachbarn in einen Liebesbann gezogen werden soll oder die Nebenbuhlerin Pickel und Warzen bekommen soll, niemand gibt gerne zu, zu solchen Mitteln gegriffen zu haben. Für diese Dienstleistung streicht der Magier 50 Silber pro Stufe ein."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#cerddor"
|
||||
msgstr "Cerddormagier sind die führenden Gaukler unter den Magiern, sie lieben es das Volk zu unterhalten und im Mittelpunkt zu stehen. Schon Anfänger lernen die kleinen Kunststücke und magischen Tricks, mit denen man das Volk locken und verführen kann, den Geldbeutel ganz weit zu öffnen, und am Ende der Woche wird der Gaukler 50 Silber pro Stufe verdient haben."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#tybied"
|
||||
msgstr "Wenn einem der Alchemist nicht weiterhelfen kann, geht man zu dem gelehrten Tybiedmagier. Seine Tränke und Tinkturen helfen gegen alles, was man sonst nicht bekommen kann. Ob nun die kryptische Formel unter dem Holzschuh des untreuen Ehemannes wirklich geholfen hat - nun, der des Lesens nicht mächtige Bauer wird es nie wissen. Dem Magier hilft es auf jeden Fall... beim Füllen seines Geldbeutels. 50 Silber pro Stufe lassen sich so in einer Woche verdienen."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#illaun"
|
||||
msgstr "Niemand kann so gut die Träume deuten wie ein Magier des Illaun. Auch die Kunst der Wahrsagerei, des Kartenlegens und des Handlesens sind ihm geläufig. Dafür zahlen ihm die Bauern 50 Silber pro Stufe."
|
||||
|
||||
msgctxt "describe"
|
||||
msgid "lifepotion"
|
||||
msgstr "Das 'Wasser des Lebens' ist in der Lage, aus gefällten Baumstämmen wieder lebende Bäume zu machen. Dazu wird ein knotiger Saugwurz zusammen mit einem Elfenlieb erwärmt, so dass man gerade noch den Finger reinhalten kann. Dies gieße man in ein Gefäß und lasse es langsam abkühlen. Der Extrakt reicht für 10 Holzstämme."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "blessedharvest"
|
||||
msgstr "Dieses Ernteritual verbessert die Erträge der arbeitenden Bauern in der Region um ein Silberstück. Je mehr Kraft der Druide investiert, desto länger wirkt der Zauber."
|
||||
|
49
res/translations/strings-e2.en.po
Normal file
49
res/translations/strings-e2.en.po
Normal file
|
@ -0,0 +1,49 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: en\n"
|
||||
"X-Generator: Poedit 2.0.7\n"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#gwyrrd"
|
||||
msgstr "The abilities of the mages of Gwyrrd concerning the breeding and healing of cattle are highly appreciated among the peasants. Especially at the markets, their services are demanded frequently. Some of them also use their talents to sell an animal at a higher price. A magician can earn 50 silver pieces per level in this way."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#draig"
|
||||
msgstr "In the dark alleys you can find those who sell curses and hexes on demand - but you can buy the apropriate counterspells from the followers of Draig as well. May it be a love spell for the son of a neighbour or a wart in the face of a rival. For offering these services, the sorcerer charges 50 silver pieces per level."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#cerddor"
|
||||
msgstr "The mages of Cerddor truly are the bards of the wizards; they love to use their sorcery to entertain the crowds and to be the center of attention. Even the apprentices study those little magic tricks, which attract and fascinate the people and thus ensnare them into leaving a few coins or more for the artist. By the end of the week, the bard will have earned 50 silver per level."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#illaun"
|
||||
msgstr "No one can read dreams as well as the mages of Illaun. Furthermore, they are also familiar with all other common means of foretelling the future like crystal balls, tarot cards or palms. A mentalist can earn 50 silver pieces per level and week for offering these services to peasants."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#tybied"
|
||||
msgstr "If the local alchemist could not help you, you should visit a scholar of Tybied. His potions and tinctures may help when nothing else does. If the cryptic formula under the wooden shoes of the unfaithful husband really helped? - well, the peasant, who isn't capable of reading, will never know. At least it helped the magician... to fill his purse. In one week he can earn 50 silver per level that way."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "blessedharvest"
|
||||
msgstr "This ritual increases the output of the local farms. Peasants in the region produce an extra silverpiece. The stronger the druid's spell is, the longer the effect will last."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "raindance"
|
||||
msgstr "This ancient rite calls upon the forces of life and fertility. For the next few weeks, the peasant's harvest will be extraordinary good."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "concealing_aura"
|
||||
msgstr "This spell will hide the whole equipment of a target unit from the looks of others."
|
||||
|
||||
msgctxt "describe"
|
||||
msgid "lifepotion"
|
||||
msgstr "The \"Water of Life\" allows living trees to be created from logs. A Knotroot and Elvendear are heated until one can just still keep one's finger in. This is then poured into a jar and allowed to cool slowly. The extract is sufficient for 10 pieces of wood."
|
||||
|
|
@ -327,10 +327,6 @@ msgctxt "spell"
|
|||
msgid "clone"
|
||||
msgstr "Seelenkopie"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "concealing_aura"
|
||||
msgstr "Dieser Zauber wird die gesamte Ausrüstung der Zieleinheit für einige Zeit vor den Blicken anderer verschleiern."
|
||||
|
||||
msgctxt "shipinfo"
|
||||
msgid "balloon"
|
||||
msgstr "Der Sumpfgasballon besteht aus einem großen Weidenkorb, welcher Platz für maximal 5 Personen oder 500 Gewichtseinheiten bietet, und einer großen, mit Sumpfgas gefüllten Wyrmblase. Bei guten Winden kann sich der Ballon zwei Regionen pro Woche fortbewegen. Das Führen eines Ballons ist nicht einfach, und der Kapitän muss mindestens ein Segeltalent von 6 besitzen. Diese neue Entwicklung auf Eressea wird ausschließlich für den Xontormia-Expreß hergestellt und die Baupläne sind streng geheim. So ist es auch bisher noch niemandem gelungen, ein Exemplar nachzubauen."
|
||||
|
@ -908,10 +904,6 @@ msgctxt "spellinfo"
|
|||
msgid "disturbingdreams"
|
||||
msgstr "Dieser Zauber führt in der betroffenen Region für einige Wochen zu Schlaflosigkeit und Unruhe. Den Betroffenen fällt das Lernen deutlich schwerer."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "raindance"
|
||||
msgstr "Dieses uralte Tanzritual ruft die Kräfte des Lebens und der Fruchtbarkeit. Die Erträge der Bauern werden für einige Wochen deutlich besser ausfallen."
|
||||
|
||||
msgid "wdw_pyramid"
|
||||
msgstr "Pyramide"
|
||||
|
||||
|
@ -1459,10 +1451,6 @@ msgctxt "race"
|
|||
msgid "goblin_x"
|
||||
msgstr "Goblin"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#gwyrrd"
|
||||
msgstr "Die Fähigkeiten der Gwyrrd-Magier in der Viehzucht und Heilung sind bei den Bauern sehr begehrt. Gerade auf Märkten sind ihre Dienste häufig sehr gefragt. Manch einer mag auch sein Talent dazu nutzen, ein Tier für einen besseren Preis zu verkaufen. Pro Stufe kann der Magier so 50 Silber verdienen."
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "raindance"
|
||||
msgstr "Regentanz"
|
||||
|
@ -1494,10 +1482,6 @@ msgstr "Mallorn"
|
|||
msgid "mallorn_p"
|
||||
msgstr "Mallorn"
|
||||
|
||||
msgctxt "describe"
|
||||
msgid "lifepotion"
|
||||
msgstr "Das 'Wasser des Lebens' ist in der Lage, aus gefällten Baumstämmen wieder lebende Bäume zu machen. Dazu wird ein knotiger Saugwurz zusammen mit einem Elfenlieb erwärmt, so dass man gerade noch den Finger reinhalten kann. Dies gieße man in ein Gefäß und lasse es langsam abkühlen. Der Extrakt reicht für 10 Holzstämme."
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "homestone"
|
||||
msgstr "Heimstein"
|
||||
|
@ -1740,10 +1724,6 @@ msgstr "Beschwörung eines Wasserelementares"
|
|||
msgid "GEBAEUDE"
|
||||
msgstr "GEBÄUDE"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "blessedharvest"
|
||||
msgstr "Dieses Ernteritual verbessert die Erträge der arbeitenden Bauern in der Region um ein Silberstück. Je mehr Kraft der Druide investiert, desto länger wirkt der Zauber."
|
||||
|
||||
msgid "KRAEUTER"
|
||||
msgstr "KRÄUTER"
|
||||
|
||||
|
@ -3147,10 +3127,6 @@ msgctxt "spellinfo"
|
|||
msgid "create_focus"
|
||||
msgstr "Erzeugt einen Aurafokus."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#draig"
|
||||
msgstr "In den dunkleren Gassen gibt es sie, die Flüche und Verhexungen auf Bestellung. Aber auch Gegenzauber hat der Jünger des Draigs natürlich im Angebot. Ob nun der Sohn des Nachbarn in einen Liebesbann gezogen werden soll oder die Nebenbuhlerin Pickel und Warzen bekommen soll, niemand gibt gerne zu, zu solchen Mitteln gegriffen zu haben. Für diese Dienstleistung streicht der Magier 50 Silber pro Stufe ein."
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "song_of_slavery"
|
||||
msgstr "Gesang der Versklavung"
|
||||
|
@ -4910,10 +4886,6 @@ msgstr "Elixier der Macht"
|
|||
msgid "wand_p"
|
||||
msgstr "Zauberstäbe"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#cerddor"
|
||||
msgstr "Cerddormagier sind _die_ Gaukler unter den Magiern, sie lieben es das Volk zu unterhalten und im Mittelpunkt zu stehen. Schon Anfänger lernen die kleinen Kunststücke und magischen Tricks, mit denen man das Volk locken und verführen kann, den Geldbeutel ganz weit zu öffnen, und am Ende der Woche wird der Gaukler 50 Silber pro Stufe verdient haben."
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "strength"
|
||||
msgstr "Unbekannter Effekt"
|
||||
|
@ -4996,10 +4968,6 @@ msgstr "Myrrhe"
|
|||
msgid "skeleton_prefix_9"
|
||||
msgstr "Dunkle"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#illaun"
|
||||
msgstr "Niemand kann so gut die Träume deuten wie ein Magier des Illaun. Auch die Kunst der Wahrsagerei, des Kartenlegens und des Handlesens sind ihm geläufig. Dafür zahlen ihm die Bauern 50 Silber pro Stufe."
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "big_recruit"
|
||||
msgstr "Hohe Kunst der Überzeugung"
|
||||
|
@ -5913,10 +5881,6 @@ msgctxt "spell"
|
|||
msgid "cerddorfumbleshield"
|
||||
msgstr "Bannlied"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#tybied"
|
||||
msgstr "Wenn einem der Alchemist nicht weiterhelfen kann, geht man zu dem gelehrten Tybiedmagier. Seine Tränke und Tinkturen helfen gegen alles, was man sonst nicht bekommen kann. Ob nun die kryptische Formel unter dem Holzschuh des untreuen Ehemannes wirklich geholfen hat - nun, der des Lesens nicht mächtige Bauer wird es nie wissen. Dem Magier hilft es auf jeden Fall... beim Füllen seines Geldbeutels. 50 Silber pro Stufe lassen sich so in einer Woche verdienen."
|
||||
|
||||
msgid "ANZAHL"
|
||||
msgstr "ANZAHL"
|
||||
|
||||
|
|
|
@ -273,10 +273,6 @@ msgctxt "spell"
|
|||
msgid "clone"
|
||||
msgstr "Doppelganger"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "concealing_aura"
|
||||
msgstr "This spell will hide the whole equipment of a target unit from the looks of others."
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "bloodsacrifice"
|
||||
msgstr "Lesser Sacrifice"
|
||||
|
@ -695,10 +691,6 @@ msgctxt "spellinfo"
|
|||
msgid "disturbingdreams"
|
||||
msgstr "This spell causes insomnia and restlessness in a whole region for several weeks. All affected persons will learn much slower than normal."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "raindance"
|
||||
msgstr "This ancient rite calls upon the forces of life and fertility. For the next few weeks, the peasant's harvest will be extraordinary good."
|
||||
|
||||
msgid "wdw_pyramid"
|
||||
msgstr "pyramid"
|
||||
|
||||
|
@ -1221,10 +1213,6 @@ msgctxt "race"
|
|||
msgid "goblin_x"
|
||||
msgstr "goblin"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#gwyrrd"
|
||||
msgstr "The abilities of the mages of Gwyrrd concerning the breeding and healing of cattle are highly appreciated among the peasants. Especially at the markets, their services are demanded frequently. Some of them also use their talents to sell an animal at a higher price. A magician can earn 50 silver pieces per level in this way."
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "raindance"
|
||||
msgstr "Rain Dance"
|
||||
|
@ -1252,10 +1240,6 @@ msgstr "mallorn"
|
|||
msgid "mallorn_p"
|
||||
msgstr "mallorn"
|
||||
|
||||
msgctxt "describe"
|
||||
msgid "lifepotion"
|
||||
msgstr "The \"Water of Life\" allows living trees to be created from logs. A Knotroot and Elvendear are heated until one can just still keep one's finger in. This is then poured into a jar and allowed to cool slowly. The extract is sufficient for 10 pieces of wood."
|
||||
|
||||
msgid "thickfog_trail"
|
||||
msgstr "%s"
|
||||
|
||||
|
@ -1490,10 +1474,6 @@ msgctxt "spell"
|
|||
msgid "goodwinds"
|
||||
msgstr "Summon Water Elemental"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "blessedharvest"
|
||||
msgstr "This ritual increases the output of the local farms. Peasants in the region produce an extra silverpiece. The stronger the druid's spell is, the longer the effect will last."
|
||||
|
||||
msgid "KRAEUTER"
|
||||
msgstr "HERBS"
|
||||
|
||||
|
@ -2732,10 +2712,6 @@ msgctxt "spellinfo"
|
|||
msgid "create_focus"
|
||||
msgstr "Creates an aurafocus crystal."
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#draig"
|
||||
msgstr "In the dark alleys you can find those who sell curses and hexes on demand - but you can buy the apropriate counterspells from the followers of Draig as well. May it be a love spell for the son of a neighbour or a wart in the face of a rival. For offering these services, the sorcerer charges 50 silver pieces per level."
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "song_of_slavery"
|
||||
msgstr "Song of Slavery"
|
||||
|
@ -4370,10 +4346,6 @@ msgstr "elixir of power"
|
|||
msgid "wand_p"
|
||||
msgstr "wands"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#cerddor"
|
||||
msgstr "The mages of Cerddor truly are the bards of the wizards; they love to use their sorcery to entertain the crowds and to be the center of attention. Even the apprentices study those little magic tricks, which attract and fascinate the people and thus ensnare them into leaving a few coins or more for the artist. By the end of the week, the bard will have earned 50 silver per level."
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "strength"
|
||||
msgstr "Unknown Effect"
|
||||
|
@ -4426,10 +4398,6 @@ msgstr "trees"
|
|||
msgid "myrrh_p"
|
||||
msgstr "myrrh"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#illaun"
|
||||
msgstr "No one can read dreams as well as the mages of Illaun. Furthermore, they are also familiar with all other common means of foretelling the future like crystal balls, tarot cards or palms. A mentalist can earn 50 silver pieces per level and week for offering these services to peasants."
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "big_recruit"
|
||||
msgstr "High art of persuasion"
|
||||
|
@ -5222,10 +5190,6 @@ msgctxt "spell"
|
|||
msgid "cerddorfumbleshield"
|
||||
msgstr "Countersong"
|
||||
|
||||
msgctxt "spellinfo"
|
||||
msgid "earn_silver#tybied"
|
||||
msgstr "If the local alchemist could not help you, you should visit a scholar of Tybied. His potions and tinctures may help when nothing else does. If the cryptic formula under the wooden shoes of the unfaithful husband really helped? - well, the peasant, who isn't capable of reading, will never know. At least it helped the magician... to fill his purse. In one week he can earn 50 silver per level that way."
|
||||
|
||||
msgctxt "keyword"
|
||||
msgid "teach"
|
||||
msgstr "TEACH"
|
||||
|
|
|
@ -4,6 +4,7 @@ eressea.log.debug('rules for game E2')
|
|||
math.randomseed(rng.random())
|
||||
|
||||
local equipment = require('eressea.equipment')
|
||||
|
||||
local sets = {
|
||||
['seed_faction'] = {
|
||||
['items'] = {
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
-- forward declaration required:
|
||||
|
||||
-- forward declarations required:
|
||||
local self = {}
|
||||
|
||||
local function equip_first(u)
|
||||
equip_newunits(u)
|
||||
name = 'seed_' .. u.race
|
||||
equip_unit(u, name, 255)
|
||||
end
|
||||
|
||||
local mysets = {
|
||||
['first_unit'] = {
|
||||
['items'] = {
|
||||
['money'] = 2500,
|
||||
['log'] = 10,
|
||||
['stone'] = 4
|
||||
}
|
||||
},
|
||||
['callback'] = equip_first
|
||||
},
|
||||
['seed_unit'] = {
|
||||
['items'] = {
|
||||
|
@ -75,7 +82,7 @@ local mysets = {
|
|||
},
|
||||
['seed_insect'] = {
|
||||
['items'] = {
|
||||
['nestwarmth'] =9
|
||||
['nestwarmth'] = 9
|
||||
}
|
||||
},
|
||||
['seed_halfling'] = {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require 'eressea.path'
|
||||
require 'eressea.resources'
|
||||
require 'eressea.equipment'
|
||||
require 'eressea.spells'
|
||||
|
||||
local self = {}
|
||||
|
|
|
@ -6,5 +6,6 @@ package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
|||
require 'eressea.path'
|
||||
require 'eressea'
|
||||
require 'eressea.xmlconf'
|
||||
|
||||
eressea.read_game(get_turn() .. ".dat")
|
||||
gmtool.editor()
|
||||
|
|
|
@ -14,6 +14,22 @@ function test_read_race()
|
|||
assert_not_nil(f)
|
||||
end
|
||||
|
||||
function test_first_insect()
|
||||
local f = faction.create('insect')
|
||||
local r = region.create(0, 0, "plain")
|
||||
local u = unit.create(f, r, 1)
|
||||
u:equip('first_unit')
|
||||
assert_equal(9, u:get_item('nestwarmth'))
|
||||
end
|
||||
|
||||
function test_first_troll()
|
||||
local f = faction.create('troll')
|
||||
local r = region.create(0, 0, "plain")
|
||||
local u = unit.create(f, r, 1)
|
||||
u:equip('first_unit')
|
||||
assert_equal(2, u:eff_skill('perception'))
|
||||
end
|
||||
|
||||
function test_seed_unit()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create('human')
|
||||
|
|
|
@ -209,6 +209,7 @@ void register_attributes(void)
|
|||
|
||||
at_deprecate("maxmagicians", a_readint); /* factions with differnt magician limits, probably unused */
|
||||
at_deprecate("hurting", a_readint); /* an old arena attribute */
|
||||
at_deprecate("chaoscount", a_readint); /* used to increase the chance of monster spawns */
|
||||
at_deprecate("xontormiaexpress", a_readint); /* required for old datafiles */
|
||||
at_deprecate("orcification", a_readint); /* required for old datafiles */
|
||||
at_deprecate("lua", read_ext); /* required for old datafiles */
|
||||
|
|
|
@ -20,7 +20,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <kernel/config.h>
|
||||
#include "battle.h"
|
||||
#include "alchemy.h"
|
||||
#include "chaos.h"
|
||||
#include "guard.h"
|
||||
#include "laws.h"
|
||||
#include "monsters.h"
|
||||
|
@ -2531,7 +2530,6 @@ static void battle_effects(battle * b, int dead_players)
|
|||
}
|
||||
if (dead_peasants) {
|
||||
deathcounts(r, dead_peasants + dead_players);
|
||||
add_chaoscount(r, dead_peasants / 2);
|
||||
rsetpeasants(r, rp - dead_peasants);
|
||||
}
|
||||
}
|
||||
|
@ -3325,7 +3323,7 @@ fighter * get_fighter(battle * b, const struct unit * u)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int join_battle(battle * b, unit * u, bool attack, fighter ** cp)
|
||||
int join_battle(battle * b, unit * u, bool attack, fighter ** cp)
|
||||
{
|
||||
side *s;
|
||||
fighter *fc = NULL;
|
||||
|
|
|
@ -261,6 +261,7 @@ extern "C" {
|
|||
void free_battle(struct battle * b);
|
||||
struct fighter *make_fighter(struct battle *b, struct unit *u,
|
||||
struct side * s, bool attack);
|
||||
int join_battle(struct battle * b, struct unit * u, bool attack, struct fighter ** cp);
|
||||
struct side *make_side(struct battle * b, const struct faction * f,
|
||||
const struct group * g, unsigned int flags,
|
||||
const struct faction * stealthfaction);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include <platform.h>
|
||||
|
||||
#include "battle.h"
|
||||
|
||||
#include "reports.h"
|
||||
#include "skill.h"
|
||||
|
||||
#include <kernel/config.h>
|
||||
|
@ -16,6 +18,8 @@
|
|||
#include <spells/buildingcurse.h>
|
||||
|
||||
#include <util/functions.h>
|
||||
#include <util/language.h>
|
||||
#include <util/message.h>
|
||||
#include <util/rand.h>
|
||||
#include <util/rng.h>
|
||||
#include <util/strings.h>
|
||||
|
@ -552,6 +556,103 @@ static void test_battle_skilldiff(CuTest *tc)
|
|||
test_teardown();
|
||||
}
|
||||
|
||||
static void test_battle_report_one(CuTest *tc)
|
||||
{
|
||||
battle * b = NULL;
|
||||
region *r;
|
||||
unit *u1, *u2;
|
||||
message *m;
|
||||
const char *expect;
|
||||
fighter *fig;
|
||||
|
||||
test_setup();
|
||||
mt_create_va(mt_new("start_battle", NULL), "factions:string", MT_NEW_END);
|
||||
r = test_create_plain(0, 0);
|
||||
u1 = test_create_unit(test_create_faction(NULL), r);
|
||||
u2 = test_create_unit(test_create_faction(NULL), r);
|
||||
b = make_battle(r);
|
||||
join_battle(b, u1, true, &fig);
|
||||
join_battle(b, u2, false, &fig);
|
||||
faction_setname(u1->faction, "Monster");
|
||||
expect = factionname(u1->faction);
|
||||
|
||||
report_battle_start(b);
|
||||
CuAssertPtrNotNull(tc, m = test_find_messagetype(u1->faction->battles->msgs, "start_battle"));
|
||||
CuAssertStrEquals(tc, expect, (const char *)m->parameters[0].v);
|
||||
|
||||
free_battle(b);
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
static void test_battle_report_two(CuTest *tc)
|
||||
{
|
||||
battle * b = NULL;
|
||||
region *r;
|
||||
unit *u1, *u2;
|
||||
message *m;
|
||||
char expect[64];
|
||||
fighter *fig;
|
||||
struct locale *lang;
|
||||
|
||||
test_setup();
|
||||
lang = test_create_locale();
|
||||
locale_setstring(lang, "and", "and");
|
||||
mt_create_va(mt_new("start_battle", NULL), "factions:string", MT_NEW_END);
|
||||
r = test_create_plain(0, 0);
|
||||
u1 = test_create_unit(test_create_faction(NULL), r);
|
||||
u1->faction->locale = lang;
|
||||
u2 = test_create_unit(test_create_faction(NULL), r);
|
||||
u2->faction->locale = lang;
|
||||
|
||||
str_slprintf(expect, sizeof(expect), "%s and %s", factionname(u1->faction), factionname(u2->faction));
|
||||
b = make_battle(r);
|
||||
join_battle(b, u1, true, &fig);
|
||||
join_battle(b, u2, true, &fig);
|
||||
report_battle_start(b);
|
||||
|
||||
CuAssertPtrNotNull(tc, m = test_find_messagetype(u1->faction->battles->msgs, "start_battle"));
|
||||
CuAssertStrEquals(tc, expect, (const char *)m->parameters[0].v);
|
||||
|
||||
free_battle(b);
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
static void test_battle_report_three(CuTest *tc)
|
||||
{
|
||||
battle * b = NULL;
|
||||
region *r;
|
||||
unit *u1, *u2, *u3;
|
||||
message *m;
|
||||
char expect[64];
|
||||
fighter *fig;
|
||||
struct locale *lang;
|
||||
|
||||
test_setup();
|
||||
lang = test_create_locale();
|
||||
locale_setstring(lang, "and", "and");
|
||||
mt_create_va(mt_new("start_battle", NULL), "factions:string", MT_NEW_END);
|
||||
r = test_create_plain(0, 0);
|
||||
u1 = test_create_unit(test_create_faction(NULL), r);
|
||||
u1->faction->locale = lang;
|
||||
u2 = test_create_unit(test_create_faction(NULL), r);
|
||||
u2->faction->locale = lang;
|
||||
u3 = test_create_unit(test_create_faction(NULL), r);
|
||||
u3->faction->locale = lang;
|
||||
|
||||
str_slprintf(expect, sizeof(expect), "%s, %s and %s", factionname(u1->faction), factionname(u2->faction), factionname(u3->faction));
|
||||
b = make_battle(r);
|
||||
join_battle(b, u1, true, &fig);
|
||||
join_battle(b, u2, true, &fig);
|
||||
join_battle(b, u3, true, &fig);
|
||||
report_battle_start(b);
|
||||
|
||||
CuAssertPtrNotNull(tc, m = test_find_messagetype(u1->faction->battles->msgs, "start_battle"));
|
||||
CuAssertStrEquals(tc, expect, (const char *)m->parameters[0].v);
|
||||
|
||||
free_battle(b);
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
static void test_battle_skilldiff_building(CuTest *tc)
|
||||
{
|
||||
troop ta, td;
|
||||
|
@ -690,6 +791,9 @@ CuSuite *get_battle_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_select_armor);
|
||||
SUITE_ADD_TEST(suite, test_battle_skilldiff);
|
||||
SUITE_ADD_TEST(suite, test_battle_skilldiff_building);
|
||||
SUITE_ADD_TEST(suite, test_battle_report_one);
|
||||
SUITE_ADD_TEST(suite, test_battle_report_two);
|
||||
SUITE_ADD_TEST(suite, test_battle_report_three);
|
||||
SUITE_ADD_TEST(suite, test_defenders_get_building_bonus);
|
||||
SUITE_ADD_TEST(suite, test_attackers_get_no_building_bonus);
|
||||
SUITE_ADD_TEST(suite, test_building_bonus_respects_size);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "bind_ship.h"
|
||||
#include "bind_building.h"
|
||||
|
||||
#include "chaos.h"
|
||||
#include "teleport.h"
|
||||
|
||||
#include <kernel/calendar.h>
|
||||
|
@ -356,7 +355,7 @@ static int tolua_region_get_resourcelevel(lua_State * L)
|
|||
#define LUA_ASSERT(c, s) if (!(c)) { log_error("%s(%d): %s\n", __FILE__, __LINE__, (s)); return 0; }
|
||||
|
||||
static int special_resource(const char *type) {
|
||||
const char * special[] = { "seed", "sapling", "tree", "grave", "chaos", 0 };
|
||||
const char * special[] = { "seed", "sapling", "tree", "grave", NULL };
|
||||
int i;
|
||||
|
||||
for (i = 0; special[i]; ++i) {
|
||||
|
@ -389,9 +388,6 @@ static int tolua_region_get_resource(lua_State * L)
|
|||
case 3:
|
||||
result = deathcount(r);
|
||||
break;
|
||||
case 4:
|
||||
result = get_chaoscount(r);
|
||||
break;
|
||||
default:
|
||||
rtype = rt_find(type);
|
||||
if (rtype) {
|
||||
|
@ -423,9 +419,6 @@ static int tolua_region_set_resource(lua_State * L)
|
|||
case 3:
|
||||
deathcounts(r, value - deathcount(r));
|
||||
break;
|
||||
case 4:
|
||||
add_chaoscount(r, value - get_chaoscount(r));
|
||||
break;
|
||||
default:
|
||||
rtype = rt_find(type);
|
||||
if (rtype != NULL) {
|
||||
|
|
61
src/chaos.c
61
src/chaos.c
|
@ -39,57 +39,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
/*********************/
|
||||
/* at_chaoscount */
|
||||
/*********************/
|
||||
attrib_type at_chaoscount = {
|
||||
"chaoscount",
|
||||
DEFAULT_INIT,
|
||||
DEFAULT_FINALIZE,
|
||||
DEFAULT_AGE,
|
||||
a_writeint,
|
||||
a_readint,
|
||||
NULL,
|
||||
ATF_UNIQUE
|
||||
};
|
||||
|
||||
void set_chaoscount(struct region *r, int deaths)
|
||||
{
|
||||
if (deaths==0) {
|
||||
a_removeall(&r->attribs, &at_chaoscount);
|
||||
} else {
|
||||
attrib *a = a_find(r->attribs, &at_chaoscount);
|
||||
if (!a) {
|
||||
a = a_add(&r->attribs, a_new(&at_chaoscount));
|
||||
}
|
||||
a->data.i = deaths;
|
||||
}
|
||||
}
|
||||
|
||||
int get_chaoscount(const region * r)
|
||||
{
|
||||
attrib *a = a_find(r->attribs, &at_chaoscount);
|
||||
if (!a)
|
||||
return 0;
|
||||
return a->data.i;
|
||||
}
|
||||
|
||||
void add_chaoscount(region * r, int fallen)
|
||||
{
|
||||
attrib *a;
|
||||
|
||||
if (fallen == 0)
|
||||
return;
|
||||
|
||||
a = a_find(r->attribs, &at_chaoscount);
|
||||
if (!a)
|
||||
a = a_add(&r->attribs, a_new(&at_chaoscount));
|
||||
a->data.i += fallen;
|
||||
|
||||
if (a->data.i <= 0)
|
||||
a_remove(&r->attribs, a);
|
||||
}
|
||||
|
||||
static const terrain_type *chaosterrain(void)
|
||||
{
|
||||
static const terrain_type **types;
|
||||
|
@ -248,18 +197,8 @@ void chaos_update(void) {
|
|||
region *r;
|
||||
/* Chaos */
|
||||
for (r = regions; r; r = r->next) {
|
||||
int i;
|
||||
|
||||
if ((r->flags & RF_CHAOTIC)) {
|
||||
chaos(r);
|
||||
}
|
||||
i = get_chaoscount(r);
|
||||
if (i) {
|
||||
add_chaoscount(r, -(int)(i * ((double)(rng_int() % 10)) / 100.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void chaos_register(void) {
|
||||
at_register(&at_chaoscount);
|
||||
}
|
||||
|
|
|
@ -24,15 +24,8 @@ extern "C" {
|
|||
|
||||
struct region;
|
||||
|
||||
extern struct attrib_type at_chaoscount;
|
||||
|
||||
void chaos_register(void);
|
||||
void chaos_update(void);
|
||||
|
||||
void set_chaoscount(struct region *r, int deaths);
|
||||
int get_chaoscount(const struct region * r);
|
||||
void add_chaoscount(struct region * r, int deaths);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "attributes/attributes.h"
|
||||
#include "races/races.h"
|
||||
|
||||
#include "chaos.h"
|
||||
#include "items.h"
|
||||
#include "creport.h"
|
||||
#include "report.h"
|
||||
|
@ -82,5 +81,4 @@ void game_init(void)
|
|||
register_attributes();
|
||||
register_gmcmd();
|
||||
|
||||
chaos_register();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include <util/unicode.h>
|
||||
|
||||
#include "gmtool_structs.h"
|
||||
#include "chaos.h"
|
||||
#include "console.h"
|
||||
#include "listbox.h"
|
||||
#include "wormhole.h"
|
||||
|
@ -531,7 +530,6 @@ static void statusline(WINDOW * win, const char *str)
|
|||
}
|
||||
|
||||
static void reset_region(region *r) {
|
||||
set_chaoscount(r, 0);
|
||||
r->flags = 0;
|
||||
a_removeall(&r->attribs, NULL);
|
||||
while (r->units) {
|
||||
|
|
|
@ -631,28 +631,24 @@ void kernel_init(void)
|
|||
translation_init();
|
||||
}
|
||||
|
||||
static order * defaults[MAXLOCALES];
|
||||
|
||||
order *default_order(const struct locale *lang)
|
||||
{
|
||||
int i = locale_index(lang);
|
||||
keyword_t kwd;
|
||||
const char * str;
|
||||
order *result = 0;
|
||||
assert(i < MAXLOCALES);
|
||||
|
||||
result = defaults[i];
|
||||
if (!result) {
|
||||
const char * str;
|
||||
keyword_t kwd = NOKEYWORD;
|
||||
str = config_get("orders.default");
|
||||
if (str) {
|
||||
kwd = findkeyword(str);
|
||||
}
|
||||
if (kwd != NOKEYWORD) {
|
||||
result = create_order(kwd, lang, NULL);
|
||||
defaults[i] = result;
|
||||
}
|
||||
assert(i < MAXLOCALES);
|
||||
kwd = keyword_disabled(K_WORK) ? NOKEYWORD : K_WORK;
|
||||
str = config_get("orders.default");
|
||||
if (str) {
|
||||
kwd = findkeyword(str);
|
||||
}
|
||||
return result ? copy_order(result) : 0;
|
||||
if (kwd != NOKEYWORD) {
|
||||
result = create_order(kwd, lang, NULL);
|
||||
return copy_order(result);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int rule_give(void)
|
||||
|
@ -760,14 +756,6 @@ void free_config(void) {
|
|||
*/
|
||||
void free_gamedata(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i != MAXLOCALES; ++i) {
|
||||
if (defaults[i]) {
|
||||
free_order(defaults[i]);
|
||||
defaults[i] = 0;
|
||||
}
|
||||
}
|
||||
free(forbidden_ids);
|
||||
forbidden_ids = NULL;
|
||||
|
||||
|
|
|
@ -180,15 +180,22 @@ static void test_default_order(CuTest *tc) {
|
|||
|
||||
test_setup();
|
||||
loc = test_create_locale();
|
||||
ord = default_order(loc);
|
||||
CuAssertPtrEquals(tc, 0, ord);
|
||||
free_order(ord);
|
||||
|
||||
config_set("orders.default", "work");
|
||||
ord = default_order(loc);
|
||||
CuAssertPtrNotNull(tc, ord);
|
||||
CuAssertIntEquals(tc, K_WORK, getkeyword(ord));
|
||||
free_order(ord);
|
||||
|
||||
enable_keyword(K_WORK, false);
|
||||
ord = default_order(loc);
|
||||
CuAssertPtrEquals(tc, NULL, ord);
|
||||
free_order(ord);
|
||||
|
||||
config_set("orders.default", "entertain");
|
||||
ord = default_order(loc);
|
||||
CuAssertPtrNotNull(tc, ord);
|
||||
CuAssertIntEquals(tc, K_ENTERTAIN, getkeyword(ord));
|
||||
free_order(ord);
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "group.h"
|
||||
#include "item.h"
|
||||
#include "messages.h"
|
||||
#include "order.h"
|
||||
#include "plane.h"
|
||||
#include "race.h"
|
||||
#include "region.h"
|
||||
|
@ -294,8 +295,13 @@ unit *addplayer(region * r, faction * f)
|
|||
assert(f->units == NULL);
|
||||
faction_setorigin(f, 0, r->x, r->y);
|
||||
u = create_unit(r, f, 1, f->race, 0, NULL, NULL);
|
||||
u->thisorder = default_order(f->locale);
|
||||
unit_addorder(u, copy_order(u->thisorder));
|
||||
name = config_get("rules.equip_first");
|
||||
equip_unit(u, name ? name : "first_unit");
|
||||
if (!equip_unit(u, name ? name : "first_unit")) {
|
||||
/* give every unit enough money to survive the first turn */
|
||||
i_change(&u->items, get_resourcetype(R_SILVER)->itype, maintenance_cost(u));
|
||||
}
|
||||
u->hp = unit_max_hp(u) * u->number;
|
||||
fset(u, UFL_ISNEW);
|
||||
if (f->race == get_race(RC_DAEMON)) {
|
||||
|
@ -486,36 +492,6 @@ void destroyfaction(faction ** fp)
|
|||
}
|
||||
|
||||
handle_event(f->attribs, "destroy", f);
|
||||
#if 0
|
||||
faction *ff;
|
||||
for (ff = factions; ff; ff = ff->next) {
|
||||
group *g;
|
||||
ally *sf, **sfp;
|
||||
|
||||
for (sfp = &ff->allies; *sfp;) {
|
||||
sf = *sfp;
|
||||
if (sf->faction == f || sf->faction == NULL) {
|
||||
*sfp = sf->next;
|
||||
free(sf);
|
||||
}
|
||||
else
|
||||
sfp = &(*sfp)->next;
|
||||
}
|
||||
for (g = ff->groups; g; g = g->next) {
|
||||
for (sfp = &g->allies; *sfp; ) {
|
||||
sf = *sfp;
|
||||
if (sf->faction == f || sf->faction == NULL) {
|
||||
*sfp = sf->next;
|
||||
free(sf);
|
||||
}
|
||||
else {
|
||||
sfp = &(*sfp)->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (f->alliance) {
|
||||
setalliance(f, 0);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
#include <kernel/ally.h>
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/calendar.h>
|
||||
#include <kernel/callbacks.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
|
@ -298,9 +300,30 @@ static void test_save_special_items(CuTest *tc) {
|
|||
test_teardown();
|
||||
}
|
||||
|
||||
static void test_addplayer(CuTest *tc) {
|
||||
unit *u;
|
||||
region *r;
|
||||
faction *f;
|
||||
item_type *itype;
|
||||
test_setup();
|
||||
callbacks.equip_unit = NULL;
|
||||
itype = test_create_silver();
|
||||
r = test_create_plain(0, 0);
|
||||
f = test_create_faction(NULL);
|
||||
u = addplayer(r, f);
|
||||
CuAssertPtrNotNull(tc, u);
|
||||
CuAssertPtrEquals(tc, r, u->region);
|
||||
CuAssertPtrEquals(tc, f, u->faction);
|
||||
CuAssertIntEquals(tc, i_get(u->items, itype), 10);
|
||||
CuAssertPtrNotNull(tc, u->orders);
|
||||
CuAssertIntEquals(tc, K_WORK, getkeyword(u->orders));
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
CuSuite *get_faction_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
SUITE_ADD_TEST(suite, test_addplayer);
|
||||
SUITE_ADD_TEST(suite, test_max_migrants);
|
||||
SUITE_ADD_TEST(suite, test_addfaction);
|
||||
SUITE_ADD_TEST(suite, test_remove_empty_factions);
|
||||
|
|
|
@ -512,6 +512,7 @@ static void test_create_order_long(CuTest *tc) {
|
|||
stream_order(&out, ord, lang, true);
|
||||
out.api->rewind(out.handle);
|
||||
out.api->readln(out.handle, buffer, sizeof(buffer));
|
||||
CuAssertIntEquals(tc, 1026, strlen(buffer));
|
||||
mstream_done(&out);
|
||||
free_order(ord);
|
||||
test_teardown();
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "monsters.h"
|
||||
|
||||
#include "economy.h"
|
||||
#include "chaos.h"
|
||||
#include "give.h"
|
||||
#include "guard.h"
|
||||
#include "laws.h"
|
||||
|
@ -756,6 +755,11 @@ void plan_monsters(faction * f)
|
|||
if (u->faction!=f)
|
||||
continue;
|
||||
|
||||
/* Parteitarnung von Monstern ist doof: */
|
||||
if (fval(u, UFL_ANON_FACTION)) {
|
||||
u->flags &= ~UFL_ANON_FACTION;
|
||||
}
|
||||
|
||||
/* Befehle m<>ssen jede Runde neu gegeben werden: */
|
||||
free_orders(&u->orders);
|
||||
if (skill_enabled(SK_PERCEPTION)) {
|
||||
|
@ -843,18 +847,14 @@ void plan_monsters(faction * f)
|
|||
pathfinder_cleanup();
|
||||
}
|
||||
|
||||
static double chaosfactor(region * r)
|
||||
{
|
||||
return fval(r, RF_CHAOTIC) ? ((double)(1 + get_chaoscount(r)) / 1000.0) : 0.0;
|
||||
}
|
||||
|
||||
static int nrand(int handle_start, int sub)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
do {
|
||||
if (rng_int() % 100 < handle_start)
|
||||
if (rng_int() % 100 < handle_start) {
|
||||
res++;
|
||||
}
|
||||
handle_start -= sub;
|
||||
} while (handle_start > 0);
|
||||
|
||||
|
@ -876,7 +876,7 @@ void spawn_dragons(void)
|
|||
region *r;
|
||||
faction *monsters = get_or_create_monsters();
|
||||
int minage = config_get_int("monsters.spawn.min_age", 100);
|
||||
int spawn_chance = 100 * config_get_int("monsters.spawn.chance", 100);
|
||||
int spawn_chance = config_get_int("monsters.spawn.chance", 100);
|
||||
|
||||
if (spawn_chance <= 0) {
|
||||
/* monster spawning disabled */
|
||||
|
@ -895,7 +895,8 @@ void spawn_dragons(void)
|
|||
else if ((r->terrain == newterrain(T_GLACIER)
|
||||
|| r->terrain == newterrain(T_SWAMP)
|
||||
|| r->terrain == newterrain(T_DESERT))
|
||||
&& rng_int() % spawn_chance < (5 + 100 * chaosfactor(r))) {
|
||||
&& rng_int() % spawn_chance < 6)
|
||||
{
|
||||
if (chance(0.80)) {
|
||||
u = create_unit(r, monsters, nrand(60, 20) + 1, get_race(RC_FIREDRAGON), 0, NULL, NULL);
|
||||
}
|
||||
|
@ -907,7 +908,7 @@ void spawn_dragons(void)
|
|||
|
||||
log_debug("spawning %d %s in %s.\n", u->number,
|
||||
LOC(default_locale,
|
||||
rc_name_s(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL)), regionname(r, NULL));
|
||||
rc_name_s(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL)), regionname(r, NULL));
|
||||
|
||||
name_unit(u);
|
||||
|
||||
|
@ -932,9 +933,9 @@ void spawn_undead(void)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
/* Chance 0.1% * chaosfactor */
|
||||
|
||||
if (r->land && unburied > rpeasants(r) / 20
|
||||
&& rng_int() % 10000 < (100 + 100 * chaosfactor(r))) {
|
||||
&& rng_int() % 10000 < 200) {
|
||||
message *msg;
|
||||
unit *u;
|
||||
/* es ist sinnfrei, wenn irgendwo im Wald 3er-Einheiten Untote entstehen.
|
||||
|
|
205
src/report.c
205
src/report.c
|
@ -79,7 +79,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/base36.h>
|
||||
#include <util/bsdstring.h>
|
||||
#include "util/bsdstring.h"
|
||||
#include <util/goodies.h>
|
||||
#include <util/language.h>
|
||||
#include <util/lists.h>
|
||||
|
@ -243,39 +243,44 @@ static size_t write_spell_modifier(const spell * sp, int flag, const char * str,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void nr_spell_syntax(struct stream *out, spellbook_entry * sbe, const struct locale *lang)
|
||||
void nr_spell_syntax(char *buf, size_t size, spellbook_entry * sbe, const struct locale *lang)
|
||||
{
|
||||
int bytes;
|
||||
char buf[4096];
|
||||
char *bufp = buf;
|
||||
size_t size = sizeof(buf) - 1;
|
||||
const spell *sp = spellref_get(&sbe->spref);
|
||||
const char *params = sp->parameter;
|
||||
const char *spname;
|
||||
sbstring sbs;
|
||||
|
||||
sbs_init(&sbs, buf, size);
|
||||
if (sp->sptyp & ISCOMBATSPELL) {
|
||||
bytes = (int)str_strlcpy(bufp, LOC(lang, keyword(K_COMBATSPELL)), size);
|
||||
sbs_strcpy(&sbs, LOC(lang, keyword(K_COMBATSPELL)));
|
||||
}
|
||||
else {
|
||||
bytes = (int)str_strlcpy(bufp, LOC(lang, keyword(K_CAST)), size);
|
||||
sbs_strcpy(&sbs, LOC(lang, keyword(K_CAST)));
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
|
||||
/* Reihenfolge beachten: Erst REGION, dann STUFE! */
|
||||
if (sp->sptyp & FARCASTING) {
|
||||
bytes = snprintf(bufp, size, " [%s x y]", LOC(lang, parameters[P_REGION]));
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_strcat(&sbs, " [");
|
||||
sbs_strcat(&sbs, LOC(lang, parameters[P_REGION]));
|
||||
sbs_strcat(&sbs, " x y]");
|
||||
}
|
||||
if (sp->sptyp & SPELLLEVEL) {
|
||||
bytes = snprintf(bufp, size, " [%s n]", LOC(lang, parameters[P_LEVEL]));
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_strcat(&sbs, " [");
|
||||
sbs_strcat(&sbs, LOC(lang, parameters[P_LEVEL]));
|
||||
sbs_strcat(&sbs, " n]");
|
||||
}
|
||||
|
||||
bytes = (int)snprintf(bufp, size, " \"%s\"", spell_name(sp, lang));
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
spname = spell_name(sp, lang);
|
||||
if (strchr(spname, ' ') != NULL) {
|
||||
/* contains spaces, needs quotes */
|
||||
sbs_strcat(&sbs, " '");
|
||||
sbs_strcat(&sbs, spname);
|
||||
sbs_strcat(&sbs, "'");
|
||||
}
|
||||
else {
|
||||
sbs_strcat(&sbs, " ");
|
||||
sbs_strcat(&sbs, spname);
|
||||
}
|
||||
|
||||
while (params && *params) {
|
||||
typedef struct starget {
|
||||
|
@ -298,52 +303,48 @@ void nr_spell_syntax(struct stream *out, spellbook_entry * sbe, const struct loc
|
|||
if (cp == 'u') {
|
||||
targetp = targets + 1;
|
||||
locp = LOC(lang, targetp->vars);
|
||||
bytes = (int)snprintf(bufp, size, " <%s>", locp);
|
||||
sbs_strcat(&sbs, " <");
|
||||
sbs_strcat(&sbs, locp);
|
||||
sbs_strcat(&sbs, ">");
|
||||
if (*params == '+') {
|
||||
++params;
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
bytes = (int)snprintf(bufp, size, " [<%s> ...]", locp);
|
||||
sbs_strcat(&sbs, " [<");
|
||||
sbs_strcat(&sbs, locp);
|
||||
sbs_strcat(&sbs, "> ...]");
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
}
|
||||
else if (cp == 's') {
|
||||
targetp = targets + 2;
|
||||
locp = LOC(lang, targetp->vars);
|
||||
bytes = (int)snprintf(bufp, size, " <%s>", locp);
|
||||
sbs_strcat(&sbs, " <");
|
||||
sbs_strcat(&sbs, locp);
|
||||
sbs_strcat(&sbs, ">");
|
||||
if (*params == '+') {
|
||||
++params;
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
bytes = (int)snprintf(bufp, size, " [<%s> ...]", locp);
|
||||
sbs_strcat(&sbs, " [<");
|
||||
sbs_strcat(&sbs, locp);
|
||||
sbs_strcat(&sbs, "> ...]");
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
}
|
||||
else if (cp == 'r') {
|
||||
bytes = (int)str_strlcpy(bufp, " <x> <y>", size);
|
||||
sbs_strcat(&sbs, " <x> <y>");
|
||||
if (*params == '+') {
|
||||
++params;
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
bytes = (int)str_strlcpy(bufp, " [<x> <y> ...]", size);
|
||||
sbs_strcat(&sbs, " [<x> <y> ...]");
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
}
|
||||
else if (cp == 'b') {
|
||||
targetp = targets + 3;
|
||||
locp = LOC(lang, targetp->vars);
|
||||
bytes = (int)snprintf(bufp, size, " <%s>", locp);
|
||||
sbs_strcat(&sbs, " <");
|
||||
sbs_strcat(&sbs, locp);
|
||||
sbs_strcat(&sbs, ">");
|
||||
if (*params == '+') {
|
||||
++params;
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
bytes = (int)snprintf(bufp, size, " [<%s> ...]", locp);
|
||||
sbs_strcat(&sbs, " [<");
|
||||
sbs_strcat(&sbs, locp);
|
||||
sbs_strcat(&sbs, "> ...]");
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
}
|
||||
else if (cp == 'k') {
|
||||
int i, maxparam = 0;
|
||||
|
@ -361,41 +362,35 @@ void nr_spell_syntax(struct stream *out, spellbook_entry * sbe, const struct loc
|
|||
++maxparam;
|
||||
}
|
||||
if (!maxparam || maxparam > 1) {
|
||||
bytes = (int)str_strlcpy(bufp, " (", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_strcat(&sbs, " (");
|
||||
}
|
||||
i = 0;
|
||||
for (targetp = targets; targetp->flag; ++targetp) {
|
||||
if (!maxparam || sp->sptyp & targetp->flag) {
|
||||
if (i++ != 0) {
|
||||
bytes = (int)str_strlcpy(bufp, " |", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_strcat(&sbs, " |");
|
||||
}
|
||||
if (targetp->param && targetp->vars) {
|
||||
locp = LOC(lang, targetp->vars);
|
||||
bytes =
|
||||
(int)snprintf(bufp, size, " %s <%s>", parameters[targetp->param],
|
||||
locp);
|
||||
sbs_strcat(&sbs, " ");
|
||||
sbs_strcat(&sbs, parameters[targetp->param]);
|
||||
sbs_strcat(&sbs, " <");
|
||||
sbs_strcat(&sbs, locp);
|
||||
sbs_strcat(&sbs, ">");
|
||||
if (multi) {
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
bytes = (int)snprintf(bufp, size, " [<%s> ...]", locp);
|
||||
sbs_strcat(&sbs, " [<");
|
||||
sbs_strcat(&sbs, locp);
|
||||
sbs_strcat(&sbs, "> ...]");
|
||||
}
|
||||
}
|
||||
else {
|
||||
bytes =
|
||||
(int)snprintf(bufp, size, " %s", parameters[targetp->param]);
|
||||
sbs_strcat(&sbs, " ");
|
||||
sbs_strcat(&sbs, parameters[targetp->param]);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
}
|
||||
}
|
||||
if (!maxparam || maxparam > 1) {
|
||||
bytes = (int)str_strlcpy(bufp, " )", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_strcat(&sbs, " )");
|
||||
}
|
||||
}
|
||||
else if (cp == 'i' || cp == 'c') {
|
||||
|
@ -416,21 +411,20 @@ void nr_spell_syntax(struct stream *out, spellbook_entry * sbe, const struct loc
|
|||
}
|
||||
if (*params == '?') {
|
||||
++params;
|
||||
bytes = (int)snprintf(bufp, size, " [<%s>]", locp);
|
||||
sbs_strcat(&sbs, " [<");
|
||||
sbs_strcat(&sbs, locp);
|
||||
sbs_strcat(&sbs, ">]");
|
||||
}
|
||||
else {
|
||||
bytes = (int)snprintf(bufp, size, " <%s>", locp);
|
||||
sbs_strcat(&sbs, " <");
|
||||
sbs_strcat(&sbs, locp);
|
||||
sbs_strcat(&sbs, ">");
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
}
|
||||
else {
|
||||
log_error("unknown spell parameter %c for spell %s", cp, sp->sname);
|
||||
}
|
||||
}
|
||||
*bufp = 0;
|
||||
paragraph(out, buf, 2, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
void nr_spell(struct stream *out, spellbook_entry * sbe, const struct locale *lang)
|
||||
|
@ -542,10 +536,8 @@ void nr_spell(struct stream *out, spellbook_entry * sbe, const struct locale *la
|
|||
paragraph(out, buf, 0, 0, 0);
|
||||
paragraph(out, LOC(lang, "nr_spell_syntax"), 0, 0, 0);
|
||||
|
||||
bufp = buf;
|
||||
size = sizeof(buf) - 1;
|
||||
|
||||
nr_spell_syntax(out, sbe, lang);
|
||||
nr_spell_syntax(buf, sizeof(buf), sbe, lang);
|
||||
paragraph(out, buf, 2, 0, 0);
|
||||
|
||||
newline(out);
|
||||
}
|
||||
|
@ -1825,72 +1817,61 @@ nr_ship(struct stream *out, const region *r, const ship * sh, const faction * f,
|
|||
static void
|
||||
nr_building(struct stream *out, const region *r, const building *b, const faction *f)
|
||||
{
|
||||
int i, bytes;
|
||||
int i;
|
||||
const char *name, *bname, *billusion = NULL;
|
||||
const struct locale *lang;
|
||||
char buffer[8192], *bufp = buffer;
|
||||
char buffer[8192];
|
||||
message *msg;
|
||||
size_t size = sizeof(buffer) - 1;
|
||||
size_t size;
|
||||
sbstring sbs;
|
||||
|
||||
assert(f);
|
||||
lang = f->locale;
|
||||
newline(out);
|
||||
bytes =
|
||||
snprintf(bufp, size, "%s, %s %d, ", buildingname(b), LOC(lang,
|
||||
"nr_size"), b->size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_init(&sbs, buffer, sizeof(buffer));
|
||||
|
||||
report_building(b, &bname, &billusion);
|
||||
|
||||
size = str_slprintf(buffer, sizeof(buffer), "%s, %s %d, ", buildingname(b),
|
||||
LOC(lang, "nr_size"), b->size);
|
||||
sbs.end += size;
|
||||
name = LOC(lang, billusion ? billusion : bname);
|
||||
bytes = (int)str_strlcpy(bufp, name, size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_strcat(&sbs, name);
|
||||
|
||||
if (billusion) {
|
||||
unit *owner = building_owner(b);
|
||||
if (owner && owner->faction == f) {
|
||||
/* illusion. report real type */
|
||||
name = LOC(lang, bname);
|
||||
bytes = snprintf(bufp, size, " (%s)", name);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_strcat(&sbs, " (");
|
||||
sbs_strcat(&sbs, LOC(lang, bname));
|
||||
sbs_strcat(&sbs, ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (!building_finished(b)) {
|
||||
bytes = (int)str_strlcpy(bufp, " ", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
bytes = (int)str_strlcpy(bufp, LOC(lang, "nr_building_inprogress"), size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_strcat(&sbs, " ");
|
||||
sbs_strcat(&sbs, LOC(lang, "nr_building_inprogress"));
|
||||
}
|
||||
|
||||
if (b->besieged > 0 && r->seen.mode >= seen_lighthouse) {
|
||||
msg = msg_message("nr_building_besieged", "soldiers diff", b->besieged,
|
||||
b->besieged - b->size * SIEGEFACTOR);
|
||||
bytes = (int)nr_render(msg, lang, bufp, size, f);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
|
||||
size = nr_render(msg, lang, sbs.end, sbs.size - (sbs.end - sbs.begin), f);
|
||||
sbs.end += size;
|
||||
|
||||
msg_release(msg);
|
||||
}
|
||||
i = 0;
|
||||
if (b->display && b->display[0]) {
|
||||
bytes = (int)str_strlcpy(bufp, "; ", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
bytes = (int)str_strlcpy(bufp, b->display, size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_strcat(&sbs, "; ");
|
||||
sbs_strcat(&sbs, b->display);
|
||||
i = b->display[strlen(b->display) - 1];
|
||||
}
|
||||
|
||||
if (i != '!' && i != '?' && i != '.') {
|
||||
bytes = (int)str_strlcpy(bufp, ".", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
sbs_strcat(&sbs, ".");
|
||||
}
|
||||
*bufp = 0;
|
||||
paragraph(out, buffer, 2, 0, 0);
|
||||
|
||||
if (r->seen.mode >= seen_lighthouse) {
|
||||
|
@ -1900,14 +1881,10 @@ nr_building(struct stream *out, const region *r, const building *b, const factio
|
|||
|
||||
static void nr_paragraph(struct stream *out, message * m, faction * f)
|
||||
{
|
||||
int bytes;
|
||||
char buf[4096], *bufp = buf;
|
||||
size_t size = sizeof(buf) - 1;
|
||||
char buf[4096];
|
||||
|
||||
assert(f);
|
||||
bytes = (int)nr_render(m, f->locale, bufp, size, f);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||
msg_release(m);
|
||||
|
||||
paragraph(out, buf, 0, 0, 0);
|
||||
|
@ -2011,6 +1988,8 @@ void report_travelthru(struct stream *out, region *r, const faction *f)
|
|||
}
|
||||
}
|
||||
|
||||
#include "util/bsdstring.h"
|
||||
|
||||
int
|
||||
report_plaintext(const char *filename, report_context * ctx,
|
||||
const char *bom)
|
||||
|
|
|
@ -30,7 +30,7 @@ extern "C" {
|
|||
void report_travelthru(struct stream *out, struct region * r, const struct faction * f);
|
||||
void report_region(struct stream *out, const struct region * r, struct faction * f);
|
||||
|
||||
void nr_spell_syntax(struct stream *out, struct spellbook_entry * sbe, const struct locale *lang);
|
||||
void nr_spell_syntax(char *buf, size_t size, struct spellbook_entry * sbe, const struct locale *lang);
|
||||
void nr_spell(struct stream *out, struct spellbook_entry * sbe, const struct locale *lang);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -228,32 +228,11 @@ static void set_parameter(spell_fixture spell, char *value) {
|
|||
}
|
||||
|
||||
static void check_spell_syntax(CuTest *tc, char *msg, spell_fixture *spell, char *syntax) {
|
||||
stream strm;
|
||||
char buf[1024];
|
||||
char *linestart, *newline;
|
||||
size_t len;
|
||||
|
||||
mstream_init(&strm);
|
||||
nr_spell_syntax(&strm, spell->sbe, spell->lang);
|
||||
strm.api->rewind(strm.handle);
|
||||
len = strm.api->read(strm.handle, buf, sizeof(buf));
|
||||
buf[len] = '\0';
|
||||
nr_spell_syntax(buf, sizeof(buf), spell->sbe, spell->lang);
|
||||
|
||||
linestart = strtok(buf, "\n");
|
||||
while (linestart && !strstr(linestart, "ZAUBERE"))
|
||||
linestart = strtok(NULL, "\n");
|
||||
|
||||
CuAssertPtrNotNull(tc, linestart);
|
||||
|
||||
newline = strtok(NULL, "\n");
|
||||
while (newline) {
|
||||
*(newline - 1) = '\n';
|
||||
newline = strtok(NULL, "\n");
|
||||
}
|
||||
|
||||
CuAssertStrEquals_Msg(tc, msg, syntax, linestart);
|
||||
|
||||
mstream_done(&strm);
|
||||
CuAssertStrEquals_Msg(tc, msg, syntax, buf);
|
||||
}
|
||||
|
||||
static void test_write_spell_syntax(CuTest *tc) {
|
||||
|
@ -262,54 +241,54 @@ static void test_write_spell_syntax(CuTest *tc) {
|
|||
test_setup();
|
||||
setup_spell_fixture(&spell);
|
||||
|
||||
check_spell_syntax(tc, "vanilla", &spell, " ZAUBERE \"Testzauber\"");
|
||||
check_spell_syntax(tc, "vanilla", &spell, "ZAUBERE Testzauber");
|
||||
|
||||
spell.sp->sptyp |= FARCASTING;
|
||||
check_spell_syntax(tc, "far", &spell, " ZAUBERE [REGION x y] \"Testzauber\"");
|
||||
check_spell_syntax(tc, "far", &spell, "ZAUBERE [REGION x y] Testzauber");
|
||||
|
||||
spell.sp->sptyp |= SPELLLEVEL;
|
||||
check_spell_syntax(tc, "farlevel", &spell, " ZAUBERE [REGION x y] [STUFE n] \"Testzauber\"");
|
||||
check_spell_syntax(tc, "farlevel", &spell, "ZAUBERE [REGION x y] [STUFE n] Testzauber");
|
||||
spell.sp->sptyp = 0;
|
||||
|
||||
set_parameter(spell, "kc");
|
||||
check_spell_syntax(tc, "kc", &spell, " ZAUBERE \"Testzauber\" ( REGION | EINHEIT <enr> | SCHIFF <snr> | BURG <bnr> )");
|
||||
check_spell_syntax(tc, "kc", &spell, "ZAUBERE Testzauber ( REGION | EINHEIT <enr> | SCHIFF <snr> | BURG <bnr> )");
|
||||
|
||||
spell.sp->sptyp |= BUILDINGSPELL;
|
||||
check_spell_syntax(tc, "kc typed", &spell, " ZAUBERE \"Testzauber\" BURG <bnr>");
|
||||
check_spell_syntax(tc, "kc typed", &spell, "ZAUBERE Testzauber BURG <bnr>");
|
||||
spell.sp->sptyp = 0;
|
||||
|
||||
set_parameter(spell, "b");
|
||||
check_spell_syntax(tc, "b", &spell, " ZAUBERE \"Testzauber\" <bnr>");
|
||||
check_spell_syntax(tc, "b", &spell, "ZAUBERE Testzauber <bnr>");
|
||||
|
||||
set_parameter(spell, "s");
|
||||
check_spell_syntax(tc, "s", &spell, " ZAUBERE \"Testzauber\" <snr>");
|
||||
check_spell_syntax(tc, "s", &spell, "ZAUBERE Testzauber <snr>");
|
||||
|
||||
set_parameter(spell, "s+");
|
||||
check_spell_syntax(tc, "s+", &spell, " ZAUBERE \"Testzauber\" <snr> [<snr> ...]");
|
||||
check_spell_syntax(tc, "s+", &spell, "ZAUBERE Testzauber <snr> [<snr> ...]");
|
||||
|
||||
set_parameter(spell, "u");
|
||||
check_spell_syntax(tc, "u", &spell, " ZAUBERE \"Testzauber\" <enr>");
|
||||
check_spell_syntax(tc, "u", &spell, "ZAUBERE Testzauber <enr>");
|
||||
|
||||
set_parameter(spell, "r");
|
||||
check_spell_syntax(tc, "r", &spell, " ZAUBERE \"Testzauber\" <x> <y>");
|
||||
check_spell_syntax(tc, "r", &spell, "ZAUBERE Testzauber <x> <y>");
|
||||
|
||||
set_parameter(spell, "bc");
|
||||
free(spell.sp->syntax);
|
||||
spell.sp->syntax = str_strdup("hodor");
|
||||
check_spell_syntax(tc, "bc hodor", &spell, " ZAUBERE \"Testzauber\" <bnr> <Hodor>");
|
||||
check_spell_syntax(tc, "bc hodor", &spell, "ZAUBERE Testzauber <bnr> <Hodor>");
|
||||
free(spell.sp->syntax);
|
||||
spell.sp->syntax = 0;
|
||||
|
||||
set_parameter(spell, "c?");
|
||||
free(spell.sp->syntax);
|
||||
spell.sp->syntax = str_strdup("hodor");
|
||||
check_spell_syntax(tc, "c?", &spell, " ZAUBERE \"Testzauber\" [<Hodor>]");
|
||||
check_spell_syntax(tc, "c?", &spell, "ZAUBERE Testzauber [<Hodor>]");
|
||||
free(spell.sp->syntax);
|
||||
spell.sp->syntax = 0;
|
||||
|
||||
set_parameter(spell, "kc+");
|
||||
check_spell_syntax(tc, "kc+", &spell,
|
||||
" ZAUBERE \"Testzauber\" ( REGION | EINHEIT <enr> [<enr> ...] | SCHIFF <snr>\n [<snr> ...] | BURG <bnr> [<bnr> ...] )");
|
||||
"ZAUBERE Testzauber ( REGION | EINHEIT <enr> [<enr> ...] | SCHIFF <snr> [<snr> ...] | BURG <bnr> [<bnr> ...] )");
|
||||
|
||||
cleanup_spell_fixture(&spell);
|
||||
test_teardown();
|
||||
|
|
|
@ -2193,10 +2193,12 @@ void report_battle_start(battle * b)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (first && lastf) {
|
||||
sbs_strcat(&sbs, " ");
|
||||
sbs_strcat(&sbs, LOC(f->locale, "and"));
|
||||
sbs_strcat(&sbs, " ");
|
||||
if (lastf) {
|
||||
if (first) {
|
||||
sbs_strcat(&sbs, " ");
|
||||
sbs_strcat(&sbs, LOC(f->locale, "and"));
|
||||
sbs_strcat(&sbs, " ");
|
||||
}
|
||||
sbs_strcat(&sbs, lastf);
|
||||
}
|
||||
|
||||
|
|
2
storage
2
storage
|
@ -1 +1 @@
|
|||
Subproject commit 5623ee6527e97af20c7d8efc03800b6fe1579744
|
||||
Subproject commit 0ef4b39e39d8146d6ca323500a285c53843db988
|
Loading…
Reference in a new issue