mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[10474] Cleanup vmap_assembler
* Drop dead code * Use std::string instead of char* * Use std::cout instead of printf() Signed-off-by: Lynx3d <lynx3d@some-imaginary-isp.org>
This commit is contained in:
parent
31ea979c7c
commit
ae53d49352
3 changed files with 10 additions and 119 deletions
|
|
@ -1,21 +0,0 @@
|
||||||
# list of map names
|
|
||||||
|
|
||||||
509 #AhnQiraj
|
|
||||||
469 #BlackwingLair
|
|
||||||
189 #MonasteryInstances
|
|
||||||
030 #PVPZone01
|
|
||||||
037 #PVPZone02
|
|
||||||
033 #Shadowfang
|
|
||||||
533 #Stratholme Raid
|
|
||||||
209 #TanarisInstance
|
|
||||||
309 #Zul'gurub
|
|
||||||
560 #HillsbradPast
|
|
||||||
534 #HyjalPast
|
|
||||||
532 #Karazahn
|
|
||||||
543 #HellfireRampart
|
|
||||||
568 #ZulAman
|
|
||||||
564 #BlackTemple
|
|
||||||
574 #UtgardeKeep
|
|
||||||
575 #UtgardePinnacle
|
|
||||||
609 #EbonHold
|
|
||||||
628 #IsleOfConquest
|
|
||||||
|
|
@ -1,120 +1,32 @@
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "TileAssembler.h"
|
#include "TileAssembler.h"
|
||||||
|
|
||||||
//=======================================================
|
|
||||||
// remove last return or LF and tailing SPACE
|
|
||||||
// remove all char after a #
|
|
||||||
|
|
||||||
void chompAndTrim(std::string& str)
|
|
||||||
{
|
|
||||||
for(unsigned int i=0;i<str.length(); ++i) {
|
|
||||||
char lc = str[i];
|
|
||||||
if(lc == '#') {
|
|
||||||
str = str.substr(0,i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while(str.length() >0) {
|
|
||||||
char lc = str[str.length()-1];
|
|
||||||
if(lc == '\r' || lc == '\n' || lc == ' ') {
|
|
||||||
str = str.substr(0,str.length()-1);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================
|
|
||||||
/**
|
|
||||||
This callback method is called for each model found in the dir file.
|
|
||||||
return true if it should be included in the vmap
|
|
||||||
*/
|
|
||||||
bool modelNameFilter(char *pName)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
bool result;
|
|
||||||
result = !Wildcard::wildcardfit("*bush[0-9]*", pName);
|
|
||||||
if(result) result = !Wildcard::wildcardfit("*shrub[0-9]*", pName);
|
|
||||||
if(result) result = !Wildcard::wildcardfit("*_Bushes_*", pName);
|
|
||||||
if(result) result = !Wildcard::wildcardfit("*_Bush_*", pName);
|
|
||||||
if(!result) {
|
|
||||||
printf("%s",pName);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================
|
|
||||||
/**
|
|
||||||
File contains map names that should be split into tiles
|
|
||||||
A '#' at the beginning of a line defines a comment
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* bool readConfigFile(char *pConffile, VMAP::TileAssembler* pTa)
|
|
||||||
{
|
|
||||||
bool result = false;
|
|
||||||
char buffer[501];
|
|
||||||
FILE *cf = fopen(pConffile, "rb");
|
|
||||||
if(cf) {
|
|
||||||
while(fgets(buffer, 500, cf)) {
|
|
||||||
std::string name = std::string(buffer);
|
|
||||||
size_t pos = name.find_first_not_of(' ');
|
|
||||||
name = name.substr(pos);
|
|
||||||
chompAndTrim(name); // just to be sure
|
|
||||||
if(name[0] != '#' && name.size() >0) { // comment?
|
|
||||||
unsigned int mapId = atoi(name.c_str());
|
|
||||||
pTa->addWorldAreaMapId(mapId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(cf);
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
} */
|
|
||||||
//=======================================================
|
//=======================================================
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
if(argc != 3 && argc != 4)
|
if(argc != 3)
|
||||||
{
|
{
|
||||||
printf("\nusage: %s <raw data dir> <vmap dest dir> [config file name]\n", argv[0]);
|
std::cout << "usage: " << argv[0] << " <raw data dir> <vmap dest dir>" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *src = argv[1];
|
std::string src = argv[1];
|
||||||
char *dest = argv[2];
|
std::string dest = argv[2];
|
||||||
char *conffile = NULL;
|
|
||||||
if(argc >= 4)
|
|
||||||
conffile = argv[3];
|
|
||||||
|
|
||||||
VMAP::TileAssembler* ta = new VMAP::TileAssembler(std::string(src), std::string(dest));
|
std::cout << "using " << src << " as source directory and writing output to " << dest << std::endl;
|
||||||
ta->setModelNameFilterMethod(modelNameFilter);
|
|
||||||
|
|
||||||
/*
|
VMAP::TileAssembler* ta = new VMAP::TileAssembler(src, dest);
|
||||||
All the names in the list are considered to be world maps or huge instances.
|
|
||||||
These maps will be spilt into tiles in the vmap assemble process
|
|
||||||
*/
|
|
||||||
/* if(conffile != NULL)
|
|
||||||
{
|
|
||||||
if(!readConfigFile(conffile, ta))
|
|
||||||
{
|
|
||||||
printf("Can not open file config file: %s\n", conffile);
|
|
||||||
delete ta;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
|
|
||||||
if(!ta->convertWorld2())
|
if(!ta->convertWorld2())
|
||||||
{
|
{
|
||||||
printf("exit with errors\n");
|
std::cout << "exit with errors" << std::endl;
|
||||||
delete ta;
|
delete ta;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete ta;
|
delete ta;
|
||||||
printf("Ok, all done\n");
|
std::cout << "Ok, all done" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10473"
|
#define REVISION_NR "10474"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue