Beispiel #1
0
void CCurrencyBlock::SetCredits (const CString &sCurrency, CurrencyValue iValue)

//	SetCredits
//
//	Sets the credit value for the given currency

{
    ASSERT(!sCurrency.IsBlank());

    CEconomyType *pEcon = g_pUniverse->FindEconomyType(sCurrency);
    if (pEcon == NULL)
        return;

    SetCredits(pEcon->GetUNID(), iValue);
}
Beispiel #2
0
/**\brief Parse one player out of an xml node
 */
bool Player::FromXMLNode( xmlDocPtr doc, xmlNodePtr node ) {
	xmlNodePtr  attr;
	string value;
	Coordinate pos;

	if( (attr = FirstChildNamed(node,"name")) ){
		SetName(NodeToString(doc,attr));
	}

	if( (attr = FirstChildNamed(node, "planet"))){
		string temp;
		xmlNodePtr name = FirstChildNamed(attr,"name");
		lastPlanet = NodeToString(doc,name);
		Planet* p = Planets::Instance()->GetPlanet( lastPlanet );
		if( p != NULL ) {
			SetWorldPosition( p->GetWorldPosition() );
		}
	}else return false;

	if( (attr = FirstChildNamed(node,"model")) ){
		value = NodeToString(doc,attr);
		Model* model = Models::Instance()->GetModel( value );
		if( NULL!=model) {
			SetModel( model );
		} else {
			LogMsg(ERR,"No such model as '%s'", value.c_str());
			return false;
		}
	} else return false;
	
	if( (attr = FirstChildNamed(node,"engine")) ){
		value = NodeToString(doc,attr);
		Engine* engine = Engines::Instance()->GetEngine( value );
		if( NULL!=engine) {
			SetEngine( engine );
		} else {
			LogMsg(ERR,"No such engine as '%s'", value.c_str());
			return false;
		}
	} else return false;


	if( (attr = FirstChildNamed(node,"credits")) ){
		value = NodeToString(doc,attr);
		SetCredits( atoi(value.c_str()) );
	} else return false;

	for( attr = FirstChildNamed(node,"weapon"); attr!=NULL; attr = NextSiblingNamed(attr,"weapon") ){
		AddShipWeapon( NodeToString(doc,attr) );
	}

	for( attr = FirstChildNamed(node,"outfit"); attr!=NULL; attr = NextSiblingNamed(attr,"outfit") ){
		AddOutfit( NodeToString(doc,attr) );
	}

	for( attr = FirstChildNamed(node,"cargo"); attr!=NULL; attr = NextSiblingNamed(attr,"cargo") ){
		xmlNodePtr type = FirstChildNamed(attr,"type");
		xmlNodePtr ammt = FirstChildNamed(attr,"amount");
		if(!type || !ammt)
			return false;
		if( NodeToInt(doc,ammt) > 0 )
		{
			StoreCommodities( NodeToString(doc,type), NodeToInt(doc,ammt) );
		}
	}

	for( attr = FirstChildNamed(node,"ammo"); attr!=NULL; attr = NextSiblingNamed(attr,"ammo") ){
		xmlNodePtr type = FirstChildNamed(attr,"type");
		xmlNodePtr ammt = FirstChildNamed(attr,"amount");
		if(!type || !ammt)
			return false;
		AmmoType ammoType = Weapon::AmmoNameToType( NodeToString(doc,type) );
		int ammoCount = NodeToInt(doc,ammt);
		if( ammoType < max_ammo ) {
			AddAmmo( ammoType, ammoCount );
		} else return false;
	}

	for( attr = FirstChildNamed(node,"Mission"); attr!=NULL; attr = NextSiblingNamed(attr,"Mission") ){
		Mission *mission = Mission::FromXMLNode(doc,attr);
		if( mission != NULL ) {
			LogMsg(INFO, "Successfully loaded the %s mission of player '%s'", mission->GetName().c_str(), this->GetName().c_str() );
			missions.push_back( mission );
		} else {
			LogMsg(INFO, "Aborted loading mission of player '%s'", this->GetName().c_str() );
		}
	}

	for( attr = FirstChildNamed(node,"favor"); attr!=NULL; attr = NextSiblingNamed(attr,"favor") ){
		xmlNodePtr alliance = FirstChildNamed(attr,"alliance");
		xmlNodePtr value = FirstChildNamed(attr,"value");
		if(!alliance || !value)
			return false;
		if( NodeToInt(doc,value) > 0 )
		{
			UpdateFavor( NodeToString(doc,alliance), NodeToInt(doc,value) );
		}
	}

	for( attr = FirstChildNamed(node,"hiredEscort"); attr!=NULL; attr = NextSiblingNamed(attr,"hiredEscort") ){
		xmlNodePtr typePtr = FirstChildNamed(attr, "type");
		xmlNodePtr payPtr = FirstChildNamed(attr, "pay");
		assert(typePtr && payPtr);
		if(!typePtr || !payPtr) return false;
		string type = NodeToString(doc, typePtr);
		int pay = atoi( NodeToString(doc, payPtr).c_str() );
		// Adding it with sprite ID -1 means it's up to player.lua to go ahead and create the correct sprite.
		this->AddHiredEscort(type, pay, -1);
	}

	if(this->ConfigureWeaponSlots(doc, node)){
		// great - it worked
		LogMsg( INFO, "Successfully loaded weapon slots");
	}
	else {
		LogMsg( ERR, "Weapon slot XML helper failed to configure weapon slots");
	}

	if( (attr = FirstChildNamed(node,"lastLoadTime")) ){
		lastLoadTime = NodeToInt(doc,attr);
	} else {
		lastLoadTime = (time_t)0;
	}

	RemoveLuaControlFunc();

	return true;
}
Beispiel #3
0
void LogEntry1Data::ResumeSyncSend(void)
	{
	if (!SyncSendPaused)
		{
		return;
		}

	SyncSendPaused = FALSE;

	if (SyncNumber == CERROR)
		{
		return;
		}

	// We just unpaused and we're assigned a record number... tell everybody
	// else all about ourselves.
	GAINEXCLUSIVEACCESS();
	char Buffer[256];
	
	CopyStringToBuffer(Buffer, Name);
	SetName(Buffer);

	CopyStringToBuffer(Buffer, Initials);
	SetInitials(Buffer);

	CopyStringToBuffer(Buffer, Password);
	SetPassword(Buffer);

	CopyStringToBuffer(Buffer, Surname);
	SetSurname(Buffer);

	CopyStringToBuffer(Buffer, Title);
	SetTitle(Buffer);

	CopyStringToBuffer(Buffer, RealName);
	SetRealName(Buffer);

	CopyStringToBuffer(Buffer, PhoneNumber);
	SetPhoneNumber(Buffer);

	CopyStringToBuffer(Buffer, ForwardAddr);
	SetForwardAddr(Buffer);

	CopyStringToBuffer(Buffer, ForwardAddrNode);
	SetForwardAddrNode(Buffer);

	CopyStringToBuffer(Buffer, ForwardAddrRegion);
	SetForwardAddrRegion(Buffer);

	CopyStringToBuffer(Buffer, PromptFormat);
	SetPromptFormat(Buffer);

	CopyStringToBuffer(Buffer, DateStamp);
	SetDateStamp(Buffer);

	CopyStringToBuffer(Buffer, VerboseDateStamp);
	SetVerboseDateStamp(Buffer);

	CopyStringToBuffer(Buffer, Signature);
	SetSignature(Buffer);

	CopyStringToBuffer(Buffer, NetPrefix);
	SetNetPrefix(Buffer);

	CopyStringToBuffer(Buffer, MailAddr1);
	SetMailAddr1(Buffer);

	CopyStringToBuffer(Buffer, MailAddr2);
	SetMailAddr2(Buffer);

	CopyStringToBuffer(Buffer, MailAddr3);
	SetMailAddr3(Buffer);

	CopyStringToBuffer(Buffer, Alias);
	SetAlias(Buffer);

	CopyStringToBuffer(Buffer, LocID);
	SetLocID(Buffer);

	CopyStringToBuffer(Buffer, MorePrompt);
	SetMorePrompt(Buffer);

	CopyStringToBuffer(Buffer, Occupation);
	SetOccupation(Buffer);

	CopyStringToBuffer(Buffer, WhereHear);
	SetWhereHear(Buffer);

	CopyStringToBuffer(Buffer, LastRoom);
	SetLastRoom(Buffer);

	CopyStringToBuffer(Buffer, LastHall);
	SetLastHall(Buffer);

	CopyStringToBuffer(Buffer, DefaultRoom);
	SetDefaultRoom(Buffer);

	CopyStringToBuffer(Buffer, DefaultHall);
	SetDefaultHall(Buffer);

	CopyStringToBuffer(Buffer, TermType);
	SetTermType(Buffer);
	RELEASEEXCLUSIVEACCESS();

	SetBirthDate(BirthDate);
	SetFirstOn(FirstOn);
	SetSex(Sex);
	SetNulls(Nulls);
	SetWidth(Width);
	SetLinesPerScreen(LinesPerScreen);
	SetAttribute(ATTR_NORMAL, attributes[ATTR_NORMAL]);
	SetAttribute(ATTR_BLINK, attributes[ATTR_BLINK]);
	SetAttribute(ATTR_REVERSE, attributes[ATTR_REVERSE]);
	SetAttribute(ATTR_BOLD, attributes[ATTR_BOLD]);
	SetAttribute(ATTR_UNDERLINE, attributes[ATTR_UNDERLINE]);
	SetNumUserShow(NumUserShow);
	SetDefaultProtocol(DefaultProtocol);
	SetCallTime(CallTime);
	SetCallNumber(CallNumber);
	SetTotalTime(TotalTime);
	SetCredits(Credits);
	SetLogins(Logins);
	SetPosted(Posted);
	SetRead(Read);
	SetPasswordChangeTime(PasswordChangeTime);
	SetCallsToday(CallsToday);
	SetCallLimit(CallLimit);
	SetLastMessage(LastMessage);
	SetDL_Bytes(DL_Bytes);
	SetUL_Bytes(UL_Bytes);
	SetDL_Num(DL_Num);
	SetUL_Num(UL_Num);
	SetPoopcount(Poopcount);

	SetDungeoned(IsDungeoned());
	SetForwardToNode(IsForwardToNode());
	SetAutoNextHall(IsAutoNextHall());
	SetEnterBorders(IsEnterBorders());
	SetVerified(IsVerified());
	SetSurnameLocked(IsSurnameLocked());
	SetDefaultHallLocked(IsDefaultHallLocked());
	SetPsycho(IsPsycho());
	SetViewTitleSurname(IsViewTitleSurname());
	SetViewSubjects(IsViewSubjects());
	SetViewSignatures(IsViewSignatures());
	SetOldIBMGraph(IsOldIBMGraph());
	SetOldIBMANSI(IsOldIBMANSI());
	SetOldIBMColor(IsOldIBMColor());
	SetTwirly(IsTwirly());
	SetAutoVerbose(IsAutoVerbose());
	SetPauseBetweenMessages(IsPauseBetweenMessages());
	SetMinibin(IsMinibin());
	SetClearScreenBetweenMessages(IsClearScreenBetweenMessages());
	SetViewRoomInfoLines(IsViewRoomInfoLines());
	SetViewHallDescription(IsViewHallDescription());
	SetVerboseContinue(IsVerboseContinue());
	SetViewCensoredMessages(IsViewCensoredMessages());
	SetViewBorders(IsViewBorders());
	SetOut300(IsOut300());
	SetUserSignatureLocked(IsUserSignatureLocked());
	SetHideMessageExclusions(IsHideMessageExclusions());
	SetDownload(IsDownload());
	SetUpload(IsUpload());
	SetChat(IsChat());
	SetPrintFile(IsPrintFile());
	SetSpellCheckMode(GetSpellCheckMode());
	SetMakeRoom(IsMakeRoom());
	SetVerboseLogOut(IsVerboseLogOut());
	SetConfirmSave(IsConfirmSave());
	SetConfirmAbort(IsConfirmAbort());
	SetConfirmNoEO(IsConfirmNoEO());
	SetUsePersonalHall(IsUsePersonalHall());
	SetYouAreHere(IsYouAreHere());
	SetIBMRoom(IsIBMRoom());
	SetWideRoom(IsWideRoom());
	SetMusic(IsMusic());
	SetCheckApostropheS(IsCheckApostropheS());
	SetCheckAllCaps(IsCheckAllCaps());
	SetCheckDigits(IsCheckDigits());
	SetExcludeEncryptedMessages(IsExcludeEncryptedMessages());
	SetViewCommas(IsViewCommas());
	SetPUnPauses(IsPUnPauses());
	SetRoman(IsRoman());
	SetSuperSysop(IsSuperSysop());

	SetInuse(IsInuse());
	SetUpperOnly(IsUpperOnly());
	SetLinefeeds(IsLinefeeds());
	SetExpert(IsExpert());
	SetAide(IsAide());
	SetTabs(IsTabs());
	SetOldToo(IsOldToo());
	SetProblem(IsProblem());
	SetUnlisted(IsUnlisted());
	SetPermanent(IsPermanent());
	SetSysop(IsSysop());
	SetNode(IsNode());
	SetNetUser(IsNetUser());
	SetAccounting(IsAccounting());
	SetMail(IsMail());
	SetViewRoomDesc(IsViewRoomDesc());
	}