About Store Forum Documentation Contact



Post Reply 
Esenthel MMO error
Author Message
Rollcage Offline
Member

Post: #1
Esenthel MMO error
I've converted the MMO code to EsenthelScript,
But every time I try to enter the world with a player. I get an error relating to the players inventory saying
"error: selected class is not base class of derived one"

The error occurs at
Inventory::Inventory() {items.replaceClass<Item>();}

class NetInventory
{
Memc<NetItem> items;
......
......
}

class NetItem
{
......
......
}
class Item : NetItem
{
......
......
}

I don't really understand why it's coming up with an error when the same code works in c++
12-21-2011 05:44 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Esenthel MMO error
as commented for replaceClass:
// replace the type of class stored in the container, all elements are automatically removed before changing the type of the class, the new type must be derived from the base 'TYPE' (if you're receiving a compilation error pointing to this method this means that the new class isn't derived from the base class)

I see some inconsistence in the sample codes:
Inventory::Inventory() {items.replaceClass<Item>();}

class NetInventory

you have 2 classes for inventory (NetInventory , Inventory), please make sure you're codes are correct, and you call methods for correct members
12-21-2011 01:37 PM
Find all posts by this user Quote this message in a reply
Rollcage Offline
Member

Post: #3
RE: Esenthel MMO error
Sorry I forgot to mention Inventory is derived fomr NetInventory.

class Inventory : NetInventory
12-21-2011 01:59 PM
Find all posts by this user Quote this message in a reply
Rollcage Offline
Member

Post: #4
RE: Esenthel MMO error
The code is the same from the esenthel MMO demo just converted to .es;
The code compiles fine and I can login and create a char. However when i try to enter the world with a char an error occurs. It doesn't seem to recognize that Item is derived from NetItem...

Code:
Client.exe!EE::ASSERT_BASE_DERIVED_EX<NetItem,Item>(NetItem & __formal, NetItem & __formal)  Line 149 + 0x139 bytes    C++
    Client.exe!EE::ASSERT_BASE_DERIVED<NetItem,Item>()  Line 152 + 0x1d bytes    C++
    Client.exe!EE::Memc<NetItem>::replaceClass<Item>()  Line 215 + 0x11 bytes    C++
    Client.exe!Inventory::Inventory()  Line 95 + 0x42 bytes    C++
    Client.exe!Chr::Chr()  Line 286 + 0xa8 bytes    C++
    Client.exe!Player::Player()  Line 9 + 0x33 bytes    C++
    Client.exe!EE::ClassFunc<Player>::New(void * elm)  Line 12 + 0x51 bytes    C++
    Client.exe!EE::_Memx::New()  + 0x62 bytes    C++
    Client.exe!EE::Game::WorldManager::objCreateNear()  + 0x1cd bytes    C++
    Client.exe!InsertCharacter()  Line 13 + 0x38 bytes    C++
12-21-2011 04:09 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Esenthel MMO error
in C++

NetItem class had some virtual methods:
virtual void compress(File &f); // compress data so it can be sent using network connection
virtual void decompress(File &f); // decompress data from data obtained using network connection

did you keep those methods in the Esenthel Script version? (and keep them as virtual) ?
12-21-2011 07:34 PM
Find all posts by this user Quote this message in a reply
Rollcage Offline
Member

Post: #6
RE: Esenthel MMO error
Yep that was it, I forgot to keep them virtual.
Thanks alot
12-22-2011 01:34 AM
Find all posts by this user Quote this message in a reply
Post Reply