console fixes

This commit is contained in:
Eduardo Bart 2012-03-23 19:02:58 -03:00
parent fe86dc8050
commit 3aacd9d43c
2 changed files with 5 additions and 5 deletions

View File

@ -226,6 +226,7 @@ function Console.clear()
end end
end end
channels = {} channels = {}
channels[0] = 'Default'
consoleTabBar:getTab('Default').tabPanel:destroyChildren() consoleTabBar:getTab('Default').tabPanel:destroyChildren()
consoleTabBar:getTab('Server Log').tabPanel:destroyChildren() consoleTabBar:getTab('Server Log').tabPanel:destroyChildren()
@ -317,7 +318,7 @@ function Console.addText(text, speaktype, tabName)
end end
function Console.addTabText(text, speaktype, tab) function Console.addTabText(text, speaktype, tab)
if Options['showTimestampsInConsole'] then if Options.getOption('showTimestampsInConsole') then
text = os.date('%H:%M') .. ' ' .. text text = os.date('%H:%M') .. ' ' .. text
end end
@ -326,6 +327,7 @@ function Console.addTabText(text, speaktype, tab)
label:setText(text) label:setText(text)
label:setColor(speaktype.color) label:setColor(speaktype.color)
consoleTabBar:blinkTab(tab) consoleTabBar:blinkTab(tab)
print 'yeah'
if panel:getChildCount() > 10 then if panel:getChildCount() > 10 then
panel:removeChild(panel:getFirstChild()) panel:removeChild(panel:getFirstChild())

View File

@ -436,11 +436,9 @@ std::vector<Otc::Direction> Map::findPath(const Position& startPos, const Positi
std::vector<Otc::Direction> dirs; std::vector<Otc::Direction> dirs;
if(startPos == goalPos || startPos.z != goalPos.z || startPos.distance(goalPos) > maxSteps) { if(startPos == goalPos || startPos.z != goalPos.z || startPos.distance(goalPos) > maxSteps)
return dirs; return dirs;
}
auto estimateCost = [=](const Position& pos) { return pos.distance(goalPos); };
std::unordered_map<Position, Node*, PositionHasher> nodes; std::unordered_map<Position, Node*, PositionHasher> nodes;
std::priority_queue<Node*, std::vector<Node*>, LessNode> searchList; std::priority_queue<Node*, std::vector<Node*>, LessNode> searchList;
@ -486,7 +484,7 @@ std::vector<Otc::Direction> Map::findPath(const Position& startPos, const Positi
neighborNode->prev = currentNode; neighborNode->prev = currentNode;
neighborNode->cost = cost; neighborNode->cost = cost;
neighborNode->steps = currentNode->steps + 1; neighborNode->steps = currentNode->steps + 1;
neighborNode->totalCost = neighborNode->cost + estimateCost(neighborPos); neighborNode->totalCost = neighborNode->cost + neighborPos.distance(goalPos);
neighborNode->dir = walkDir; neighborNode->dir = walkDir;
neighborNode->evaluated = false; neighborNode->evaluated = false;
searchList.push(neighborNode); searchList.push(neighborNode);