예제 #1
0
void ProtocolGame::parseTileAddThing(InputMessage& msg)
{
    Position pos = parsePosition(msg);
    int stackPos = msg.getU8();

    ThingPtr thing = internalGetThing(msg);
    g_map.addThing(thing, pos, stackPos);
}
예제 #2
0
void ProtocolGame::setTileDescription(InputMessage& msg, Position position)
{
    g_map.cleanTile(position);

    int stackPos = 0;
    while(true) {
        int inspectTileId = msg.getU16(true);
        if(inspectTileId >= 0xFF00)
            return;
        else {
            if(stackPos >= 10)
                logTraceError("too many things, stackpos=", stackPos, " pos=", position);

            ThingPtr thing = internalGetThing(msg);
            if(thing)
                g_map.addThing(thing, position, 255);
        }
        stackPos++;
    }
}
예제 #3
0
bool ProtocolGame854::parseTileAddThing(NetworkMessage& msg)
{
    MSG_READ_POSITION(tilePos);
    MSG_READ_U8(stackPos);
    Thing* thing = internalGetThing(msg);
    if(!thing){
        RAISE_PROTOCOL_ERROR("Tile Add - getThing");
    }

    Tile* tile = Map::getInstance().getTile(tilePos);
    if(!tile){
        RAISE_PROTOCOL_ERROR("Tile Add - !tile");
    }

    if(!tile->insertThing(thing, stackPos)){
        RAISE_PROTOCOL_ERROR("Tile Add - addThing");
    }
    Notifications::onTileUpdate(tilePos);
    return true;
}