94 lines
3.6 KiB
C++
94 lines
3.6 KiB
C++
// This file is part of c-evo-evo.
|
|
//
|
|
// This software is governed by the CeCILL license under French law and
|
|
// abiding by the rules of distribution of free software. You can use,
|
|
// modify and/or redistribute the software under the terms of the CeCILL
|
|
// license as circulated by CEA, CNRS and INRIA at the following URL
|
|
// "http://www.cecill.info".
|
|
//
|
|
// As a counterpart to the access to the source code and rights to copy,
|
|
// modify and redistribute granted by the license, users are provided only
|
|
// with a limited warranty and the software's author, the holder of the
|
|
// economic rights, and the successive licensors have only limited
|
|
// liability.
|
|
//
|
|
// In this respect, the user's attention is drawn to the risks associated
|
|
// with loading, using, modifying and/or developing or reproducing the
|
|
// software by the user in light of its specific status of free software,
|
|
// that may mean that it is complicated to manipulate, and that also
|
|
// therefore means that it is reserved for developers and experienced
|
|
// professionals having in-depth computer knowledge. Users are therefore
|
|
// encouraged to load and test the software's suitability as regards their
|
|
// requirements in conditions enabling the security of their systems and/or
|
|
// data to be ensured and, more generally, to use and operate it in the
|
|
// same conditions as regards security.
|
|
//
|
|
// The fact that you are presently reading this means that you have had
|
|
// knowledge of the CeCILL license and that you accept its terms.
|
|
|
|
// --- Test Flags --- (see Cevo/Database.h)
|
|
|
|
#include "Cevo/Database.h"
|
|
|
|
namespace Cevo {
|
|
namespace Database {
|
|
|
|
void clearTestFlags(int clearFlags)
|
|
{
|
|
gTestFlags &= (~clearFlags | tfTested | tfAllTechs | tfAllContact);
|
|
for (int p1 = 0; p1 < nPl; ++p1)
|
|
if ((1 << p1) & (gAlive | gWatching))
|
|
rw[p1].TestFlags = gTestFlags;
|
|
}
|
|
|
|
void setTestFlags(int p, int setFlags)
|
|
{
|
|
const int moreFlags = setFlags & ~gTestFlags;
|
|
gTestFlags |= (setFlags & 0x7FF);
|
|
for (int p1 = 0; p1 < nPl; ++p1)
|
|
if ((1 << p1) & (gAlive | gWatching))
|
|
rw[p1].TestFlags = gTestFlags;
|
|
|
|
if (moreFlags & (tfUncover | tfAllContact)) {
|
|
for (int p1 = 0; p1 < nPl - 1; ++p1)
|
|
if ((1 << p1) & gAlive)
|
|
for (int p2 = p1 + 1; p2 < nPl; ++p2)
|
|
if (((1 << p2) & gAlive) && rw[p1].Treaty[p2] == trNoContact) // make p1 and p2 know each other
|
|
introduceEnemy(p1, p2);
|
|
}
|
|
|
|
if (moreFlags & tfAllTechs) {
|
|
for (int p1 = 0; p1 < nPl; ++p1) {
|
|
resourceMask[p1] = 0xFFFFFFFFu;
|
|
if ((1 << p1) & gAlive) {
|
|
for (int i = 0; i < nAdv; ++i) // give all techs to player p1
|
|
if (!IsFutureTech(i) && rw[p1].Tech[i] < tsApplicable) {
|
|
rw[p1].Tech[i] = tsCheat;
|
|
checkSpecialModels(p1, i);
|
|
}
|
|
for (int p2 = 0; p2 < nPl; ++p2)
|
|
if (p2 != p1 && ((gAlive | gWatching) & (1 << p2)))
|
|
for (int i = 1; i <= 3; ++i)
|
|
if (rw[p2].EnemyReport[p1]->Tech[AgePreq[i]] < tsApplicable)
|
|
rw[p2].EnemyReport[p1]->Tech[AgePreq[i]] = tsCheat;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (moreFlags & tfUncover) {
|
|
discoverAll(p, lObserveSuper);
|
|
for (int p1 = 0; p1 < nPl; ++p1) {
|
|
if ((1 << p1) & gAlive) {
|
|
resourceMask[p1] = 0xFFFFFFFFu;
|
|
if (p1 != p) {
|
|
giveCivilReport(p, p1);
|
|
giveMilReport(p, p1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
} // namespace Database
|
|
} // namespace Cevo
|