1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "nel/misc/types_nl.h"
25 /// This is our Unix-variant to the Windows _getch function.
28 struct termios oldt
, newt
;
30 tcgetattr(STDIN_FILENO
, &oldt
);
32 newt
.c_lflag
&= ~(ICANON
| ECHO
);
33 tcsetattr(STDIN_FILENO
, TCSANOW
, &newt
);
35 tcsetattr(STDIN_FILENO
, TCSANOW
, &oldt
);
41 #include "nel/misc/path.h"
42 #include "nel/misc/sheet_id.h"
43 #include "nel/misc/common.h"
48 using namespace NLMISC
;
52 // ***************************************************************************
56 bool operator()(const CSheetId
&a
, const CSheetId
&b
)
58 return a
.toString()<b
.toString();
62 // ***************************************************************************
63 /// Dispaly info cmd line
64 int main(int argc
, const char *argv
[])
68 puts("Usage: disp_sheet_id path");
69 puts(" display a raw list of file names sorted by name with their sheet_id associated");
70 puts(" output in sheetid.txt");
71 puts("Press any key");
76 NLMISC::CApplicationContext appContext
;
78 CPath::addSearchPath(argv
[1]);
80 CSheetId::init(false);
82 std::vector
<CSheetId
> sheets
;
83 CSheetId::buildIdVector(sheets
);
87 sort(sheets
.begin(), sheets
.end(), Pred
);
90 FILE *out
= nlfopen("sheetid.txt", "wb");
93 for(uint i
=0;i
<sheets
.size();i
++)
95 fprintf(out
, "%s : %d\n", sheets
[i
].toString().c_str(), sheets
[i
].asInt());