Now mod center is loaded from glest.io

This commit is contained in:
mathusummut
2019-03-04 00:18:52 +01:00
parent f91fa527a7
commit 8ce2993e5d
12 changed files with 228 additions and 196 deletions

View File

@@ -62,6 +62,7 @@ IRCChannel=#glest-lobby
Lang=english
MaxLights=8
Masterserver=http://master.megaglest.org/
Modserver=https://glest.io/
NetPlayerName=newbie
NetworkConsistencyChecks=true
NetworkInterfaces=lo,eth,wlan,vlan,vboxnet,br-lan,br-gest,enp0s,enp1s,enp2s,enp3s,enp4s,enp5s,enp6s,enp7s,enp8s,enp9s

View File

@@ -62,6 +62,7 @@ IRCChannel=#glest-lobby
Lang=english
MaxLights=8
Masterserver=http://master.megaglest.org/
Modserver=https://glest.io/
NetPlayerName=newbie
NetworkConsistencyChecks=true
PhotoMode=false

View File

@@ -62,6 +62,7 @@ IRCChannel=#glest-lobby
Lang=english
MaxLights=8
Masterserver=http://master.megaglest.org/
Modserver=http://master.megaglest.org/
NetPlayerName=newbie
NetworkConsistencyChecks=true
PhotoMode=false

View File

@@ -333,7 +333,7 @@ namespace Game {
}
if (Config::getInstance().getBool("EnableLoadCancel", "true")) {
if (Config::getInstance().getBool("EnableLoadCancel", "false")) {
if (buttonCancel.getEnabled() == false) {
buttonCancel.init((metrics.getVirtualW() / 2) - (125 / 2), 50 * metrics.getVirtualH() / 100, 125);
buttonCancel.setText(lang.getString("Cancel"));

View File

@@ -1540,11 +1540,8 @@ namespace Game {
::Shared::Platform::Window::handleEvent();
SDL_PumpEvents();
}
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if ((loadTypes & lgt_FactionPreview) == lgt_FactionPreview) {
if (SystemFlags::
@@ -1559,11 +1556,8 @@ namespace Game {
::Shared::Platform::Window::handleEvent();
SDL_PumpEvents();
}
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (showPerfStats) {
sprintf(perfBuf,
@@ -1624,11 +1618,8 @@ namespace Game {
(__FILE__).c_str(), __FUNCTION__,
__LINE__);
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
//tileset
if ((loadTypes & lgt_TileSet) == lgt_TileSet) {
@@ -1643,11 +1634,8 @@ namespace Game {
loadTileset(config.getPathListForType(ptTilesets, scenarioDir),
tilesetName, &checksum, loadedFileList);
}
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (showPerfStats) {
sprintf(perfBuf,
@@ -1662,11 +1650,8 @@ namespace Game {
::Shared::Platform::Window::handleEvent();
SDL_PumpEvents();
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (SystemFlags::
getSystemSettingType(SystemFlags::debugSystem).enabled)
@@ -1726,11 +1711,8 @@ namespace Game {
::Shared::Platform::Window::handleEvent();
SDL_PumpEvents();
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (SystemFlags::
getSystemSettingType(SystemFlags::debugSystem).enabled)
@@ -1752,11 +1734,8 @@ namespace Game {
world.loadMap(Config::getMapPath(mapName, scenarioDir), &checksum);
}
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (showPerfStats) {
sprintf(perfBuf,
@@ -1771,11 +1750,8 @@ namespace Game {
::Shared::Platform::Window::handleEvent();
SDL_PumpEvents();
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (SystemFlags::
getSystemSettingType(SystemFlags::debugSystem).enabled)
@@ -1823,11 +1799,8 @@ namespace Game {
sleep(0);
SDL_PumpEvents();
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (SystemFlags::
getSystemSettingType(SystemFlags::debugSystem).enabled)
@@ -1919,11 +1892,8 @@ namespace Game {
SDL_PumpEvents();
}
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
try {
world.init(this, gameSettings.getDefaultUnits());
@@ -1993,11 +1963,9 @@ namespace Game {
::Shared::Platform::Window::handleEvent();
SDL_PumpEvents();
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
gui.init(this);
if (SystemFlags::
@@ -2015,11 +1983,8 @@ namespace Game {
chatManager.init(&console, world.getThisTeamIndex());
console.clearStoredLines();
}
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (showPerfStats) {
sprintf(perfBuf,
@@ -2039,11 +2004,8 @@ namespace Game {
}
}
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (showPerfStats) {
sprintf(perfBuf,
@@ -2094,11 +2056,8 @@ namespace Game {
std::vector < SlaveThreadControllerInterface * >slaveThreadList;
aiInterfaces.resize(world.getFactionCount());
for (int i = 0; i < world.getFactionCount(); ++i) {
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
Faction *faction = world.getFaction(i);
@@ -2150,11 +2109,8 @@ namespace Game {
::Shared::Platform::Window::handleEvent();
SDL_PumpEvents();
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (world.getFactionCount() == 1
&& world.getFaction(0)->getPersonalityType() == fpt_Observer) {
@@ -2205,21 +2161,15 @@ namespace Game {
add(Lang::
getInstance().getString("LogScreenGameLoadingInitRenderer", ""), true);
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
//printf("Before renderer.initGame\n");
renderer.initGame(this, this->getGameCameraPtr());
//printf("After renderer.initGame\n");
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (showPerfStats) {
sprintf(perfBuf,
@@ -2252,11 +2202,8 @@ namespace Game {
::Shared::Platform::Window::handleEvent();
SDL_PumpEvents();
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
if (SystemFlags::
getSystemSettingType(SystemFlags::debugSystem).enabled)
@@ -2357,11 +2304,8 @@ namespace Game {
setupPopupMenus(false);
for (int i = 0; i < world.getFactionCount(); ++i) {
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
if (logger.getCancelLoading())
return;
}
Faction *faction = world.getFaction(i);
@@ -3890,6 +3834,8 @@ namespace Game {
//world->getMapPtr()->end();
//world.end();
Logger& logger = Logger::getInstance();
if (keepFactions == false) {
world.end();
@@ -3909,7 +3855,6 @@ namespace Game {
// unit particles and fade them out etc and this end method deletes the original
// object pointers.
Renderer& renderer = Renderer::getInstance();
Logger& logger = Logger::getInstance();
renderer.endGame(true);
GameConstants::updateFps = original_updateFps;
@@ -3919,14 +3864,34 @@ namespace Game {
this->resetMembers();
this->load();
if (logger.getCancelLoading()) {
Lang &lang = Lang::getInstance();
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
for (unsigned int langIndex = 0; langIndex < languageList.size(); ++langIndex) {
string sErr = lang.getString("GameCancelledByUser", languageList[langIndex]);
bool localEcho = lang.isLanguageLocal(languageList[langIndex]);
//sendTextMessage(sErr, -1, localEcho, languageList[langIndex]);
/*GameNetworkInterface* gameNetworkInterface = NetworkManager::getInstance().getGameNetworkInterface();
if (gameNetworkInterface != NULL)
gameNetworkInterface->sendTextMessage(sErr, -1, localEcho, languageList[langIndex]); */
printf("\niuieioeioeui\n");
}
quitGame();
logger.setCancelLoading(false);
//endGame();
} else {
return;
}
this->init();
if (logger.getCancelLoading()) {
logger.setCancelLoading(false);
//endGame();
Lang &lang = Lang::getInstance();
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
for (unsigned int langIndex = 0; langIndex < languageList.size(); ++langIndex) {
string sErr = lang.getString("GameCancelledByUser", languageList[langIndex]);
bool localEcho = lang.isLanguageLocal(languageList[langIndex]);
//sendTextMessage(sErr, -1, localEcho, languageList[langIndex]);
printf("\niuieioeioeui\n");
}
quitGame();
logger.setCancelLoading(false);
return;
}
} else {
SoundRenderer & soundRenderer = SoundRenderer::getInstance();
@@ -3946,6 +3911,19 @@ namespace Game {
this->setGameSettings(&gameSettings);
this->load(lgt_FactionPreview | lgt_TileSet | lgt_Map |
lgt_Scenario);
if (logger.getCancelLoading()) {
Lang &lang = Lang::getInstance();
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
for (unsigned int langIndex = 0; langIndex < languageList.size(); ++langIndex) {
string sErr = lang.getString("GameCancelledByUser", languageList[langIndex]);
bool localEcho = lang.isLanguageLocal(languageList[langIndex]);
//sendTextMessage(sErr, -1, localEcho, languageList[langIndex]);
printf("\niuieioeioeui\n");
}
quitGame();
logger.setCancelLoading(false);
return;
}
try {
world.init(this, gameSettings.getDefaultUnits(), false);
} catch (const exception & ex) {
@@ -3964,6 +3942,19 @@ namespace Game {
ErrorDisplayMessage(ex.what(), true);
}
}
if (logger.getCancelLoading()) {
Lang &lang = Lang::getInstance();
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
for (unsigned int langIndex = 0; langIndex < languageList.size(); ++langIndex) {
string sErr = lang.getString("GameCancelledByUser", languageList[langIndex]);
bool localEcho = lang.isLanguageLocal(languageList[langIndex]);
//sendTextMessage(sErr, -1, localEcho, languageList[langIndex]);
printf("\niuieioeioeui\n");
}
quitGame();
logger.setCancelLoading(false);
return;
}
world.initUnitsForScenario();
Map *map = world.getMap();

View File

@@ -963,7 +963,7 @@ namespace Game {
//places all the opengl lights
void Renderer::setupLighting() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL) {
return;
}
@@ -1067,6 +1067,9 @@ namespace Game {
//}
void Renderer::loadGameCameraMatrix() {
if (game == NULL)
return;
const GameCamera *gameCamera = game->getGameCamera();
glMatrixMode(GL_MODELVIEW);
@@ -1395,6 +1398,9 @@ namespace Game {
}
void Renderer::computeVisibleQuad() {
if (gameCamera == NULL)
return;
visibleQuad = this->gameCamera->computeVisibleQuad();
bool frustumChanged = false;
@@ -1672,7 +1678,7 @@ namespace Game {
}
void Renderer::renderMouse3d() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL) {
return;
}
@@ -1681,7 +1687,7 @@ namespace Game {
return;
}
if (game == NULL) {
/*if (game == NULL) {
char szBuf[8096] = "";
snprintf(szBuf, 8096, "In [%s::%s] Line: %d game == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
throw game_runtime_error(szBuf);
@@ -1693,16 +1699,16 @@ namespace Game {
char szBuf[8096] = "";
snprintf(szBuf, 8096, "In [%s::%s] Line: %d game->getGui()->getMouse3d() == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
throw game_runtime_error(szBuf);
}
}*/
const Gui *gui = game->getGui();
const Mouse3d *mouse3d = gui->getMouse3d();
const Map *map = game->getWorld()->getMap();
if (map == NULL) {
/*if (map == NULL) {
char szBuf[8096] = "";
snprintf(szBuf, 8096, "In [%s::%s] Line: %d map == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
throw game_runtime_error(szBuf);
}
}*/
assertGl();
@@ -2186,7 +2192,7 @@ namespace Game {
void Renderer::renderPerformanceStats() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL) {
return;
}
@@ -2222,7 +2228,7 @@ namespace Game {
}
void Renderer::renderClock() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL) {
return;
}
@@ -2294,7 +2300,7 @@ namespace Game {
}
void Renderer::renderResourceStatus() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL) {
return;
}
@@ -2501,9 +2507,12 @@ namespace Game {
string str = intToStr(r->getAmount());
glEnable(GL_TEXTURE_2D);
Vec4f resourceFontColor = Vec4f(1.f, 1.f, 1.f, 1.f);
if (game == NULL) {
const Vec4f fontColor = game->getGui()->getDisplay()->getColor();
Vec4f resourceFontColor = fontColor;
resourceFontColor = fontColor;
}
bool isNegativeConsumableDisplayCycle = false;
if (rt->getClass() == rcConsumable) {
@@ -2565,9 +2574,8 @@ namespace Game {
}
void Renderer::renderSelectionQuad() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
}
Config &config = Config::getInstance();
if (config.getBool("RecordMode", "false") == true) {
@@ -2610,7 +2618,6 @@ namespace Game {
Vec2i computeCenteredPos(const string &text, Font2D *font, int x, int y) {
if (font == NULL) {
//abort();
throw game_runtime_error("font == NULL (1) text = " + text);
}
const Metrics &metrics = Metrics::getInstance();
@@ -2655,6 +2662,8 @@ namespace Game {
void Renderer::renderTextSurroundingBox(int x, int y, int w, int h,
int maxEditWidth, int maxEditRenderWidth) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true)
return;
//glColor4fv(color.ptr());
//glBegin(GL_QUADS); // Start drawing a quad primitive
@@ -4328,7 +4337,7 @@ namespace Game {
}
void Renderer::renderSurface(const int renderFps) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL) {
return;
}
@@ -4741,7 +4750,7 @@ namespace Game {
}
void Renderer::renderObjects(const int renderFps) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL) {
return;
}
@@ -4840,9 +4849,8 @@ namespace Game {
}
void Renderer::renderWater() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
}
const World *world = game->getWorld();
const Map *map = world->getMap();
@@ -5090,6 +5098,8 @@ namespace Game {
}
void Renderer::renderGhostModel(const UnitType *building, const Vec2i pos, CardinalDir facing, Vec4f *forceColor) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
//const UnitType *building= gui->getBuilding();
//const Vec2i &pos= gui->getPosObjWorld();
@@ -5240,7 +5250,7 @@ namespace Game {
glPopMatrix();
unit->setVisible(true);
if (showDebugUI == true &&
if (game != NULL && showDebugUI == true &&
(showDebugUILevel & debugui_unit_titles) == debugui_unit_titles) {
unit->setScreenPos(computeScreenPosition(currVec));
@@ -5336,9 +5346,8 @@ namespace Game {
}
void Renderer::renderMorphEffects() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
}
VisibleQuadContainerCache &qCache = getQuadCache();
if (qCache.visibleQuadUnitList.empty() == false) {
@@ -5395,9 +5404,8 @@ namespace Game {
void Renderer::renderSelectionEffects(int healthbarMode) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
}
Config &config = Config::getInstance();
if (config.getBool("RecordMode", "false") == true) {
@@ -5704,6 +5712,9 @@ namespace Game {
}
bool Renderer::isHealthBarVisible(const Unit *unit, int healthbarMode) {
if (game == NULL)
return false;
int healthbarVisible = hbvUndefined;
//check options (hotkey)
if (healthbarMode == hbvUndefined) {
@@ -5733,9 +5744,8 @@ namespace Game {
}
void Renderer::renderWaterEffects() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
}
const World *world = game->getWorld();
const WaterEffects *we = world->getWaterEffects();
@@ -5832,9 +5842,8 @@ namespace Game {
}
void Renderer::renderHud() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
}
Texture2D *hudTexture = game->getGui()->getHudTexture();
if (hudTexture != NULL) {
@@ -5844,9 +5853,8 @@ namespace Game {
}
void Renderer::renderMinimap() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
}
const World *world = game->getWorld();
const Minimap *minimap = world->getMinimap();
@@ -6176,9 +6184,9 @@ namespace Game {
}
void Renderer::renderHighlightedCellsOnMinimap() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
}
// Draw marked cells
const std::vector<MarkedCell> *highlightedCells = game->getHighlightedCells();
if (highlightedCells->empty() == false) {
@@ -6226,6 +6234,9 @@ namespace Game {
}
void Renderer::renderMarkedCellsOnMinimap() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
// Draw marked cells
std::map<Vec2i, MarkedCell> markedCells = game->getMapMarkedCellList();
if (markedCells.empty() == false) {
@@ -6307,9 +6318,8 @@ namespace Game {
}
}
void Renderer::renderVisibleMarkedCells(bool renderTextHint, int x, int y) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
}
// Draw marked cells
std::map<Vec2i, MarkedCell> markedCells = game->getMapMarkedCellList();
@@ -6424,9 +6434,8 @@ namespace Game {
}
void Renderer::renderDisplay() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true || game == NULL)
return;
}
CoreData &coreData = CoreData::getInstance();
const Metrics &metrics = Metrics::getInstance();
@@ -6800,6 +6809,9 @@ namespace Game {
// ==================== computing ====================
bool Renderer::ccomputePosition(const Vec2i &screenPos, Vec2i &worldPos, bool exactCoords) {
if (game == NULL)
return false;
assertGl();
const Map* map = game->getWorld()->getMap();
const Metrics &metrics = Metrics::getInstance();
@@ -7205,11 +7217,10 @@ namespace Game {
//assertGl();
if (nearestLightPos.w == 0.f) {
if (nearestLightPos.w == 0.f && game != NULL) {
//directional light
//light pos
assert(game != NULL);
assert(game->getWorld() != NULL);
const TimeFlow *tf = game->getWorld()->getTimeFlow();
assert(tf != NULL);
@@ -7419,7 +7430,9 @@ namespace Game {
}
void Renderer::autoConfig() {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled())
return;
Config &config = Config::getInstance();
bool nvidiaCard = toLower(getGlVendor()).find("nvidia") != string::npos;
@@ -7449,7 +7462,6 @@ namespace Game {
//filter
config.setString("Filter", "Bilinear");
}
}
void Renderer::clearBuffers() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -7605,7 +7617,6 @@ namespace Game {
return unitsList;
}
assert(game != NULL);
//const World *world= game->getWorld();
//assert(world != NULL);
@@ -9172,6 +9183,9 @@ namespace Game {
}
void Renderer::updateMarkedCellScreenPosQuadCache(Vec2i pos) {
if (game == NULL)
return;
const World *world = game->getWorld();
const Map *map = world->getMap();

View File

@@ -671,8 +671,7 @@ namespace Game {
}
programState->addPerformanceCount("programState->updateCamera()",
chronoPerformanceCounts.getMillis
());
chronoPerformanceCounts.getMillis());
if (showPerfStats) {
sprintf(perfBuf,
@@ -707,6 +706,12 @@ namespace Game {
while (prevState == this->programState && updateTimer.isTime()) {
Chrono chronoUpdateLoop;
/*if (Logger::getInstance().getCancelLoading()) {
Logger::getInstance().setCancelLoading(false);
printf("hmm");
break;
}*/
#ifdef DEBUG
if (SystemFlags::
getSystemSettingType(SystemFlags::debugPerformance).enabled)
@@ -881,8 +886,7 @@ namespace Game {
}
programState->addPerformanceCount("programState->tick()",
chronoPerformanceCounts.getMillis
());
chronoPerformanceCounts.getMillis());
if (showPerfStats) {
sprintf(perfBuf,

View File

@@ -549,11 +549,12 @@ namespace Game {
if (SystemFlags::VERBOSE_MODE_ENABLED)
printf("In [%s::%s Line %d]\n", __FILE__, __FUNCTION__, __LINE__);
if (config.getString("Masterserver", "") != "") {
string baseURL = config.getString("Masterserver");
string baseURL = config.getString("Modserver", "");
if (baseURL == "")
baseURL = config.getString("Masterserver", "");
if (baseURL != "") {
endPathWithSlash(baseURL, false);
}
string phpVersionParam =
config.getString("phpVersionParam", "?version=0.1");

View File

@@ -1911,9 +1911,7 @@ namespace Game {
int sleepMillis = Config::getInstance().getInt("NetworkServerLoopGameLoadingCapSleepMillis", "10");
int64 lastStatusUpdate = 0;
while (exitServer == false &&
allReady == false &&
logger.getCancelLoading() == false) {
while (exitServer == false && allReady == false && logger.getCancelLoading() == false) {
waitLoopIterationCount++;
if (waitLoopIterationCount > 0 &&
@@ -2103,11 +2101,10 @@ namespace Game {
Shared::Platform::Window::handleEvent();
}
if (logger.getCancelLoading() == true) {
if (logger.getCancelLoading()) {
Lang &lang = Lang::getInstance();
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
for (unsigned int langIndex = 0; langIndex < languageList.size(); ++langIndex) {
string sErr = lang.getString("GameCancelledByUser", languageList[langIndex]);
bool localEcho = lang.isLanguageLocal(languageList[langIndex]);
sendTextMessage(sErr, -1, localEcho, languageList[langIndex]);

View File

@@ -79,9 +79,8 @@ namespace Game {
//printf("\n>>> factionname=%s\n",factionName.c_str());
for (bool realFactionPathFound = false; realFactionPathFound == false;) {
if (logger.getCancelLoading()) {
if (logger.getCancelLoading())
return;
}
currentPath = techTreePath + "factions/" + factionName;
endPathWithSlash(currentPath);

View File

@@ -251,7 +251,11 @@ namespace Game {
snprintf(szBuf, 8096,
Lang::getInstance().getString("LogScreenGameLoadingTechtree", "").c_str(),
formatString(getName(true)).c_str());
Logger::getInstance().add(szBuf, true);
Logger & logger = Logger::getInstance();
logger.add(szBuf, true);
if (logger.getCancelLoading())
return;
vector < string > filenames;
//load resources
@@ -262,6 +266,9 @@ namespace Game {
resourceTypes.resize(filenames.size());
for (int i = 0; i < (int) filenames.size(); ++i) {
if (logger.getCancelLoading())
return;
str = currentPath + "resources/" + filenames[i];
resourceTypes[i].load(str, checksum, &checksumValue,
loadedFileList, treePath);
@@ -298,6 +305,8 @@ namespace Game {
sleep(0);
Window::handleEvent();
SDL_PumpEvents();
if (logger.getCancelLoading())
return;
//load tech tree xml info
try {
@@ -329,6 +338,8 @@ namespace Game {
techTreeNode->getChild("attack-types");
attackTypes.resize(attackTypesNode->getChildCount());
for (int i = 0; i < (int) attackTypes.size(); ++i) {
if (logger.getCancelLoading())
return;
const XmlNode *attackTypeNode =
attackTypesNode->getChild("attack-type", i);
attackTypes[i].setName(attackTypeNode->getAttribute("name")->
@@ -348,6 +359,9 @@ namespace Game {
techTreeNode->getChild("armor-types");
armorTypes.resize(armorTypesNode->getChildCount());
for (int i = 0; i < (int) armorTypes.size(); ++i) {
if (logger.getCancelLoading())
return;
const XmlNode *armorTypeNode =
armorTypesNode->getChild("armor-type", i);
armorTypes[i].setName(armorTypeNode->getAttribute("name")->
@@ -365,6 +379,9 @@ namespace Game {
techTreeNode->getChild("damage-multipliers");
for (int i = 0; i < (int) damageMultipliersNode->getChildCount();
++i) {
if (logger.getCancelLoading())
return;
const XmlNode *damageMultiplierNode =
damageMultipliersNode->getChild("damage-multiplier", i);
const AttackType *attackType =
@@ -424,10 +441,10 @@ namespace Game {
getTranslatedFactionName(name,
factionName)).
c_str());
Logger & logger = Logger::getInstance();
if (logger.getCancelLoading())
return;
logger.setState(szBuf);
logger.
setProgress((int)
logger.setProgress((int)
((((double) i) / (double) factions.size()) *
100.0));

View File

@@ -479,7 +479,11 @@ namespace Game {
endPathWithSlash(currentPath);
string path = currentPath + lastDir(currentPath) + ".xml";
const XmlNode *techTreeNode = xmlTree.getRootNode();
if (scriptManager) scriptManager->init(this, this->getGame()->getGameCameraPtr(), techTreeNode);
if (scriptManager && !Logger::getInstance().getCancelLoading()) {
Game* game = getGame();
if (game != NULL)
scriptManager->init(this, game->getGameCameraPtr(), techTreeNode);
}
return techtreeChecksum;
}
@@ -530,6 +534,7 @@ namespace Game {
}
void World::updateAllTilesetObjects() {
if (game != NULL) {
Gui *gui = this->game->getGuiPtr();
if (gui != NULL) {
Object *selObj = gui->getHighlightedResourceObject();
@@ -537,6 +542,7 @@ namespace Game {
selObj->updateHighlight();
}
}
}
if (animatedTilesetObjectPosListLoaded == false) {
animatedTilesetObjectPosListLoaded = true;