-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
87 changed files
with
4,593 additions
and
5,252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
weblegends-git-describe.h | ||
weblegends-git-describe.tmp.h | ||
events.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "../weblegends.h" | ||
#include "../helpers.h" | ||
|
||
void do_event_missing(std::ostream & s, const event_context &, df::history_event *event, const char *file, int line) | ||
{ | ||
std::string df_description; | ||
df::history_event_context df_context; | ||
event->getSentence(&df_description, &df_context); | ||
s << "<abbr title=\"" << html_escape(df_description) << "\">" << enum_item_key_str(event->getType()) << ":" << event->id << "</abbr>"; | ||
#ifdef WEBLEGENDS_DEBUG | ||
weblegends_debug_log() << "[weblegends] [" << weblegends_basename(file, file) << ":" << line << "] missing event type handler for " << enum_item_key_str(event->getType()) << ": event-" << event->id << ": " << df_description << std::endl; | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
#include "../helpers_event.h" | ||
|
||
#include "df/history_event_add_hf_entity_linkst.h" | ||
|
||
void do_event(std::ostream & s, const event_context & context, df::history_event_add_hf_entity_linkst *event) | ||
{ | ||
auto ent = df::historical_entity::find(event->civ); | ||
auto hf = df::historical_figure::find(event->histfig); | ||
df::entity_position *pos; | ||
BEFORE_SWITCH(type, event->link_type); | ||
switch (type) | ||
{ | ||
case histfig_entity_link_type::MEMBER: | ||
event_link(s, context, hf); | ||
s << " became a member of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::FORMER_MEMBER: | ||
event_link(s, context, hf); | ||
s << " became a former member of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::MERCENARY: | ||
event_link(s, context, hf); | ||
s << " became a mercenary of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::FORMER_MERCENARY: | ||
event_link(s, context, hf); | ||
s << " became a former mercenary of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::SLAVE: | ||
event_link(s, context, hf); | ||
s << " became a slave of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::FORMER_SLAVE: | ||
event_link(s, context, hf); | ||
s << " became a former slave of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::PRISONER: | ||
event_link(s, context, hf); | ||
s << " became a prisoner of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::FORMER_PRISONER: | ||
event_link(s, context, hf); | ||
s << " became a former prisoner of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::ENEMY: | ||
event_link(s, context, hf); | ||
s << " became an enemy of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::CRIMINAL: | ||
event_link(s, context, hf); | ||
s << " became a criminal of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::POSITION: | ||
pos = binsearch_in_vector(ent->positions.own, event->position_id); | ||
event_link(s, context, hf); | ||
s << " became "; | ||
if (pos->number == 1) | ||
{ | ||
s << "the "; | ||
} | ||
else | ||
{ | ||
s << "a "; | ||
} | ||
if (hf->sex == 0 && !pos->name_female[0].empty()) | ||
{ | ||
s << pos->name_female[0]; | ||
} | ||
else if (hf->sex == 1 && !pos->name_male[0].empty()) | ||
{ | ||
s << pos->name_male[0]; | ||
} | ||
else | ||
{ | ||
s << pos->name[0]; | ||
} | ||
s << " of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::FORMER_POSITION: | ||
pos = binsearch_in_vector(ent->positions.own, event->position_id); | ||
event_link(s, context, hf); | ||
s << " became a former "; | ||
if (hf->sex == 0) | ||
{ | ||
s << pos->name_female[0]; | ||
} | ||
else if (hf->sex == 1) | ||
{ | ||
s << pos->name_male[0]; | ||
} | ||
else | ||
{ | ||
s << pos->name[0]; | ||
} | ||
s << " of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::POSITION_CLAIM: | ||
pos = binsearch_in_vector(ent->positions.own, event->position_id); | ||
event_link(s, context, hf); | ||
s << " claimed the position of "; | ||
if (hf->sex == 0) | ||
{ | ||
s << pos->name_female[0]; | ||
} | ||
else if (hf->sex == 1) | ||
{ | ||
s << pos->name_male[0]; | ||
} | ||
else | ||
{ | ||
s << pos->name[0]; | ||
} | ||
s << " of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::SQUAD: | ||
event_link(s, context, hf); | ||
s << " became a squad member of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::FORMER_SQUAD: | ||
event_link(s, context, hf); | ||
s << " became a former squad member of "; | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::OCCUPATION: | ||
event_link(s, context, hf); | ||
s << " became a worker of "; | ||
// TODO: get occupation type | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
case histfig_entity_link_type::FORMER_OCCUPATION: | ||
event_link(s, context, hf); | ||
s << " became a former worker of "; | ||
// TODO: get occupation type | ||
event_link(s, context, ent); | ||
BREAK(type); | ||
} | ||
AFTER_SWITCH(type, stl_sprintf("event-%d (ADD_HF_ENTITY_LINK)", event->id)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#include "../helpers_event.h" | ||
|
||
#include "df/history_event_add_hf_hf_linkst.h" | ||
|
||
void do_event(std::ostream & s, const event_context & context, df::history_event_add_hf_hf_linkst *event) | ||
{ | ||
auto hf = df::historical_figure::find(event->hf); | ||
auto hf_target = df::historical_figure::find(event->hf_target); | ||
BEFORE_SWITCH(type, event->type); | ||
switch (type) | ||
{ | ||
case histfig_hf_link_type::MOTHER: | ||
event_link(s, context, hf); | ||
s << " was born to "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::FATHER: | ||
event_link(s, context, hf); | ||
s << " was fathered by "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::SPOUSE: | ||
event_link(s, context, hf); | ||
s << " married "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::CHILD: | ||
event_link(s, context, hf); | ||
if (hf->sex == 1) | ||
{ | ||
s << " fathered "; | ||
} | ||
else | ||
{ | ||
s << " gave birth to "; | ||
} | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::DEITY: | ||
event_link(s, context, hf); | ||
s << " began worshipping "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::LOVER: | ||
event_link(s, context, hf); | ||
s << " fell in love with "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::PRISONER: | ||
event_link(s, context, hf); | ||
s << " imprisoned "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::IMPRISONER: | ||
event_link(s, context, hf); | ||
s << " was imprisoned by "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::MASTER: | ||
event_link(s, context, hf); | ||
s << " started an apprenticeship under "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::APPRENTICE: | ||
event_link(s, context, hf); | ||
s << " accepted "; | ||
event_link(s, context, hf_target); | ||
s << " as an apprentice"; | ||
BREAK(type); | ||
case histfig_hf_link_type::COMPANION: | ||
event_link(s, context, hf); | ||
s << " became the companion of "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::FORMER_MASTER: | ||
event_link(s, context, hf); | ||
s << " was no longer the master of "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::FORMER_APPRENTICE: | ||
event_link(s, context, hf); | ||
s << " was no longer the apprentice of "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::PET_OWNER: | ||
if (auto race = hf ? df::creature_raw::find(hf->race) : nullptr) | ||
{ | ||
auto caste = race->caste.at(hf->caste); | ||
if (caste->flags.is_set(caste_raw_flags::ADOPTS_OWNER)) | ||
{ | ||
std::swap(hf, hf_target); | ||
} | ||
} | ||
event_link(s, context, hf); | ||
s << " was adopted as the pet of "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::FORMER_SPOUSE: | ||
event_link(s, context, hf); | ||
s << " was no longer the spouse of "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
case histfig_hf_link_type::DECEASED_SPOUSE: | ||
event_link(s, context, hf); | ||
s << " became the deceased spouse of "; | ||
event_link(s, context, hf_target); | ||
BREAK(type); | ||
} | ||
AFTER_SWITCH(type, stl_sprintf("event-%d (ADD_HF_HF_LINK)", event->id)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include "../helpers_event.h" | ||
|
||
#include "df/history_event_add_hf_site_linkst.h" | ||
|
||
void do_event(std::ostream & s, const event_context & context, df::history_event_add_hf_site_linkst *event) | ||
{ | ||
auto site = df::world_site::find(event->site); | ||
auto structure = site ? binsearch_in_vector(site->buildings, event->structure) : nullptr; | ||
auto histfig = df::historical_figure::find(event->histfig); | ||
auto civ = df::historical_entity::find(event->civ); | ||
|
||
event_link(s, context, histfig); | ||
BEFORE_SWITCH(type, event->type); | ||
switch (type) | ||
{ | ||
case histfig_site_link_type::OCCUPATION: | ||
s << " started working at "; | ||
BREAK(type); | ||
case histfig_site_link_type::SEAT_OF_POWER: | ||
s << " ruled from "; | ||
BREAK(type); | ||
case histfig_site_link_type::HANGOUT: | ||
do_event_missing(s, context, event, __FILE__, __LINE__); | ||
BREAK(type); | ||
case histfig_site_link_type::HOME_SITE_ABSTRACT_BUILDING: | ||
s << " took up residence in "; | ||
BREAK(type); | ||
case histfig_site_link_type::HOME_SITE_REALIZATION_BUILDING: | ||
do_event_missing(s, context, event, __FILE__, __LINE__); | ||
BREAK(type); | ||
case histfig_site_link_type::LAIR: | ||
do_event_missing(s, context, event, __FILE__, __LINE__); | ||
BREAK(type); | ||
case histfig_site_link_type::HOME_SITE_REALIZATION_SUL: | ||
do_event_missing(s, context, event, __FILE__, __LINE__); | ||
BREAK(type); | ||
case histfig_site_link_type::HOME_SITE_SAVED_CIVZONE: | ||
do_event_missing(s, context, event, __FILE__, __LINE__); | ||
BREAK(type); | ||
case histfig_site_link_type::PRISON_ABSTRACT_BUILDING: | ||
do_event_missing(s, context, event, __FILE__, __LINE__); | ||
BREAK(type); | ||
case histfig_site_link_type::PRISON_SITE_BUILDING_PROFILE: | ||
do_event_missing(s, context, event, __FILE__, __LINE__); | ||
BREAK(type); | ||
} | ||
AFTER_SWITCH(type, stl_sprintf("event-%d (ADD_HF_SITE_LINK)", event->id)); | ||
event_link(s, context, structure); | ||
if (civ) | ||
{ | ||
s << " of "; | ||
event_link(s, context, civ); | ||
} | ||
if (civ) | ||
{ | ||
s << " in "; | ||
event_link(s, context, site); | ||
} | ||
} |
Oops, something went wrong.