Commit 3057f6d8 authored by wind2009's avatar wind2009

Merge remote-tracking branch '233/patch-chain-sort' into develop

parents b942dd75 640e0463
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#define COMMON_H_ #define COMMON_H_
#include <stdint.h> #include <stdint.h>
#include <assert.h>
typedef unsigned long long uint64; typedef unsigned long long uint64;
typedef unsigned int uint32; typedef unsigned int uint32;
typedef unsigned short uint16; typedef unsigned short uint16;
......
...@@ -27,6 +27,9 @@ duel::duel() { ...@@ -27,6 +27,9 @@ duel::duel() {
game_field = new field(this); game_field = new field(this);
game_field->temp_card = new_card(0); game_field->temp_card = new_card(0);
message_buffer.reserve(SIZE_MESSAGE_BUFFER); message_buffer.reserve(SIZE_MESSAGE_BUFFER);
#ifdef _WIN32
_set_error_mode(_OUT_TO_MSGBOX);
#endif // _WIN32
} }
duel::~duel() { duel::~duel() {
for(auto& pcard : cards) for(auto& pcard : cards)
......
...@@ -16,10 +16,15 @@ ...@@ -16,10 +16,15 @@
int32 field::field_used_count[32] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5}; int32 field::field_used_count[32] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5};
bool chain::chain_operation_sort(const chain& c1, const chain& c2) { bool chain::chain_operation_sort(const chain& c1, const chain& c2) {
if (c1.triggering_effect && c2.triggering_effect && c1.triggering_effect->id != c2.triggering_effect->id) auto e1 = c1.triggering_effect;
return c1.triggering_effect->id < c2.triggering_effect->id; auto e2 = c2.triggering_effect;
else if (e1 && e2) {
return c1.chain_id < c2.chain_id; if (e1->handler == e2->handler && e1->description != e2->description)
return e1->description < e2->description;
if (e1->id != e2->id)
return e1->id < e2->id;
}
return c1.chain_id < c2.chain_id;
} }
void chain::set_triggering_state(card* pcard) { void chain::set_triggering_state(card* pcard) {
triggering_controler = pcard->current.controler; triggering_controler = pcard->current.controler;
...@@ -1091,6 +1096,7 @@ void field::swap_deck_and_grave(uint8 playerid) { ...@@ -1091,6 +1096,7 @@ void field::swap_deck_and_grave(uint8 playerid) {
} }
player[playerid].list_extra.insert(player[playerid].list_extra.end() - player[playerid].extra_p_count, ex.begin(), ex.end()); player[playerid].list_extra.insert(player[playerid].list_extra.end() - player[playerid].extra_p_count, ex.begin(), ex.end());
reset_sequence(playerid, LOCATION_GRAVE); reset_sequence(playerid, LOCATION_GRAVE);
reset_sequence(playerid, LOCATION_DECK);
reset_sequence(playerid, LOCATION_EXTRA); reset_sequence(playerid, LOCATION_EXTRA);
pduel->write_buffer8(MSG_SWAP_GRAVE_DECK); pduel->write_buffer8(MSG_SWAP_GRAVE_DECK);
pduel->write_buffer8(playerid); pduel->write_buffer8(playerid);
......
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