Browse Source

Implement new pfGameScore class and friends

pfGameScore will call you back on actions that require server ops. Also, we
ref count the score instead of using some weird hashtable manager class
because the server never actually tells us if someone else changes the
score.
Adam Johnson 13 years ago
parent
commit
bbdc5cd0bb
  1. 1
      Sources/Plasma/FeatureLib/pfGameScoreMgr/CMakeLists.txt
  2. 478
      Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp
  3. 142
      Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.h
  4. 2
      Sources/Plasma/FeatureLib/pfMessage/CMakeLists.txt
  5. 154
      Sources/Plasma/FeatureLib/pfMessage/pfGameScoreMsg.h
  6. 7
      Sources/Plasma/FeatureLib/pfMessage/pfMessageCreatable.h
  7. 4
      Sources/Plasma/NucleusLib/inc/plCreatableIndex.h

1
Sources/Plasma/FeatureLib/pfGameScoreMgr/CMakeLists.txt

@ -2,6 +2,7 @@ include_directories(../../CoreLib)
include_directories(../../NucleusLib)
include_directories(../../NucleusLib/inc)
include_directories(../../PubUtilLib)
include_directories(../../FeatureLib)
set(pfGameScoreMgr_SOURCES
pfGameScoreMgr.cpp

478
Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp

@ -40,435 +40,141 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "pfGameScoreMgr.h"
#include "pnUtils/pnUtils.h"
#include "pfMessage/pfGameScoreMsg.h"
#include "plNetGameLib/plNetGameLib.h"
#include "pnNetProtocol/pnNetProtocol.h"
//============================================================================
pfGameScore::pfGameScore()
struct ScoreFindParam
{
}
uint32_t fOwnerId;
plString fName;
plKey fReceiver; // because plKey as a void* isn't cool
pfGameScore::~pfGameScore()
{
pfGameScoreMgr::GetInstance()->RemoveCachedScore(scoreId);
}
ScoreFindParam(uint32_t ownerId, plString name, plKey r)
: fOwnerId(ownerId), fName(name), fReceiver(r)
{ }
};
void pfGameScore::Init(
unsigned sid,
unsigned oid,
uint32_t createTime,
const char gname[],
unsigned gType,
int val
) {
scoreId = sid;
ownerId = oid;
createdTime = createTime;
gameType = gType;
value = val;
struct ScoreTransferParam
{
pfGameScore* fTo;
pfGameScore* fFrom;
int32_t fPoints;
plKey fReceiver;
ScoreTransferParam(pfGameScore* to, pfGameScore* from, int32_t points, plKey r)
: fTo(to), fFrom(from), fPoints(points), fReceiver(r)
{ }
};
StrCopy(gameName, gname, arrsize(gameName));
pfGameScoreMgr::GetInstance()->AddCachedScore(this);
}
struct ScoreUpdateParam
{
pfGameScore* fParent;
plKey fReceiver;
int32_t fPoints; // reset points to this if update op
void pfGameScore::CopyFrom(
const pfGameScore* score
) {
scoreId = score->scoreId;
ownerId = score->ownerId;
createdTime = score->createdTime;
gameType = score->gameType;
value = score->value;
ScoreUpdateParam(pfGameScore* s, plKey r, int32_t points = 0)
: fParent(s), fReceiver(r), fPoints(points)
{ }
};
StrCopy(gameName, score->gameName, arrsize(gameName));
//======================================
static void OnScoreSet(ENetError result, void* param)
{
ScoreUpdateParam* p = (ScoreUpdateParam*)param;
pfGameScoreUpdateMsg* msg = new pfGameScoreUpdateMsg(result, p->fParent, p->fPoints);
msg->Send(p->fReceiver);
delete p;
}
//============================================================================
pfGameScoreMgr::pfGameScoreMgr()
void pfGameScore::SetPoints(int32_t value, plKey rcvr)
{
Ref(); // netcode holds us
NetCliAuthScoreSetPoints(fScoreId, value, OnScoreSet, new ScoreUpdateParam(this, rcvr, value));
}
pfGameScoreMgr* pfGameScoreMgr::GetInstance()
//======================================
static void OnScoreUpdate(ENetError result, void* param)
{
static pfGameScoreMgr s_instance;
return &s_instance;
ScoreUpdateParam* p = (ScoreUpdateParam*)param;
pfGameScoreUpdateMsg* msg = new pfGameScoreUpdateMsg(result, p->fParent, p->fPoints);
msg->Send(p->fReceiver);
delete p;
}
void pfGameScoreMgr::AddCachedScore(pfGameScore * score)
void pfGameScore::AddPoints(int32_t add, plKey rcvr)
{
GameScoreLink * scoreLink = fScores.Find(score->scoreId);
if (scoreLink == nil)
{
GameScoreLink * link = new GameScoreLink(score);
fScores.Add(link);
}
else
scoreLink->score->CopyFrom(score);
Ref(); // netcode holds us
NetCliAuthScoreAddPoints(fScoreId, add, OnScoreUpdate, new ScoreUpdateParam(this, rcvr, fValue + add));
}
void pfGameScoreMgr::RemoveCachedScore(unsigned scoreId)
//======================================
void pfGameScore::Delete()
{
if (GameScoreLink * link = fScores.Find(scoreId))
{
delete link;
}
NetCliAuthScoreDelete(fScoreId, nil, nil); // who cares about getting a notify here?
UnRef(); // kthxbai
}
//============================================================================
struct NetWaitOp
//======================================
static void OnScoreTransfer(ENetError result, void* param)
{
ENetError result;
bool complete;
};
static void WaitOpCallback(
ENetError result,
void * param
) {
NetWaitOp * op = (NetWaitOp *)param;
op->result = result;
op->complete = true;
ScoreTransferParam* p = (ScoreTransferParam*)param;
pfGameScoreTransferMsg* msg = new pfGameScoreTransferMsg(result, p->fTo, p->fFrom, p->fPoints);
msg->Send(p->fReceiver);
delete p;
}
//============================================================================
// CreateScore
//============================================================================
struct CreateScoreOp : NetWaitOp
void pfGameScore::TransferPoints(pfGameScore* to, int32_t points, plKey recvr)
{
pfGameScore * score;
};
this->Ref(); to->Ref(); // netcode holds us
NetCliAuthScoreTransferPoints(this->fScoreId, to->fScoreId, points,
OnScoreTransfer, new ScoreTransferParam(to, this, points, recvr));
}
static void CreateScoreCallback(
//======================================
static void OnScoreCreate(
ENetError result,
void * param,
unsigned scoreId,
uint32_t createdTime,
unsigned ownerId,
uint32_t scoreId,
uint32_t createdTime, // ignored
uint32_t ownerId,
const char* gameName,
unsigned gameType,
int value
) {
CreateScoreOp * op = (CreateScoreOp*)param;
op->result = result;
if (IS_NET_SUCCESS(result)) {
op->score->Init(
scoreId,
ownerId,
createdTime,
gameName,
gameType,
value
);
}
else
op->score->scoreId = 0;
op->complete = true;
}
ENetError pfGameScoreMgr::CreateScore(
unsigned ownerId,
const char* gameName,
unsigned gameType,
int value,
pfGameScore& score
uint32_t gameType,
int32_t value
) {
CreateScoreOp param;
memset(&param, 0, sizeof(CreateScoreOp));
param.score = &score;
NetCliAuthScoreCreate(
ownerId,
gameName,
gameType,
value,
CreateScoreCallback,
&param
);
while (!param.complete) {
NetClientUpdate();
AsyncSleep(10);
}
return param.result;
}
//============================================================================
// DeleteScore
//============================================================================
ENetError pfGameScoreMgr::DeleteScore(
unsigned scoreId
) {
NetWaitOp param;
memset(&param, 0, sizeof(NetWaitOp));
NetCliAuthScoreDelete(
scoreId,
WaitOpCallback,
&param
);
while (!param.complete) {
NetClientUpdate();
AsyncSleep(10);
}
return param.result;
ScoreUpdateParam* p = (ScoreUpdateParam*)param;
pfGameScore* score = new pfGameScore(scoreId, ownerId, _TEMP_CONVERT_FROM_LITERAL(gameName), gameType, value);
pfGameScoreUpdateMsg* msg = new pfGameScoreUpdateMsg(result, score, value);
msg->Send(p->fReceiver);
delete p;
}
//============================================================================
// GetScores
//============================================================================
struct GetScoresOp : NetWaitOp
void pfGameScore::Create(uint32_t ownerId, const plString& name, uint32_t type, int32_t value, plKey rcvr)
{
pfGameScore*** scores;
int* scoreCount;
};
NetCliAuthScoreCreate(ownerId, name.c_str(), type, value, OnScoreCreate, new ScoreUpdateParam(nil, rcvr));
}
static void GetScoresCallback(
//======================================
static void OnScoreFound(
ENetError result,
void * param,
const NetGameScore scores[],
unsigned scoreCount
) {
GetScoresOp * op = (GetScoresOp*)param;
op->result = result;
if (IS_NET_SUCCESS(result)) {
*(op->scores) = new pfGameScore*[scoreCount];
*(op->scoreCount) = scoreCount;
for (int i = 0; i < scoreCount; ++i) {
pfGameScore* score = new pfGameScore();
score->IncRef();
char tempGameName[kMaxGameScoreNameLength];
StrToAnsi(tempGameName, scores[i].gameName, arrsize(tempGameName));
score->Init(
scores[i].scoreId,
scores[i].ownerId,
scores[i].createdTime,
tempGameName,
scores[i].gameType,
scores[i].value
);
(*op->scores)[i] = score;
}
}
else {
*(op->scores) = nil;
op->scoreCount = 0;
}
op->complete = true;
}
ENetError pfGameScoreMgr::GetScoresIncRef(
unsigned ownerId,
const char* gameName,
pfGameScore**& outScoreList,
int& outScoreListCount
) {
GetScoresOp param;
memset(&param, 0, sizeof(GetScoresOp));
param.scores = &outScoreList;
param.scoreCount = &outScoreListCount;
NetCliAuthScoreGetScores(
ownerId,
gameName,
GetScoresCallback,
&param
);
while (!param.complete) {
NetClientUpdate();
AsyncSleep(10);
}
return param.result;
}
//============================================================================
// AddPoints
//============================================================================
ENetError pfGameScoreMgr::AddPoints(
unsigned scoreId,
int numPoints
) {
NetWaitOp param;
memset(&param, 0, sizeof(NetWaitOp));
NetCliAuthScoreAddPoints(
scoreId,
numPoints,
WaitOpCallback,
&param
);
while (!param.complete) {
NetClientUpdate();
AsyncSleep(10);
}
if (IS_NET_SUCCESS(param.result)) {
if (GameScoreLink * link = fScores.Find(scoreId)) {
link->score->value += numPoints;
}
}
return param.result;
}
//============================================================================
// TransferPoints
//============================================================================
ENetError pfGameScoreMgr::TransferPoints(
unsigned srcScoreId,
unsigned destScoreId,
int numPoints
) {
NetWaitOp param;
memset(&param, 0, sizeof(NetWaitOp));
NetCliAuthScoreTransferPoints(
srcScoreId,
destScoreId,
numPoints,
WaitOpCallback,
&param
);
while (!param.complete) {
NetClientUpdate();
AsyncSleep(10);
}
if (IS_NET_SUCCESS(param.result)) {
if (GameScoreLink * link = fScores.Find(srcScoreId)) {
link->score->value -= numPoints;
}
if (GameScoreLink * link = fScores.Find(destScoreId)) {
link->score->value += numPoints;
}
}
return param.result;
}
//============================================================================
// SetPoints
//============================================================================
ENetError pfGameScoreMgr::SetPoints(
unsigned scoreId,
int numPoints
uint32_t scoreCount
) {
NetWaitOp param;
memset(&param, 0, sizeof(NetWaitOp));
NetCliAuthScoreSetPoints(
scoreId,
numPoints,
WaitOpCallback,
&param
);
while (!param.complete) {
NetClientUpdate();
AsyncSleep(10);
}
if (IS_NET_SUCCESS(param.result)) {
if (GameScoreLink * link = fScores.Find(scoreId)) {
link->score->value = numPoints;
}
std::vector<pfGameScore*> vec(scoreCount);
for (uint32_t i = 0; i < scoreCount; ++i)
{
const NetGameScore ngs = scores[i];
vec[i] = new pfGameScore(ngs.scoreId, ngs.ownerId, _TEMP_CONVERT_FROM_WCHAR_T(ngs.gameName), ngs.gameType, ngs.value);
}
return param.result;
ScoreFindParam* p = (ScoreFindParam*)param;
pfGameScoreListMsg* msg = new pfGameScoreListMsg(result, vec, p->fOwnerId, p->fName);
msg->Send(p->fReceiver);
delete p;
}
//============================================================================
// GetRankList
//============================================================================
struct GetRanksOp : NetWaitOp
void pfGameScore::Find(uint32_t ownerId, const plString& name, plKey rcvr)
{
NetGameRank*** ranks;
int* rankCount;
};
static void GetRanksCallback(
ENetError result,
void * param,
const NetGameRank ranks[],
unsigned rankCount
) {
GetRanksOp * op = (GetRanksOp*)param;
op->result = result;
if (IS_NET_SUCCESS(result)) {
*(op->ranks) = new NetGameRank*[rankCount];
*(op->rankCount) = rankCount;
for (int i = 0; i < rankCount; ++i) {
NetGameRank * rank = new NetGameRank;
rank->rank = ranks[i].rank;
rank->score = ranks[i].score;
StrCopy(rank->name, ranks[i].name, arrsize(rank->name));
(*op->ranks)[i] = rank;
}
}
else {
*(op->ranks) = nil;
op->rankCount = 0;
}
op->complete = true;
}
ENetError pfGameScoreMgr::GetRankList(
unsigned ownerId,
unsigned scoreGroup,
unsigned parentFolderId,
const char * gameName,
unsigned timePeriod,
unsigned numResults,
unsigned pageNumber,
bool sortDesc,
NetGameRank**& outRankList,
int& outRankListCount
) {
GetRanksOp param;
memset(&param, 0, sizeof(GetRanksOp));
param.ranks = &outRankList;
param.rankCount = &outRankListCount;
NetCliAuthScoreGetRankList(
ownerId,
scoreGroup,
parentFolderId,
gameName,
timePeriod,
numResults,
pageNumber,
sortDesc,
GetRanksCallback,
&param
);
while (!param.complete) {
NetClientUpdate();
AsyncSleep(10);
}
return param.result;
NetCliAuthScoreGetScores(ownerId, name.c_str(), OnScoreFound, new ScoreFindParam(ownerId, name, rcvr));
}

142
Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.h

@ -39,115 +39,53 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.h
*
***/
#ifndef PLASMA20_SOURCES_PLASMA_FEATURELIB_PFGAMESCOREMGR_PFGAMESCOREMGR_H
#define PLASMA20_SOURCES_PLASMA_FEATURELIB_PFGAMESCOREMGR_PFGAMESCOREMGR_H
#ifndef _pfGameScoreMgr_h_
#define _pfGameScoreMgr_h_
#include "HeadSpin.h"
#include "pnKeyedObject/plKey.h"
#include "pnNetBase/pnNetBase.h"
#include "pnUtils/pnUtils.h"
struct NetGameRank;
struct pfGameScore : AtomicRef
#include "hsRefCnt.h"
#include "plString.h"
// TODO: Rank List (seems to be unused in regular gameplay though...)
// That's some strange stuff...
/**
* Plasma Game Score
* Mid-level class that encapsulates game scores and sends pfGameScoreMsg notifications
* via the dispatcher when network operations complete.
*/
class pfGameScore : public hsRefCnt
{
unsigned scoreId;
unsigned ownerId;
uint32_t createdTime;
char gameName[kMaxGameScoreNameLength];
unsigned gameType;
int value;
pfGameScore();
~pfGameScore();
void Init(
unsigned sid,
unsigned oid,
uint32_t createTime,
const char gname[],
unsigned gType,
int val
);
void CopyFrom(const pfGameScore* score);
};
uint32_t fScoreId;
uint32_t fOwnerId;
plString fName;
uint32_t fGameType; // EGameScoreTypes
int32_t fValue;
class pfGameScoreMgr
{
private:
pfGameScoreMgr();
struct GameScoreLink : THashKeyVal<unsigned>
{
HASHLINK(GameScoreLink) link;
pfGameScore * score;
GameScoreLink(pfGameScore * gscore)
: THashKeyVal<unsigned>(gscore->scoreId)
, score(gscore)
{
}
};
HASHTABLEDECL(
GameScoreLink,
THashKeyVal<unsigned>,
link
) fScores;
friend class pfGameScoreTransferMsg;
friend class pfGameScoreUpdateMsg;
public:
static pfGameScoreMgr* GetInstance();
void AddCachedScore(pfGameScore * score);
void RemoveCachedScore(unsigned scoreId);
ENetError CreateScore(
unsigned ownerId,
const char* gameName,
unsigned gameType,
int value,
pfGameScore& score
);
ENetError DeleteScore(
unsigned scoreId
);
ENetError AddPoints(
unsigned scoreId,
int numPoints
);
ENetError TransferPoints(
unsigned srcScoreId,
unsigned destScoreId,
int numPoints
);
ENetError SetPoints(
unsigned scoreId,
int numPoints
);
ENetError GetScoresIncRef(
unsigned ownerId,
const char* gameName,
pfGameScore**& outScoreList,
int& outScoreListCount
);
ENetError GetRankList(
unsigned ownerId,
unsigned scoreGroup,
unsigned parentFolderId,
const char * gameName,
unsigned timePeriod,
unsigned numResults,
unsigned pageNumber,
bool sortDesc,
NetGameRank**& outRankList,
int& outRankListCount
);
pfGameScore(uint32_t scoreId, uint32_t owner, plString name, uint32_t type, int32_t value = 0)
: fScoreId(scoreId), fOwnerId(owner), fName(name), fGameType(type), fValue(value)
{ }
plString GetGameName() const { return fName; }
uint32_t GetGameType() const { return fGameType; }
uint32_t GetOwner() const { return fOwnerId; }
int32_t GetPoints() const { return fValue; }
void SetPoints(int32_t value, plKey rcvr = nil);
void AddPoints(int32_t add, plKey rcvr = nil);
void Delete();
void TransferPoints(pfGameScore* to, plKey rcvr = nil) { TransferPoints(to, fValue, rcvr); }
void TransferPoints(pfGameScore* to, int32_t points, plKey rcvr = nil);
static void Create(uint32_t ownerId, const plString& name, uint32_t type, int32_t value, plKey rcvr);
static void Find(uint32_t ownerId, const plString& name, plKey rcvr);
};
#endif // PLASMA20_SOURCES_PLASMA_FEATURELIB_PFGAMESCOREMGR_PFGAMESCOREMGR_H
#endif // _pfGameScoreMgr_h_

2
Sources/Plasma/FeatureLib/pfMessage/CMakeLists.txt

@ -2,6 +2,7 @@ include_directories(../../CoreLib)
include_directories(../../NucleusLib)
include_directories(../../NucleusLib/inc)
include_directories(../../PubUtilLib)
include_directories(../../FeatureLib)
set(pfMessage_SOURCES
pfKIMsg.cpp
@ -14,6 +15,7 @@ set(pfMessage_SOURCES
set(pfMessage_HEADERS
pfBackdoorMsg.h
pfGameGUIMsg.h
pfGameScoreMsg.h
pfGUINotifyMsg.h
pfKIMsg.h
pfMarkerMsg.h

154
Sources/Plasma/FeatureLib/pfMessage/pfGameScoreMsg.h

@ -0,0 +1,154 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef _pfGameScoreMsg_h_
#define _pfGameScoreMsg_h_
#include "HeadSpin.h"
#include "pfGameScoreMgr/pfGameScoreMgr.h"
#include "pnMessage/plMessage.h"
#include "pnNetBase/pnNetBase.h"
#include <vector>
class pfGameScore;
class pfGameScoreMsg : public plMessage
{
ENetError fResult;
public:
pfGameScoreMsg() { }
pfGameScoreMsg(ENetError result)
: fResult(result)
{ }
CLASSNAME_REGISTER(pfGameScoreMsg);
GETINTERFACE_ANY(pfGameScoreMsg, plMessage);
ENetError GetResult() const { return fResult; }
virtual void Read(hsStream*, hsResMgr*) { FATAL("wtf are you doing???"); }
virtual void Write(hsStream*, hsResMgr*) { FATAL("wtf are you doing???"); }
};
class pfGameScoreListMsg : public pfGameScoreMsg
{
std::vector<pfGameScore*> fScores;
uint32_t fOwnerId;
plString fName;
public:
pfGameScoreListMsg() { }
pfGameScoreListMsg(ENetError result, std::vector<pfGameScore*> vec, uint32_t ownerId, plString name)
: fScores(vec), pfGameScoreMsg(result), fOwnerId(ownerId), fName(name)
{ }
~pfGameScoreListMsg()
{
for (std::vector<pfGameScore*>::iterator it = fScores.begin(); it != fScores.end(); ++it)
(*it)->UnRef();
}
CLASSNAME_REGISTER(pfGameScoreListMsg);
GETINTERFACE_ANY(pfGameScoreListMsg, pfGameScoreMsg);
plString GetName() const { return fName; }
uint32_t GetOwnerID() const { return fOwnerId; }
size_t GetNumScores() const { return fScores.size(); }
pfGameScore* GetScore(size_t idx) const { return fScores.at(idx); }
};
class pfGameScoreTransferMsg : public pfGameScoreMsg
{
pfGameScore* fSource;
pfGameScore* fDestination;
public:
pfGameScoreTransferMsg() { }
pfGameScoreTransferMsg(ENetError result, pfGameScore* to, pfGameScore* from, int32_t points)
: fSource(from), fDestination(to), pfGameScoreMsg(result)
{
if (result == kNetSuccess)
{
from->fValue -= points;
to->fValue += points;
}
}
~pfGameScoreTransferMsg()
{
fSource->UnRef();
fDestination->UnRef();
}
CLASSNAME_REGISTER(pfGameScoreTransferMsg);
GETINTERFACE_ANY(pfGameScoreTransferMsg, pfGameScoreMsg);
pfGameScore* GetDestination() const { return fDestination; }
pfGameScore* GetSource() const { return fSource; }
};
class pfGameScoreUpdateMsg : public pfGameScoreMsg
{
pfGameScore* fScore;
public:
pfGameScoreUpdateMsg() { }
pfGameScoreUpdateMsg(ENetError result, pfGameScore* s, int32_t points)
: fScore(s), pfGameScoreMsg(result)
{
if (result == kNetSuccess)
s->fValue = points;
}
~pfGameScoreUpdateMsg()
{
fScore->UnRef();
}
CLASSNAME_REGISTER(pfGameScoreUpdateMsg);
GETINTERFACE_ANY(pfGameScoreUpdateMsg, pfGameScoreMsg);
pfGameScore* GetScore() const { return fScore; }
};
#endif // _pfGameScoreMsg_h_

7
Sources/Plasma/FeatureLib/pfMessage/pfMessageCreatable.h

@ -68,6 +68,13 @@ REGISTER_CREATABLE( plAvEnableMsg );
REGISTER_CREATABLE( pfGameGUIMsg );
#include "pfGameScoreMsg.h"
REGISTER_NONCREATABLE( pfGameScoreMsg );
REGISTER_CREATABLE( pfGameScoreListMsg );
REGISTER_CREATABLE( pfGameScoreTransferMsg );
REGISTER_CREATABLE( pfGameScoreUpdateMsg );
#include "pfGUINotifyMsg.h"
REGISTER_CREATABLE( pfGUINotifyMsg );

4
Sources/Plasma/NucleusLib/inc/plCreatableIndex.h

@ -947,6 +947,10 @@ CLASS_INDEX_LIST_START
CLASS_INDEX(plAngularVelocityMsg),
CLASS_INDEX(plRideAnimatedPhysMsg),
CLASS_INDEX(plAvBrainRideAnimatedPhysical),
CLASS_INDEX(pfGameScoreMsg),
CLASS_INDEX(pfGameScoreListMsg),
CLASS_INDEX(pfGameScoreTransferMsg),
CLASS_INDEX(pfGameScoreUpdateMsg),
CLASS_INDEX_LIST_END
#endif // plCreatableIndex_inc

Loading…
Cancel
Save