Initial MSVC 2008 projects workspace
This commit is contained in:
45
L2C_Server/world/model/character/GameCharacter.cpp
Normal file
45
L2C_Server/world/model/character/GameCharacter.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "pch.h"
|
||||
#include "GameCharacter.h"
|
||||
|
||||
GameCharacter::GameCharacter( unsigned int objectId ): GameObject( objectId )
|
||||
{
|
||||
m_name = NULL;
|
||||
}
|
||||
|
||||
GameCharacter::~GameCharacter()
|
||||
{
|
||||
if( m_name )
|
||||
{
|
||||
free( m_name );
|
||||
m_name = NULL;
|
||||
}
|
||||
GameObject::~GameObject();
|
||||
}
|
||||
|
||||
void GameCharacter::setName( const wchar_t *name )
|
||||
{
|
||||
if( m_name ) free( m_name );
|
||||
m_name = NULL;
|
||||
if( name ) m_name = _wcsdup( name );
|
||||
}
|
||||
|
||||
void GameCharacter::setLevel( int level )
|
||||
{
|
||||
m_level = level;
|
||||
if( m_level < 0 ) m_level = 0;
|
||||
}
|
||||
|
||||
const wchar_t *GameCharacter::getName() const
|
||||
{
|
||||
return (const wchar_t *)m_name;
|
||||
}
|
||||
|
||||
wchar_t *GameCharacter::toString() const
|
||||
{
|
||||
GameCharacter *nc_this = const_cast<GameCharacter *>(this);
|
||||
if( !nc_this->m_toString_buffer )
|
||||
nc_this->m_toString_buffer = (wchar_t *)malloc( 512 );
|
||||
if( nc_this->m_toString_buffer )
|
||||
swprintf( nc_this->m_toString_buffer, 255, L"%s lvl %d [oid %u]", m_name, m_level, m_objectId );
|
||||
return m_toString_buffer;
|
||||
}
|
24
L2C_Server/world/model/character/GameCharacter.h
Normal file
24
L2C_Server/world/model/character/GameCharacter.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include "../GameObject.h"
|
||||
|
||||
class GameCharacter: public GameObject
|
||||
{
|
||||
public:
|
||||
GameCharacter( unsigned int objectId );
|
||||
virtual ~GameCharacter();
|
||||
|
||||
public:
|
||||
void setName( const wchar_t *name );
|
||||
void setLevel( int level );
|
||||
|
||||
public:
|
||||
const wchar_t *getName() const;
|
||||
int getLevel() const { return m_level; }
|
||||
|
||||
public:
|
||||
virtual wchar_t *toString() const;
|
||||
|
||||
protected:
|
||||
wchar_t *m_name;
|
||||
int m_level;
|
||||
};
|
11
L2C_Server/world/model/character/GameNpc.cpp
Normal file
11
L2C_Server/world/model/character/GameNpc.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "pch.h"
|
||||
#include "GameNpc.h"
|
||||
|
||||
GameNpc::GameNpc( unsigned int objectId, int npcTemplateId ): GameCharacter( objectId )
|
||||
{
|
||||
m_npcTemplateId = npcTemplateId;
|
||||
}
|
||||
|
||||
GameNpc::~GameNpc()
|
||||
{
|
||||
}
|
18
L2C_Server/world/model/character/GameNpc.h
Normal file
18
L2C_Server/world/model/character/GameNpc.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "GameCharacter.h"
|
||||
|
||||
class GameNpc: public GameCharacter
|
||||
{
|
||||
public:
|
||||
GameNpc( unsigned int objectId, int npcTemplateId );
|
||||
virtual ~GameNpc();
|
||||
|
||||
public:
|
||||
int getNpcTemplateId() const { return m_npcTemplateId; }
|
||||
|
||||
public:
|
||||
void setNpcTemplateId( int tmplId ) { m_npcTemplateId = tmplId; }
|
||||
|
||||
protected:
|
||||
int m_npcTemplateId;
|
||||
};
|
19
L2C_Server/world/model/character/GamePlayer.cpp
Normal file
19
L2C_Server/world/model/character/GamePlayer.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "pch.h"
|
||||
#include "Log.h"
|
||||
#include "../../../net/GameClient/GameClient.h"
|
||||
#include "GamePlayer.h"
|
||||
|
||||
GamePlayer::GamePlayer( GameClient *clnt, unsigned int objectId ): GameCharacter( objectId )
|
||||
{
|
||||
m_gameClient = clnt;
|
||||
}
|
||||
|
||||
GamePlayer::~GamePlayer()
|
||||
{
|
||||
m_gameClient = NULL;
|
||||
}
|
||||
|
||||
GameClient *GamePlayer::getGameClient()
|
||||
{
|
||||
return m_gameClient;
|
||||
}
|
16
L2C_Server/world/model/character/GamePlayer.h
Normal file
16
L2C_Server/world/model/character/GamePlayer.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "GameCharacter.h"
|
||||
class GameClient; // forward decl
|
||||
|
||||
class GamePlayer: public GameCharacter
|
||||
{
|
||||
public:
|
||||
GamePlayer( GameClient *clnt, unsigned int objectId );
|
||||
virtual ~GamePlayer();
|
||||
|
||||
public:
|
||||
GameClient *getGameClient();
|
||||
|
||||
protected:
|
||||
GameClient *m_gameClient;
|
||||
};
|
Reference in New Issue
Block a user