Пример #1
0
void CNelLauncherDlg::doubleClickedShard(int row, int column)
{
	nlinfo("a shard was double clicked");

	// Execute the clickedConnect slot. It has all this logic already.
	clickedConnect();
}
Пример #2
0
//===============================================
void	CHTimer::doAfter(bool displayAfter)
{
	_CurrNode->Clock.stop();
	_PreambuleClock.start();
	/* Remove my Son preambule, and remove only ONE StartStop
		It is because between the start and the end, only ONE rdtsc time is counted:
	*/
	sint64 numTicks = _CurrNode->Clock.getNumTicks()  - _CurrNode->SonsPreambule - (CSimpleClock::getStartStopNumTicks());
	// Case where the SonPreambule is overestimated,
	numTicks= std::max((sint64)0, numTicks);
	// In case where the SonPreambule is overestimated, the TotalTime must not be < of the SonTime
	if(_CurrNode->TotalTime + numTicks < _CurrNode->SonsTotalTime)
		numTicks= _CurrNode->SonsTotalTime - _CurrNode->TotalTime;

	_CurrNode->TotalTime += numTicks;
	_CurrNode->MinTime = std::min(_CurrNode->MinTime, (uint64)numTicks);
	_CurrNode->MaxTime = std::max(_CurrNode->MaxTime, (uint64)numTicks);
	_CurrNode->LastSonsTotalTime = _CurrNode->SonsTotalTime;

	_CurrNode->SessionCurrent += (uint64)numTicks;

	if (displayAfter)
	{
		nlinfo("HTIMER: %s %.3fms loop number %d", _Name, numTicks * _MsPerTick, _CurrNode->NumVisits);
	}
	//
	if (_WantStandardDeviation)
	{
		_CurrNode->Measures.push_back(numTicks * _MsPerTick);
	}
	//
	if (_Parent)
	{
		_CurrTimer = _Parent;
	}
	//
	if (_CurrNode->Parent)
	{
		CNode	*curNode= _CurrNode;
		CNode	*parent= _CurrNode->Parent;
		parent->SonsTotalTime += numTicks;
		_PreambuleClock.stop();
		/*
			The SonPreambule of my parent is
				+ my BeforePreambule (counted in doBefore)
				+ my Afterpreambule (see below)
				+ my Sons Preambule
				+ some constant time due to the Start/Stop of the _CurrNode->Clock, the 2* Start/Stop
					of the PreabmuleClock, the function call time of doBefore and doAfter
		*/
		parent->SonsPreambule += _PreambuleClock.getNumTicks() + curNode->SonsPreambule + _AfterStopEstimateTime;
		// walk to parent
		_CurrNode= parent;
	}
	else
	{
		_PreambuleClock.stop();
	}
}
Пример #3
0
// *********************************************************************************************************
CVerboseClock::~CVerboseClock()
{
	TTime endTime = CTime::getLocalTime();
	if (ClientCfg.R2EDVerboseParseTime)
	{
		nlinfo("%.2f seconds for : %s", (endTime - _StartTime) / 1000.f, _Msg.c_str());
	}
}
Пример #4
0
//---------------------------------------------------
// setValue :
//
//---------------------------------------------------
void CLogicVariable::setValue( sint64 value )
{
	_Value = value;

	if( _Verbose )
	{
		nlinfo("variable \"%s\" value is now %f",_Name.c_str(),(double)_Value);
	}

} // setValue //
Пример #5
0
void PluginManager::removeObject(QObject *obj)
{
	if (obj == 0)
	{
		nlwarning("trying to remove null object");
		return;
	}

	if (!m_allObjects.contains(obj))
	{
		nlinfo("object not in list: %s", obj->objectName().toUtf8().constData());
		return;
	}
	nlinfo("removeObject: %s", obj->objectName().toUtf8().constData());

	Q_EMIT aboutToRemoveObject(obj);
	QWriteLocker lock(&m_lock);
	m_allObjects.removeAll(obj);
}
Пример #6
0
/**
 *	Request to the DSS to send a chat line from a bot in a chat channel
 *	Chat group can be constructed from CChatGroup class.
 *	sentenceId is the id of the sentence that must be sent by the DSS
 */
void forwardToDss(const TDataSetRow &senderId, CChatGroup::TGroupType groupType, std::string& sentenceId,uint32 scenarioId)
{
	nlinfo( ("forwarding to DSS : id: "+sentenceId).c_str());
	NLNET::CMessage	msgout("translateAndForward");
	msgout.serial(const_cast<TDataSetRow&>(senderId));
	msgout.serialEnum(groupType);
	msgout.serial(sentenceId);
	msgout.serial(scenarioId);
	NLNET::CUnifiedNetwork::getInstance()->send("DSS",msgout);
}
Пример #7
0
void CCreatures::display()
{
	nlassert(_initialised);

	std::map<CSheetId,CCreatures::CCreatureRecord>::iterator it;
	for(it=_creatures.begin();it!=_creatures.end();++it)
	{
		nlinfo("CREATURE: %s Walk: %f Run: %f",(*it).first.toString().c_str(),
			(*it).second._walkSpeed,(*it).second._runSpeed);
	}
}
Пример #8
0
	bool CConnection::query(const std::string &queryString)
	{
		H_AUTO(CConnection_query);
		nlassert(_Connected);

		nldebug("Executing query : [%s%s", queryString.substr(0, 100).c_str(), 100<queryString.size() ? "]" : "");
		for (uint i=100; i<queryString.size(); i+=100)
			nldebug("\t%s%s", queryString.substr(i, 100).c_str(), i+100>queryString.size() ? "]" : "");

		TTime startDate = CTime::getLocalTime();

		int result = mysql_real_query(_MysqlContext, queryString.c_str(), (unsigned long)queryString.size());
		if (result != 0)
		{
			// in all case, we try to reconnect
			int merrno = mysql_errno(_MysqlContext);
			//if (result == CR_SERVER_GONE_ERROR)
			{
				// reconnect and retry the request
				nlinfo("%p Mysql error errno:%d result:%d : %s, try to reconnect...", _MysqlContext, merrno, result, mysql_error(_MysqlContext));
				if (_connect())
					result = mysql_real_query(_MysqlContext, queryString.c_str(), (unsigned long)queryString.size());
				else
				{
					nlwarning("Failed to reopen closed connection to send query '%s'", queryString.c_str());
					if (MSWStrictMode)
					{
						nlstopex(("SQL Strict mode, the above error is fatal"));
					}
					TTime endDate = CTime::getLocalTime();
					MSWRequestDuration = uint32(endDate - startDate);
					return false;
				}
			}

			if (result != 0)
			{
				nlwarning("Mysql error errno:%d result:%d : %s", merrno, result, mysql_error(_MysqlContext));
				nlwarning("   in query '%s':", queryString.c_str());
				if (MSWStrictMode)
				{
					nlstopex(("SQL Strict mode, the above error is fatal"));
				}
				TTime endDate = CTime::getLocalTime();
				MSWRequestDuration = uint32(endDate - startDate);
				return false;
			}
		}

		TTime endDate = CTime::getLocalTime();
		MSWRequestDuration = uint32(endDate - startDate);

		return true;
	}
Пример #9
0
void CMacroManager::execute(const std::string &name, NLMISC::CLog &log)
{
	std::vector<CMacro>::iterator it;
	for (it=_macros.begin(); it!=_macros.end(); ++it)
		if ((*it)._name==name)
		{
			nlinfo("Executing macro: %s",name.c_str());
			(*it).execute(log);
			return;
		}
}
Пример #10
0
	// ***************************************************************************
	bool CDBViewQuantity::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
	{
		if(!CViewText::parse(cur, parentGroup))
			return false;

		// link to the db
		CXMLAutoPtr ptr;
		ptr = xmlGetProp (cur, (xmlChar*)"value");
		if ( ptr )
			_Number.link ( ptr );
		else
		{
			nlinfo ("no value in %s", _Id.c_str());
			return false;
		}
		ptr = xmlGetProp (cur, (xmlChar*)"valuemax");
		if ( ptr )
			_NumberMax.link ( ptr );
		else
		{
			nlinfo ("no max value in %s", _Id.c_str());
			return false;
		}

		// empty opt
		ptr = xmlGetProp (cur, (xmlChar*)"emptytext");
		if(ptr)
		{
			const char *propPtr = ptr;
			_EmptyText = ucstring(propPtr);
			if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i'))
				_EmptyText = CI18N::get (propPtr);
		}

		// init cache.
		_Cache= 0;
		_CacheMax= 0;
		buildTextFromCache();

		return true;
	}
//-----------------------------------------------
//	display
//
//-----------------------------------------------
void CSheetId::display()
{
	if (!_Initialised) init(false);

	CStaticMap<uint32,CChar>::const_iterator itStr;
	for( itStr = _SheetIdToName.begin(); itStr != _SheetIdToName.end(); ++itStr )
	{
		//nlinfo("%d %s",(*itStr).first,(*itStr).second.c_str());
		nlinfo("SHEETID: (%08x %d) %s",(*itStr).first,(*itStr).first,(*itStr).second.Ptr);
	}

} // display //
Пример #12
0
void CDynamicMapClient::onNpcAnimationTargeted(uint32 mode)
{
	//H_AUTO(R2_CDynamicMapClient_onNpcAnimationTargeted)
	nlinfo("R2Cl: DSS_TARGET");

	CLuaState &lua = getEditor().getLua();
	CLuaStackChecker lsc(&lua);

	int initialStackSize = lua.getTop();


	if (mode & CAnimationProp::Spawnable)
	{
		lua.push("r2ed_anim_despawn");
	}

	if (mode & CAnimationProp::Alive)
	{
		lua.push("r2ed_anim_kill");
		if (mode & CAnimationProp::Grouped)	{	lua.push("r2ed_anim_grp_kill"); }
		lua.push("r2ed_anim_add_hp");
		if (mode & CAnimationProp::Grouped)	{	lua.push("r2ed_anim_grp_heal"); }

	}

	if (mode & CAnimationProp::Controlable)
	{
		if (mode & CAnimationProp::Controled )
		{
			lua.push("r2ed_anim_stop_control");
		}
		else
		{
			lua.push("r2ed_anim_control");
		}
	}

	if (mode & CAnimationProp::Speaking)
	{
		if(mode & CAnimationProp::SpeakedAs)
		{
			lua.push("r2ed_anim_stop_speak");
		}
		else
		{
			lua.push("r2ed_anim_speak_as");
		}
	}

	//
	getEditor().callEnvMethod("updateAnimBarActions", lua.getTop() - initialStackSize);

}
CNelLauncherDlg::CNelLauncherDlg(QWidget *parent)
{
	displayerAdded = false;
	verboseLog = false;

	// Set up the Qt UI.
	setupUi(this);

	// Connect singals/slots.
	connect( pbLogin, SIGNAL( clicked() ), this, SLOT( clickedLogin() ) );
	connect( tblShardList, SIGNAL( cellDoubleClicked(int,int) ), this, SLOT( doubleClickedShard(int,int) ) );
	connect( pbConnect, SIGNAL( clicked() ), this, SLOT( clickedConnect() ) );

	// Set up the table.
	QStringList tableLabels;
	tableLabels << "Nb Players" << "Version" << "Status" << "Shard Name";
	tblShardList->setColumnCount(4);
	tblShardList->setHorizontalHeaderLabels(tableLabels);

	// Set up the NeL stuff.
	fileDisplayer = new NLMISC::CFileDisplayer("nel_launcher.log", true);
        NLMISC::createDebug();
        NLMISC::DebugLog->addDisplayer(fileDisplayer);
        NLMISC::InfoLog->addDisplayer(fileDisplayer);
        NLMISC::WarningLog->addDisplayer(fileDisplayer);
        NLMISC::ErrorLog->addDisplayer(fileDisplayer);
        NLMISC::AssertLog->addDisplayer(fileDisplayer);
        displayerAdded = true;

        nlinfo("Loading config file");

        ConfigFile.load("nel_launcher.cfg");

	if(ConfigFile.exists("VerboseLog"))
		verboseLog =  ConfigFile.getVar("VerboseLog").asBool();

	if(verboseLog) nlinfo("Using verbose log mode");

}
Пример #14
0
	// ***************************************************************************
	bool CDBViewDigit::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
	{
		if(!CViewBase::parse(cur, parentGroup))
			return false;

		CViewRenderer &rVR = *CViewRenderer::getInstance();

		// link to the db
		CXMLAutoPtr ptr;
		ptr = xmlGetProp (cur, (xmlChar*)"value");
		if ( ptr )
			_Number.link ( ptr );
		else
		{
			nlinfo ("no value in %s", _Id.c_str());
			return false;
		}

		// read options
		ptr = xmlGetProp (cur, (xmlChar*)"numdigit");
		if(ptr)	fromString((const char*)ptr, _NumDigit);
		clamp(_NumDigit, 1, 10);

		ptr = xmlGetProp (cur, (xmlChar*)"wspace");
		if(ptr)	fromString((const char*)ptr, _WSpace);

		ptr= (char*) xmlGetProp( cur, (xmlChar*)"color" );
		_Color = CRGBA(255,255,255,255);
		if (ptr)
			_Color = convertColor (ptr);

		// compute window size. Remove one space.
		sint32	wDigit= rVR.getFigurTextureW();
		sint32	hDigit= rVR.getFigurTextureH();
		setW((wDigit+_WSpace)*_NumDigit - _WSpace);
		setH(hDigit);

		// some init
		// For _NumDigit=2; set the divBase to 100, etc...
		_DivBase= 1;
		for(uint i= 0;i<(uint)_NumDigit;i++)
		{
			_DivBase*= 10;
		}

		// init cache.
		_Cache= -1;

		return true;
	}
Пример #15
0
//---------------------------------------------------
// update :
//
//---------------------------------------------------
void CLogicCounter::update()
{
	if( Control.getValue() == STOPPED )
	{
		return;
	}

	_TickCount++;
	if( _TickCount < Period.getValue() )
	{
		return;
	}
	else
	{
		_TickCount = 0;
	}

	switch( Control.getValue() )
	{
		case RUN :
		{
			_Value += Step.getValue();
			manageRunningMode();
		}
		break;

		case REWIND :
		{
			_Value = LowLimit.getValue();
			Control.setValue( RUN );
		}
		break;

		case FAST_FORWARD :
		{
			_Value = HighLimit.getValue();
			Control.setValue( RUN );
		}
		break;

	}

	if( _Verbose )
	{
		nlinfo("variable \"%s\" value is now %f",_Name.c_str(),(double)_Value);
	}

} // update //
Пример #16
0
void CMoveChecker::teleport(TDataSetRow entityIndex, sint32 x, sint32 y, uint32 tick)
{
	// get hold of the entity's record in the move checker (and creat a new entry if need be)
	SPosition& thePosition= _Positions[entityIndex];

	nlinfo("Move checker teleporting player: %s from (%d,%d) @tick: %d to (%d,%d) @tick: %d",
		entityIndex.toString().c_str(),thePosition.X,thePosition.Y,thePosition.Tick,x,y,tick);

	// record the new position
	thePosition.X= x;
	thePosition.Y= y;
	thePosition.Tick= tick;

	// generate a few stats
	startStats(entityIndex,x,y,tick);
}
Пример #17
0
/**
 *	Request to the DSS to send a chat line from a bot in a chat channel
 *	Chat group can be constructed from CChatGroup class.
 *	sentenceId is the id of the sentence that must be sent by the DSS
 */
void forwardToDssArg(const TDataSetRow &senderId, CChatGroup::TGroupType groupType, std::string& sentenceId,uint32 scenarioId,std::vector<float>& argValues)
{
	nlinfo( ("forwarding to DSS : id: "+sentenceId).c_str());
	NLNET::CMessage	msgout("translateAndForwardArg");
	msgout.serial(const_cast<TDataSetRow&>(senderId));
	msgout.serialEnum(groupType);
	msgout.serial(sentenceId);
	msgout.serial(scenarioId);
	uint32 size=(uint32)argValues.size(),i=0;
	msgout.serial(size);
	for(;i<size;++i)
	{
		msgout.serial(argValues[i]);
	}
	NLNET::CUnifiedNetwork::getInstance()->send("DSS",msgout);
}
Пример #18
0
	void CObjectViewer::resetScene()
	{
		deleteEntities();

		// Reset camera.
		//..

		// to load files with the same name but located in different directories
		//CPath::clearMap();

		// load and set search paths from config
		//Modules::config().configSearchPaths();

		_CurrentInstance = "";

		nlinfo("Scene cleared");
	}
Пример #19
0
	void add(TDataSetRow entityIndex, sint32 x, sint32 y, uint32 tick)
	{
		// if we've just teleported then there's no point worrying about the time since last update...
		if (_Teleporting)
		{
			// flag teleporting as finished
			_Teleporting= false;
		}
		else
		{
			// check whether entity has been updated recently
//			if((tick-_LastTick)!=1)
//			{
//				nlwarning("Move Checker Stats: entity %s has only received position update after %d ticks",entityIndex.toString().c_str(),tick-_LastTick);
//			}
		}

		// calculate the distance moved and check whether its a new record
		uint32 squaredist= (_X-x)*(_X-x) + (_Y-y)*(_Y-y);
		if (squaredist>_MaxDist)
		{
			_MaxDist=squaredist;
			_MaxDistTime= std::max((uint32)_Counter,(uint32)_Distances.size()/2);
		}
		_Distances[_Counter%_Distances.size()]= squaredist;

		// store away basic info for next time round
		_X=x;
		_Y=y;
		_LastTick=tick;

		// increment our counter...
		++_Counter;

		// if we've hit a new record recently then display a log message
		if ( (_Counter-_MaxDistTime) == (_Distances.size()/2) )
		{
			std::string s;
			for (uint32 i=(uint32)_Distances.size();i!=0;--i)
			{
				s+=NLMISC::toString(" %d",_Distances[(_Counter-i)%_Distances.size()]);
			}
			nlinfo("SpeedStats record for %s: %d (%.2f m/s): %s",entityIndex.toString().c_str(),_MaxDist,sqrt((double)_MaxDist)/200,s.c_str());
		}
	}
Пример #20
0
void PluginManager::addObject(QObject *obj)
{
	QWriteLocker lock(&m_lock);
	if (obj == 0)
	{
		nlwarning("trying to add null object");
		return;
	}
	if (m_allObjects.contains(obj))
	{
		nlwarning("trying to add duplicate object");
		return;
	}
	nlinfo("addObject: %s", obj->objectName().toUtf8().constData());

	m_allObjects.append(obj);

	Q_EMIT objectAdded(obj);
}
Пример #21
0
//---------------------------------------------------
// setCurrentState :
//
//---------------------------------------------------
void CLogicStateMachine::setCurrentState( string stateName )
{
	map<string,CLogicState>::iterator itStates = _States.find( stateName );
	if( itStates != _States.end() )
	{
		(*itStates).second.exitState();

		_CurrentState = stateName;

		(*itStates).second.enterState();

		nlinfo("Switching to state \"%s\"",_CurrentState.c_str());
	}
	else
	{
		nlwarning("(LOGIC)<CLogicStateMachine::setCurrentState> The state \"%s\" is not in the state machine \"%s\"",stateName.c_str(),_Name.c_str());
	}

} // setCurrentState //
//-----------------------------------------------
//	display
//
//-----------------------------------------------
void CSheetId::display(uint32 type)
{
	if (!_Initialised) init(false);

	CStaticMap<uint32,CChar>::const_iterator itStr;
	for( itStr = _SheetIdToName.begin(); itStr != _SheetIdToName.end(); ++itStr )
	{
		// work out the type value for this entry in the map
		TSheetId sheetId;
		sheetId.Id=(*itStr).first;

		// decide whether or not to display the entry
		if (type==sheetId.IdInfos.Type)
		{
			//nlinfo("%d %s",(*itStr).first,(*itStr).second.c_str());
			nlinfo("SHEETID: (%08x %d) %s",(*itStr).first,(*itStr).first,(*itStr).second.Ptr);
		}
	}

} // display //
Пример #23
0
std::string getXMLProp (xmlNodePtr node, const char *propName)
{
	const char *name = (const char*)xmlGetProp (node, (xmlChar*)propName);
	if (name)
	{
		nlinfo ("get prop %s = %s", propName, name);
		string n = name;
		xmlFree ((void*)name);
		return n;
	}
	else
	{
		// Make an error message
		char tmp[512];
		smprintf (tmp, 512, "LogicStateMachine XML Syntax error in block %s line %d, aguments Name not found",
			node->name, (int)node->line);
		throw EXmlParsingError (tmp);
		return "";
	}
}
void CSampleBank::onUpdate()
{
	if (_SplitLoadDone)
	{
		nldebug("Some samples have been loaded");
		if (_LoadList.empty())
		{
			// all the samples are loaded, we can compute the bank size.
			TSampleTable::iterator	first(_Samples.begin()), last(_Samples.end());
			for (; first != last; ++first)
			{
				_ByteSize += first->second->getSize();
			}

			_SampleBankManager->m_LoadedSize += _ByteSize;

			// stop the update.
			_SampleBankManager->m_AudioMixer->unregisterUpdate(this);
			_LoadingDone = true;

			// Force an update in the background manager (can restar stopped sound).
			_SampleBankManager->m_AudioMixer->getBackgroundSoundManager()->updateBackgroundStatus();

			nlinfo("Sample bank %s loaded.", CStringMapper::unmap(_Name).c_str());
		}
		else
		{
			_SplitLoadDone = false;
			for (uint i=0; i<ASYNC_LOADING_SPLIT && !_LoadList.empty(); ++i)
			{
				CAsyncFileManagerSound::getInstance().loadWavFile(_LoadList.front().first, CStringMapper::unmap(_LoadList.front().second)+".wav");
				_LoadList.pop_front();
			}
			// add a end loading event...
			CAsyncFileManagerSound::getInstance().signal(&_SplitLoadDone);
		}
	}
}
Пример #25
0
//---------------------------------------------------
// applyModification :
//
//---------------------------------------------------
void CLogicVariable::applyModification( string op, sint64 value )
{
	if( op == "SET" || op == "set" )
	{
		_Value = value;
	}
	else
	if( op == "ADD" || op == "add" )
	{
		_Value += value;
	}
	else
	if( op == "SUB" || op == "sub" )
	{
		_Value -= value;
	}
	else
	if( op == "MUL" || op == "mul")
	{
		_Value *= value;
	}
	else
	if( op == "DIV" || op == "div")
	{
		if( value != 0 ) _Value /= value;
	}
	else
	{
		nlwarning("(LGCS)<CLogicVariable::applyModification> The operator \"%s\" is unknown",op.c_str());
		return;
	}

	if( _Verbose )
	{
		nlinfo("variable \"%s\" value is now %f",_Name.c_str(),(double)_Value);
	}

} // applyModification //
Пример #26
0
void CDynamicMapClient::show() const
{
	//H_AUTO(R2_CDynamicMapClient_show)
//	std::stringstream ss;
//	std::string s;
	std::string ss;

	CObject* highLevel= getCurrentScenario()->getHighLevel();
	if (highLevel) { highLevel->serialize(ss); }
	else { ss += "No HL\n"; }

	std::vector<std::string> lines;
	NLMISC::splitString(ss, "\n", lines);
	uint first=0, last=(uint)lines.size();
	for (; first != last ; ++first) { nlinfo("%s", lines[first].c_str()); }

/*	while ( std::getline(ss, s))
	{
		nlinfo("%s", s.c_str());
	}*/

	//nlinfo("%s", ss.str().c_str());
}
Пример #27
0
bool CNelLauncherConnection::receive(std::string &res)
{
	nlassert(m_Sock.connected());

	uint32 size;
	res = "";

	uint8 buf[1024];

	//if(VerboseLog) nlinfo("Receiving");

	while (true)
	{
		size = 1023;

		if(m_Sock.receive((uint8*)buf, size, false) == NLNET::CSock::Ok)
		{
			//if(VerboseLog) nlinfo("Received OK %d bytes", size);
			buf[1023] = '\0';
			res += (char*)buf;
			//nlinfo("block received '%s'", buf);
		}
		else
		{
			//if(VerboseLog) nlinfo("Received CLOSE %d bytes", size);
			buf[size] = '\0';
			res += (char*)buf;
			//nlwarning ("server connection closed");
			break;
		}
	}

	// trim off whitespace.
	res = NLMISC::trim(res);
	nlinfo("all received '%s'", res.c_str());
	return true;
}
Пример #28
0
//-----------------------------------------------
//	init
//
//-----------------------------------------------
void CSheetId::init(bool removeUnknownSheet)
{
	// allow multiple calls to init in case libraries depending on sheetid call this init from their own
	if (_Initialised)
	{
		if (_DontHaveSheetKnowledge)
			nlinfo("SHEETID: CSheetId is already initialized without sheet_id.bin");
		return;
	}

//	CFile::addFileChangeCallback ("sheet_id.bin", cbFileChange);

	_RemoveUnknownSheet = removeUnknownSheet;

	loadSheetId ();
	_Initialised=true;

#ifdef NL_TEMP_YUBO_NO_SOUND_SHEET_ID
	if (typeFromFileExtension("sound") == std::numeric_limits<uint32>::max())
	{
		nlwarning("SHEETID: Loading without known sound sheet id, please update sheet_id.bin with .sound sheets");
		nlassert(_FileExtensions.size() == 1 << (NL_SHEET_ID_TYPE_BITS));
		nlassert(_FileExtensions[a_NoSoundSheetType].empty());
		_FileExtensions[a_NoSoundSheetType] = "sound";
		_DevSheetIdToName.push_back(std::vector<std::string>());
		_DevSheetIdToName[0].push_back("unknown.sound");
		TSheetId id;
		id.IdInfos.Type = a_NoSoundSheetType;
		id.IdInfos.Id = _DevSheetIdToName[0].size() - 1;
		nlassert(id.IdInfos.Id == 0);
		_DevSheetNameToId["unknown.sound"] = id.Id;
		a_NoSoundSheetId = true;
	}
#endif

} // init //
Пример #29
0
	void NeLTexture::loadFromFile(const String &filename, const String& resourceGroup)
	{
		String file = NLMISC::CPath::lookup(filename.c_str()).c_str();

		// this object can only contain one texture at a time, free the old one if it exists.
		freeNeLTexture();

		// create the texture from a file...

		/* TODO: Determine if Kervala was correct in removing setWrapS/T */
		m_TextureFile=m_Owner->getNeLDriver().createTextureFile(file.c_str());
		m_TextureFile->setWrapS(NL3D::UTexture::Clamp);
		m_TextureFile->setWrapT(NL3D::UTexture::Clamp);

		if(m_TextureFile == 0) { // failed to load the texture.
			nlinfo("Failed to load texture: %s",filename.c_str());
			return;
		}

		// because nel unloads the texture from RAM when it loads it into VRAM
		// we need to load the texture into a bitmap to get the sizes.
		NL3D::CBitmap tmpBitmap;
		NLMISC::CIFile nelfile(file.c_str());
		tmpBitmap.load(nelfile);
		d_width=tmpBitmap.getWidth();
		d_height=tmpBitmap.getHeight();

		// set the material up.
		m_UsingFile=true; m_UsingMem=false;
		m_Material.setTexture(m_TextureFile);
		m_Material.setBlend(true);
		m_Material.setBlendFunc(NL3D::UMaterial::srcalpha, NL3D::UMaterial::invsrcalpha);
		m_Material.setAlphaTest(false);
		m_Material.setZFunc(NL3D::UMaterial::always);
		m_Material.setDoubleSided();
	}
Пример #30
0
	void ProcEditor::onAddButtonClicked()
	{
		bool ok;
		QString name =
			QInputDialog::getText( this,
							tr( "Adding new Action" ),
							tr( "Please specify the name of the new action handler" ),
							QLineEdit::Normal,
							QString(),
							&ok );

		if( ok )
		{
			CProcedure *proc =
				CWidgetManager::getInstance()->getParser()->getProc( currentProc.toUtf8().constData() );
			if( proc != NULL )
			{
				proc->addAction( name.toUtf8().constData() );
				actionList->addItem( name );
			}
			else
				nlinfo( "Cannot find procedure %s", currentProc.toUtf8().constData() );
		}
	}