From b2870ca56aaa9bede81bdea25300968b12bd5cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Sun, 12 Sep 2010 18:33:25 +0000 Subject: [PATCH] LoW: Fixed loading of persistent variables. Removed newlines from story titles. Disabled shroud explicitly since shroud=on seems to be the new multiplayer default. --- .../scenarios/01_The_Uprooting.cfg | 15 ++- .../scenarios/04_Elvish_Treasury.cfg | 45 +++++-- .../scenarios/09_Bounty_hunters.cfg | 27 +--- .../Legend_of_Wesmere/utils/low-macros.cfg | 115 ++++++++++-------- 4 files changed, 118 insertions(+), 84 deletions(-) diff --git a/data/campaigns/Legend_of_Wesmere/scenarios/01_The_Uprooting.cfg b/data/campaigns/Legend_of_Wesmere/scenarios/01_The_Uprooting.cfg index db96ab6bab5..56b5872154f 100644 --- a/data/campaigns/Legend_of_Wesmere/scenarios/01_The_Uprooting.cfg +++ b/data/campaigns/Legend_of_Wesmere/scenarios/01_The_Uprooting.cfg @@ -1,10 +1,6 @@ #textdomain wesnoth-low #ifdef MULTIPLAYER [multiplayer] -#ifdef HARD - name= _ "2p MC — LoW, Hard Mode, Chapter one" - description= _ "The Legend of Wesmere\nMultiplayer Campaign\nChapter one\n Hard difficulty" -#endif #ifdef EASY name= _ "2p MC — LoW, Easy Mode, Chapter one" description= _ "The Legend of Wesmere\nMultiplayer Campaign\nChapter one\n Easy difficulty" @@ -12,6 +8,10 @@ #ifdef NORMAL name= _ "2p MC — LoW, Normal Mode, Chapter one" description= _ "The Legend of Wesmere\nMultiplayer Campaign\nChapter one\n Normal difficulty" +#endif +#ifdef HARD + name= _ "2p MC — LoW, Hard Mode, Chapter one" + description= _ "The Legend of Wesmere\nMultiplayer Campaign\nChapter one\n Hard difficulty" #endif random_start_time=no allow_new_game=yes @@ -45,7 +45,10 @@ [story] [part] delay=4000 - title= _ "The Legend of Wesmere, Chapter one\nPart one\nFlight and fight" + title= _ "The Legend of Wesmere, +Chapter one +Part one +Flight and fight" [/part] [part] delay=4000 @@ -89,6 +92,7 @@ This is the story of Kalenz, and of the Elves in the days of the humans in Wesno [side] side=1 fog=no + shroud=no {KALENZ} # wmllint: recognize Kalenz save_id=Kalenz @@ -339,6 +343,7 @@ This is the story of Kalenz, and of the Elves in the days of the humans in Wesno [side] side=7 fog=no + shroud=no {LANDAR} save_id=Landar controller=human diff --git a/data/campaigns/Legend_of_Wesmere/scenarios/04_Elvish_Treasury.cfg b/data/campaigns/Legend_of_Wesmere/scenarios/04_Elvish_Treasury.cfg index 9032ecd7924..2de50c42460 100644 --- a/data/campaigns/Legend_of_Wesmere/scenarios/04_Elvish_Treasury.cfg +++ b/data/campaigns/Legend_of_Wesmere/scenarios/04_Elvish_Treasury.cfg @@ -62,9 +62,14 @@ #wmllint: validate-off [side] - {KALENZ} + #{KALENZ} {PLAYER_GOLD} + {PLAYABLE} + no_leader=yes fog=no + shroud=no + team_name=Player + user_team_name= _ "Player" # wmllint: recognize Kalenz recruit=Elvish Fighter, Elvish Archer, Elvish Scout #ifndef MULTIPLAYER @@ -136,8 +141,12 @@ [side] side=4 fog=no - {LANDAR} + shroud=no + no_leader=yes + #{LANDAR} {PLAYER_GOLD} + team_name=Player + user_team_name= _ "Player" # wmllint: recognize Landar recruit=Elvish Fighter, Elvish Archer, Elvish Scout [/side] @@ -146,7 +155,11 @@ [side] side=5 fog=no + shroud=no {CLEODIL} + {PLAYER_GOLD} + team_name=Player + user_team_name= _ "Player" # wmllint: recognize Cleodil recruit=Elvish Shaman, Elvish Scout, Wose [/side] @@ -193,20 +206,35 @@ #enddef [event] - name=prestart + #Used this instead of prestart since global variables aren't synced before + name=side 1 turn 1 [objectives] {OBJECTIVES} [/objectives] - {RECALL_LOYALS} +#ifdef MULTIPLAYER + {GET_PERSISTENT_RECALLS_FROM2 1 4 LoW_Chapter_One kalenz} + {GET_PERSISTENT_RECALLS_FROM2 4 1 LoW_Chapter_One landar} +#endif + [recall] + id=Kalenz + x=7 + y=29 + [/recall] + + [recall] + id=Landar + x=16 + y=29 + [/recall] + + {RECALL_LOYALS} # wmllint: recognize Huraldur #{CHECK_LANDAR} - [/event] - # wmllint: directory spelling dastone - [event] - name=start + [redraw] + [/redraw] [message] id=Kalenz @@ -372,6 +400,7 @@ [/message] [message] id=Cleodil + # wmllint: directory spelling dastone message= _ "The saurians happily carried away the treasury gold, but they had come here looking for something more specific... some individual object they called ‘dastone’. I am sorry, my lord Kalenz, I could not understand their distorted speech very well." [/message] [message] diff --git a/data/campaigns/Legend_of_Wesmere/scenarios/09_Bounty_hunters.cfg b/data/campaigns/Legend_of_Wesmere/scenarios/09_Bounty_hunters.cfg index 188f8ae31e7..a237d8357d3 100644 --- a/data/campaigns/Legend_of_Wesmere/scenarios/09_Bounty_hunters.cfg +++ b/data/campaigns/Legend_of_Wesmere/scenarios/09_Bounty_hunters.cfg @@ -172,29 +172,10 @@ # wmllint: recognize Anduilas #ifdef MULTIPLAYER -#define UNSTORE_PARTY SIDE - {FOREACH party_store member} - {VARIABLE (party_store[$member].side) {SIDE}} - [unstore_unit] - variable=party_store[$member] - x,y=recall,recall - [/unstore_unit] - - {DEBUG "unstoring $party_store[$member].name to side {SIDE}."} - - {NEXT member} - {CLEAR_VARIABLE party_store} -#enddef - - {GET_PERSISTENT_RECALLS_FROM3 1 5 6 kalenz party_store} - {UNSTORE_PARTY 1} - {GET_PERSISTENT_RECALLS_FROM3 5 1 6 landar party_store} - {UNSTORE_PARTY 5} - {GET_PERSISTENT_RECALLS_FROM3 6 1 5 olurf party_store} - {UNSTORE_PARTY 6} - -#undef UNSTORE_PARTY - #{CLEAR_GLOBAL_VARIABLE LoW party.Kalenz 1} + {GET_PERSISTENT_RECALLS_FROM4 1 5 6 7 LoW_Chapter_Two kalenz} + {GET_PERSISTENT_RECALLS_FROM4 5 1 6 7 LoW_Chapter_Two landar} + {GET_PERSISTENT_RECALLS_FROM4 6 1 5 7 LoW_Chapter_Two olurf} + {GET_PERSISTENT_RECALLS_FROM4 7 1 5 6 LoW_Chapter_Two cleodil} #endif #define LEAVE_BEHIND_L3 NAME SIDE diff --git a/data/campaigns/Legend_of_Wesmere/utils/low-macros.cfg b/data/campaigns/Legend_of_Wesmere/utils/low-macros.cfg index 01fa9f54fca..0a650572c95 100644 --- a/data/campaigns/Legend_of_Wesmere/utils/low-macros.cfg +++ b/data/campaigns/Legend_of_Wesmere/utils/low-macros.cfg @@ -288,61 +288,80 @@ Orcish Archer, Orcish Assassin, Orcish Grunt, Wolf Rider, Goblin Spearman#enddef {FLAG_VARIANT undead} #enddef +##### Persistent Global Variable macros for multiplayer mode ##### - - - - - - - - - -#define GET_PERSISTENT_RECALLS_FROM3 SIDE1 SIDE2 SIDE3 GLOBAL_VAR LOCAL_VAR - #Loads the recall list variable from both sides. - {VARIABLE_FROM_GLOBAL LoW {GLOBAL_VAR} {LOCAL_VAR} {SIDE1}} +#define LOAD_PERSISTENT_IF_LOCAL_EMPTY SIDE NAMESPACE GLOBAL_VAR LOCAL_VAR [if] {VARIABLE_CONDITIONAL ({LOCAL_VAR}.length) equals 0} [then] - {DEBUG ("Global Variable {GLOBAL_VAR} is empty for side {SIDE1}.")} - {VARIABLE_FROM_GLOBAL LoW {GLOBAL_VAR} {LOCAL_VAR} {SIDE2}} - [if] - {VARIABLE_CONDITIONAL ({LOCAL_VAR}.length) equals 0} - [then] - {DEBUG ("Global Variable {GLOBAL_VAR} is empty for side {SIDE2}.")} - {VARIABLE_FROM_GLOBAL LoW {GLOBAL_VAR} {LOCAL_VAR} {SIDE3}} - [if] - {VARIABLE_CONDITIONAL ({LOCAL_VAR}.length) equals 0} - [then] - {DEBUG ("Global Variable {GLOBAL_VAR} is empty for side {SIDE3}.")} - [/then] - [else] - {DEBUG ("Global Variable {GLOBAL_VAR} is at size: ${LOCAL_VAR}.length for side {SIDE3}.")} - [/else] - [/if] - [/then] - [else] - {DEBUG ("Global Variable {GLOBAL_VAR} is at size: ${LOCAL_VAR}.length for side {SIDE2}.")} - [/else] - [/if] + {DEBUG ("Global Variable {GLOBAL_VAR} is empty for side {SIDE}.")} + {VARIABLE_FROM_GLOBAL {NAMESPACE} {GLOBAL_VAR} {LOCAL_VAR} {SIDE}} [/then] [else] - {DEBUG ("Global Variable {GLOBAL_VAR} is at size: ${LOCAL_VAR}.length for side {SIDE1}.")} + {DEBUG ("Global Variable {GLOBAL_VAR} is at size: ${LOCAL_VAR}.length|, so {SIDE} got not considered.")} [/else] [/if] #enddef -# define GET_PERSISTENT_RECALLS_FROM3 SIDE1 SIDE2 SIDE3 GLOBAL_VAR LOCAL_VAR -# Loads the recall list variable from all three sides. -# {GET_PERSISTENT_RECALLS_FROM2 {SIDE1} {SIDE2} {GLOBAL_VAR} {LOCAL_VAR} } -# [if] -# {VARIABLE_CONDITIONAL ({LOCAL_VAR}.length) equals 0} -# [then] -# {DEBUG ("Global Variable {GLOBAL_VAR} is empty for side {SIDE2}.")} -# {VARIABLE_FROM_GLOBAL LoW {GLOBAL_VAR} {LOCAL_VAR} {SIDE3}} -# [/then] -# [else] -# {DEBUG ("Global Variable {GLOBAL_VAR} is at size: ${GLOBAL_VAR}.length for side {SIDE2}.")} -# [/else] -# [/if] -# enddef +#define LOAD_PERSISTENT_2PLAYER SIDE1 SIDE2 NAMESPACE GLOBAL_VAR LOCAL_VAR + #Loads a global variable into a local one. + #Specify two sides, the variable is loaded from the second one if it is empty + #after reading from the first. + {VARIABLE_FROM_GLOBAL {NAMESPACE} {GLOBAL_VAR} {LOCAL_VAR} {SIDE1}} + {LOAD_PERSISTENT_IF_LOCAL_EMPTY {SIDE2} {NAMESPACE} {GLOBAL_VAR} {LOCAL_VAR}} +#enddef + +#define LOAD_PERSISTENT_3PLAYER SIDE1 SIDE2 SIDE3 NAMESPACE GLOBAL_VAR LOCAL_VAR + #Loads a global variable into a local one. + #Specify two sides, the variable is loaded from the second one if it is empty + #after reading from the first. + {VARIABLE_FROM_GLOBAL {NAMESPACE} {GLOBAL_VAR} {LOCAL_VAR} {SIDE1}} + {LOAD_PERSISTENT_IF_LOCAL_EMPTY {SIDE2} {NAMESPACE} {GLOBAL_VAR} {LOCAL_VAR}} + {LOAD_PERSISTENT_IF_LOCAL_EMPTY {SIDE3} {NAMESPACE} {GLOBAL_VAR} {LOCAL_VAR}} +#enddef + +#define LOAD_PERSISTENT_4PLAYER SIDE1 SIDE2 SIDE3 SIDE4 NAMESPACE GLOBAL_VAR LOCAL_VAR + #Loads a global variable into a local one. + #Specify two sides, the variable is loaded from the second one if it is empty + #after reading from the first. + {VARIABLE_FROM_GLOBAL {NAMESPACE} {GLOBAL_VAR} {LOCAL_VAR} {SIDE1}} + {LOAD_PERSISTENT_IF_LOCAL_EMPTY {SIDE2} {NAMESPACE} {GLOBAL_VAR} {LOCAL_VAR}} + {LOAD_PERSISTENT_IF_LOCAL_EMPTY {SIDE3} {NAMESPACE} {GLOBAL_VAR} {LOCAL_VAR}} + {LOAD_PERSISTENT_IF_LOCAL_EMPTY {SIDE4} {NAMESPACE} {GLOBAL_VAR} {LOCAL_VAR}} +#enddef + +#define UNSTORE_PARTY SIDE + {FOREACH party_store member} + {VARIABLE (party_store[$member].side) {SIDE}} + [unstore_unit] + variable=party_store[$member] + x,y=recall,recall + [/unstore_unit] + + {DEBUG "unstoring $party_store[$member].name to side {SIDE}."} + + {NEXT member} + {CLEAR_VARIABLE member} + {CLEAR_VARIABLE party_store} +#enddef + + +#define GET_PERSISTENT_RECALLS_FROM2 SIDE1 SIDE2 NAMESPACE GLOBAL_VAR + #Loads the recall list variable from both sides. + {LOAD_PERSISTENT_2PLAYER {SIDE1} {SIDE2} {NAMESPACE} {GLOBAL_VAR} party_store} + {UNSTORE_PARTY {SIDE1} } +#enddef + +#define GET_PERSISTENT_RECALLS_FROM3 SIDE1 SIDE2 SIDE3 NAMESPACE GLOBAL_VAR + #Loads the recall list variable from both sides. + {LOAD_PERSISTENT_3PLAYER {SIDE1} {SIDE2} {SIDE3} {NAMESPACE} {GLOBAL_VAR} party_store} + {UNSTORE_PARTY {SIDE1} } +#enddef + +#define GET_PERSISTENT_RECALLS_FROM4 SIDE1 SIDE2 SIDE3 SIDE4 NAMESPACE GLOBAL_VAR + #Loads the recall list variable from both sides. + {LOAD_PERSISTENT_4PLAYER {SIDE1} {SIDE2} {SIDE3} {SIDE4} {NAMESPACE} {GLOBAL_VAR} party_store} + {UNSTORE_PARTY {SIDE1} } +#enddef + +