tmewett / BrogueCE

Brogue: Community Edition - a community-lead fork of the much-loved minimalist roguelike game
https://sites.google.com/site/broguegame/
GNU Affero General Public License v3.0
1.03k stars 109 forks source link

Fix formatting issue in describeLocation function #713

Closed adrior11 closed 3 weeks ago

adrior11 commented 3 months ago

Fix: #711

Issue:

The problem stemmed from the concatenation process in the describeLocation [Movement.c] function. Specifically, when appending strings, the code did not consistently check if a space already existed at the end of one string before adding another space. This could result in double spaces when the next string was concatenated.

Suggested Solution:

To resolve this, I added a check to ensure that a space is only added if one does not already exist at the end of the string. The updated code snippet ensures that the verb string always ends with exactly one space before concatenating the next part of the sentence:

if (verb[strlen(verb) - 1] != ' ') {
    strcat(verb, " ");
}

Before:

357658044-9461b391-f7b9-41f2-96e2-ebd48811173f

After: Screenshot 2024-08-16 at 12 26 27