CR version 69, new attribute: section

MESSAGE.section replaces MESSAGETYPE.section
This commit is contained in:
Enno Rehling 2020-08-23 20:19:30 +02:00
parent 90f81682af
commit 708abf4997
1 changed files with 5 additions and 5 deletions

View File

@ -7,11 +7,10 @@
#include "travelthru.h" #include "travelthru.h"
/* tweakable features */ /* tweakable features */
#define RENDER_CRMESSAGES
#define RESOURCECOMPAT #define RESOURCECOMPAT
#define BUFFERSIZE 32768 #define BUFFERSIZE 32768
/* riesig, wegen spionage-messages :-( */ /* FIXME: riesig, wegen spionage-messages :-( */
static char g_bigbuf[BUFFERSIZE]; static char g_bigbuf[BUFFERSIZE];
#include <spells/regioncurse.h> #include <spells/regioncurse.h>
@ -84,7 +83,7 @@ static char g_bigbuf[BUFFERSIZE];
bool opt_cr_absolute_coords = false; bool opt_cr_absolute_coords = false;
/* globals */ /* globals */
#define C_REPORT_VERSION 68 #define C_REPORT_VERSION 69
struct locale *crtag_locale(void) { struct locale *crtag_locale(void) {
static struct locale * lang; static struct locale * lang;
@ -544,16 +543,17 @@ static void render_messages(FILE * F, faction * f, message_list * msgs)
bool printed = false; bool printed = false;
const struct message_type *mtype = m->msg->type; const struct message_type *mtype = m->msg->type;
unsigned int hash = mtype->key; unsigned int hash = mtype->key;
#ifdef RENDER_CRMESSAGES
g_bigbuf[0] = '\0'; g_bigbuf[0] = '\0';
if (nr_render(m->msg, f->locale, g_bigbuf, sizeof(g_bigbuf), f) > 0) { if (nr_render(m->msg, f->locale, g_bigbuf, sizeof(g_bigbuf), f) > 0) {
fprintf(F, "MESSAGE %d\n", message_id(m->msg)); fprintf(F, "MESSAGE %d\n", message_id(m->msg));
fprintf(F, "%u;type\n", hash); fprintf(F, "%u;type\n", hash);
if (m->msg->type->section) {
fprintf(F, "\"%s\";section\n", m->msg->type->section);
}
fwritestr(F, g_bigbuf); fwritestr(F, g_bigbuf);
fputs(";rendered\n", F); fputs(";rendered\n", F);
printed = true; printed = true;
} }
#endif
g_bigbuf[0] = '\0'; g_bigbuf[0] = '\0';
if (cr_render(m->msg, g_bigbuf, (const void *)f) == 0) { if (cr_render(m->msg, g_bigbuf, (const void *)f) == 0) {
if (g_bigbuf[0]) { if (g_bigbuf[0]) {