Commit Graph
156 Commits
Author SHA1 Message Date
salix5andCopilot 8ef2167e5b Remove CTOS_DeckData and use uint32_t array in deck loading functions (#3071)
* Use size_t for length in HandleCTOSPacket

Co-authored-by: Copilot <copilot@github.com>

* Use uint32_t in deck loading functions

Co-authored-by: Copilot <copilot@github.com>

* fix

Co-authored-by: Copilot <copilot@github.com>

* Validate deck update length in SingleDuel and TagDuel

Co-authored-by: Copilot <copilot@github.com>

* revert

---------

Co-authored-by: Copilot <copilot@github.com>
2026-05-12 15:10:10 +08:00
salix5 df02543f6c Use std::vector in EndDuel for SingleDuel and TagDuel (#3077) 2026-05-06 09:03:47 +08:00
salix5 50b693f713 Use size_t for index and return uint32_t in CheckDeck (#3051) 2026-04-15 12:55:43 +08:00
Mercury233 9fa42dd103 move global vars from gframe to member of mainGame (#3041) 2026-04-11 08:57:44 +08:00
salix5 6fea874dac Change Deck to (const CardDataC*) vector (#3006) 2026-03-25 09:34:16 +08:00
mercury233 631eed90f8 use std::swap in SingleDuel::TPResult 2026-02-27 16:33:30 +08:00
Mercury233 488e66c5a4 fix face-down MSG_SPSUMMONING (#2896) 2025-08-15 17:06:47 +08:00
salix5 42a427a4fa use function template BufferIO::Read (#2835) 2025-07-06 13:18:46 +08:00
Mercury233 e7ebb75fa0 update forced in MSG_SELECT_CHAIN (#2797) 2025-06-29 17:40:43 +08:00
Mercury233 f4db575058 update MSG_CONFIRM_CARDS, add skip_panel (#2470) 2025-06-29 17:39:57 +08:00
salix5 b3482765e4 fix: seeding std::mt19937 with only 1 uint32_t (#2820) 2025-06-18 15:47:55 +08:00
salix5 fd189e5c8c DeckManager: use uint32_t code (#2739)
* fix LoadLFListSingle

* update LoadDeck, LoadSide

* rename to LoadDeckFromStream

* update CTOS_DeckData

* static member function
2025-03-29 10:44:21 +08:00
salix5 dc5a305301 use <ctime> header (#2668) 2025-02-12 16:26:38 +08:00
salix5 ad9a70691e fix DeckManager::CheckDeck (#2656)
* fix DeckManager::CheckDeck

* use MAX_CARD_ID
2025-01-31 17:09:58 +08:00
salix5 2bfb8198bd check len before memcpy in UpdateDeck (#2652) 2025-01-24 00:59:24 +08:00
salix5 d376ed0e65 use <cwchar> function (#2651) 2025-01-17 19:50:59 +08:00
salix5 1127be0fba add CTOS_DeckData (#2641)
* add CTOS_DeckData

* Update netserver.cpp

* update length check

* update length check
2025-01-11 18:09:47 +08:00
salix5 cc18709fb0 Replay: add read/write template (#2637)
* Replay: add read/write template

* Replay: remove WriteInt8, WriteInt16

* use int32_t in WriteInt32

* remove ReadInt8, ReadInt16

* use int32_t in ReadInt32

* update ReadData

* add ReadHeader

* use array index
2024-12-27 08:23:02 +08:00
salix5 fb4580f93d Patch1 (#2635)
* update include in network.h

* format
2024-12-15 15:15:24 +08:00
salix5 f2278ae751 use vector rbegin (#2628)
* use vector rbegin

* const reference

* use vector assign

* minor update

* init
2024-12-06 23:50:39 +08:00
salix5 85793b7105 replace intN macro (#2627)
* remove int32

* replace uint32_t

* remove uint8
2024-12-05 19:29:41 +08:00
salix5 c1cd59c475 change byte to unsigned char (#2622)
the dependency of byte is Windows SDK, not common.h
2024-11-30 15:27:20 +08:00
salix5 51929625b3 BufferIO: add CopyCharArray (#2616)
array length is determined by reference to array
2024-11-16 11:51:18 +08:00
salix5 2dd2263c44 use <cstring> functions (#2580) 2024-08-18 03:14:02 +08:00
salix5 848348ca9c deckManager: add LoadCurrentDeck, SaveDeckBuffer (#2571)
* update LoadDeck from int array

* update LoadDeck from std::istringstream

* reorder

* rename to LoadCurrentDeck

* akways clear current_deck in LoadCurrentDeck

* reorder

* change LoadDeck from std::istringstream

* set errorcode for TYPE_TOKEN

* use LoadDeck in export deck

* update LoadSide

* fix CheckDeck

* fix LoadLFListSingle

* minor fix

* add SaveDeckBuffer

* fix LoadSide

* update LoadDeck(Deck&, std::istringstream&
2024-08-11 05:06:08 +08:00
salix5 bb82764e0b Use local variable in ServerEchoRead, ClientRead (#2562)
* use local var in ServerEchoRead, ClientRead

* zero init in GetResponse
2024-06-18 16:54:48 +08:00
salix5 cc91dc81ee verify the source of BufferIO::CopyWStr (#2558)
* verify the source of BufferIO::CopyWStr

* add BufferIO::NullTerminate

* use MAX_STRING_ID

* use constant

* use constant
2024-06-09 11:00:08 +08:00
salix5 e209e77502 disconnect when the packet is too large (#2551)
* use memcpy in DuelClient, NetServer

* NetServer: discard too large packet

* DuelClient: discard too large packet

* replace memcpy with std::memcpy

* disconnect when the packet is too large

* check packet_len

* check len in HandleCTOSPacket()

* check len in HandleSTOCPacketLan()

* remove bool type in HostInfo

* check len in packet handling

* add boundary check to STOC_CHAT packet

* use memcpy in DuelMode::JoinGame

* add DECK_MAX_SIZE, DECK_MIN_SIZE

* fix DuelMode::UpdateDeck()

* fix

* fix Manager::OpenDeckFile()

* update DuelMode init

* update DuelMode::JoinGame

* update DuelMode::GetResponse

* Revert "check len in packet handling"

This reverts commit 2b5c12f360.

* use memcpy in GetPosition

* check struct size by static_assert

* update DuelMode::UpdateDeck

* check if the struct is trivially copyable

* replace unsigned short to uint16_t

* replace unsigned int to uint32_t

* add padding member to STOC_HS_PlayerEnter

* workaround: use STOC_HS_PlayerEnter_size
2024-05-31 21:52:06 +08:00
salix5 1f03d7321c update get_log_message() (#2550) 2024-05-31 21:51:52 +08:00
salix5 b290125977 Use BufferIO::ReadUInt8 (#2537)
* change code, location, position to unsigned

* change code, location, postion to unsigned

* use ReadUInt8() for 1-byte data

* Game::LocalPlayer() returns 0, 1

* wrong matching

* change card code to unsigned
2024-05-02 21:59:41 +08:00
salix5 31bd9394da remove warning 4267 (#2529) 2024-04-21 20:46:54 +08:00
salix5 e3155746c5 fix: check response size before writing (#2514)
* update DuelClient::response_buf[]

* fix: check response size before writing
2024-02-14 04:03:07 +08:00
salix5 771bd5d3de Revert "match_result use player_id"
This reverts commit c4d7ca2db2.
2023-12-26 19:51:22 +08:00
salix5 ee5fea7e02 clear data while face-down
MSG_UPDATE_DATA
flag=0: clear

MSG_UPDATE_CARD
flag=QUERY_CODE, code=0: clear
2023-12-19 16:35:12 +08:00
salix5 a24d3db31a remove memset 2023-12-18 22:35:12 +08:00
salix5 c4d7ca2db2 match_result use player_id
player_id: the index of players[] when G1 starts
type: first/second player in current duel
2023-12-18 22:33:29 +08:00
salix5 3c6de95686 update message handler 2023-12-18 11:00:05 +08:00
salix5 86825b0a6c update script reader 2023-12-18 01:37:32 +08:00
salix5 7d446e2477 update card reader 2023-12-18 00:44:53 +08:00
salix5 74d53175ec SingleDuel: use std vector 2023-12-16 15:05:04 +08:00
salix5 bbec144b08 SingleDuel: use inline function 2023-12-16 14:59:35 +08:00
salix5 1b54a18994 fix position check
Refresh must use QUERY_CODE, QUERY_POSITION.
2023-12-16 10:43:52 +08:00
salix5 2bea392d88 edit comment 2023-12-16 10:43:52 +08:00
salix5 32389dda77 use unsigned char buffer 2023-12-14 16:10:19 +08:00
salix5 905bb0d913 rename 2023-12-14 12:51:50 +08:00
salix5 1110ff16a0 use std::vector buffer 2023-12-14 01:21:09 +08:00
salix5 0423cf886e update mt19937 2023-12-12 14:10:05 +08:00
mercury233 d63e517791 replace 0x80 with LOCATION_OVERLAY 2022-11-06 09:02:04 +08:00
神楽坂玲奈 1cfa1a1cbb clean abuse of ptr type, compiles on vs x64. (#2370) 2022-09-28 08:56:18 +08:00
Mercury233 545f42bffa update time limit handling (#2296) 2022-09-28 08:40:38 +08:00