Пример #1
0
extern "C" int __declspec(dllexport) Unload(void)
{
	return ShutdownProc(0, 0);
}
Пример #2
0
void mainloop( void )
{	
    print("初始化NPC...");
    NPC_generateLoop( 1 );
    print("完成\n");
    print("初始化signal1...");
    signal(SIGUSR1,sigusr1);
    print("完成\n");
    print("初始化signal2...");
    signal(SIGUSR2,sigusr2);
    print("完成\n");
#ifdef _MAP_WARPPOINT
	print("初始化地图传送点...");
	MAPPOINT_InitMapWarpPoint();
	print("完成\n");
	if( !MAPPOINT_loadMapWarpPoint() ){
		return;
	}
#endif

#ifdef _ASSESS_SYSEFFICACY
	Assess_InitSysEfficacy();
#endif
#ifdef _CHATROOMPROTOCOL			// (不可开) Syu ADD 聊天室频道
	print("初始化聊天室频...");
	InitChatRoom();
	print("完成\n");
#endif
#ifdef _CHANNEL_MODIFY
	print("初始化职业频道...");
	if(!InitOccChannel()) return;			// 初始化职业频道
	print("完成\n");
#endif
#ifdef _ANGEL_SUMMON
	print("初始化精灵召奂时间...");
	AngelReady = 0;
#ifdef _ANGEL_TIME
	AngelNextTime = time(NULL) + getAngelPlayerTime();
#else
	AngelNextTime = time(NULL) + 1*60;
#endif
	print("完成\n");
#endif
#ifdef _JZ_NEWSCRIPT_LUA
	print("初始化LNS引擎...");
	NPC_Lua_Init(getLuaFile());
	print("完成\n");
#endif
//#ifdef _ALLDOMAN
//	print("初始化英雄表列...");
//	InitHeroList();
//	print("完成\n");
//#endif

	int itime=0;
	while(1){
		if(getCpuUse()!=-1){
			itime++;
			if(itime>getCpuUse()){
				itime=0;
				usleep(1);
			}
		}
#ifdef _ASSESS_SYSEFFICACY
Assess_SysEfficacy( 0 );
#endif

    setNewTime();
    memcpy(&tmNow, localtime( (time_t *)&NowTime.tv_sec),
               sizeof( tmNow ) );
		if( tmOld.tm_hour != getLogHour( ) && tmNow.tm_hour == getLogHour( ) ){
#ifdef _GMSV_DEBUG
			DebugMainFunction="backupAllLogFile";
#endif
			backupAllLogFile( &tmOld );
		}

    setNewTime();
    pthread_t tid1;
#ifdef _ASSESS_SYSEFFICACY_SUB //显示LOOP时间
//Assess_SysEfficacy_sub( 0, 1);
//#ifdef _GMSV_DEBUG
//	  DebugMainFunction="netloop_faster";
//#endif
//	  netloop_faster();
//Assess_SysEfficacy_sub( 1, 1);
		pthread_create(&tid1, NULL, net_battle_loop, NULL);
Assess_SysEfficacy_sub( 0, 2);
#ifdef _GMSV_DEBUG
    DebugMainFunction="NPC_generateLoop";
#endif
    NPC_generateLoop( 0 );
Assess_SysEfficacy_sub( 1, 2);
	
//Assess_SysEfficacy_sub( 0, 3);
//#ifdef _GMSV_DEBUG
//    DebugMainFunction="BATTLE_Loop";
//#endif
//    BATTLE_Loop();
//Assess_SysEfficacy_sub( 1, 3);
		
Assess_SysEfficacy_sub( 0, 4);
#ifdef _GMSV_DEBUG
   DebugMainFunction="CHAR_Loop";
#endif
   CHAR_Loop();
Assess_SysEfficacy_sub( 1, 4);
	pthread_join(tid1,NULL);
#ifdef _GMSV_DEBUG
   DebugMainFunction="PETMAIL_proc";
#endif
   PETMAIL_proc();

#ifdef _GMSV_DEBUG
   DebugMainFunction="family_proc";
#endif
   family_proc();

#ifdef _GMSV_DEBUG
   DebugMainFunction="chardatasavecheck";
#endif
   chardatasavecheck();

#ifdef _GMSV_DEBUG
		DebugMainFunction="AngelReadyProc";
#endif
		AngelReadyProc();

		tmOld = tmNow;
		if( tmOld.tm_sec != tmNow.tm_sec ) {
#ifdef _GMSV_DEBUG
			DebugMainFunction="CHAR_checkEffectLoop";
#endif
			CHAR_checkEffectLoop();
		}
    if( SERVSTATE_getShutdown()> 0 ) {
      ShutdownProc();
#ifdef _GMSV_DEBUG
      DebugMainFunction="ShutdownProc";
#endif
    }
		tmOld = tmNow;

#ifdef _ASSESS_SYSEFFICACY
Assess_SysEfficacy( 1 );
#endif
#endif
  }
}