fix compile issue for win32

This commit is contained in:
Eduardo Bart 2012-05-09 20:04:09 -03:00
parent 606fc38109
commit 04eca969fa
4 changed files with 19 additions and 20 deletions

View File

@ -45,7 +45,6 @@ void Application::registerLuaFunctions()
g_lua.bindGlobalFunction("pointtostring", [](const Point& v) { return Fw::tostring(v); }); g_lua.bindGlobalFunction("pointtostring", [](const Point& v) { return Fw::tostring(v); });
g_lua.bindGlobalFunction("colortostring", [](const Color& v) { return Fw::tostring(v); }); g_lua.bindGlobalFunction("colortostring", [](const Color& v) { return Fw::tostring(v); });
g_lua.bindGlobalFunction("sizetostring", [](const Size& v) { return Fw::tostring(v); }); g_lua.bindGlobalFunction("sizetostring", [](const Size& v) { return Fw::tostring(v); });
g_lua.bindGlobalFunction("getticks", []() { return g_clock.asyncTicks(); });
// Event // Event
g_lua.registerClass<Event>(); g_lua.registerClass<Event>();

View File

@ -479,9 +479,8 @@ void Game::walk(Otc::Direction direction)
return; return;
// only do prewalks to walkable tiles // only do prewalks to walkable tiles
TilePtr fromTile = m_localPlayer->getTile();
TilePtr toTile = g_map.getTile(m_localPlayer->getPosition().translatedToDirection(direction)); TilePtr toTile = g_map.getTile(m_localPlayer->getPosition().translatedToDirection(direction));
if(toTile && toTile->isWalkable()/* && fromTile && fromTile->hasThing(m_localPlayer)*/) if(toTile && toTile->isWalkable())
m_localPlayer->preWalk(direction); m_localPlayer->preWalk(direction);
else else
m_localPlayer->lockWalk(); m_localPlayer->lockWalk();

View File

@ -120,6 +120,7 @@ void Map::cleanDynamicThings()
removeThing(creature); removeThing(creature);
creature->setRemoved(true); creature->setRemoved(true);
} }
m_knownCreatures.clear();
for(int i=0;i<=Otc::MAX_Z;++i) for(int i=0;i<=Otc::MAX_Z;++i)
m_floorMissiles[i].clear(); m_floorMissiles[i].clear();
@ -296,9 +297,9 @@ void Map::setCentralPosition(const Position& centralPosition)
logTraceError("invalid creature"); logTraceError("invalid creature");
} }
// this fixes local player position when the local player is removed fro the map, // this fixes local player position when the local player is removed from the map,
// the local player is removed from the map when there are too many creatures on his tile // the local player is removed from the map when there are too many creatures on his tile,
// so there is not enough stackpos to the server send him // so there is no enough stackpos to the server send him
g_eventDispatcher.addEvent([this] { g_eventDispatcher.addEvent([this] {
LocalPlayerPtr localPlayer = g_game.getLocalPlayer(); LocalPlayerPtr localPlayer = g_game.getLocalPlayer();
if(!localPlayer || localPlayer->getPosition() == m_centralPosition) if(!localPlayer || localPlayer->getPosition() == m_centralPosition)

View File

@ -445,8 +445,6 @@ void ProtocolGame::parseCreatureMove(InputMessage& msg)
if(!g_map.removeThing(thing)) if(!g_map.removeThing(thing))
logTraceError("could not remove thing"); logTraceError("could not remove thing");
g_map.addThing(thing, newPos); g_map.addThing(thing, newPos);
//g_game.processCreatureMove(creature, oldPos, newPos);
} }
void ProtocolGame::parseOpenContainer(InputMessage& msg) void ProtocolGame::parseOpenContainer(InputMessage& msg)
@ -629,7 +627,7 @@ void ProtocolGame::parseCreatureMark(InputMessage& msg)
if(creature) if(creature)
creature->addTimedSquare(color); creature->addTimedSquare(color);
else else
logTraceError("could not get greature"); logTraceError("could not get creature");
} }
void ProtocolGame::parseCreatureHealth(InputMessage& msg) void ProtocolGame::parseCreatureHealth(InputMessage& msg)
@ -641,7 +639,7 @@ void ProtocolGame::parseCreatureHealth(InputMessage& msg)
if(creature) if(creature)
creature->setHealthPercent(healthPercent); creature->setHealthPercent(healthPercent);
else else
logTraceError("could not get greature"); logTraceError("could not get creature");
} }
void ProtocolGame::parseCreatureLight(InputMessage& msg) void ProtocolGame::parseCreatureLight(InputMessage& msg)
@ -656,7 +654,7 @@ void ProtocolGame::parseCreatureLight(InputMessage& msg)
if(creature) if(creature)
creature->setLight(light); creature->setLight(light);
else else
logTraceError("could not get greature"); logTraceError("could not get creature");
} }
void ProtocolGame::parseCreatureOutfit(InputMessage& msg) void ProtocolGame::parseCreatureOutfit(InputMessage& msg)
@ -668,7 +666,7 @@ void ProtocolGame::parseCreatureOutfit(InputMessage& msg)
if(creature) if(creature)
creature->setOutfit(outfit); creature->setOutfit(outfit);
else else
logTraceError("could not get greature"); logTraceError("could not get creature");
} }
void ProtocolGame::parseCreatureSpeed(InputMessage& msg) void ProtocolGame::parseCreatureSpeed(InputMessage& msg)
@ -680,7 +678,7 @@ void ProtocolGame::parseCreatureSpeed(InputMessage& msg)
if(creature) if(creature)
creature->setSpeed(speed); creature->setSpeed(speed);
else else
logTraceError("could not get greature"); logTraceError("could not get creature");
} }
void ProtocolGame::parseCreatureSkulls(InputMessage& msg) void ProtocolGame::parseCreatureSkulls(InputMessage& msg)
@ -692,7 +690,7 @@ void ProtocolGame::parseCreatureSkulls(InputMessage& msg)
if(creature) if(creature)
creature->setSkull(skull); creature->setSkull(skull);
else else
logTraceError("could not get greature"); logTraceError("could not get creature");
} }
void ProtocolGame::parseCreatureShields(InputMessage& msg) void ProtocolGame::parseCreatureShields(InputMessage& msg)
@ -704,7 +702,7 @@ void ProtocolGame::parseCreatureShields(InputMessage& msg)
if(creature) if(creature)
creature->setShield(shield); creature->setShield(shield);
else else
logTraceError("could not get greature"); logTraceError("could not get creature");
} }
void ProtocolGame::parseCreatureUnpass(InputMessage& msg) void ProtocolGame::parseCreatureUnpass(InputMessage& msg)
@ -716,7 +714,7 @@ void ProtocolGame::parseCreatureUnpass(InputMessage& msg)
if(creature) if(creature)
creature->setPassable(!unpass); creature->setPassable(!unpass);
else else
logTraceError("could not get greature"); logTraceError("could not get creature");
} }
void ProtocolGame::parseCreatureTurn(InputMessage& msg) void ProtocolGame::parseCreatureTurn(InputMessage& msg)
@ -728,7 +726,7 @@ void ProtocolGame::parseCreatureTurn(InputMessage& msg)
if(creature) if(creature)
creature->turn(direction); creature->turn(direction);
else else
logTraceError("could not get greature"); logTraceError("could not get creature");
} }
void ProtocolGame::parseEditText(InputMessage& msg) void ProtocolGame::parseEditText(InputMessage& msg)
@ -1233,11 +1231,13 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
else else
logTraceError("creature id is invalid"); logTraceError("creature id is invalid");
if(creature) {
creature->setId(id); creature->setId(id);
creature->setName(name); creature->setName(name);
g_map.addCreature(creature); g_map.addCreature(creature);
} }
}
int healthPercent = msg.getU8(); int healthPercent = msg.getU8();
Otc::Direction direction = (Otc::Direction)msg.getU8(); Otc::Direction direction = (Otc::Direction)msg.getU8();