Adjust fallen changes

* Restore old map load() used in minimap
* Change tabs to 4 spaces
* Add missing cmake file
This commit is contained in:
Eduardo Bart 2012-06-21 00:05:44 -03:00
parent 6b0d922dd9
commit f3499efe83
17 changed files with 4629 additions and 4590 deletions

View File

@ -48,6 +48,8 @@ SET(otclient_SOURCES ${otclient_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/core/shadermanager.h
${CMAKE_CURRENT_LIST_DIR}/core/item.cpp
${CMAKE_CURRENT_LIST_DIR}/core/item.h
${CMAKE_CURRENT_LIST_DIR}/core/itemloader.cpp
${CMAKE_CURRENT_LIST_DIR}/core/itemloader.h
${CMAKE_CURRENT_LIST_DIR}/core/localplayer.cpp
${CMAKE_CURRENT_LIST_DIR}/core/localplayer.h
${CMAKE_CURRENT_LIST_DIR}/core/map.cpp

View File

@ -54,7 +54,7 @@ void Map::notificateTileUpdateToMapViews(const Position& pos)
mapView->onTileUpdate(pos);
}
bool Map::load(const std::string& fileName)
bool Map::loadOTBM(const std::string& fileName)
{
FileStreamPtr fin = g_resources.openFile(fileName);
if (!fin) {
@ -274,7 +274,38 @@ bool Map::load(const std::string& fileName)
return true;
}
void Map::save(const std::string& fileName)
bool Map::loadOTCM(const std::string& fileName)
{
if(!g_resources.fileExists(fileName)) {
g_logger.error(stdext::format("Unable to load map '%s'", fileName));
return false;
}
std::stringstream in;
g_resources.loadFile(fileName, in);
while(!in.eof()) {
Position pos;
in.read((char*)&pos, sizeof(pos));
uint16 id;
in.read((char*)&id, sizeof(id));
while(id != 0xFFFF) {
ItemPtr item = Item::create(id);
if(item->isStackable() || item->isFluidContainer() || item->isFluid()) {
uint8 countOrSubType;
in.read((char*)&countOrSubType, sizeof(countOrSubType));
item->setCountOrSubType(countOrSubType);
}
addThing(item, pos, 255);
in.read((char*)&id, sizeof(id));
}
}
return true;
}
void Map::saveOTCM(const std::string& fileName)
{
std::stringstream out;

View File

@ -82,8 +82,12 @@ public:
void removeMapView(const MapViewPtr& mapView);
void notificateTileUpdateToMapViews(const Position& pos);
bool load(const std::string& fileName);
void save(const std::string& fileName);
bool loadOTCM(const std::string& fileName);
void saveOTCM(const std::string& fileName);
bool loadOTBM(const std::string& fileName);
//void saveOTBM(const std::string& fileName);
void clean();
void cleanDynamicThings();
void cleanTexts();

View File

@ -76,8 +76,10 @@ void OTClient::registerLuaFunctions()
g_lua.bindSingletonFunction("g_map", "removeCreatureById", &Map::removeCreatureById, &g_map);
g_lua.bindSingletonFunction("g_map", "getSpectators", &Map::getSpectators, &g_map);
g_lua.bindSingletonFunction("g_map", "findPath", &Map::findPath, &g_map);
g_lua.bindSingletonFunction("g_map", "load", &Map::load, &g_map);
g_lua.bindSingletonFunction("g_map", "save", &Map::save, &g_map);
g_lua.bindSingletonFunction("g_map", "loadOTBM", &Map::loadOTBM, &g_map);
//g_lua.bindSingletonFunction("g_map", "saveOTBM", &Map::save, &g_map);
g_lua.bindSingletonFunction("g_map", "loadOTCM", &Map::loadOTCM, &g_map);
g_lua.bindSingletonFunction("g_map", "saveOTCM", &Map::saveOTCM, &g_map);
g_lua.registerSingletonClass("g_game");
g_lua.bindSingletonFunction("g_game", "loginWorld", &Game::loginWorld, &g_game);