From 21435082c9d41cad3019914fd8d9528046e4d1ba Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 27 Jun 2015 20:47:25 -0400 Subject: [PATCH] Add optional space insertion to string buffer append nodes --- doc/editor/appendix/Specials.html | 15 +++++++++++++++ rsrc/strings/specials-text-general.txt | 10 +++++----- src/boe.specials.cpp | 5 +++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/doc/editor/appendix/Specials.html b/doc/editor/appendix/Specials.html index 90c54d0c..579b0332 100644 --- a/doc/editor/appendix/Specials.html +++ b/doc/editor/appendix/Specials.html @@ -451,16 +451,25 @@ lost.
Type 38: Append String to Buffer
Appends a literal string to the string buffer.
+
Pict:
If set to 1, a space will be inserted between the current contents of +the buffer and the new contents. This is necessary because trailing and leading spaces +are stripped from strings.
Extra 1a:
The number of the string to append.
Type 39: Append Number to Buffer
Appends a literal number to the string buffer.
+
Pict:
If set to 1, a space will be inserted between the current contents of +the buffer and the new contents. This is necessary because trailing and leading spaces +are stripped from strings.
Extra 1a:
The number to append. You might want to reference a pointer here.
Type 40: Append Monster/PC Name to Buffer
Appends the name of a monster or PC to the string buffer.
+
Pict:
If set to 1, a space will be inserted between the current contents of +the buffer and the new contents. This is necessary because trailing and leading spaces +are stripped from strings.
Extra 1a:
The number of the monster type whose name you want to append. If left at 0, the game will instead use the currently selected target from the Select Target node, which can be either a monster or a PC.
@@ -468,6 +477,9 @@ node, which can be either a monster or a PC.
Type 41: Append Item Name to Buffer
Appends the name of an item type to the string buffer.
+
Pict:
If set to 1, a space will be inserted between the current contents of +the buffer and the new contents. This is necessary because trailing and leading spaces +are stripped from strings.
Extra 1a:
The number of the item type whose name you want to append.
Extra 1b:
If 0, append the unidentified name. If 1, append the full identified name. If 2, don't append the name; instead append the info string that would be shown for @@ -476,6 +488,9 @@ the item in a shop or get items dialog.
Type 42: Append Terrain Name to Buffer
Appends the name of a terrain type to the string buffer.
+
Pict:
If set to 1, a space will be inserted between the current contents of +the buffer and the new contents. This is necessary because trailing and leading spaces +are stripped from strings.
Extra 1a:
The number of the terrain type whose name you want to append.
diff --git a/rsrc/strings/specials-text-general.txt b/rsrc/strings/specials-text-general.txt index d6dbd103..be6e89f7 100644 --- a/rsrc/strings/specials-text-general.txt +++ b/rsrc/strings/specials-text-general.txt @@ -612,7 +612,7 @@ Unused Unused Unused Unused -Unused +If 1, put a space before it Unused String to append Unused @@ -628,7 +628,7 @@ Unused Unused Unused Unused -Unused +If 1, put a space before it Unused Number to append Unused @@ -644,7 +644,7 @@ Unused Unused Unused Unused -Unused +If 1, put a space before it Unused Monster type, or 0 to used selected PC Unused @@ -660,7 +660,7 @@ Unused Unused Unused Unused -Unused +If 1, put a space before it Unused Item type 0 - unidentified, 1 - full identified name @@ -676,7 +676,7 @@ Unused Unused Unused Unused -Unused +If 1, put a space before it Unused Terrain type Unused diff --git a/src/boe.specials.cpp b/src/boe.specials.cpp index 0e5bcb61..a1a97f41 100644 --- a/src/boe.specials.cpp +++ b/src/boe.specials.cpp @@ -2384,12 +2384,15 @@ void general_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, break; case eSpecType::APPEND_STRING: get_strs(str1,str1,cur_spec_type,spec.ex1a,-1); + if(spec.pic) univ.get_buf() += ' '; univ.get_buf() += str1; break; case eSpecType::APPEND_NUM: + if(spec.pic) univ.get_buf() += ' '; univ.get_buf() += std::to_string(spec.ex1a); break; case eSpecType::APPEND_MONST: + if(spec.pic) univ.get_buf() += ' '; if(spec.ex1a == 0) { int pc = univ.get_target_i(*current_pc_picked_in_spec_enc); if(pc == 6) @@ -2401,6 +2404,7 @@ void general_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, } else univ.get_buf() += univ.scenario.scen_monsters[spec.ex1a].m_name; break; case eSpecType::APPEND_ITEM: + if(spec.pic) univ.get_buf() += ' '; if(spec.ex1b == 1) univ.get_buf() += univ.scenario.scen_items[spec.ex1a].full_name; else if(spec.ex1b == 2) @@ -2408,6 +2412,7 @@ void general_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, else univ.get_buf() += univ.scenario.scen_items[spec.ex1a].name; break; case eSpecType::APPEND_TER: + if(spec.pic) univ.get_buf() += ' '; univ.get_buf() += univ.scenario.ter_types[spec.ex1a].name; break; case eSpecType::SWAP_STR_BUF: