Feature #1500 ยป 0093-Send-government-flags-to-client.patch
| client/packhand.c | ||
|---|---|---|
|
sz_strlcpy(gov->sound_str, p->sound_str);
|
||
|
sz_strlcpy(gov->sound_alt, p->sound_alt);
|
||
|
sz_strlcpy(gov->sound_alt2, p->sound_alt2);
|
||
|
gov->flags = p->flags;
|
||
|
PACKET_STRVEC_EXTRACT(gov->helptext, p->helptext);
|
||
| ... | ... | |
|
packet->female_title);
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Packet ruleset_gov_flag handler.
|
||
|
****************************************************************************/
|
||
|
void handle_ruleset_gov_flag(const struct packet_ruleset_gov_flag *p)
|
||
|
{
|
||
|
const char *flagname;
|
||
|
const char *helptxt;
|
||
|
fc_assert_ret_msg(p->id >= GOVF_USER_FLAG_1 && p->id <= GOVF_LAST_USER_FLAG,
|
||
|
"Bad user flag %d.", p->id);
|
||
|
if (p->name[0] == '\0') {
|
||
|
flagname = nullptr;
|
||
|
} else {
|
||
|
flagname = p->name;
|
||
|
}
|
||
|
if (p->helptxt[0] == '\0') {
|
||
|
helptxt = nullptr;
|
||
|
} else {
|
||
|
helptxt = p->helptxt;
|
||
|
}
|
||
|
set_user_gov_flag_name(p->id, flagname, helptxt);
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Packet ruleset_terrain handler.
|
||
|
****************************************************************************/
|
||
| common/generate_packets.py | ||
|---|---|---|
|
#include "conn_types.h"
|
||
|
#include "disaster.h"
|
||
|
#include "events.h"
|
||
|
#include "government.h"
|
||
|
#include "player.h"
|
||
|
#include "tech.h"
|
||
|
#include "unit.h"
|
||
| common/networking/packets.def | ||
|---|---|---|
|
Max used id:
|
||
|
============
|
||
|
Max id: 518
|
||
|
Max id: 519
|
||
|
Packets are not ordered by their id, but by their category. New packet
|
||
|
with higher id may get added to existing category, and not to the end of file.
|
||
| ... | ... | |
|
type BV_RMCAUSES = bitvector(bv_rmcauses)
|
||
|
type BV_CITY_OPTIONS = bitvector(bv_city_options)
|
||
|
type BV_IMPR_FLAGS = bitvector(bv_impr_flags)
|
||
|
type BV_GOV_FLAGS = bitvector(bv_gov_flags)
|
||
|
type BV_IMPRS = bitvector(bv_imprs)
|
||
|
type BV_PLAYER = bitvector(bv_player)
|
||
|
type BV_STARTPOS_NATIONS= bitvector(bv_startpos_nations)
|
||
| ... | ... | |
|
STRING sound_str[MAX_LEN_NAME];
|
||
|
STRING sound_alt[MAX_LEN_NAME];
|
||
|
STRING sound_alt2[MAX_LEN_NAME];
|
||
|
BV_GOV_FLAGS flags;
|
||
|
STRVEC helptext;
|
||
|
end
|
||
|
PACKET_RULESET_GOV_FLAG = 519; sc, lsend
|
||
|
UINT8 id;
|
||
|
STRING name[MAX_LEN_NAME];
|
||
|
STRING helptxt[MAX_LEN_PACKET];
|
||
|
end
|
||
|
PACKET_RULESET_TERRAIN_CONTROL = 146; sc, lsend
|
||
|
UINT8 ocean_reclaim_requirement_pct; /* # adjacent land tiles for reclaim */
|
||
|
UINT8 land_channel_requirement_pct; /* # adjacent ocean tiles for channel */
|
||
| server/ruleset/ruleload.c | ||
|---|---|---|
|
{
|
||
|
struct packet_ruleset_government gov;
|
||
|
struct packet_ruleset_government_ruler_title title;
|
||
|
int i;
|
||
|
for (i = 0; i < MAX_NUM_USER_GOVERNMENT_FLAGS; i++) {
|
||
|
struct packet_ruleset_gov_flag fpacket;
|
||
|
const char *flagname;
|
||
|
const char *helptxt;
|
||
|
fpacket.id = i + GOVF_USER_FLAG_1;
|
||
|
flagname = impr_flag_id_name(i + GOVF_USER_FLAG_1);
|
||
|
if (flagname == nullptr) {
|
||
|
fpacket.name[0] = '\0';
|
||
|
} else {
|
||
|
sz_strlcpy(fpacket.name, flagname);
|
||
|
}
|
||
|
helptxt = gov_flag_helptxt(i + GOVF_USER_FLAG_1);
|
||
|
if (helptxt == nullptr) {
|
||
|
fpacket.helptxt[0] = '\0';
|
||
|
} else {
|
||
|
sz_strlcpy(fpacket.helptxt, helptxt);
|
||
|
}
|
||
|
lsend_packet_ruleset_gov_flag(dest, &fpacket);
|
||
|
}
|
||
|
governments_iterate(g) {
|
||
|
/* Send one packet_government */
|
||
| ... | ... | |
|
/* Shallow-copy (borrow) requirement vector */
|
||
|
gov.reqs = g->reqs;
|
||
|
gov.flags = g->flags;
|
||
|
sz_strlcpy(gov.name, untranslated_name(&g->name));
|
||
|
sz_strlcpy(gov.rule_name, rule_name_get(&g->name));
|
||
|
sz_strlcpy(gov.graphic_str, g->graphic_str);
|
||