• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ +9 players in some stack debug

Joined
Aug 15, 2014
Messages
143
Reaction score
24
In my server when the players stack in the same sqm when the number 10 go on in stepin the last one takes debug.
When someone in stack of +9 players logout all clientes in stack takes debug too.

Can someone explain to me why this happens and how I can avoid?
Thanks guys.


I do a video explain the bug (sorry br language):
 
It happens to me too(in 1.5), I leave additional information


bug report of client

OTC:
Lua:
ERROR: too many things, pos=306 43 6, stackpos=11
at:
    [C++]: ?setTileDescription@ProtocolGame@@QEAAHAEBV?$shared_ptr@VInputMessage@@@std@@VPosition@@@Z
ERROR: unable to remove creature
at:
    [C++]: ?parseCreatureMove@ProtocolGame@@AEAAXAEBV?$shared_ptr@VInputMessage@@@std@@@Z
ERROR: too many things, pos=306 43 6, stackpos=11

OLD
Lua:
Debug Assertion 8.0 Map.cpp 519
Tue Feb 14 20:14:13 2023
Windows Version: 6.2 build 9200 on 2
Graphic Engine: DirectX9 (2)
Last Packet Types: 100 162 142 162 143 160 180 160 140 108
Last Packet: 230 021 170 000 000 000 000 000 000 000 000 005 010 000 157 000
Player Position: [306,43,6]
Player Name: MaXXXXX
Player.cpp 358: exception occurred, reason:
Network.cpp 980: exception occurred (ErrorCode = 0), reason:
Control.cpp 1309: exception occurred (Type = 100), reason:
Communication.cpp 1532: exception occurred (PlayerX = 306) (PlayerY = 43), reason:
Communication.cpp 1509: exception occurred (xmin = 0) (ymin = 0), reason:
Communication.cpp 1488: exception occurred (Type = 98) (OldType = 98), reason:
Map.cpp 524: exception occurred, reason:
Map.cpp 519: too many objects on map point, reason:
ObjectCount: 10 rx: 8 ry: 6 rz: 1
Comment:

I think the key to solving this is here:
src/protocolgame.cpp
ProtocolGame::GetTileDescription
ProtocolGame::sendCreatureTurn
ProtocolGame::sendRemoveTileThing
ProtocolGame::sendUpdateTile
ProtocolGame::sendAddCreature
ProtocolGame::sendMoveCreature


but i can't fix it. I've done more than 100 compilations trying it xd
 
I use tfs 1.3, my lines are different..

My code is this:

C++:
void ProtocolGame::GetTileDescription(const Tile* tile, NetworkMessage& msg)
{
    int32_t count;
    Item* ground = tile->getGround();
    if (ground) {
        msg.addItem(ground);
        count = 1;
    } else {
        count = 0;
    }

    const TileItemVector* items = tile->getItemList();
    if (items) {
        for (auto it = items->getBeginTopItem(), end = items->getEndTopItem(); it != end; ++it) {
            msg.addItem(*it);

            if (++count == 10) {
                break;
            }
        }
    }

    const CreatureVector* creatures = tile->getCreatures();
    if (creatures) {
        for (auto it = creatures->rbegin(), end = creatures->rend(); it != end; ++it) {
            const Creature* creature = (*it);
            if (!player->canSeeCreature(creature)) {
                continue;
            }

            bool known;
            uint32_t removedKnown;
            checkCreatureAsKnown(creature->getID(), known, removedKnown);
            AddCreature(msg, creature, known, removedKnown);
            ++count;
        }
    }

    if (items && count < 10) {
        for (auto it = items->getBeginDownItem(), end = items->getEndDownItem(); it != end; ++it) {
            msg.addItem(*it);

            if (++count == 10) {
                return;
            }
        }
    }
}
 
Last edited:
I use tfs 1.3, my lines are different..

My code is this:

C++:
void ProtocolGame::GetTileDescription(const Tile* tile, NetworkMessage& msg)
{
    int32_t count;
    Item* ground = tile->getGround();
    if (ground) {
        msg.addItem(ground);
        count = 1;
    } else {
        count = 0;
    }

    const TileItemVector* items = tile->getItemList();
    if (items) {
        for (auto it = items->getBeginTopItem(), end = items->getEndTopItem(); it != end; ++it) {
            msg.addItem(*it);

            if (++count == 10) {
                break;
            }
        }
    }

    const CreatureVector* creatures = tile->getCreatures();
    if (creatures) {
        for (auto it = creatures->rbegin(), end = creatures->rend(); it != end; ++it) {
            const Creature* creature = (*it);
            if (!player->canSeeCreature(creature)) {
                continue;
            }

            bool known;
            uint32_t removedKnown;
            checkCreatureAsKnown(creature->getID(), known, removedKnown);
            AddCreature(msg, creature, known, removedKnown);
            ++count;
        }
    }

    if (items && count < 10) {
        for (auto it = items->getBeginDownItem(), end = items->getEndDownItem(); it != end; ++it) {
            msg.addItem(*it);

            if (++count == 10) {
                return;
            }
        }
    }
}
Yes, the line I linked is different cause it should be the fix for the issue you're having lol.

replace
C++:
 ++count;

with

C++:
            if (++count == 10) {
                return;
            }
 
Yes, the line I linked is different cause it should be the fix for the issue you're having lol.

replace
C++:
 ++count;

with

C++:
            if (++count == 10) {
                return;
            }
Works In the case of 1.5
BUT if a player who was on the stack moves
the client gives bug
Lua:
Debug Assertion 8.0 Map.cpp 271
Thu Mar 02 13:57:43 2023
Windows Version: 6.2 build 9200 on 2
Graphic Engine: DirectX9 (2)
Last Packet Types: 109 160 160 160 160 160 160 103 109 160
Last Packet: 211 000 109 255 255 163 031 000 064 133 000 203 000 006 105 133
Player Position: [133,201,6]
Player Name: Saiyan Forur
Player.cpp 358: exception occurred, reason:
Network.cpp 980: exception occurred (ErrorCode = 0), reason:
Control.cpp 1309: exception occurred (Type = 109), reason:
Communication.cpp 1994: exception occurred, reason:
Map.cpp 271: assertion failed (rx = 65404), reason:
In(rx,0,MAPSIZE_X-1) [bug0000013]
Comment:
at the end copy and paste void ProtocolGame::sendMoveCreature
from the repository in my src of 1.5 and it worked xd



What oen432 mentions I THINK is so that the people who are on the stack can appear in the battle.
only the first 10 appear, but if there are 19 in the stack it does not show 9 in the battle in the case of OTC
to fix that, add that
Code:
GameNewCreatureStacking

o if you have client mehah
I guess you should add that, if this would be possible
 
Last edited:
Works In the case of 1.5
BUT if a player who was on the stack moves
the client gives bug
Lua:
Debug Assertion 8.0 Map.cpp 271
Thu Mar 02 13:57:43 2023
Windows Version: 6.2 build 9200 on 2
Graphic Engine: DirectX9 (2)
Last Packet Types: 109 160 160 160 160 160 160 103 109 160
Last Packet: 211 000 109 255 255 163 031 000 064 133 000 203 000 006 105 133
Player Position: [133,201,6]
Player Name: Saiyan Forur
Player.cpp 358: exception occurred, reason:
Network.cpp 980: exception occurred (ErrorCode = 0), reason:
Control.cpp 1309: exception occurred (Type = 109), reason:
Communication.cpp 1994: exception occurred, reason:
Map.cpp 271: assertion failed (rx = 65404), reason:
In(rx,0,MAPSIZE_X-1) [bug0000013]
Comment:
at the end copy and paste void ProtocolGame::sendMoveCreature
from the repository in my src of 1.5 and it worked xd




What oen432 mentions I THINK is so that the people who are on the stack can appear in the battle.
only the first 10 appear, but if there are 19 in the stack it does not show 9 in the battle in the case of OTC
to fix that, add that
Code:
GameNewCreatureStacking

o if you have client mehah
I guess you should add that, if this would be possible

When stacked creature moves 8.60 client still getting debug assertion. So its not Solved
 
Last edited:
When stacked creature moves 8.60 client still getting debug assertion. So its not Solved
Lua:
        if (teleport || (oldPos.z == 7 && newPos.z >= 8) || oldStackPos >= 10) {
            sendRemoveTileThing(oldPos, oldStackPos);
            sendAddCreature(creature, newPos, newStackPos, false);
        } else {

sendRemoveTileThing(oldPos, oldStackPos);

that line solved my problem
test
 
Lua:
        if (teleport || (oldPos.z == 7 && newPos.z >= 8) || oldStackPos >= 10) {
            sendRemoveTileThing(oldPos, oldStackPos);
            sendAddCreature(creature, newPos, newStackPos, false);
        } else {

sendRemoveTileThing(oldPos, oldStackPos);

that line solved my problem
test

This solve on move and already using that too, and many other things to fix the problem, now when die on Stack 8.60 client still bug.
 
Last edited:
Tile.cpp
Queryadd

C++:
if (playerTile) {
                if (hasFlag(TILESTATE_FLOORCHANGE_NORTH)) {
                  uint16_t dx = tilePos.x;

                    uint16_t dy = tilePos.y - 1;

                    uint8_t dz = tilePos.z - 1;

                    Tile* NupTile = g_game.map.getTile(dx, dy, dz);

                    if NupTile->getCreatureCount() > 9) {
                    return RETURNVALUE_NOTENOUGHROOM;
                }
                }
                }

ron swanson computer GIF

xD
 
Last edited:
To me keep this error guys:

Player.cpp 361: exception occurred, reason:
Network.cpp 946: exception occurred (ErrorCode = 0), reason:
Network.cpp 921: assertion failed (BufferSize = 0) (NextToWrite = 16394), reason:
BufferSize>0
 
Back
Top