Skip to content

Commit

Permalink
add fields to store un-enchanted states
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Shih committed Dec 14, 2016
1 parent 0b68aef commit fc9d27f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace FlowControl

if (!data.need_update) return;

state::Cards::EnchantableStates origin_states; // TODO: see issue = Cards::Database::GetInstance().Get(card_.GetCardId()).enchantable_states;
const state::Cards::EnchantableStates & origin_states = data.origin_states;
state::Cards::EnchantableStates new_states = origin_states;
data.enchantments.ApplyAll(new_states);

Expand Down
1 change: 1 addition & 0 deletions include/State/Cards/EnchantmentAuxData.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace state
return enchantments.Exists<EnchantmentType>(std::forward<T>(id));
}

EnchantableStates origin_states;
TieredEnchantments enchantments;
bool need_update;
};
Expand Down
1 change: 1 addition & 0 deletions vs_projects/flow_controller/flow_controller.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<ClCompile Include="test2.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\Cards\CardData.h" />
<ClInclude Include="..\..\include\Cards\Cards.h" />
<ClInclude Include="..\..\include\Cards\Database.h" />
<ClInclude Include="..\..\include\Cards\EnchantmentCardBase.h" />
Expand Down
3 changes: 3 additions & 0 deletions vs_projects/flow_controller/flow_controller.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -326,5 +326,8 @@
<ClInclude Include="..\..\include\State\Cards\CardData.h">
<Filter>Header Files\State\Cards</Filter>
</ClInclude>
<ClInclude Include="..\..\include\Cards\CardData.h">
<Filter>Header Files\Cards</Filter>
</ClInclude>
</ItemGroup>
</Project>
8 changes: 6 additions & 2 deletions vs_projects/flow_controller/test2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ static void CheckZoneAndPosition(const state::State & state, state::CardRef ref,

state::Cards::Card CreateDeckCard(Cards::CardId id, state::State & state, state::PlayerIdentifier player)
{
state::Cards::CardData raw_card = Cards::Database::GetInstance().Get((int)id);
state::Cards::CardData raw_card = state::Cards::CardData::FromDatabase(Cards::Database::GetInstance().Get((int)id));
raw_card.enchantable_states.player = player;
raw_card.zone = state::kCardZoneDeck;
raw_card.zone_position = (int)state.board.Get(player).deck_.Size();

raw_card.enchantment_aux_data.origin_states = raw_card.enchantable_states;

return state::Cards::Card(raw_card);
}

Expand Down Expand Up @@ -88,11 +90,13 @@ static void MakeDeck(state::State & state, FlowControl::FlowContext & flow_conte

state::Cards::Card CreateHandCard(Cards::CardId id, state::State & state, state::PlayerIdentifier player)
{
state::Cards::CardData raw_card = Cards::Database::GetInstance().Get((int)id);
state::Cards::CardData raw_card = state::Cards::CardData::FromDatabase(Cards::Database::GetInstance().Get((int)id));
raw_card.enchantable_states.player = player;
raw_card.zone = state::kCardZoneHand;
raw_card.zone_position = (int)state.board.Get(player).hand_.Size();

raw_card.enchantment_aux_data.origin_states = raw_card.enchantable_states;

return state::Cards::Card(raw_card);
}

Expand Down

0 comments on commit fc9d27f

Please sign in to comment.