change: Translate ClientManagerBoot.cpp
This commit is contained in:
@ -571,32 +571,34 @@ bool CClientManager::InitializeQuestItemTable()
|
||||
|
||||
bool CClientManager::InitializeItemTable()
|
||||
{
|
||||
//================== 함수 설명 ==================//
|
||||
//1. 요약 : 'item_proto.txt', 'item_proto_test.txt', 'item_names.txt' 파일을 읽고,
|
||||
// <item_table>(TItemTable), <m_map_itemTableByVnum> 오브젝트를 생성한다.
|
||||
//2. 순서
|
||||
// 1) 'item_names.txt' 파일을 읽어서 (a)[localMap](vnum:name) 맵을 만든다.
|
||||
// 2) 'item_proto_text.txt'파일과 (a)[localMap] 맵으로
|
||||
// (b)[test_map_itemTableByVnum](vnum:TItemTable) 맵을 생성한다.
|
||||
// 3) 'item_proto.txt' 파일과 (a)[localMap] 맵으로
|
||||
// (!)[item_table], <m_map_itemTableByVnum>을 만든다.
|
||||
// <참고>
|
||||
// 각 row 들 중,
|
||||
// (b)[test_map_itemTableByVnum],(!)[mob_table] 모두에 있는 row는
|
||||
// (b)[test_map_itemTableByVnum]의 것을 사용한다.
|
||||
// 4) (b)[test_map_itemTableByVnum]의 row중, (!)[item_table]에 없는 것을 추가한다.
|
||||
//3. 테스트
|
||||
// 1)'item_proto.txt' 정보가 item_table에 잘 들어갔는지. -> 완료
|
||||
// 2)'item_names.txt' 정보가 item_table에 잘 들어갔는지.
|
||||
// 3)'item_proto_test.txt' 에서 [겹치는] 정보가 item_table 에 잘 들어갔는지.
|
||||
// 4)'item_proto_test.txt' 에서 [새로운] 정보가 item_table 에 잘 들어갔는지.
|
||||
// 5) (최종) 게임 클라이언트에서 제대로 작동 하는지.
|
||||
// TODO Rework this in order to load multiple locales
|
||||
//================== Function Description ==================//
|
||||
// 1. Summary: Reads the files 'item_proto.txt', 'item_proto_test.txt', and 'item_names.txt',
|
||||
// and generates <item_table>(TItemTable), <m_map_itemTableByVnum> objects.
|
||||
// 2. Procedure:
|
||||
// 1) Read the 'item_names.txt' file to create
|
||||
// (a) [localMap] (vnum:name) map.
|
||||
// 2) Use 'item_proto_test.txt' and the (a) [localMap]
|
||||
// to generate (b) [test_map_itemTableByVnum] (vnum:TItemTable) map.
|
||||
// 3) Use 'item_proto.txt' and the (a) [localMap]
|
||||
// to create (!) [item_table] and <m_map_itemTableByVnum>.
|
||||
// <Note>
|
||||
// Among the rows,
|
||||
// for those existing in both (b) [test_map_itemTableByVnum] and (!) [item_table],
|
||||
// use the row from (b) [test_map_itemTableByVnum].
|
||||
// 4) Add any rows in (b) [test_map_itemTableByVnum] that are not in (!) [item_table].
|
||||
// 3. Testing:
|
||||
// 1) Check whether data from 'item_proto.txt' has been correctly entered into item_table. -> Done
|
||||
// 2) Check whether data from 'item_names.txt' has been correctly entered into item_table.
|
||||
// 3) Check whether [overlapping] data from 'item_proto_test.txt' has been correctly entered into item_table.
|
||||
// 4) Check whether [new] data from 'item_proto_test.txt' has been correctly entered into item_table.
|
||||
// 5) (Final) Verify that it works correctly in the game client.
|
||||
//_______________________________________________//
|
||||
|
||||
|
||||
|
||||
//=================================================================================//
|
||||
// 1) 'item_names.txt' 파일을 읽어서 (a)[localMap](vnum:name) 맵을 만든다.
|
||||
// 1) Read the 'item_names.txt' file to create (a) [localMap] (vnum:name) map.
|
||||
//=================================================================================//
|
||||
bool isNameFile = true;
|
||||
map<int,const char*> localMap;
|
||||
@ -614,11 +616,11 @@ bool CClientManager::InitializeItemTable()
|
||||
//_________________________________________________________________//
|
||||
|
||||
//=================================================================//
|
||||
// 2) 'item_proto_text.txt'파일과 (a)[localMap] 맵으로
|
||||
// (b)[test_map_itemTableByVnum](vnum:TItemTable) 맵을 생성한다.
|
||||
// 2) Using the 'item_proto_test.txt' file and the (a) [localMap] map,
|
||||
// generate the (b) [test_map_itemTableByVnum] (vnum:TItemTable) map.
|
||||
//=================================================================//
|
||||
map<DWORD, TItemTable *> test_map_itemTableByVnum;
|
||||
//1. 파일 읽어오기.
|
||||
// 1. Read the file.
|
||||
cCsvTable test_data;
|
||||
if(!test_data.Load("item_proto_test.txt",'\t'))
|
||||
{
|
||||
@ -627,13 +629,13 @@ bool CClientManager::InitializeItemTable()
|
||||
} else {
|
||||
test_data.Next(); //설명 로우 넘어가기.
|
||||
|
||||
//2. 테스트 아이템 테이블 생성.
|
||||
// 2. Create the test item table.
|
||||
TItemTable * test_item_table = NULL;
|
||||
int test_itemTableSize = test_data.m_File.GetRowCount()-1;
|
||||
test_item_table = new TItemTable[test_itemTableSize];
|
||||
memset(test_item_table, 0, sizeof(TItemTable) * test_itemTableSize);
|
||||
|
||||
//3. 테스트 아이템 테이블에 값을 넣고, 맵에까지 넣기.
|
||||
// 3. Insert values into the test item table and populate the map.
|
||||
while(test_data.Next()) {
|
||||
|
||||
|
||||
@ -651,25 +653,25 @@ bool CClientManager::InitializeItemTable()
|
||||
|
||||
|
||||
//========================================================================//
|
||||
// 3) 'item_proto.txt' 파일과 (a)[localMap] 맵으로
|
||||
// (!)[item_table], <m_map_itemTableByVnum>을 만든다.
|
||||
// <참고>
|
||||
// 각 row 들 중,
|
||||
// (b)[test_map_itemTableByVnum],(!)[mob_table] 모두에 있는 row는
|
||||
// (b)[test_map_itemTableByVnum]의 것을 사용한다.
|
||||
// 3) Using the 'item_proto.txt' file and the (a) [localMap] map,
|
||||
// create the (!) [item_table] and <m_map_itemTableByVnum>.
|
||||
// <Note>
|
||||
// Among the rows,
|
||||
// for those present in both (b) [test_map_itemTableByVnum] and (!) [mob_table],
|
||||
// use the row from (b) [test_map_itemTableByVnum].
|
||||
//========================================================================//
|
||||
|
||||
//vnum들을 저장할 셋. 새로운 테스트 아이템을 판별할때 사용된다.
|
||||
// A set to store vnums. Used to identify new test items.
|
||||
set<int> vnumSet;
|
||||
|
||||
//파일 읽어오기.
|
||||
// Read the file.
|
||||
cCsvTable data;
|
||||
if(!data.Load("item_proto.txt",'\t'))
|
||||
{
|
||||
SPDLOG_ERROR("item_proto.txt Failed to read the file");
|
||||
return false;
|
||||
}
|
||||
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
||||
data.Next(); // Exclude the top line (the part describing the item columns).
|
||||
|
||||
if (!m_vec_itemTable.empty())
|
||||
{
|
||||
@ -678,8 +680,8 @@ bool CClientManager::InitializeItemTable()
|
||||
m_map_itemTableByVnum.clear();
|
||||
}
|
||||
|
||||
//===== 아이템 테이블 생성 =====//
|
||||
//새로 추가되는 갯수를 파악한다.
|
||||
//===== Create item table =====//
|
||||
// Determine the number of newly added items.
|
||||
int addNumber = 0;
|
||||
while(data.Next()) {
|
||||
int vnum = atoi(data.AsStringByIndex(0));
|
||||
@ -689,14 +691,14 @@ bool CClientManager::InitializeItemTable()
|
||||
addNumber++;
|
||||
}
|
||||
}
|
||||
//data를 다시 첫줄로 옮긴다.(다시 읽어온다;;)
|
||||
// Move the data back to the first line (re-read it;;)
|
||||
data.Destroy();
|
||||
if(!data.Load("item_proto.txt",'\t'))
|
||||
{
|
||||
SPDLOG_ERROR("item_proto.txt Failed to read the file");
|
||||
return false;
|
||||
}
|
||||
data.Next(); //맨 윗줄 제외 (아이템 칼럼을 설명하는 부분)
|
||||
data.Next(); // Skip the top line (the part that describes the item columns).
|
||||
|
||||
m_vec_itemTable.resize(data.m_File.GetRowCount() - 1 + addNumber);
|
||||
memset(&m_vec_itemTable[0], 0, sizeof(TItemTable) * m_vec_itemTable.size());
|
||||
@ -711,7 +713,7 @@ bool CClientManager::InitializeItemTable()
|
||||
std::map<DWORD, TItemTable *>::iterator it_map_itemTable;
|
||||
it_map_itemTable = test_map_itemTableByVnum.find(atoi(data.AsStringByIndex(col)));
|
||||
if(it_map_itemTable == test_map_itemTableByVnum.end()) {
|
||||
//각 칼럼 데이터 저장
|
||||
// Store data for each column
|
||||
|
||||
if (!Set_Proto_Item_Table(item_table, data, localMap))
|
||||
{
|
||||
@ -720,7 +722,7 @@ bool CClientManager::InitializeItemTable()
|
||||
|
||||
|
||||
|
||||
} else { //$$$$$$$$$$$$$$$$$$$$$$$ 테스트 아이템 정보가 있다!
|
||||
} else { // $$$$$$$$$$$$$$$$$$$$$ There is test item information!
|
||||
TItemTable *tempTable = it_map_itemTable->second;
|
||||
|
||||
item_table->dwVnum = tempTable->dwVnum;
|
||||
@ -777,7 +779,7 @@ bool CClientManager::InitializeItemTable()
|
||||
//_______________________________________________________________________//
|
||||
|
||||
//========================================================================//
|
||||
// 4) (b)[test_map_itemTableByVnum]의 row중, (!)[item_table]에 없는 것을 추가한다.
|
||||
// 4) Add rows from (b) [test_map_itemTableByVnum] that do not exist in (!) [item_table].
|
||||
//========================================================================//
|
||||
test_data.Destroy();
|
||||
if(!test_data.Load("item_proto_test.txt",'\t'))
|
||||
@ -785,11 +787,11 @@ bool CClientManager::InitializeItemTable()
|
||||
SPDLOG_ERROR("item_proto_test.txt Failed to read the file");
|
||||
//return false;
|
||||
} else {
|
||||
test_data.Next(); //설명 로우 넘어가기.
|
||||
test_data.Next(); // Skip the description row.
|
||||
|
||||
while (test_data.Next()) //테스트 데이터 각각을 훑어나가며,새로운 것을 추가한다.
|
||||
while (test_data.Next()) // Iterate through each test data entry and add new ones.
|
||||
{
|
||||
//중복되는 부분이면 넘어간다.
|
||||
// Skip if it’s a duplicate.
|
||||
set<int>::iterator itVnum;
|
||||
itVnum=vnumSet.find(atoi(test_data.AsStringByIndex(0)));
|
||||
if (itVnum != vnumSet.end()) {
|
||||
|
Reference in New Issue
Block a user