summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-06-06 18:08:17 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-06-06 18:08:17 +0200
commit8e1232fc24c67e80c14d6b56904876550342b6b2 (patch)
treeed1e8efefb97e57d48011e44ed24339db6898492 /src
parent244b2a3abc4f28787a3c3c0c98666972a27460d5 (diff)
download2017-01-16_17:13:37-8e1232fc24c67e80c14d6b56904876550342b6b2.tar
2017-01-16_17:13:37-8e1232fc24c67e80c14d6b56904876550342b6b2.tar.gz
2017-01-16_17:13:37-8e1232fc24c67e80c14d6b56904876550342b6b2.tar.bz2
2017-01-16_17:13:37-8e1232fc24c67e80c14d6b56904876550342b6b2.tar.xz
2017-01-16_17:13:37-8e1232fc24c67e80c14d6b56904876550342b6b2.zip
rename factions
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 8d74def..f608c01 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -27,6 +27,7 @@ import Data.List
27 27
28import Data.List 28import Data.List
29import Data.Maybe 29import Data.Maybe
30import Data.Bool
30 31
31import Data.Function 32import Data.Function
32 33
@@ -67,6 +68,7 @@ main = do
67 , cmd "blur" blur "Focus no entity" 68 , cmd "blur" blur "Focus no entity"
68 , cmd "remove" remove "Remove the focused entity from the queue" 69 , cmd "remove" remove "Remove the focused entity from the queue"
69 , cmd "factions" listFactions "List all inhabited factions" 70 , cmd "factions" listFactions "List all inhabited factions"
71 , cmd "name'" renameFaction "Rename a faction – merge if new name is taken"
70 , cmd "members" listFaction "List all members of a faction" 72 , cmd "members" listFaction "List all members of a faction"
71 , cmd "align" alignEntity "Align the focused entity to a faction – creating it, if necessary" 73 , cmd "align" alignEntity "Align the focused entity to a faction – creating it, if necessary"
72 , cmd "name" nameEntity "Name the current entity overriding previous name assignments" 74 , cmd "name" nameEntity "Name the current entity overriding previous name assignments"
@@ -195,3 +197,8 @@ entitySeqVal' ident = do
195 Just (entity, sVal) -> do 197 Just (entity, sVal) -> do
196 (newEntity, view (seqVal . re _Just) -> val) <- evalFormula entity sVal 198 (newEntity, view (seqVal . re _Just) -> val) <- evalFormula entity sVal
197 gEntities . at ident .= Just (newEntity & set eSeqVal val) 199 gEntities . at ident .= Just (newEntity & set eSeqVal val)
200
201renameFaction :: Completable Faction -> Completable Faction -> Sh GameState ()
202renameFaction f1' f2' = withArg (\f1 -> withArg (\f2 -> renameFaction' f1 f2) f2') f1'
203 where
204 renameFaction' f1 f2 = modifying (gEntities . each . eFaction) (\cF -> bool cF f2 $ cF == f1)