Skip to content

Commit

Permalink
Faith getting bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TCA166 committed May 2, 2024
1 parent c769b15 commit 7b12969
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 23 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Simple workflow for deploying static content to GitHub Pages
name: Render and deploy rustdoc documentation

on:
push:
branches: [ "master" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Make doc
run: make doc
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload sphinx build
path: './target/doc/ck3_history_extractor'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
30 changes: 7 additions & 23 deletions src/structures/character.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,41 +43,25 @@ pub struct Character {
depth: usize
}

//TODO seperate each getting segment into a separate function

fn get_faith(house:&Option<Shared<Dynasty>>, base:&GameObject, game_state:&mut GameState) -> Shared<Faith>{
let faith_node = base.get("faith");
if faith_node.is_some(){
game_state.get_faith(faith_node.unwrap().as_string_ref().unwrap().as_str()).clone()
}
else{
let h = house.as_ref().unwrap().borrow();
if h.leaders.len() == 0 {
if h.parent.is_some(){
let p = h.parent.as_ref().unwrap().borrow();
if p.leaders.len() != 0 {
return p.leaders[0].borrow().faith.as_ref().unwrap().clone();
}
else{
panic!("No faith found");
if h.parent.is_some(){
let p = h.parent.as_ref().unwrap().borrow();
// FIXME faiths can be none, but this may be because they have not been loaded yet or because they are non for real
for l in p.leaders.iter(){
if l.borrow().faith.is_some(){
return l.borrow().faith.as_ref().unwrap().clone();
}
}
//if we made it here it means we need to search for faith in culture
panic!("No faith found");
}
else{
let mut i = 0;
loop { //FIXME sometimes house leaders don't have faith
let l = h.leaders[i].try_borrow();
if l.is_ok(){
let o = l.unwrap(); //dumb compiler forced me to create a new variable here
let f = o.faith.as_ref();
if f.is_some(){
return f.unwrap().clone();
}
}
i += 1;
}
panic!("No faith found");
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/structures/culture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fn get_date(base:&Ref<'_, GameObject>) -> Option<Shared<String>>{

impl GameObjectDerived for Culture {
fn from_game_object(base:Ref<'_, GameObject>, game_state:&mut crate::game_state::GameState) -> Self {
println!("{:?}", base);
let mut parents = Vec::new();
get_parents(&mut parents, &base, game_state);
let mut traditions = Vec::new();
Expand Down
1 change: 1 addition & 0 deletions src/structures/dynasty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ fn get_parent(base:&Ref<'_, GameObject>, game_state:&mut GameState) -> Option<Sh

impl GameObjectDerived for Dynasty {
fn from_game_object(base:Ref<'_, GameObject>, game_state:&mut GameState) -> Self {
println!("{:?}", base.get_keys());
//get the dynasty legacies
let mut perks = Vec::new();
get_perks(&mut perks, &base);
Expand Down

0 comments on commit 7b12969

Please sign in to comment.