- Split AIPlayer and AIPlayerBaka in 2 files. Moved all "AI" specific code into AIPlayerBaka, as much as possible.
-- This is a copy/paste and shouldn't have any impact on the logic. I just moved some functions from AIPlayer to AIPlayerBaka - Added back the possibility to select a different Resource folder with file Res.txt - Fix a crash when a token id does not exist
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "AIHints.h"
|
||||
#include "AIPlayer.h"
|
||||
#include "AIPlayerBaka.h"
|
||||
#include "utils.h"
|
||||
#include "AllAbilities.h"
|
||||
|
||||
@@ -33,7 +33,7 @@ AIHint::AIHint(string _line)
|
||||
}
|
||||
}
|
||||
|
||||
AIHints::AIHints(AIPlayer * player): mPlayer(player)
|
||||
AIHints::AIHints(AIPlayerBaka * player): mPlayer(player)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ AIMomirPlayer::AIMomirPlayer(string file, string fileSmall, string avatarFile, M
|
||||
agressivity = 100;
|
||||
}
|
||||
|
||||
int AIMomirPlayer::getEfficiency(AIAction * action)
|
||||
int AIMomirPlayer::getEfficiency(OrderedAIAction * action)
|
||||
{
|
||||
MTGAbility * ability = action->ability;
|
||||
ManaCost * cost = ability->getCost();
|
||||
|
||||
+13
-2255
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -97,7 +97,33 @@ void GameApp::Create()
|
||||
|
||||
WResourceManager::Instance()->ResetCacheLimits();
|
||||
|
||||
JFileSystem::init("User/", "Res/");
|
||||
string systemFolder = "Res/";
|
||||
string foldersRoot = "";
|
||||
|
||||
//Find the Res folder
|
||||
ifstream mfile("Res.txt");
|
||||
string resPath;
|
||||
if (mfile)
|
||||
{
|
||||
bool found = false;
|
||||
while (!found && std::getline(mfile, resPath))
|
||||
{
|
||||
if (resPath[resPath.size() - 1] == '\r')
|
||||
resPath.erase(resPath.size() - 1); //Handle DOS files
|
||||
string testfile = resPath + systemFolder;
|
||||
testfile.append("graphics/simon.dat");
|
||||
ifstream tempfile(testfile.c_str());
|
||||
if (tempfile)
|
||||
{
|
||||
found = true;
|
||||
tempfile.close();
|
||||
foldersRoot = resPath;
|
||||
}
|
||||
}
|
||||
mfile.close();
|
||||
}
|
||||
|
||||
JFileSystem::init(foldersRoot + "User/", foldersRoot + systemFolder);
|
||||
|
||||
// Create User Folders (for write access) if they don't exist
|
||||
{
|
||||
|
||||
@@ -1470,7 +1470,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
{
|
||||
MTGCard * safetycard = MTGCollection()->getCardById(tokenId);
|
||||
if (!safetycard) //Error, card not foudn in DB
|
||||
return NEW ATokenCreator(id, card, target, NULL, "ID NOT FOUND", "ERROR ID",0, 0, "",0, NULL,0);
|
||||
return NEW ATokenCreator(id, card, target, NULL, "ID NOT FOUND", "ERROR ID",0, 0, "","", NULL,0);
|
||||
|
||||
ATokenCreator * tok = NEW ATokenCreator(id, card,target, NULL, tokenId, starfound, multiplier, who);
|
||||
tok->oneShot = 1;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
#include "MTGDefinitions.h"
|
||||
#include "WResourceManager.h"
|
||||
#include "AIPlayer.h"
|
||||
|
||||
//TODO remove this dependency
|
||||
#include "AIPlayerBaka.h"
|
||||
|
||||
#include "Rules.h"
|
||||
#include "Credits.h"
|
||||
#include "PlayerData.h"
|
||||
|
||||
@@ -263,7 +263,6 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
string numberCD = attribute.substr(operatorPosition + 1, attribute.size() - operatorPosition - 1);
|
||||
WParsedInt * val = NEW WParsedInt(numberCD,NULL, card);
|
||||
comparisonCriterion = val->getValue();
|
||||
/*atoi(attribute.substr(operatorPosition + 1, attribute.size() - operatorPosition - 1).c_str());*/
|
||||
delete val;
|
||||
switch (attribute[operatorPosition - 1])
|
||||
{
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
#include "Player.h"
|
||||
#include "Tasks.h"
|
||||
#include "AIPlayer.h"
|
||||
|
||||
// Todo remove this dependency!
|
||||
#include "AIPlayerBaka.h"
|
||||
|
||||
#include "Translate.h"
|
||||
#include "MTGDefinitions.h"
|
||||
#include <JRenderer.h>
|
||||
|
||||
@@ -391,7 +391,7 @@ void TestSuite::initGame()
|
||||
g->currentGamePhase = initState.phase;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
AIPlayer * p = (AIPlayer *) (g->players[i]);
|
||||
AIPlayerBaka * p = (AIPlayerBaka *) (g->players[i]);
|
||||
p->forceBestAbilityUse = forceAbility;
|
||||
p->life = initState.playerData[i].life;
|
||||
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay };
|
||||
|
||||
Reference in New Issue
Block a user