mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-22 09:31:40 +00:00
[ui] Set passage text object start and size
The text object covering the whole passage was not being initialized, thus center print tried to print rubbish when (incorrectly) printing the entire message.
This commit is contained in:
parent
1d51c05f90
commit
472b6995b7
2 changed files with 9 additions and 6 deletions
|
@ -35,6 +35,12 @@
|
|||
*/
|
||||
///@{
|
||||
|
||||
enum {
|
||||
passage_type_text_obj,
|
||||
|
||||
passage_type_count
|
||||
};
|
||||
|
||||
typedef struct psg_text_s {
|
||||
/// beginning of text for this segment relative to passage_t.text
|
||||
uint32_t text;
|
||||
|
|
|
@ -44,12 +44,6 @@
|
|||
#include "QF/ui/passage.h"
|
||||
#include "QF/ui/view.h"
|
||||
|
||||
enum {
|
||||
passage_type_text_obj,
|
||||
|
||||
passage_type_count
|
||||
};
|
||||
|
||||
static const component_t passage_components[passage_type_count] = {
|
||||
[passage_type_text_obj] = {
|
||||
.size = sizeof (psg_text_t),
|
||||
|
@ -112,6 +106,7 @@ Passage_ParseText (passage_t *passage, const char *text)
|
|||
|
||||
unsigned num_paragraphs = 1;
|
||||
unsigned num_text_objects = 1;
|
||||
psg_text_t root_text = {};
|
||||
int parsing_space = Passage_IsSpace (text);
|
||||
for (const char *c = text; *c; c++) {
|
||||
int size;
|
||||
|
@ -132,6 +127,7 @@ Passage_ParseText (passage_t *passage, const char *text)
|
|||
}
|
||||
parsing_space = 0;
|
||||
}
|
||||
root_text.size = c - text;
|
||||
}
|
||||
passage->hierarchy = Hierarchy_New (passage->reg, &passage_type, 0);
|
||||
Hierarchy_Reserve (passage->hierarchy,
|
||||
|
@ -152,6 +148,7 @@ Passage_ParseText (passage_t *passage, const char *text)
|
|||
psg_text_t *text_obj = &passage_obj[h->childIndex[1]];
|
||||
*par_obj = *text_obj = (psg_text_t) { };
|
||||
|
||||
*passage_obj = root_text;
|
||||
add_entity (passage->hierarchy, par_obj - passage_obj);
|
||||
|
||||
parsing_space = Passage_IsSpace (text);
|
||||
|
|
Loading…
Reference in a new issue