Commit 12bc15bb authored by Chen Bill's avatar Chen Bill Committed by GitHub

move second_code to card_data.h (#685)

parent 1af26196
...@@ -15,14 +15,6 @@ ...@@ -15,14 +15,6 @@
#include "buffer.h" #include "buffer.h"
#include <algorithm> #include <algorithm>
const std::unordered_map<uint32, uint32> card::second_code = {
{CARD_MARINE_DOLPHIN, 17955766u},
{CARD_TWINKLE_MOSS, 17732278u},
{CARD_TIMAEUS, 10000050u},
{CARD_CRITIAS, 10000060u},
{CARD_HERMOS, 10000070u}
};
bool card_sort::operator()(card* const& c1, card* const& c2) const { bool card_sort::operator()(card* const& c1, card* const& c2) const {
return c1->cardid < c2->cardid; return c1->cardid < c2->cardid;
} }
......
...@@ -109,12 +109,6 @@ struct material_info { ...@@ -109,12 +109,6 @@ struct material_info {
}; };
const material_info null_info; const material_info null_info;
constexpr uint32 CARD_MARINE_DOLPHIN = 78734254;
constexpr uint32 CARD_TWINKLE_MOSS = 13857930;
constexpr uint32 CARD_TIMAEUS = 1784686;
constexpr uint32 CARD_CRITIAS = 11082056;
constexpr uint32 CARD_HERMOS = 46232525;
class card { class card {
public: public:
struct effect_relation_hash { struct effect_relation_hash {
...@@ -149,7 +143,6 @@ public: ...@@ -149,7 +143,6 @@ public:
uint8 location{ 0 }; uint8 location{ 0 };
uint8 sequence{ 0 }; uint8 sequence{ 0 };
}; };
static const std::unordered_map<uint32, uint32> second_code;
int32 ref_handle; int32 ref_handle;
duel* pduel; duel* pduel;
......
#ifndef CARD_DATA_H_ #ifndef CARD_DATA_H_
#define CARD_DATA_H_ #define CARD_DATA_H_
#include <unordered_map>
#include "common.h" #include "common.h"
constexpr int CARD_ARTWORK_VERSIONS_OFFSET = 20; constexpr int CARD_ARTWORK_VERSIONS_OFFSET = 20;
constexpr int SIZE_SETCODE = 16; constexpr int SIZE_SETCODE = 16;
constexpr int CARD_BLACK_LUSTER_SOLDIER2 = 5405695; constexpr uint32 CARD_BLACK_LUSTER_SOLDIER2 = 5405695;
//double name
constexpr uint32 CARD_MARINE_DOLPHIN = 78734254;
constexpr uint32 CARD_TWINKLE_MOSS = 13857930;
constexpr uint32 CARD_TIMAEUS = 1784686;
constexpr uint32 CARD_CRITIAS = 11082056;
constexpr uint32 CARD_HERMOS = 46232525;
const std::unordered_map<uint32, uint32> second_code = {
{CARD_MARINE_DOLPHIN, 17955766u},
{CARD_TWINKLE_MOSS, 17732278u},
{CARD_TIMAEUS, 10000050u},
{CARD_CRITIAS, 10000060u},
{CARD_HERMOS, 10000070u},
};
struct card_data { struct card_data {
uint32 code{}; uint32 code{};
......
...@@ -913,7 +913,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod ...@@ -913,7 +913,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod
stack.pop(); stack.pop();
int32 lhs = stack.top(); int32 lhs = stack.top();
stack.pop(); stack.pop();
stack.push(lhs && rhs); stack.push(static_cast<int32>(lhs && rhs));
} }
break; break;
} }
...@@ -923,7 +923,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod ...@@ -923,7 +923,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod
stack.pop(); stack.pop();
int32 lhs = stack.top(); int32 lhs = stack.top();
stack.pop(); stack.pop();
stack.push(lhs || rhs); stack.push(static_cast<int32>(lhs || rhs));
} }
break; break;
} }
...@@ -939,7 +939,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod ...@@ -939,7 +939,7 @@ static int32 is_declarable(card_data const& cd, const std::vector<uint32>& opcod
if(stack.size() >= 1) { if(stack.size() >= 1) {
int32 val = stack.top(); int32 val = stack.top();
stack.pop(); stack.pop();
stack.push(!val); stack.push(static_cast<int32>(!val));
} }
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment