⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 px_ls_main.c

📁 MMORPG游戏服务器端架构及函数
💻 C
字号:
/* must been first include begin */
#include "..\ProjectX_Common\ProjectX_Copyright.h"
#include "..\ProjectX_Common\ProjectX_Common.h"
/* must been first include end */

/* std and common include */
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

/* program specify include */
#include "..\ProjectX_Common\ProjectX_Utils.h"
#include "px_ls_ui.h"
#include "px_ls_state.h"
#include "px_ls_module_work.h"

char			version[] = "1.00.0143";
char			author[] = "MS:XSuns@hotmail.com";
char			last_edit_time[] = "30/06/2005 23:45";
PX_LS_STATE	*   g_state = NULL;

BOOL px_ls_init_instance(void);
BOOL px_ls_uninit_instance(void);

int main(int argc, char ** argv){
	BOOL bln_run = TRUE;
	char cache[FILENAME_MAX];

	px_ls_init_instance();

	if (_beginthread(ls_work_thread,0,NULL) == NULL) {
		x_ui_display_error("_beginthread of ls_work_thread fail,sys need exit now ...");
		bln_run = FALSE;
	}

	while (bln_run) {
		cache[0] = '\0';
		gets(cache);
		bln_run = px_ls_handle_ui_command(cache);
	}

	px_ls_uninit_instance();

	x_ui_display_info("Press any key to exit logic server");
	getchar();

	return 0;
}

BOOL px_ls_init_instance(){
	x_ui_init();
	if (g_state == NULL) {
		g_state = (LPPX_LS_STATE)ms_malloc(sizeof(PX_LS_STATE));
		g_state->cts_state = (LPCRITICAL_SECTION)ms_malloc(sizeof(CRITICAL_SECTION));
		memset(g_state->cts_state,0,sizeof(CRITICAL_SECTION));
		InitializeCriticalSectionAndSpinCount(g_state->cts_state,0x4000);
		g_state->prev_time = GetTime64();
		g_state->curr_time = GetTime64();
		g_state->prev_state = STATE_MAIN_NO_INIT;
		g_state->curr_state = STATE_MAIN_NO_INIT;
		g_state->module_dbes_state = STATE_MODULE_NO_INIT;
		g_state->module_rs_state = STATE_MODULE_NO_INIT;
		g_state->frame_module_dbes = 0;
		g_state->frame_module_rs = 0;
	}
	return TRUE;
}

BOOL px_ls_uninit_instance(){
	if (g_state != NULL) {
		DeleteCriticalSection(g_state->cts_state);
		ms_free(g_state->cts_state);
		g_state->cts_state = NULL;
		ms_free(g_state);
		g_state = NULL;
	}
	return TRUE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -