/* * pawsdetailwindow.cpp - Author: Christian Svensson * * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org) * * * 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 (version 2 of the License) * 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ // pawsdetailwindow.cpp: implementation of the pawsDetailWindow class. // ////////////////////////////////////////////////////////////////////// #include // CS INCLUDES #include #include // COMMON INCLUDES #include #include "net/msghandler.h" #include "net/messages.h" #include "engine/netpersist.h" // CLIENT INCLUDES #include "pscelclient.h" #include "../globals.h" // PAWS INCLUDES #include "pawsdetailwindow.h" #include "paws/pawstextbox.h" #include "paws/pawsmanager.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// pawsDetailWindow::pawsDetailWindow() { target = NULL; psengine->GetMsgHandler()->Subscribe( this, MSGTYPE_CHARACTERDETAILS ); } pawsDetailWindow::~pawsDetailWindow() { psengine->GetMsgHandler()->Unsubscribe( this, MSGTYPE_CHARACTERDETAILS ); } bool pawsDetailWindow::PostSetup() { intro = (pawsMultiLineTextBox*)FindWidget( "intro" ); if ( !intro ) return false; description = (pawsMultiLineTextBox*)FindWidget("Description"); if ( !description ) return false; return true; } void pawsDetailWindow::RequestDetails() { psCharacterDetailsRequestMessage requestMsg(false, false, "pawsDetailWindow"); psengine->GetMsgHandler()->SendMessage(requestMsg.msg); } void pawsDetailWindow::HandleMessage( MsgEntry* me ) { if (me->GetType() == MSGTYPE_CHARACTERDETAILS) { psCharacterDetailsMessage msg(me); if ( msg.requestor!="pawsDetailWindow" && msg.requestor!="behaviorMsg" && msg.requestor!="ShowDetailsOp") return; //Begin sentense csString str("You see a "); //Add gender switch(msg.gender) { case PSCHARACTER_GENDER_FEMALE: { str.Append("female "); break; } case PSCHARACTER_GENDER_MALE: { str.Append("male "); break; } case PSCHARACTER_GENDER_NONE: { //Don't append anything if it is neutral break; } } //Add race str.Append(msg.race); //Add seperator str.Append(" in front\nof you named "); //Add name str.Append(msg.name); intro->SetText( str.GetData() ); description->SetText(msg.desc.GetData()); this->Show(); return; } }