forked from Mirrors/openclonk
Move Game.Players to ::Players
parent
b0ceb97f5a
commit
c6dee6d7c8
|
@ -31,7 +31,6 @@
|
|||
#include <C4RoundResults.h>
|
||||
#include <C4GameObjects.h>
|
||||
#include <C4Scenario.h>
|
||||
#include <C4PlayerList.h>
|
||||
#include <C4GameControl.h>
|
||||
#include <C4Control.h>
|
||||
#include <C4PathFinder.h>
|
||||
|
@ -83,7 +82,6 @@ class C4Game
|
|||
C4ComponentHost GameText;
|
||||
C4GameScriptHost Script;
|
||||
C4LangStringTable MainSysLangStringTable, ScenarioLangStringTable, ScenarioSysLangStringTable;
|
||||
C4PlayerList Players;
|
||||
StdStrBuf PlayerNames;
|
||||
C4GameControl Control;
|
||||
C4Control &Input; // shortcut
|
||||
|
|
|
@ -91,6 +91,7 @@ class C4PlayerList
|
|||
|
||||
friend class C4Player;
|
||||
};
|
||||
extern C4PlayerList Players;
|
||||
|
||||
int32_t ValidPlr(int32_t plr);
|
||||
int32_t Hostile(int32_t plr1, int32_t plr2);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <C4Network2Client.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WINSOCK
|
||||
|
@ -136,7 +137,7 @@ void C4Client::SetLocal()
|
|||
void C4Client::Remove()
|
||||
{
|
||||
// remove players for this client
|
||||
Game.Players.RemoveAtClient(getID(), true);
|
||||
::Players.RemoveAtClient(getID(), true);
|
||||
}
|
||||
|
||||
void C4Client::CompileFunc(StdCompiler *pComp)
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <C4Player.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
const int32_t MoveToRange=5,LetGoRange1=7,LetGoRange2=30,DigRange=1;
|
||||
|
@ -1630,7 +1631,7 @@ void C4Command::Construct()
|
|||
C4Def *pDef; if (!(pDef=C4Id2Def(Data))) { Finish(); return; }
|
||||
|
||||
// player has knowledge of this construction?
|
||||
C4Player *pPlayer = Game.Players.Get(cObj->Owner);
|
||||
C4Player *pPlayer = ::Players.Get(cObj->Owner);
|
||||
if(pPlayer) if(!pPlayer->Knowledge.GetIDCount(Data, 1)) { Finish(); return; }
|
||||
|
||||
// Building, chopping, digging: stop
|
||||
|
@ -1906,13 +1907,13 @@ void C4Command::Buy()
|
|||
C4Def *pDef = C4Id2Def(Data);
|
||||
if (!pDef) { Finish(); return; }
|
||||
// Material not available for purchase at base: fail
|
||||
if (!Game.Players.Get(Target->Base)->HomeBaseMaterial.GetIDCount(Data))
|
||||
if (!::Players.Get(Target->Base)->HomeBaseMaterial.GetIDCount(Data))
|
||||
{
|
||||
Finish(false, FormatString(LoadResStr("IDS_PLR_NOTAVAIL"),pDef->GetName()).getData());
|
||||
return;
|
||||
}
|
||||
// Base owner has not enough funds: fail
|
||||
if (Game.Players.Get(Target->Base)->Wealth < pDef->GetValue(Target, cObj->Owner))
|
||||
if (::Players.Get(Target->Base)->Wealth < pDef->GetValue(Target, cObj->Owner))
|
||||
{ Finish(false, LoadResStr("IDS_PLR_NOWEALTH")); return; }
|
||||
// Not within target object: enter
|
||||
if (cObj->Contained!=Target)
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <C4Player.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4PlayerList.h>
|
||||
|
||||
#include <StdFile.h>
|
||||
#include <StdRegistry.h>
|
||||
|
@ -906,8 +907,8 @@ void C4Console::EnableControls(bool fEnable)
|
|||
EnableMenuItem(GetMenu(hWindow),IDM_FILE_OPEN, MF_BYCOMMAND | MF_ENABLED );
|
||||
EnableMenuItem(GetMenu(hWindow),IDM_FILE_OPENWPLRS, MF_BYCOMMAND | MF_ENABLED );
|
||||
EnableMenuItem(GetMenu(hWindow),IDM_FILE_RECORD, MF_BYCOMMAND | ((Game.IsRunning && Game.Control.IsRuntimeRecordPossible()) ? MF_ENABLED : MF_GRAYED));
|
||||
EnableMenuItem(GetMenu(hWindow),IDM_FILE_SAVEGAME, MF_BYCOMMAND | ((fEnable && Game.Players.GetCount()) ? MF_ENABLED : MF_GRAYED));
|
||||
EnableMenuItem(GetMenu(hWindow),IDM_FILE_SAVEGAMEAS, MF_BYCOMMAND | ((fEnable && Game.Players.GetCount()) ? MF_ENABLED : MF_GRAYED));
|
||||
EnableMenuItem(GetMenu(hWindow),IDM_FILE_SAVEGAME, MF_BYCOMMAND | ((fEnable && ::Players.GetCount()) ? MF_ENABLED : MF_GRAYED));
|
||||
EnableMenuItem(GetMenu(hWindow),IDM_FILE_SAVEGAMEAS, MF_BYCOMMAND | ((fEnable && ::Players.GetCount()) ? MF_ENABLED : MF_GRAYED));
|
||||
EnableMenuItem(GetMenu(hWindow),IDM_FILE_SAVE, MF_BYCOMMAND | (fEnable ? MF_ENABLED : MF_GRAYED));
|
||||
EnableMenuItem(GetMenu(hWindow),IDM_FILE_SAVEAS, MF_BYCOMMAND | (fEnable ? MF_ENABLED : MF_GRAYED));
|
||||
EnableMenuItem(GetMenu(hWindow),IDM_FILE_CLOSE, MF_BYCOMMAND | (fEnable ? MF_ENABLED : MF_GRAYED));
|
||||
|
@ -936,8 +937,8 @@ void C4Console::EnableControls(bool fEnable)
|
|||
// File menu
|
||||
// C4Network2 will have to handle that cases somehow (TODO: test)
|
||||
gtk_widget_set_sensitive(fileRecord, Game.IsRunning && Game.Control.IsRuntimeRecordPossible());
|
||||
gtk_widget_set_sensitive(fileSaveGame, fEnable && Game.Players.GetCount());
|
||||
gtk_widget_set_sensitive(fileSaveGameAs, fEnable && Game.Players.GetCount());
|
||||
gtk_widget_set_sensitive(fileSaveGame, fEnable && ::Players.GetCount());
|
||||
gtk_widget_set_sensitive(fileSaveGameAs, fEnable && ::Players.GetCount());
|
||||
gtk_widget_set_sensitive(fileSave, fEnable);
|
||||
gtk_widget_set_sensitive(fileSaveAs, fEnable);
|
||||
gtk_widget_set_sensitive(fileClose, fEnable);
|
||||
|
@ -1255,7 +1256,7 @@ bool C4Console::UpdateViewportMenu()
|
|||
#ifdef _WIN32
|
||||
HMENU hMenu = GetSubMenu(GetMenu(hWindow),MenuIndexViewport);
|
||||
#endif
|
||||
for (C4Player *pPlr=Game.Players.First; pPlr; pPlr=pPlr->Next)
|
||||
for (C4Player *pPlr=::Players.First; pPlr; pPlr=pPlr->Next)
|
||||
{
|
||||
StdStrBuf sText;
|
||||
sText.Format(LoadResStr("IDS_CNS_NEWPLRVIEWPORT"),pPlr->GetName());
|
||||
|
@ -1419,7 +1420,7 @@ bool C4Console::UpdatePlayerMenu()
|
|||
#ifdef _WIN32
|
||||
HMENU hMenu = GetSubMenu(GetMenu(hWindow),MenuIndexPlayer);
|
||||
#endif
|
||||
for (C4Player *pPlr=Game.Players.First; pPlr; pPlr=pPlr->Next)
|
||||
for (C4Player *pPlr=::Players.First; pPlr; pPlr=pPlr->Next)
|
||||
{
|
||||
StdStrBuf sText;
|
||||
if (::Network.isEnabled())
|
||||
|
@ -1503,7 +1504,7 @@ void C4Console::PlayerJoin()
|
|||
if (::Network.isEnabled())
|
||||
::Network.Players.JoinLocalPlayer(szPlayerFilename, true);
|
||||
else
|
||||
Game.Players.CtrlJoinLocalNoNetwork(szPlayerFilename, Game.Clients.getLocalID(), Game.Clients.getLocalName());
|
||||
::Players.CtrlJoinLocalNoNetwork(szPlayerFilename, Game.Clients.getLocalID(), Game.Clients.getLocalName());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <C4GameMessage.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
// *** C4ControlPacket
|
||||
|
@ -330,7 +331,7 @@ C4ControlPlayerSelect::C4ControlPlayerSelect(int32_t iPlr, const C4ObjectList &O
|
|||
void C4ControlPlayerSelect::Execute() const
|
||||
{
|
||||
// get player
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
if(!pPlr) return;
|
||||
|
||||
// Check object list
|
||||
|
@ -372,7 +373,7 @@ void C4ControlPlayerSelect::CompileFunc(StdCompiler *pComp)
|
|||
|
||||
void C4ControlPlayerControl::Execute() const
|
||||
{
|
||||
C4Player *pPlr=Game.Players.Get(iPlr);
|
||||
C4Player *pPlr=::Players.Get(iPlr);
|
||||
if(pPlr)
|
||||
{
|
||||
if (!Inside<int>(iCom, COM_ReleaseFirst, COM_ReleaseLast))
|
||||
|
@ -402,7 +403,7 @@ C4ControlPlayerCommand::C4ControlPlayerCommand(int32_t iPlr, int32_t iCmd, int32
|
|||
|
||||
void C4ControlPlayerCommand::Execute() const
|
||||
{
|
||||
C4Player *pPlr=Game.Players.Get(iPlr);
|
||||
C4Player *pPlr=::Players.Get(iPlr);
|
||||
if(pPlr)
|
||||
{
|
||||
pPlr->CountControl(C4Player::PCID_Command, iCmd+iX+iY+iTarget+iTarget2);
|
||||
|
@ -452,7 +453,7 @@ void C4ControlSyncCheck::Set()
|
|||
int32_t C4ControlSyncCheck::GetAllCrewPosX()
|
||||
{
|
||||
int32_t cpx=0;
|
||||
for (C4Player *pPlr=Game.Players.First; pPlr; pPlr=pPlr->Next)
|
||||
for (C4Player *pPlr=::Players.First; pPlr; pPlr=pPlr->Next)
|
||||
for (C4ObjectLink *clnk=pPlr->Crew.First; clnk; clnk=clnk->Next)
|
||||
cpx += fixtoi(clnk->Obj->fix_x, 100);
|
||||
return cpx;
|
||||
|
@ -599,7 +600,7 @@ void C4ControlClientUpdate::Execute() const
|
|||
if(pClient->isLocal())
|
||||
Game.Control.SetActivated(false);
|
||||
// remove all players ("soft kick")
|
||||
Game.Players.RemoveAtClient(iID, true);
|
||||
::Players.RemoveAtClient(iID, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -626,7 +627,7 @@ void C4ControlClientRemove::Execute() const
|
|||
{
|
||||
// TODO: in replays, client list is not yet synchronized
|
||||
// remove players anyway
|
||||
if (Game.Control.isReplay()) Game.Players.RemoveAtClient(iID, true);
|
||||
if (Game.Control.isReplay()) ::Players.RemoveAtClient(iID, true);
|
||||
return;
|
||||
}
|
||||
StdCopyStrBuf strClient(LoadResStr(pClient->isLocal() ? "IDS_NET_LOCAL_CLIENT" : "IDS_NET_CLIENT"));
|
||||
|
@ -645,7 +646,7 @@ void C4ControlClientRemove::Execute() const
|
|||
// log
|
||||
LogF(LoadResStr("IDS_NET_CLIENT_REMOVED"), strClient.getData(), pClient->getName(), strReason.getData());
|
||||
// remove all players
|
||||
Game.Players.RemoveAtClient(iID, true);
|
||||
::Players.RemoveAtClient(iID, true);
|
||||
// remove all resources
|
||||
if(::Network.isEnabled())
|
||||
::Network.ResList.RemoveAtClient(iID);
|
||||
|
@ -1035,7 +1036,7 @@ void C4ControlMessage::Execute() const
|
|||
{
|
||||
const char *szMessage = Message.getData();
|
||||
// get player
|
||||
C4Player *pPlr = (iPlayer < 0 ? NULL : Game.Players.Get(iPlayer));
|
||||
C4Player *pPlr = (iPlayer < 0 ? NULL : ::Players.Get(iPlayer));
|
||||
// security
|
||||
if(pPlr && pPlr->AtClient != iByClient) return;
|
||||
// do not record message as control, because it is not synced!
|
||||
|
@ -1091,7 +1092,7 @@ void C4ControlMessage::Execute() const
|
|||
{
|
||||
// for running game mode, check actual hostility
|
||||
C4Player *pLocalPlr;
|
||||
for(int cnt = 0; pLocalPlr = Game.Players.GetLocalByIndex(cnt); cnt++)
|
||||
for(int cnt = 0; pLocalPlr = ::Players.GetLocalByIndex(cnt); cnt++)
|
||||
if(!Hostile(pLocalPlr->Number, iPlayer))
|
||||
break;
|
||||
if(pLocalPlr) Log(FormatString("<c %x>{%s} %s</c>", pPlr->ColorDw, pPlr->GetName(), szMessage).getData());
|
||||
|
@ -1113,7 +1114,7 @@ void C4ControlMessage::Execute() const
|
|||
if(!pPlr) break;
|
||||
// show only if the target player is local
|
||||
C4Player *pLocalPlr;
|
||||
for(int cnt = 0; pLocalPlr = Game.Players.GetLocalByIndex(cnt); cnt++)
|
||||
for(int cnt = 0; pLocalPlr = ::Players.GetLocalByIndex(cnt); cnt++)
|
||||
if(pLocalPlr->ID == iToPlayer)
|
||||
break;
|
||||
if(pLocalPlr)
|
||||
|
@ -1191,7 +1192,7 @@ void C4ControlRemovePlr::Execute() const
|
|||
// host only
|
||||
if(iByClient != C4ClientIDHost) return;
|
||||
// remove
|
||||
Game.Players.Remove(iPlr, fDisconnected, false);
|
||||
::Players.Remove(iPlr, fDisconnected, false);
|
||||
}
|
||||
|
||||
void C4ControlRemovePlr::CompileFunc(StdCompiler *pComp)
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <C4Player.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
//-------------------------------- C4DefGraphics -----------------------------------------------
|
||||
|
@ -407,7 +408,7 @@ void C4DefGraphicsPtrBackup::AssignUpdate(C4DefGraphics *pNewGraphics)
|
|||
pObj->Menu->SetFrameDeco(NULL);
|
||||
}
|
||||
// check all object infos for portraits
|
||||
for (C4Player *pPlr = Game.Players.First; pPlr; pPlr=pPlr->Next)
|
||||
for (C4Player *pPlr = ::Players.First; pPlr; pPlr=pPlr->Next)
|
||||
for (C4ObjectInfo *pInfo = pPlr->CrewInfoList.GetFirst(); pInfo; pInfo=pInfo->Next)
|
||||
{
|
||||
if (pInfo->Portrait.GetGfx() == pGraphicsPtr)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <C4Game.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4PXS.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
void C4Effect::AssignCallbackFunctions()
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <C4Object.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
// *** C4FindObject
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <C4GameOverDlg.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4MouseControl.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -420,7 +421,7 @@ BOOL C4FullScreen::ViewportCheck()
|
|||
iPlrNum = NO_OWNER;
|
||||
// Film mode: create viewport for first player (instead of no-owner)
|
||||
if (fFilm)
|
||||
if (pPlr = Game.Players.First)
|
||||
if (pPlr = ::Players.First)
|
||||
iPlrNum = pPlr->Number;
|
||||
// Create viewport
|
||||
Game.CreateViewport(iPlrNum, iPlrNum==NO_OWNER);
|
||||
|
@ -455,7 +456,7 @@ BOOL C4FullScreen::ViewportCheck()
|
|||
else
|
||||
{
|
||||
// movie mode: player present, and no valid viewport assigned?
|
||||
if (Game.C4S.Head.Replay && Game.C4S.Head.Film && (pPlr = Game.Players.First))
|
||||
if (Game.C4S.Head.Replay && Game.C4S.Head.Film && (pPlr = ::Players.First))
|
||||
// assign viewport to joined player
|
||||
pNoOwnerVp->Init(pPlr->Number, true);
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Texture.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#include <StdFile.h>
|
||||
|
@ -1389,7 +1390,7 @@ C4Object *C4Game::FindVisObject(float tx, float ty, int32_t iPlr, const C4Facet
|
|||
// Layer check: Layered objects are invisible to players whose cursor is in another layer
|
||||
if (cObj->pLayer && ValidPlr(iPlr))
|
||||
{
|
||||
C4Object *pCursor = Game.Players.Get(iPlr)->Cursor;
|
||||
C4Object *pCursor = ::Players.Get(iPlr)->Cursor;
|
||||
if (!pCursor || (pCursor->pLayer != cObj->pLayer)) continue;
|
||||
}
|
||||
// Full range
|
||||
|
@ -3933,7 +3934,7 @@ bool C4Game::ActivateMenu(const char *szCommand)
|
|||
// no new menu during round evaluation
|
||||
if (C4GameOverDlg::IsShown()) return false;
|
||||
// forward to primary player
|
||||
C4Player *pPlr=Game.Players.GetLocalByIndex(0);
|
||||
C4Player *pPlr=::Players.GetLocalByIndex(0);
|
||||
if (!pPlr) return false;
|
||||
pPlr->Menu.ActivateCommand(pPlr->Number, szCommand);
|
||||
return true;
|
||||
|
@ -3955,7 +3956,7 @@ void C4Game::Abort(bool fApproved)
|
|||
Network.Vote(VT_Cancel);
|
||||
return;
|
||||
}
|
||||
if(!Control.isCtrlHost() && !Game.GameOver && Game.Players.GetLocalByIndex(0))
|
||||
if(!Control.isCtrlHost() && !Game.GameOver && ::Players.GetLocalByIndex(0))
|
||||
{
|
||||
Network.Vote(VT_Kick, true, Control.ClientID());
|
||||
return;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <C4GraphicsResource.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
const int32_t TextMsgDelayFactor = 2; // frames per char message display time
|
||||
|
@ -208,7 +209,7 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer, float Zoom)
|
|||
if(!Target->IsVisible(iPlayer, false))
|
||||
return;
|
||||
// check fog of war
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
if(pPlr && pPlr->fFogOfWar)
|
||||
if(!pPlr->FoWIsVisible(iMsgX, iMsgY))
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <C4Network2Stats.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
C4GameObjects::C4GameObjects()
|
||||
|
@ -125,7 +126,7 @@ void C4GameObjects::CrossCheck() // Every Tick1 by ExecObjects
|
|||
{ obj2->Incinerate(obj1->GetFireCausePlr(), FALSE, obj1); continue; }
|
||||
// Fight
|
||||
if ((ocf1 & OCF_FightReady) && (ocf2 & OCF_FightReady))
|
||||
if (Game.Players.Hostile(obj1->Owner,obj2->Owner))
|
||||
if (::Players.Hostile(obj1->Owner,obj2->Owner))
|
||||
{
|
||||
// RejectFight callback
|
||||
C4AulParSet parset1(C4VObj(obj2) );
|
||||
|
@ -228,7 +229,7 @@ void C4GameObjects::CrossCheck() // Every Tick1 by ExecObjects
|
|||
ocf1=obj1->OCF; ocf2=obj2->OCF;
|
||||
// Fight
|
||||
if ((ocf1 & OCF_FightReady) && (ocf2 & OCF_FightReady))
|
||||
if (Game.Players.Hostile(obj1->Owner,obj2->Owner))
|
||||
if (::Players.Hostile(obj1->Owner,obj2->Owner))
|
||||
{
|
||||
ObjectActionFight(obj1,obj2);
|
||||
ObjectActionFight(obj2,obj1);
|
||||
|
|
|
@ -30,6 +30,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <C4Player.h>
|
||||
#include <C4PlayerInfo.h>
|
||||
#include <C4PlayerInfoListBox.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -325,7 +326,7 @@ void C4GameOverDlg::OnShown()
|
|||
// close some other dialogs
|
||||
Game.Scoreboard.HideDlg();
|
||||
FullScreen.CloseMenu();
|
||||
for (C4Player *plr = Game.Players.First; plr; plr = plr->Next)
|
||||
for (C4Player *plr = ::Players.First; plr; plr = plr->Next)
|
||||
plr->CloseMenu();
|
||||
// pause game when round results dlg is shown
|
||||
Game.Pause();
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <C4Landscape.h>
|
||||
#include <C4PXS.h>
|
||||
#include <C4MassMover.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
// *** C4GameSave main class
|
||||
|
@ -240,7 +241,7 @@ bool C4GameSave::SaveRuntimeData()
|
|||
// synchronization (via control queue)
|
||||
if (GetSaveUserPlayerFiles() || GetSaveScriptPlayerFiles())
|
||||
{
|
||||
if (!Game.Players.Save((*pSaveGroup), GetCreateSmallFile(), RestoreInfos))
|
||||
if (!::Players.Save((*pSaveGroup), GetCreateSmallFile(), RestoreInfos))
|
||||
{ Log(LoadResStr("IDS_ERR_SAVE_PLAYERS")); return false; }
|
||||
}
|
||||
}
|
||||
|
@ -513,7 +514,7 @@ bool C4GameSaveSavegame::OnSaving()
|
|||
if (::Network.isEnabled())
|
||||
Game.Input.Add(CID_Synchronize, new C4ControlSynchronize(TRUE));
|
||||
else
|
||||
Game.Players.SynchronizeLocalFiles();
|
||||
::Players.SynchronizeLocalFiles();
|
||||
// OK; save now
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <C4Landscape.h>
|
||||
#include <C4Network2.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#include <StdPNG.h>
|
||||
|
@ -520,8 +521,8 @@ void C4GraphicsSystem::SortViewportsByPlayerControl()
|
|||
for (pPrev=NULL,pView=FirstViewport; pView && (pNext = pView->Next); pView=pNext)
|
||||
{
|
||||
// Get players
|
||||
pPlr1 = Game.Players.Get(pView->Player);
|
||||
pPlr2 = Game.Players.Get(pNext->Player);
|
||||
pPlr1 = ::Players.Get(pView->Player);
|
||||
pPlr2 = ::Players.Get(pNext->Player);
|
||||
// Swap order
|
||||
if (pPlr1 && pPlr2 && ( LayoutOrder(pPlr1->Control) > LayoutOrder(pPlr2->Control) ))
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------
|
||||
|
@ -66,7 +67,7 @@ bool C4MainMenu::ActivateNewPlayer(int32_t iPlayer)
|
|||
// league or replay game
|
||||
if (Game.Parameters.isLeague() || Game.C4S.Head.Replay) return false;
|
||||
// Max player limit
|
||||
if (Game.Players.GetCount() >= Game.Parameters.MaxPlayers) return false;
|
||||
if (::Players.GetCount() >= Game.Parameters.MaxPlayers) return false;
|
||||
|
||||
// Menu symbol/init
|
||||
if (GfxR->fctPlayerClr.Surface)
|
||||
|
@ -78,7 +79,7 @@ bool C4MainMenu::ActivateNewPlayer(int32_t iPlayer)
|
|||
char szFilename[_MAX_PATH+1], szCommand[_MAX_PATH+30+1];
|
||||
SCopy(*iter, szFilename, _MAX_PATH);
|
||||
if (DirectoryExists(szFilename)) continue;
|
||||
if (Game.Players.FileInUse(szFilename)) continue;
|
||||
if (::Players.FileInUse(szFilename)) continue;
|
||||
// Open group
|
||||
C4Group hGroup;
|
||||
if (!hGroup.Open(szFilename)) continue;
|
||||
|
@ -142,10 +143,10 @@ bool C4MainMenu::DoRefillInternal(bool &rfRefilled)
|
|||
// Clear items
|
||||
ClearItems();
|
||||
// Refill player
|
||||
if (!(pPlayer = Game.Players.Get(Player))) return false;
|
||||
if (!(pPlayer = ::Players.Get(Player))) return false;
|
||||
// Refill items
|
||||
C4Player *pPlr; int32_t iIndex;
|
||||
for (iIndex=0; pPlr = Game.Players.GetByIndex(iIndex); iIndex++)
|
||||
for (iIndex=0; pPlr = ::Players.GetByIndex(iIndex); iIndex++)
|
||||
// Ignore player self and invisible
|
||||
if (pPlr != pPlayer) if (!pPlr->IsInvisible())
|
||||
{
|
||||
|
@ -246,7 +247,7 @@ bool C4MainMenu::DoRefillInternal(bool &rfRefilled)
|
|||
AddRefSym(LoadResStr("IDS_MSG_FREEVIEW"), C4GUI::Icon::GetIconFacet(C4GUI::Ico_Star), "Observe:Free", C4MN_Item_NoCount, NULL, LoadResStr("IDS_MSG_FREELYSCROLLAROUNDTHEMAP"));
|
||||
// Add players
|
||||
C4Player *pPlr; int32_t iIndex;
|
||||
for (iIndex=0; pPlr = Game.Players.GetByIndex(iIndex); iIndex++)
|
||||
for (iIndex=0; pPlr = ::Players.GetByIndex(iIndex); iIndex++)
|
||||
{
|
||||
// Ignore invisible
|
||||
if (!pPlr->IsInvisible())
|
||||
|
@ -545,13 +546,13 @@ bool C4MainMenu::ActivateOptions(int32_t iPlayer, int32_t selection)
|
|||
// Music
|
||||
AddRefSym(LoadResStr("IDS_MNU_MUSIC"), GfxR->fctOptions.GetPhase(1 + Config.Sound.RXMusic),"Options:Music",C4MN_Item_NoCount);
|
||||
// Mouse control
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
if (pPlr && !Game.C4S.Head.DisableMouse)
|
||||
{
|
||||
if (pPlr->MouseControl)
|
||||
AddRefSym(LoadResStr("IDS_MNU_MOUSECONTROL"), GfxR->fctOptions.GetPhase(11 + 1), "Options:Mouse");
|
||||
else
|
||||
if (!Game.Players.MouseControlTaken())
|
||||
if (!::Players.MouseControlTaken())
|
||||
AddRefSym(LoadResStr("IDS_MNU_MOUSECONTROL"), GfxR->fctOptions.GetPhase(11), "Options:Mouse");
|
||||
}
|
||||
// Music
|
||||
|
@ -602,7 +603,7 @@ bool C4MainMenu::ActivateDisplay(int32_t iPlayer, int32_t selection)
|
|||
bool C4MainMenu::ActivateMain(int32_t iPlayer)
|
||||
{
|
||||
// Determine player
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
// Menu symbol/init
|
||||
C4FacetSurface fctSymbol;
|
||||
fctSymbol.Create(C4SymbolSize, C4SymbolSize);
|
||||
|
@ -626,7 +627,7 @@ bool C4MainMenu::ActivateMain(int32_t iPlayer)
|
|||
AddRefSym(LoadResStr("IDS_TEXT_VIEW"),C4GUI::Icon::GetIconFacet(C4GUI::Ico_View),"ActivateMenu:Observer",C4MN_Item_NoCount,NULL,LoadResStr("IDS_TEXT_DETERMINEPLAYERVIEWTOFOLL"));
|
||||
}
|
||||
// Hostility (player menu only)
|
||||
if (pPlr && (Game.Players.GetCount() > 1))
|
||||
if (pPlr && (::Players.GetCount() > 1))
|
||||
{
|
||||
GfxR->fctFlagClr.Surface->SetClr(0xff0000);
|
||||
AddRefSym(LoadResStr("IDS_MENU_CPATTACK"),GfxR->fctMenu.GetPhase(7),"ActivateMenu:Hostility",C4MN_Item_NoCount,NULL,LoadResStr("IDS_MENU_CPATTACKINFO"));
|
||||
|
@ -638,7 +639,7 @@ bool C4MainMenu::ActivateMain(int32_t iPlayer)
|
|||
AddRefSym(LoadResStr("IDS_MSG_SELTEAM"),fctTeams,"ActivateMenu:TeamSel",C4MN_Item_NoCount,NULL,LoadResStr("IDS_MSG_ALLOWSYOUTOJOINADIFFERENT"));
|
||||
}
|
||||
// Player join
|
||||
if ((Game.Players.GetCount() < Game.Parameters.MaxPlayers) && !Game.Parameters.isLeague())
|
||||
if ((::Players.GetCount() < Game.Parameters.MaxPlayers) && !Game.Parameters.isLeague())
|
||||
{
|
||||
AddRefSym(LoadResStr("IDS_MENU_CPNEWPLAYER"),GfxR->fctPlayerClr.GetPhase(),"ActivateMenu:NewPlayer",C4MN_Item_NoCount,NULL,LoadResStr("IDS_MENU_CPNEWPLAYERINFO"));
|
||||
}
|
||||
|
@ -689,7 +690,7 @@ bool C4MainMenu::ActivateHostility(int32_t iPlayer)
|
|||
bool C4MainMenu::MenuCommand(const char *szCommand, bool fIsCloseCommand)
|
||||
{
|
||||
// Determine player
|
||||
C4Player *pPlr = Game.Players.Get(Player);
|
||||
C4Player *pPlr = ::Players.Get(Player);
|
||||
// Activate
|
||||
if (SEqual2(szCommand,"ActivateMenu:"))
|
||||
{
|
||||
|
@ -722,7 +723,7 @@ bool C4MainMenu::MenuCommand(const char *szCommand, bool fIsCloseCommand)
|
|||
// 2do: not for observers and such?
|
||||
::Network.Players.JoinLocalPlayer(szCommand+11, true);
|
||||
else
|
||||
Game.Players.CtrlJoinLocalNoNetwork(szCommand+11, Game.Clients.getLocalID(), Game.Clients.getLocalName());
|
||||
::Players.CtrlJoinLocalNoNetwork(szCommand+11, Game.Clients.getLocalID(), Game.Clients.getLocalName());
|
||||
return true;
|
||||
}
|
||||
// SetHostility
|
||||
|
@ -731,7 +732,7 @@ bool C4MainMenu::MenuCommand(const char *szCommand, bool fIsCloseCommand)
|
|||
// only if allowed
|
||||
if (!Game.Teams.IsHostilityChangeAllowed()) return false;
|
||||
int32_t iOpponent; sscanf(szCommand+13,"%i",&iOpponent);
|
||||
C4Player *pOpponent = Game.Players.Get(iOpponent);
|
||||
C4Player *pOpponent = ::Players.Get(iOpponent);
|
||||
if (!pOpponent || pOpponent->GetType() != C4PT_User) return false;
|
||||
// TODO: doesn't really work
|
||||
Game.Input.Add(CID_Script, new C4ControlScript(FormatString("SetHostility(%d, %d, !Hostile(%d, %d, true))", Player, iOpponent, Player, iOpponent).getData(), C4ControlScript::SCOPE_Global, true));
|
||||
|
@ -763,7 +764,7 @@ bool C4MainMenu::MenuCommand(const char *szCommand, bool fIsCloseCommand)
|
|||
{
|
||||
int iClientID = atoi(szCommand+10);
|
||||
if(iClientID && ::Network.isEnabled())
|
||||
if(Game.Parameters.isLeague() && Game.Players.GetAtClient(iClientID))
|
||||
if(Game.Parameters.isLeague() && ::Players.GetAtClient(iClientID))
|
||||
::Network.Vote(VT_Kick, true, iClientID);
|
||||
else
|
||||
{
|
||||
|
@ -777,7 +778,7 @@ bool C4MainMenu::MenuCommand(const char *szCommand, bool fIsCloseCommand)
|
|||
if (SEqual2(szCommand,"Part"))
|
||||
{
|
||||
if(::Network.isEnabled())
|
||||
if(Game.Parameters.isLeague() && Game.Players.GetLocalByIndex(0))
|
||||
if(Game.Parameters.isLeague() && ::Players.GetLocalByIndex(0))
|
||||
::Network.Vote(VT_Kick, true, Game.Control.ClientID());
|
||||
else
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
const int32_t C4MN_DefInfoWdt = 270, // default width of info windows
|
||||
|
@ -54,7 +55,7 @@ void DrawMenuSymbol(int32_t iMenu, C4Facet &cgo, int32_t iOwner, C4Object *cObj)
|
|||
C4Facet ccgo;
|
||||
|
||||
DWORD dwColor=0;
|
||||
if (ValidPlr(iOwner)) dwColor=Game.Players.Get(iOwner)->ColorDw;
|
||||
if (ValidPlr(iOwner)) dwColor=::Players.Get(iOwner)->ColorDw;
|
||||
|
||||
switch (iMenu)
|
||||
{
|
||||
|
@ -935,7 +936,7 @@ void C4Menu::DrawElement(C4TargetFacet &cgo)
|
|||
{
|
||||
if (pDef) ::GraphicsResource.fctWealth.DrawValue(cgoExtra,iValue,0,0,C4FCT_Right);
|
||||
// Flag parent object's owner's wealth display
|
||||
C4Player *pParentPlr = Game.Players.Get(GetControllingPlayer());
|
||||
C4Player *pParentPlr = ::Players.Get(GetControllingPlayer());
|
||||
if (pParentPlr) pParentPlr->ViewWealth = C4ViewDelay;
|
||||
}
|
||||
break;
|
||||
|
@ -1308,7 +1309,7 @@ bool C4Menu::HasMouse()
|
|||
{
|
||||
int32_t iPlayer = GetControllingPlayer();
|
||||
if (iPlayer == NO_OWNER) return true; // free view dialog also has the mouse
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
if (pPlr && pPlr->MouseControl) return true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <C4GraphicsResource.h>
|
||||
#include <C4MessageInput.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
const int C4LogSize=30000, C4LogMaxLines=1000;
|
||||
|
@ -376,13 +377,13 @@ C4Player* C4MessageBoard::GetMessagePlayer(const char *szMessage)
|
|||
{
|
||||
StdStrBuf str;
|
||||
str.CopyUntil(szMessage + 2,' ');
|
||||
return Game.Players.GetByName(str.getData());
|
||||
return ::Players.GetByName(str.getData());
|
||||
}
|
||||
if (SCharCount(':',szMessage))
|
||||
{
|
||||
StdStrBuf str;
|
||||
str.CopyUntil(szMessage + 2,':');
|
||||
return Game.Players.GetByName(str.getData());
|
||||
return ::Players.GetByName(str.getData());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <C4Player.h>
|
||||
#include <C4GameLobby.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
#include <cctype>
|
||||
|
||||
|
@ -97,7 +98,7 @@ void C4ChatInputDialog::OnChatCancel()
|
|||
if (fObjInput)
|
||||
{
|
||||
// check if the target input is still valid
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
if (!pPlr) return;
|
||||
if (pPlr->MarkMessageBoardQueryAnswered(pTarget))
|
||||
{
|
||||
|
@ -139,7 +140,7 @@ C4GUI::Edit::InputResult C4ChatInputDialog::OnChatInput(C4GUI::Edit *edt, bool f
|
|||
{
|
||||
fProcessed = true;
|
||||
// check if the target input is still valid
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
if (!pPlr) return C4GUI::Edit::IR_CloseDlg;
|
||||
if (!pPlr->MarkMessageBoardQueryAnswered(pTarget))
|
||||
{
|
||||
|
@ -233,7 +234,7 @@ bool C4ChatInputDialog::KeyCompleteNick()
|
|||
// get current word in edit
|
||||
if (!pEdit->GetCurrentWord(IncompleteNick, 256)) return false;
|
||||
if (!*IncompleteNick) return false;
|
||||
C4Player *plr = Game.Players.First;
|
||||
C4Player *plr = ::Players.First;
|
||||
while (plr)
|
||||
{
|
||||
// Compare name and input
|
||||
|
@ -362,7 +363,7 @@ bool C4MessageInput::ProcessInput(const char *szText)
|
|||
char szTargetPlr[C4MaxName + 1];
|
||||
SCopyUntil(szText + 9, szTargetPlr, ' ', C4MaxName);
|
||||
// search player
|
||||
C4Player *pToPlr = Game.Players.GetByName(szTargetPlr);
|
||||
C4Player *pToPlr = ::Players.GetByName(szTargetPlr);
|
||||
if(!pToPlr) return FALSE;
|
||||
// set
|
||||
eMsgType = C4CMT_Private;
|
||||
|
@ -435,7 +436,7 @@ bool C4MessageInput::ProcessInput(const char *szText)
|
|||
SCopy(szMsg, szMessage, Min<unsigned long>(C4MaxMessage, szEnd - szMsg + 1));
|
||||
}
|
||||
// get sending player (if any)
|
||||
C4Player *pPlr = Game.IsRunning ? Game.Players.GetLocalByIndex(0) : NULL;
|
||||
C4Player *pPlr = Game.IsRunning ? ::Players.GetLocalByIndex(0) : NULL;
|
||||
// send
|
||||
Game.Control.DoInput(CID_Message,
|
||||
new C4ControlMessage(eMsgType, szMessage, pPlr ? pPlr->Number : -1, iToPlayer),
|
||||
|
@ -589,7 +590,7 @@ bool C4MessageInput::ProcessCommand(const char *szCommand)
|
|||
return FALSE;
|
||||
}
|
||||
// league: Kick needs voting
|
||||
if(Game.Parameters.isLeague() && Game.Players.GetAtClient(pClient->getID()))
|
||||
if(Game.Parameters.isLeague() && ::Players.GetAtClient(pClient->getID()))
|
||||
::Network.Vote(VT_Kick, true, pClient->getID());
|
||||
else
|
||||
// add control
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "C4ChatDlg.h"
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
const int32_t C4MC_Drag_None = 0,
|
||||
|
@ -223,7 +224,7 @@ void C4MouseControl::Move(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyFl
|
|||
// Execute caption
|
||||
if (KeepCaption) KeepCaption--; else { Caption.Clear(); IsHelpCaption=false; CaptionBottomY=0; }
|
||||
// Check player
|
||||
if ((Player>NO_OWNER) && !(pPlayer=Game.Players.Get(Player))) { Active=FALSE; return; }
|
||||
if ((Player>NO_OWNER) && !(pPlayer=::Players.Get(Player))) { Active=FALSE; return; }
|
||||
// Check viewport
|
||||
if (!(Viewport=::GraphicsSystem.GetViewport(Player))) return;
|
||||
// get view position
|
||||
|
@ -555,7 +556,7 @@ void C4MouseControl::UpdateCursorTarget()
|
|||
// Select
|
||||
if (ocf & OCF_Alive)
|
||||
if (ValidPlr(Player))
|
||||
if (Game.Players.Get(Player)->ObjectInCrew(TargetObject))
|
||||
if (::Players.Get(Player)->ObjectInCrew(TargetObject))
|
||||
Cursor=C4MC_Cursor_Select;
|
||||
// select custom region
|
||||
if (TargetObject->Category & C4D_MouseSelect)
|
||||
|
@ -679,7 +680,7 @@ int32_t C4MouseControl::UpdateSingleSelection()
|
|||
|
||||
// Cursor has moved off single crew (or target object) selection: clear selection
|
||||
else if (Selection.GetObject())
|
||||
if (Game.Players.Get(Player)->ObjectInCrew(Selection.GetObject())
|
||||
if (::Players.Get(Player)->ObjectInCrew(Selection.GetObject())
|
||||
|| (Selection.GetObject()->Category & C4D_MouseSelect))
|
||||
Selection.Clear();
|
||||
|
||||
|
@ -1085,7 +1086,7 @@ BOOL C4MouseControl::IsValidMenu(C4Menu *pMenu)
|
|||
return TRUE;
|
||||
// Local control player menu
|
||||
C4Player *pPlr;
|
||||
for (int32_t cnt=0; pPlr=Game.Players.Get(cnt); cnt++)
|
||||
for (int32_t cnt=0; pPlr=::Players.Get(cnt); cnt++)
|
||||
if (pMenu == &(pPlr->Menu))
|
||||
if (pMenu->IsActive())
|
||||
return TRUE;
|
||||
|
@ -1269,7 +1270,7 @@ void C4MouseControl::SendCommand(int32_t iCommand, int32_t iX, int32_t iY, C4Obj
|
|||
// no commands in passive mode
|
||||
if (IsPassive()) return;
|
||||
// no commands if player is eliminated or doesn't exist any more
|
||||
C4Player *pPlr = Game.Players.Get(Player);
|
||||
C4Player *pPlr = ::Players.Get(Player);
|
||||
if (!pPlr || pPlr->Eliminated) return;
|
||||
// User add multiple command mode
|
||||
if (ShiftDown) iAddMode|=C4P_Command_Append;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <C4Network2Stats.h>
|
||||
#include <C4GameLobby.h> // fullscreen network lobby
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
|
@ -609,7 +610,7 @@ void C4Network2ClientList::UpdateClientActivity()
|
|||
{
|
||||
for(C4Network2Client *pClient = pFirst; pClient; pClient = pClient->getNext())
|
||||
if(pClient->isActivated())
|
||||
if(Game.Players.GetAtClient(pClient->getID()))
|
||||
if(::Players.GetAtClient(pClient->getID()))
|
||||
pClient->SetLastActivity(Game.FrameCounter);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "C4Viewport.h"
|
||||
#include "C4GameOptions.h"
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WINSOCK
|
||||
|
@ -252,7 +253,7 @@ const C4Client *C4Network2ClientListBox::ClientListItem::GetClient() const
|
|||
void C4Network2ClientListBox::ClientListItem::OnButtonActivate(C4GUI::Control *pButton)
|
||||
{
|
||||
// league: Do not deactivate clients with players
|
||||
if (Game.Parameters.isLeague() && Game.Players.GetAtClient(iClientID))
|
||||
if (Game.Parameters.isLeague() && ::Players.GetAtClient(iClientID))
|
||||
{
|
||||
Log(LoadResStr("IDS_LOG_COMMANDNOTALLOWEDINLEAGUE"));
|
||||
return;
|
||||
|
@ -265,7 +266,7 @@ void C4Network2ClientListBox::ClientListItem::OnButtonKick(C4GUI::Control *pButt
|
|||
{
|
||||
// try kick
|
||||
// league: Kick needs voting
|
||||
if(Game.Parameters.isLeague() && Game.Players.GetAtClient(iClientID))
|
||||
if(Game.Parameters.isLeague() && ::Players.GetAtClient(iClientID))
|
||||
::Network.Vote(VT_Kick, true, iClientID);
|
||||
else
|
||||
Game.Clients.CtrlRemove(GetClient(), LoadResStr(pForDlg->IsStartup() ? "IDS_MSG_KICKFROMSTARTUPDLG" : "IDS_MSG_KICKFROMCLIENTLIST"));
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Game.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
C4Graph::C4Graph()
|
||||
|
@ -322,14 +323,14 @@ C4Network2Stats::C4Network2Stats()
|
|||
statControls.SetAverageTime(100);
|
||||
statActions.SetTitle(LoadResStr("IDS_NET_APM"));
|
||||
statActions.SetAverageTime(100);
|
||||
for (C4Player *pPlr = Game.Players.First; pPlr; pPlr = pPlr->Next) pPlr->CreateGraphs();
|
||||
for (C4Player *pPlr = ::Players.First; pPlr; pPlr = pPlr->Next) pPlr->CreateGraphs();
|
||||
C4Network2Client *pClient = NULL;
|
||||
while (pClient = ::Network.Clients.GetNextClient(pClient)) pClient->CreateGraphs();
|
||||
}
|
||||
|
||||
C4Network2Stats::~C4Network2Stats()
|
||||
{
|
||||
for (C4Player *pPlr = Game.Players.First; pPlr; pPlr = pPlr->Next) pPlr->ClearGraphs();
|
||||
for (C4Player *pPlr = ::Players.First; pPlr; pPlr = pPlr->Next) pPlr->ClearGraphs();
|
||||
C4Network2Client *pClient = NULL;
|
||||
while (pClient = ::Network.Clients.GetNextClient(pClient)) pClient->ClearGraphs();
|
||||
Application.Remove(this);
|
||||
|
@ -363,7 +364,7 @@ void C4Network2Stats::ExecuteControlFrame()
|
|||
statControls.SetMultiplier((C4Graph::ValueType) 1000 / 38 / Game.Control.ControlRate);
|
||||
statActions.SetMultiplier((C4Graph::ValueType) 1000 / 38 * 60 / Game.Control.ControlRate);
|
||||
// register and reset control counts for all players
|
||||
for (C4Player *pPlr = Game.Players.First; pPlr; pPlr = pPlr->Next)
|
||||
for (C4Player *pPlr = ::Players.First; pPlr; pPlr = pPlr->Next)
|
||||
{
|
||||
if (pPlr->pstatControls)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
void DrawVertex(C4Facet &cgo, int32_t tx, int32_t ty, int32_t col, int32_t contact)
|
||||
|
@ -213,7 +214,7 @@ BOOL C4Object::Init(C4Def *pDef, C4Object *pCreator,
|
|||
// Color
|
||||
if (Def->ColorByOwner)
|
||||
if (ValidPlr(Owner))
|
||||
Color=Game.Players.Get(Owner)->ColorDw;
|
||||
Color=::Players.Get(Owner)->ColorDw;
|
||||
|
||||
// Shape & face
|
||||
Shape=Def->Shape;
|
||||
|
@ -886,7 +887,7 @@ BOOL C4Object::ExecFire(int32_t iFireNumber, int32_t iCausedByPlr)
|
|||
|
||||
BOOL C4Object::BuyEnergy()
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(Base); if (!pPlr) return FALSE;
|
||||
C4Player *pPlr = ::Players.Get(Base); if (!pPlr) return FALSE;
|
||||
if (!GetPhysical()->Energy) return FALSE;
|
||||
if (pPlr->Eliminated) return FALSE;
|
||||
if (pPlr->Wealth<Game.C4S.Game.Realism.BaseRegenerateEnergyPrice) return FALSE;
|
||||
|
@ -1039,7 +1040,7 @@ BOOL C4Object::ExecLife()
|
|||
void C4Object::AutoSellContents()
|
||||
{
|
||||
C4ObjectLink *clnk; C4Object *cobj1,*cobj2;
|
||||
C4Player *pPlr = Game.Players.Get(Base); if (!pPlr) return;
|
||||
C4Player *pPlr = ::Players.Get(Base); if (!pPlr) return;
|
||||
|
||||
// Content's gold contents
|
||||
for (clnk=Contents.First; clnk && (cobj1=clnk->Obj); clnk=clnk->Next)
|
||||
|
@ -1224,7 +1225,7 @@ void C4Object::AssignDeath(bool fForced)
|
|||
// Lose contents
|
||||
while (thing=Contents.GetObject()) thing->Exit(thing->GetX(),thing->GetY());
|
||||
// Remove from crew/cursor/view
|
||||
C4Player *pPlr = Game.Players.Get(Owner);
|
||||
C4Player *pPlr = ::Players.Get(Owner);
|
||||
if (pPlr) pPlr->ClearPointers(this, true);
|
||||
// ensure objects that won't be affected by dead-plrview-decay are handled properly
|
||||
if (!pPlr || !(Category & C4D_Living) || !pPlr->FoWViewObjs.IsContained(this))
|
||||
|
@ -1269,7 +1270,7 @@ BOOL C4Object::ChangeDef(C4ID idNew)
|
|||
// an object may have newly become an ColorByOwner-object
|
||||
// if it had been ColorByOwner, but is not now, this will be caught in UpdateGraphics()
|
||||
if (!Color && ValidPlr(Owner))
|
||||
Color=Game.Players.Get(Owner)->ColorDw;
|
||||
Color=::Players.Get(Owner)->ColorDw;
|
||||
if (!Def->Rotateable) { r=0; fix_r=rdir=Fix0; }
|
||||
// Reset solid mask
|
||||
SolidMask=Def->SolidMask;
|
||||
|
@ -1635,7 +1636,7 @@ BOOL C4Object::ActivateEntrance(int32_t by_plr, C4Object *by_obj)
|
|||
if (Hostile(by_plr,Base) && (Game.C4S.Game.Realism.BaseFunctionality & BASEFUNC_RejectEntrance))
|
||||
{
|
||||
if (ValidPlr(Owner))
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_HOSTILENOENTRANCE"),Game.Players.Get(Owner)->GetName()).getData(),this);
|
||||
GameMsgObject(FormatString(LoadResStr("IDS_OBJ_HOSTILENOENTRANCE"),::Players.Get(Owner)->GetName()).getData(),this);
|
||||
return FALSE;
|
||||
}
|
||||
// Try entrance activation
|
||||
|
@ -1938,7 +1939,7 @@ BOOL C4Object::ActivateMenu(int32_t iMenu, int32_t iMenuSelect,
|
|||
if (!pTarget) break;
|
||||
|
||||
// Create symbol & init menu
|
||||
pPlayer=Game.Players.Get(pTarget->Owner);
|
||||
pPlayer=::Players.Get(pTarget->Owner);
|
||||
fctSymbol.Create(C4SymbolSize,C4SymbolSize);
|
||||
pTarget->Def->Draw(fctSymbol,FALSE,pTarget->Color, pTarget);
|
||||
Menu->Init(fctSymbol,pTarget->GetName(),this,C4MN_Extra_None,0,iMenu,C4MN_Style_Context);
|
||||
|
@ -1955,7 +1956,7 @@ BOOL C4Object::ActivateMenu(int32_t iMenu, int32_t iMenuSelect,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4MN_Construction:
|
||||
// Check valid player
|
||||
if (!(pPlayer = Game.Players.Get(Owner))) break;
|
||||
if (!(pPlayer = ::Players.Get(Owner))) break;
|
||||
// Create symbol
|
||||
fctSymbol.Create(C4SymbolSize,C4SymbolSize);
|
||||
DrawMenuSymbol(C4MN_Construction,fctSymbol,-1,NULL);
|
||||
|
@ -1983,7 +1984,7 @@ BOOL C4Object::ActivateMenu(int32_t iMenu, int32_t iMenuSelect,
|
|||
case C4MN_Info:
|
||||
// Target by parameter
|
||||
if (!pTarget) break;
|
||||
pPlayer=Game.Players.Get(pTarget->Owner);
|
||||
pPlayer=::Players.Get(pTarget->Owner);
|
||||
// Create symbol & init menu
|
||||
fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctOKCancel.Draw(fctSymbol,TRUE,0,1);
|
||||
Menu->Init(fctSymbol, pTarget->GetName(), this, C4MN_Extra_None, 0, iMenu, C4MN_Style_Info);
|
||||
|
@ -2026,7 +2027,7 @@ void C4Object::AutoContextMenu(int32_t iMenuSelect)
|
|||
if (OCF & OCF_CrewMember)
|
||||
{
|
||||
// Player has AutoContextMenus enabled
|
||||
C4Player* pPlayer = Game.Players.Get(Controller);
|
||||
C4Player* pPlayer = ::Players.Get(Controller);
|
||||
if (pPlayer && pPlayer->PrefAutoContextMenu)
|
||||
{
|
||||
// Open context menu for structure
|
||||
|
@ -2434,7 +2435,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode)
|
|||
if (eDrawMode!=ODM_BaseOnly)
|
||||
if (ValidPlr(Owner))
|
||||
if (Owner == iByPlayer)
|
||||
if (Game.Players.Get(Owner)->SelectFlash)
|
||||
if (::Players.Get(Owner)->SelectFlash)
|
||||
DrawSelectMark(cgo, 1);
|
||||
|
||||
// Energy shortage
|
||||
|
@ -2511,7 +2512,7 @@ void C4Object::DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDraw
|
|||
if (!Inside<int>(GetX() + Shape.GetX() - cotx, 1 - Shape.Wdt, cgo.Wdt)
|
||||
|| !Inside<int>(GetY() + Shape.GetY() - coty, 1 - Shape.Hgt, cgo.Hgt)) return;
|
||||
// get player
|
||||
C4Player* pOwner = Game.Players.Get(Owner);
|
||||
C4Player* pOwner = ::Players.Get(Owner);
|
||||
if (pOwner) if (!Hostile(Owner, iByPlayer)) if (!pOwner->IsInvisible())
|
||||
{
|
||||
int32_t X = GetX();
|
||||
|
@ -2885,7 +2886,7 @@ void C4Object::DenumeratePointers()
|
|||
bool DrawCommandQuery(int32_t controller, C4ScriptHost& scripthost, int32_t* mask, int com)
|
||||
{
|
||||
int method = scripthost.GetControlMethod(com, mask[0], mask[1]);
|
||||
C4Player* player = Game.Players.Get(controller);
|
||||
C4Player* player = ::Players.Get(controller);
|
||||
if(!player) return false;
|
||||
|
||||
switch(method)
|
||||
|
@ -2916,7 +2917,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList *
|
|||
if(Action.ComDir == COMD_Stop && iDFA == DFA_WALK && (tObj = Game.Objects.AtObject(GetX(), GetY(), ocf, this)))
|
||||
{
|
||||
int32_t com = COM_Down_D;
|
||||
if(Game.Players.Get(Controller)->PrefControlStyle) com = COM_Down;
|
||||
if(::Players.Get(Controller)->PrefControlStyle) com = COM_Down;
|
||||
|
||||
tObj->DrawCommand(cgoBottom,C4FCT_Right,NULL,com,pRegions,Owner,
|
||||
FormatString(LoadResStr("IDS_CON_BUILD"), tObj->GetName()).getData(),&ccgo);
|
||||
|
@ -2927,7 +2928,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList *
|
|||
// Grab target control (control flag)
|
||||
if (iDFA==DFA_PUSH && Action.Target)
|
||||
{
|
||||
bool letgobydouble = !Game.Players.Get(Controller)->PrefControlStyle
|
||||
bool letgobydouble = !::Players.Get(Controller)->PrefControlStyle
|
||||
|| DrawCommandQuery(Controller, Action.Target->Def->Script, Action.Target->Def->Script.ControlMethod, 3)
|
||||
|| DrawCommandQuery(Controller, Action.Target->Def->Script, Action.Target->Def->Script.ControlMethod, 11)
|
||||
|| DrawCommandQuery(Controller, Action.Target->Def->Script, Action.Target->Def->Script.ControlMethod, 19);
|
||||
|
@ -3131,11 +3132,11 @@ BOOL C4Object::AssignInfo()
|
|||
{
|
||||
if (Info || !ValidPlr(Owner)) return FALSE;
|
||||
// In crew list?
|
||||
C4Player *pPlr = Game.Players.Get(Owner);
|
||||
C4Player *pPlr = ::Players.Get(Owner);
|
||||
if (pPlr->Crew.GetLink(this))
|
||||
{
|
||||
// Register with player
|
||||
if(!Game.Players.Get(Owner)->MakeCrewMember(this, true, false))
|
||||
if(!::Players.Get(Owner)->MakeCrewMember(this, true, false))
|
||||
pPlr->Crew.Remove(this);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3145,13 +3146,13 @@ BOOL C4Object::AssignInfo()
|
|||
// or c) The clonk belongs to a script player that's restored without Game.txt
|
||||
else if (nInfo.getLength())
|
||||
{
|
||||
if(!Game.Players.Get(Owner)->MakeCrewMember(this, true, false))
|
||||
if(!::Players.Get(Owner)->MakeCrewMember(this, true, false))
|
||||
return FALSE;
|
||||
// Dead and gone (info flags, remove from crew/cursor)
|
||||
if (!Alive)
|
||||
{
|
||||
Info->HasDied=TRUE;
|
||||
if (ValidPlr(Owner)) Game.Players.Get(Owner)->ClearPointers(this, true);
|
||||
if (ValidPlr(Owner)) ::Players.Get(Owner)->ClearPointers(this, true);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3215,7 +3216,7 @@ BOOL C4Object::ContainedControl(BYTE byCom)
|
|||
C4Def *pCDef = Contained->Def;
|
||||
bool fCallSfEarly = CompareVersion(pCDef->rC4XVer[0],pCDef->rC4XVer[1],pCDef->rC4XVer[2],pCDef->rC4XVer[3],4,9,1,3) >= 0;
|
||||
bool result = false;
|
||||
C4Player * pPlr = Game.Players.Get(Controller);
|
||||
C4Player * pPlr = ::Players.Get(Controller);
|
||||
if(fCallSfEarly)
|
||||
{
|
||||
if (sf && !!sf->Exec(Contained, &C4AulParSet(C4VObj(this)))) result = true;
|
||||
|
@ -3350,7 +3351,7 @@ void C4Object::DirectCom(BYTE byCom, int32_t iData) // By player ObjectCom
|
|||
|
||||
// Object script override
|
||||
C4Player *pController;
|
||||
if (pController = Game.Players.Get(Controller))
|
||||
if (pController = ::Players.Get(Controller))
|
||||
if (CallControl(pController, byCom))
|
||||
return;
|
||||
|
||||
|
@ -3513,7 +3514,7 @@ void C4Object::DirectCom(BYTE byCom, int32_t iData) // By player ObjectCom
|
|||
|
||||
void C4Object::AutoStopDirectCom(BYTE byCom, int32_t iData) // By DirecCom
|
||||
{
|
||||
C4Player * pPlayer = Game.Players.Get(Controller);
|
||||
C4Player * pPlayer = ::Players.Get(Controller);
|
||||
// Control by procedure
|
||||
switch (GetProcedure())
|
||||
{
|
||||
|
@ -3677,7 +3678,7 @@ void C4Object::AutoStopDirectCom(BYTE byCom, int32_t iData) // By DirecCom
|
|||
|
||||
void C4Object::AutoStopUpdateComDir()
|
||||
{
|
||||
C4Player * pPlr = Game.Players.Get(Controller);
|
||||
C4Player * pPlr = ::Players.Get(Controller);
|
||||
if (!pPlr || pPlr->Cursor != this) return;
|
||||
int32_t NewComDir = Coms2ComDir(pPlr->PressedComs);
|
||||
if (Action.ComDir == NewComDir) return;
|
||||
|
@ -3979,7 +3980,7 @@ void C4Object::DrawCommand(C4Facet &cgoBar, int32_t iAlign, const char *szFuncti
|
|||
|
||||
// Flash
|
||||
C4Player *pPlr;
|
||||
if (pPlr=Game.Players.Get(Owner))
|
||||
if (pPlr=::Players.Get(Owner))
|
||||
if (iCom==pPlr->FlashCom)
|
||||
fFlash=TRUE;
|
||||
|
||||
|
@ -5365,7 +5366,7 @@ BOOL C4Object::SetOwner(int32_t iOwner)
|
|||
if (iOwner != NO_OWNER)
|
||||
if (GetGraphics()->IsColorByOwner())
|
||||
{
|
||||
Color=Game.Players.Get(iOwner)->ColorDw;
|
||||
Color=::Players.Get(iOwner)->ColorDw;
|
||||
UpdateFace(false);
|
||||
}
|
||||
// no change?
|
||||
|
@ -5373,11 +5374,11 @@ BOOL C4Object::SetOwner(int32_t iOwner)
|
|||
// remove old owner view
|
||||
if (ValidPlr(Owner))
|
||||
{
|
||||
pPlr = Game.Players.Get(Owner);
|
||||
pPlr = ::Players.Get(Owner);
|
||||
while (pPlr->FoWViewObjs.Remove(this)) {}
|
||||
}
|
||||
else
|
||||
for (pPlr = Game.Players.First; pPlr; pPlr = pPlr->Next)
|
||||
for (pPlr = ::Players.First; pPlr; pPlr = pPlr->Next)
|
||||
while (pPlr->FoWViewObjs.Remove(this)) {}
|
||||
// set new owner
|
||||
int32_t iOldOwner=Owner;
|
||||
|
@ -5418,7 +5419,7 @@ void C4Object::PlrFoWActualize()
|
|||
if (ValidPlr(Owner))
|
||||
{
|
||||
// single player's FoW-list
|
||||
pPlr = Game.Players.Get(Owner);
|
||||
pPlr = ::Players.Get(Owner);
|
||||
while (pPlr->FoWViewObjs.Remove(this)) {}
|
||||
if (PlrViewRange) pPlr->FoWViewObjs.Add(this, C4ObjectList::stNone);
|
||||
}
|
||||
|
@ -5426,7 +5427,7 @@ void C4Object::PlrFoWActualize()
|
|||
else
|
||||
{
|
||||
// all players!
|
||||
for (pPlr = Game.Players.First; pPlr; pPlr = pPlr->Next)
|
||||
for (pPlr = ::Players.First; pPlr; pPlr = pPlr->Next)
|
||||
{
|
||||
while (pPlr->FoWViewObjs.Remove(this)) {}
|
||||
if (PlrViewRange) pPlr->FoWViewObjs.Add(this, C4ObjectList::stNone);
|
||||
|
@ -5587,8 +5588,8 @@ BOOL C4Object::GrabInfo(C4Object *pFrom)
|
|||
ClearInfo (Info);
|
||||
}
|
||||
// remove objects from any owning crews
|
||||
Game.Players.ClearPointers(pFrom);
|
||||
Game.Players.ClearPointers(this);
|
||||
::Players.ClearPointers(pFrom);
|
||||
::Players.ClearPointers(this);
|
||||
// set info
|
||||
Info = pFrom->Info; pFrom->ClearInfo (pFrom->Info);
|
||||
// set name
|
||||
|
@ -5600,7 +5601,7 @@ BOOL C4Object::GrabInfo(C4Object *pFrom)
|
|||
// if alive, recruit to new crew
|
||||
if (Alive) Info->Recruit();
|
||||
// make new crew member
|
||||
C4Player *pPlr = Game.Players.Get(Owner);
|
||||
C4Player *pPlr = ::Players.Get(Owner);
|
||||
if (pPlr) pPlr->MakeCrewMember(this);
|
||||
// done, success
|
||||
return TRUE;
|
||||
|
@ -6131,7 +6132,7 @@ bool C4Object::IsPlayerObject(int32_t iPlayerNumber)
|
|||
// flags are player objects
|
||||
if (id == C4ID_Flag) return true;
|
||||
|
||||
C4Player *pOwner = Game.Players.Get(Owner);
|
||||
C4Player *pOwner = ::Players.Get(Owner);
|
||||
if (pOwner)
|
||||
{
|
||||
if (pOwner && pOwner->Crew.IsContained(this)) return true;
|
||||
|
@ -6152,7 +6153,7 @@ bool C4Object::IsUserPlayerObject()
|
|||
// must be a player object at all
|
||||
if (!IsPlayerObject()) return false;
|
||||
// and the owner must not be a script player
|
||||
C4Player *pOwner = Game.Players.Get(Owner);
|
||||
C4Player *pOwner = ::Players.Get(Owner);
|
||||
if (!pOwner || pOwner->GetType() != C4PT_User) return false;
|
||||
// otherwise, it's a user playeer object
|
||||
return true;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <C4GraphicsResource.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
BOOL SimFlightHitsLiquid(FIXED fcx, FIXED fcy, FIXED xdir, FIXED ydir);
|
||||
|
@ -618,7 +619,7 @@ BOOL ObjectComPut(C4Object *cObj, C4Object *pTarget, C4Object *pThing)
|
|||
{
|
||||
// Was meant to be a drop anyway
|
||||
if (ValidPlr(cObj->Owner))
|
||||
if (Game.Players.Get(cObj->Owner)->LastComDownDouble)
|
||||
if (::Players.Get(cObj->Owner)->LastComDownDouble)
|
||||
return ObjectComDrop(cObj, pThing);
|
||||
// No grab put: fail
|
||||
return FALSE;
|
||||
|
@ -960,17 +961,17 @@ BOOL SellFromBase(int32_t iPlr, C4Object *pBaseObj, C4ID id, C4Object *pSellObj)
|
|||
if (!pBaseObj || !ValidPlr(pBaseObj->Base)) return FALSE;
|
||||
if (~Game.C4S.Game.Realism.BaseFunctionality & BASEFUNC_Sell) return FALSE;
|
||||
// Base owner eliminated
|
||||
if (Game.Players.Get(pBaseObj->Base)->Eliminated)
|
||||
if (::Players.Get(pBaseObj->Base)->Eliminated)
|
||||
{
|
||||
StartSoundEffect("Error",false,100,pBaseObj);
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_ELIMINATED"),Game.Players.Get(pBaseObj->Base)->GetName()).getData(),iPlr);
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_ELIMINATED"),::Players.Get(pBaseObj->Base)->GetName()).getData(),iPlr);
|
||||
return FALSE;
|
||||
}
|
||||
// Base owner hostile
|
||||
if (Hostile(iPlr,pBaseObj->Base))
|
||||
{
|
||||
StartSoundEffect("Error",false,100,pBaseObj);
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_HOSTILE"),Game.Players.Get(pBaseObj->Base)->GetName()).getData(),iPlr);
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_HOSTILE"),::Players.Get(pBaseObj->Base)->GetName()).getData(),iPlr);
|
||||
return FALSE;
|
||||
}
|
||||
// check validity of sell object, if specified
|
||||
|
@ -983,7 +984,7 @@ BOOL SellFromBase(int32_t iPlr, C4Object *pBaseObj, C4ID id, C4Object *pSellObj)
|
|||
// check definition NoSell
|
||||
if (pThing->Def->NoSell) return FALSE;
|
||||
// Sell object (pBaseObj owner gets the money)
|
||||
return Game.Players.Get(pBaseObj->Base)->Sell2Home(pThing);
|
||||
return ::Players.Get(pBaseObj->Base)->Sell2Home(pThing);
|
||||
}
|
||||
|
||||
BOOL Buy2Base(int32_t iPlr, C4Object *pBase, C4ID id, BOOL fShowErrors)
|
||||
|
@ -998,10 +999,10 @@ BOOL Buy2Base(int32_t iPlr, C4Object *pBase, C4ID id, BOOL fShowErrors)
|
|||
{
|
||||
if (!fShowErrors) return FALSE;
|
||||
StartSoundEffect("Error",false,100,pBase);
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_HOSTILE"),Game.Players.Get(pBase->Base)->GetName()).getData(),iPlr); return FALSE;
|
||||
GameMsgPlayer(FormatString(LoadResStr("IDS_PLR_HOSTILE"),::Players.Get(pBase->Base)->GetName()).getData(),iPlr); return FALSE;
|
||||
}
|
||||
// buy
|
||||
if (!(pThing=Game.Players.Get(pBase->Base)->Buy(id, fShowErrors, iPlr, pBase))) return FALSE;
|
||||
if (!(pThing=::Players.Get(pBase->Base)->Buy(id, fShowErrors, iPlr, pBase))) return FALSE;
|
||||
// Object enter target object
|
||||
pThing->Enter(pBase);
|
||||
// Success
|
||||
|
@ -1010,7 +1011,7 @@ BOOL Buy2Base(int32_t iPlr, C4Object *pBase, C4ID id, BOOL fShowErrors)
|
|||
|
||||
BOOL PlayerObjectCommand(int32_t plr, int32_t cmdf, C4Object *pTarget, int32_t tx, int32_t ty)
|
||||
{
|
||||
C4Player *pPlr=Game.Players.Get(plr);
|
||||
C4Player *pPlr=::Players.Get(plr);
|
||||
if (!pPlr) return FALSE;
|
||||
int32_t iAddMode = C4P_Command_Set;
|
||||
// Adjust for old-style keyboard throw/drop control: add & in range
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <C4Log.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -322,8 +323,8 @@ void C4ObjectInfo::Draw(C4Facet &cgo, BOOL fShowPortrait, BOOL fCaptain, C4Objec
|
|||
//C4Facet fctPortrait; fctPortrait.Set(Portrait);
|
||||
C4Facet ccgo; ccgo.Set(cgo.Surface,cgo.X+iX,cgo.Y,4*cgo.Hgt/3+10,cgo.Hgt+10);
|
||||
DWORD dwColor = 0xFFFFFFFF;
|
||||
if (pOfObj && Game.Players.Get(pOfObj->Owner))
|
||||
dwColor = Game.Players.Get(pOfObj->Owner)->ColorDw;
|
||||
if (pOfObj && ::Players.Get(pOfObj->Owner))
|
||||
dwColor = ::Players.Get(pOfObj->Owner)->ColorDw;
|
||||
pPortraitGfx->DrawClr(ccgo, TRUE, dwColor);
|
||||
iX+=4*cgo.Hgt/3;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <C4MouseControl.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -192,8 +193,8 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
// Refill target
|
||||
if (!(pTarget=RefillObject)) return false;
|
||||
// Add base owner's homebase material
|
||||
if (!(pPlayer = Game.Players.Get(pTarget->Base))) return FALSE;
|
||||
C4Player *pBuyPlayer = Object ? Game.Players.Get(Object->Owner) : NULL;
|
||||
if (!(pPlayer = ::Players.Get(pTarget->Base))) return FALSE;
|
||||
C4Player *pBuyPlayer = Object ? ::Players.Get(Object->Owner) : NULL;
|
||||
C4ID idDef;
|
||||
for (cnt=0; idDef=pPlayer->HomeBaseMaterial.GetID(::Definitions,C4D_All,cnt,&iCount); cnt++)
|
||||
{
|
||||
|
@ -322,7 +323,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled)
|
|||
sprintf(szCommand, "PlayerObjectCommand(%d, \"Put\", Object(%d), 0, 0) && ExecuteCommand()", Object->Owner, pTarget->Number);
|
||||
// Secondary command: put all inventory items (all selected clonks)
|
||||
szCommand2[0] = 0;
|
||||
if ((Object->Contents.ObjectCount() > 1) || (Game.Players.Get(Object->Owner)->GetSelectedCrewCount() > 1))
|
||||
if ((Object->Contents.ObjectCount() > 1) || (::Players.Get(Object->Owner)->GetSelectedCrewCount() > 1))
|
||||
sprintf(szCommand2, "PlayerObjectCommand(%d, \"Put\", Object(%d), 1000, 0) && ExecuteCommand()", Object->Owner, pTarget->Number); // Workaround: specifying a really high put count here; will be adjusted later by C4Menu::ObjectCommand...
|
||||
// Create symbol
|
||||
fctSymbol.Create(C4SymbolSize,C4SymbolSize);
|
||||
|
@ -468,7 +469,7 @@ bool C4ObjectMenu::IsReadOnly()
|
|||
// if the player is eliminated, do not control either!
|
||||
if (!pVP->fIsNoOwnerViewport)
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(::MouseControl.GetPlayer());
|
||||
C4Player *pPlr = ::Players.Get(::MouseControl.GetPlayer());
|
||||
if (pPlr && pPlr->Eliminated) return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#define C4FOW_Def_View_RangeX 500
|
||||
|
@ -311,7 +312,7 @@ BOOL C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientNa
|
|||
pInfo->SetJoined(iNumber);
|
||||
|
||||
// Number might have changed: Recheck list sorting before scenarioinit, which will do script calls
|
||||
Game.Players.RecheckPlayerSort(this);
|
||||
::Players.RecheckPlayerSort(this);
|
||||
|
||||
// check for a postponed scenario init, if no team is specified (post-lobby-join in network, or simply non-network)
|
||||
C4Team *pTeam = NULL;
|
||||
|
@ -395,7 +396,7 @@ BOOL C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientNa
|
|||
AtClient = iAtClient;
|
||||
SCopy(szAtClientName,AtClientName,C4MaxTitle);
|
||||
// Number might have changed: Recheck list sorting
|
||||
Game.Players.RecheckPlayerSort(this);
|
||||
::Players.RecheckPlayerSort(this);
|
||||
// Init control after loading runtime data, because control init will overwrite some of the values
|
||||
InitControl();
|
||||
}
|
||||
|
@ -676,7 +677,7 @@ BOOL C4Player::ScenarioInit()
|
|||
|
||||
// Set color
|
||||
int32_t iColor=BoundBy<int32_t>(PrefColor,0,C4MaxColor-1);
|
||||
while (Game.Players.ColorTaken(iColor))
|
||||
while (::Players.ColorTaken(iColor))
|
||||
{ ++iColor%=C4MaxColor; if (iColor==PrefColor) break; }
|
||||
Color=iColor;
|
||||
|
||||
|
@ -720,7 +721,7 @@ BOOL C4Player::ScenarioInit()
|
|||
int32_t iStartPos=BoundBy(PrefPosition*iMaxPos/C4P_MaxPosition,0,iMaxPos-1);
|
||||
int32_t iPosition=iStartPos;
|
||||
// Distribute according to availability
|
||||
while (Game.Players.PositionTaken(iPosition))
|
||||
while (::Players.PositionTaken(iPosition))
|
||||
{ ++iPosition%=iMaxPos; if (iPosition==iStartPos) break; }
|
||||
Position=iPosition;
|
||||
// Set x position
|
||||
|
@ -844,7 +845,7 @@ C4Object *C4Player::Buy(C4ID id, BOOL fShowErrors, int32_t iForPlr, C4Object *pB
|
|||
if (!(pThing=Game.CreateObject(id,pBuyObj,iForPlr))) return FALSE;
|
||||
// Make crew member
|
||||
if (pDef->CrewMember) if (ValidPlr(iForPlr))
|
||||
Game.Players.Get(iForPlr)->MakeCrewMember(pThing);
|
||||
::Players.Get(iForPlr)->MakeCrewMember(pThing);
|
||||
// success
|
||||
C4AulParSet parset (C4VInt(Number), C4VObj(pBuyObj));
|
||||
pThing->Call(PSF_Purchase, &parset);
|
||||
|
@ -927,7 +928,7 @@ void C4Player::Evaluate()
|
|||
// Melee: personal value gain score ...check Game.Objects(C4D_Goal)
|
||||
if (Game.C4S.Game.IsMelee()) LastRound.Score = Max<int32_t>(ValueGain,0);
|
||||
// Cooperative: shared score
|
||||
else LastRound.Score = Max(Game.Players.AverageValueGain(),0);
|
||||
else LastRound.Score = Max(::Players.AverageValueGain(),0);
|
||||
LastRound.Level = 0; // unknown...
|
||||
LastRound.Bonus = SuccessBonus * LastRound.Won;
|
||||
LastRound.FinalScore = LastRound.Score + LastRound.Bonus;
|
||||
|
@ -974,7 +975,7 @@ BOOL C4Player::SetHostility(int32_t iOpponent, int32_t iHostility, BOOL fSilent)
|
|||
// Announce
|
||||
StartSoundEffect("Trumpet");
|
||||
Log(FormatString(LoadResStr(iHostility ? "IDS_PLR_HOSTILITY" : "IDS_PLR_NOHOSTILITY"),
|
||||
GetName(),Game.Players.Get(iOpponent)->GetName()).getData());
|
||||
GetName(),::Players.Get(iOpponent)->GetName()).getData());
|
||||
// Success
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1032,7 +1033,7 @@ void C4Player::SetTeamHostility()
|
|||
// team only
|
||||
if (!Team) return;
|
||||
// set hostilities
|
||||
for (C4Player *pPlr = Game.Players.First; pPlr; pPlr = pPlr->Next)
|
||||
for (C4Player *pPlr = ::Players.First; pPlr; pPlr = pPlr->Next)
|
||||
if (pPlr != this)
|
||||
{
|
||||
bool fHostile = (pPlr->Team != Team);
|
||||
|
@ -1160,7 +1161,7 @@ BOOL C4Player::Strip(const char *szFilename, bool fAggressive)
|
|||
void C4Player::DrawHostility(C4Facet &cgo, int32_t iIndex)
|
||||
{
|
||||
C4Player *pPlr;
|
||||
if (pPlr=Game.Players.GetByIndex(iIndex))
|
||||
if (pPlr=::Players.GetByIndex(iIndex))
|
||||
{
|
||||
// Portrait
|
||||
if (Config.Graphics.ShowPortraits && pPlr->BigIcon.Surface)
|
||||
|
@ -1856,11 +1857,11 @@ void C4Player::InitControl()
|
|||
iControl = C4P_Control_Keyboard1;
|
||||
}
|
||||
// Choose next while control taken
|
||||
if (Game.Players.ControlTaken(iControl))
|
||||
if (::Players.ControlTaken(iControl))
|
||||
{
|
||||
// Preferred control taken, search for available keyboard control
|
||||
for (iControl=C4P_Control_Keyboard1; iControl<=C4P_Control_Keyboard4; iControl++)
|
||||
if (!Game.Players.ControlTaken(iControl)) // Available control found
|
||||
if (!::Players.ControlTaken(iControl)) // Available control found
|
||||
break;
|
||||
// No available control found
|
||||
if (iControl>C4P_Control_Keyboard4)
|
||||
|
@ -1878,7 +1879,7 @@ void C4Player::InitControl()
|
|||
if (PrefMouse && !Game.Control.isReplay())
|
||||
if (!Game.C4S.Head.DisableMouse)
|
||||
if (Inside<int32_t>(Control, C4P_Control_Keyboard1, C4P_Control_GamePadMax))
|
||||
if (!Game.Players.MouseControlTaken())
|
||||
if (!::Players.MouseControlTaken())
|
||||
MouseControl=TRUE;
|
||||
// no controls issued yet
|
||||
ControlCount = ActionCount = 0;
|
||||
|
@ -2014,7 +2015,7 @@ void C4Player::Eliminate()
|
|||
{
|
||||
// Check: Any player left at this client?
|
||||
C4Player *pPlr = NULL;
|
||||
for(int i = 0; pPlr = Game.Players.GetAtClient(AtClient, i); i++)
|
||||
for(int i = 0; pPlr = ::Players.GetAtClient(AtClient, i); i++)
|
||||
if(!pPlr->Eliminated)
|
||||
break;
|
||||
// If not, deactivate the client
|
||||
|
@ -2286,7 +2287,7 @@ bool C4Player::IsInvisible() const
|
|||
void C4Player::ToggleMouseControl()
|
||||
{
|
||||
// Activate mouse control if it's available
|
||||
if (!MouseControl && !Game.Players.MouseControlTaken())
|
||||
if (!MouseControl && !::Players.MouseControlTaken())
|
||||
{
|
||||
::MouseControl.Init(Number);
|
||||
MouseControl=TRUE;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <C4Log.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4FullScreen.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
// *** C4PlayerInfo
|
||||
|
@ -1640,7 +1641,7 @@ bool C4PlayerInfoList::RecreatePlayers()
|
|||
Game.Control.RecAddFile(szFilename, sFilenameInRecord.getData());
|
||||
}
|
||||
// recreate join directly
|
||||
Game.Players.Join(szFilename, FALSE, idAtClient, szAtClientName, pInfo);
|
||||
::Players.Join(szFilename, FALSE, idAtClient, szAtClientName, pInfo);
|
||||
// delete temporary files immediately
|
||||
if (pInfo->IsTempFile()) pInfo->DeleteTempFile();
|
||||
}
|
||||
|
@ -1662,7 +1663,7 @@ bool C4PlayerInfoList::RemoveUnassociatedPlayers(C4PlayerInfoList &rSavegamePlay
|
|||
// remove players that were in the game but are not associated
|
||||
if (pInfo->IsJoined() && !GetPlayerInfoBySavegameID(pInfo->GetID()))
|
||||
{
|
||||
if (Game.Players.RemoveUnjoined(pInfo->GetInGameNumber()))
|
||||
if (::Players.RemoveUnjoined(pInfo->GetInGameNumber()))
|
||||
{
|
||||
LogF(LoadResStr("IDS_PRC_REMOVEPLR"), pInfo->GetName());
|
||||
}
|
||||
|
|
|
@ -724,10 +724,12 @@ void C4PlayerList::RecheckPlayerSort(C4Player *pForPlayer)
|
|||
|
||||
int32_t ValidPlr(int32_t plr)
|
||||
{
|
||||
return Game.Players.Valid(plr);
|
||||
return ::Players.Valid(plr);
|
||||
}
|
||||
|
||||
int32_t Hostile(int32_t plr1, int32_t plr2)
|
||||
{
|
||||
return Game.Players.Hostile(plr1,plr2);
|
||||
return ::Players.Hostile(plr1,plr2);
|
||||
}
|
||||
|
||||
C4PlayerList Players;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <C4Object.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#include <StdRegistry.h>
|
||||
|
@ -208,7 +209,7 @@ BOOL C4PropertyDlg::Update()
|
|||
if (ValidPlr(cobj->Owner))
|
||||
{
|
||||
Output.Append(LineFeed);
|
||||
Output.AppendFormat(LoadResStr("IDS_CNS_OWNER"),Game.Players.Get(cobj->Owner)->GetName());
|
||||
Output.AppendFormat(LoadResStr("IDS_CNS_OWNER"),::Players.Get(cobj->Owner)->GetName());
|
||||
}
|
||||
// Contents
|
||||
if (cobj->Contents.ObjectCount())
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4Object.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
// *** C4RoundResultsPlayer
|
||||
|
@ -296,7 +297,7 @@ void C4RoundResults::EvaluateGoals(C4IDList &GoalList, C4IDList &FulfilledGoalLi
|
|||
void C4RoundResults::EvaluateGame()
|
||||
{
|
||||
// set game data
|
||||
C4Player *pFirstLocalPlayer = Game.Players.GetLocalByIndex(0);
|
||||
C4Player *pFirstLocalPlayer = ::Players.GetLocalByIndex(0);
|
||||
int32_t iFirstLocalPlayer = pFirstLocalPlayer ? pFirstLocalPlayer->Number : NO_OWNER;
|
||||
EvaluateGoals(Goals, FulfilledGoals, iFirstLocalPlayer);
|
||||
iPlayingTime = Game.Time;
|
||||
|
|
|
@ -953,7 +953,7 @@ static C4Value FnPlayerObjectCommand(C4AulContext *cthr, C4Value *pPars)
|
|||
PAR(object, pTarget2); PAR(any, Data);
|
||||
// Player
|
||||
if (!ValidPlr(iPlr) || !szCommand) return C4VFalse;
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
// Command
|
||||
long iCommand = CommandByName(FnStringPar(szCommand)); if (!iCommand) return C4VFalse;
|
||||
// Special: convert iData to szText
|
||||
|
@ -1040,7 +1040,7 @@ static bool FnSetName(C4AulContext *cthr, C4String *pNewName, C4Object *pObj, C4
|
|||
// querying owner info list here isn't 100% accurate, as infos might have been stolen by other players
|
||||
// however, there is no good way to track the original list ATM
|
||||
C4ObjectInfoList *pInfoList = NULL;
|
||||
C4Player *pOwner = Game.Players.Get(pObj->Owner);
|
||||
C4Player *pOwner = ::Players.Get(pObj->Owner);
|
||||
if (pOwner) pInfoList = &pOwner->CrewInfoList;
|
||||
char NameBuf[C4MaxName+1];
|
||||
if (pInfoList) if (pInfoList->NameExists(szName))
|
||||
|
@ -1080,12 +1080,12 @@ static C4String *FnGetDesc(C4AulContext *cthr, C4Object *pObj, C4ID idDef)
|
|||
static C4String *FnGetPlayerName(C4AulContext *cthr, long iPlayer)
|
||||
{
|
||||
if (!ValidPlr(iPlayer)) return NULL;
|
||||
return String(Game.Players.Get(iPlayer)->GetName());
|
||||
return String(::Players.Get(iPlayer)->GetName());
|
||||
}
|
||||
|
||||
static C4String *FnGetTaggedPlayerName(C4AulContext *cthr, long iPlayer)
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
if (!pPlr) return NULL;
|
||||
DWORD dwClr = pPlr->ColorDw; C4GUI::MakeColorReadableOnBlack(dwClr);
|
||||
static char szFnFormatBuf[1024+1];
|
||||
|
@ -1095,7 +1095,7 @@ static C4String *FnGetTaggedPlayerName(C4AulContext *cthr, long iPlayer)
|
|||
|
||||
static long FnGetPlayerType(C4AulContext *cthr, long iPlayer)
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
if (!pPlr) return 0;
|
||||
return pPlr->GetType();
|
||||
}
|
||||
|
@ -2235,7 +2235,7 @@ static C4Object *FnFindObjectOwner(C4AulContext *cthr,
|
|||
static bool FnMakeCrewMember(C4AulContext *cthr, C4Object *pObj, long iPlayer)
|
||||
{
|
||||
if (!ValidPlr(iPlayer)) return false;
|
||||
return !!Game.Players.Get(iPlayer)->MakeCrewMember(pObj);
|
||||
return !!::Players.Get(iPlayer)->MakeCrewMember(pObj);
|
||||
}
|
||||
|
||||
static bool FnGrabObjectInfo(C4AulContext *cthr, C4Object *pFrom, C4Object *pTo)
|
||||
|
@ -2381,7 +2381,7 @@ static bool FnSound(C4AulContext *cthr, C4String *szSound, bool fGlobal, C4Objec
|
|||
if (iAtPlayer)
|
||||
{
|
||||
// get player to play at
|
||||
C4Player *pPlr = Game.Players.Get(iAtPlayer-1);
|
||||
C4Player *pPlr = ::Players.Get(iAtPlayer-1);
|
||||
// not existant? fail
|
||||
if (!pPlr) return FALSE;
|
||||
// network client: don't play here
|
||||
|
@ -2614,7 +2614,7 @@ static bool FnHostile(C4AulContext *cthr, long iPlr1, long iPlr2, bool fCheckOne
|
|||
{
|
||||
if (fCheckOneWayOnly)
|
||||
{
|
||||
return Game.Players.HostilityDeclared(iPlr1,iPlr2);
|
||||
return ::Players.HostilityDeclared(iPlr1,iPlr2);
|
||||
}
|
||||
else
|
||||
return !!Hostile(iPlr1,iPlr2);
|
||||
|
@ -2622,7 +2622,7 @@ static bool FnHostile(C4AulContext *cthr, long iPlr1, long iPlr2, bool fCheckOne
|
|||
|
||||
static bool FnSetHostility(C4AulContext *cthr, long iPlr, long iPlr2, bool fHostile, bool fSilent, bool fNoCalls)
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
if (!pPlr) return false;
|
||||
// do rejection test first
|
||||
if (!fNoCalls)
|
||||
|
@ -2631,7 +2631,7 @@ static bool FnSetHostility(C4AulContext *cthr, long iPlr, long iPlr2, bool fHost
|
|||
return false;
|
||||
}
|
||||
// OK; set hostility
|
||||
bool fOldHostility = Game.Players.HostilityDeclared(iPlr, iPlr2);
|
||||
bool fOldHostility = ::Players.HostilityDeclared(iPlr, iPlr2);
|
||||
if (!pPlr->SetHostility(iPlr2,fHostile, fSilent)) return false;
|
||||
// calls afterwards
|
||||
Game.Script.GRBroadcast(PSF_OnHostilityChange, &C4AulParSet(C4VInt(iPlr), C4VInt(iPlr2), C4VBool(fHostile), C4VBool(fOldHostility)), true);
|
||||
|
@ -2641,21 +2641,21 @@ static bool FnSetHostility(C4AulContext *cthr, long iPlr, long iPlr2, bool fHost
|
|||
static bool FnSetPlrView(C4AulContext *cthr, long iPlr, C4Object *tobj)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return false;
|
||||
Game.Players.Get(iPlr)->SetViewMode(C4PVM_Target,tobj);
|
||||
::Players.Get(iPlr)->SetViewMode(C4PVM_Target,tobj);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool FnSetPlrShowControl(C4AulContext *cthr, long iPlr, C4String *defstring)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return false;
|
||||
Game.Players.Get(iPlr)->ShowControl=StringBitEval(FnStringPar(defstring));
|
||||
::Players.Get(iPlr)->ShowControl=StringBitEval(FnStringPar(defstring));
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool FnSetPlrShowCommand(C4AulContext *cthr, long iPlr, long iCom)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return false;
|
||||
Game.Players.Get(iPlr)->FlashCom=iCom;
|
||||
::Players.Get(iPlr)->FlashCom=iCom;
|
||||
if (!Config.Graphics.ShowCommands) Config.Graphics.ShowCommands=TRUE;
|
||||
return true;
|
||||
}
|
||||
|
@ -2663,7 +2663,7 @@ static bool FnSetPlrShowCommand(C4AulContext *cthr, long iPlr, long iCom)
|
|||
static bool FnSetPlrShowControlPos(C4AulContext *cthr, long iPlr, long pos)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return false;
|
||||
Game.Players.Get(iPlr)->ShowControlPos=pos;
|
||||
::Players.Get(iPlr)->ShowControlPos=pos;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2676,12 +2676,12 @@ static long FnGetPlrViewMode(C4AulContext *cthr, long iPlr)
|
|||
{
|
||||
if (!ValidPlr(iPlr)) return -1;
|
||||
if (Game.Control.SyncMode()) return -1;
|
||||
return Game.Players.Get(iPlr)->ViewMode;
|
||||
return ::Players.Get(iPlr)->ViewMode;
|
||||
}
|
||||
|
||||
static C4Object *FnGetPlrView(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
if (!pPlr || pPlr->ViewMode != C4PVM_Target) return NULL;
|
||||
return pPlr->ViewTarget;
|
||||
}
|
||||
|
@ -2693,8 +2693,8 @@ static bool FnDoHomebaseMaterial(C4AulContext *cthr, long iPlr, C4ID id, long iC
|
|||
C4Def *pDef = C4Id2Def(id);
|
||||
if (!pDef) return false;
|
||||
// add to material
|
||||
long iLastcount = Game.Players.Get(iPlr)->HomeBaseMaterial.GetIDCount(id);
|
||||
return Game.Players.Get(iPlr)->HomeBaseMaterial.SetIDCount(id,iLastcount+iChange,TRUE);
|
||||
long iLastcount = ::Players.Get(iPlr)->HomeBaseMaterial.GetIDCount(id);
|
||||
return ::Players.Get(iPlr)->HomeBaseMaterial.SetIDCount(id,iLastcount+iChange,TRUE);
|
||||
}
|
||||
|
||||
static bool FnDoHomebaseProduction(C4AulContext *cthr, long iPlr, C4ID id, long iChange)
|
||||
|
@ -2704,20 +2704,20 @@ static bool FnDoHomebaseProduction(C4AulContext *cthr, long iPlr, C4ID id, long
|
|||
C4Def *pDef = C4Id2Def(id);
|
||||
if (!pDef) return false;
|
||||
// add to material
|
||||
long iLastcount = Game.Players.Get(iPlr)->HomeBaseProduction.GetIDCount(id);
|
||||
return Game.Players.Get(iPlr)->HomeBaseProduction.SetIDCount(id,iLastcount+iChange,TRUE);
|
||||
long iLastcount = ::Players.Get(iPlr)->HomeBaseProduction.GetIDCount(id);
|
||||
return ::Players.Get(iPlr)->HomeBaseProduction.SetIDCount(id,iLastcount+iChange,TRUE);
|
||||
}
|
||||
|
||||
static long FnGetPlrDownDouble(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return FALSE;
|
||||
return Game.Players.Get(iPlr)->LastComDownDouble;
|
||||
return ::Players.Get(iPlr)->LastComDownDouble;
|
||||
}
|
||||
|
||||
static bool FnClearLastPlrCom(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
// get player
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
// reset last coms
|
||||
pPlr->LastCom = COM_None;
|
||||
|
@ -2728,7 +2728,7 @@ static bool FnClearLastPlrCom(C4AulContext *cthr, long iPlr)
|
|||
|
||||
static bool FnSetPlrKnowledge(C4AulContext *cthr, long iPlr, C4ID id, bool fRemove)
|
||||
{
|
||||
C4Player *pPlr=Game.Players.Get(iPlr);
|
||||
C4Player *pPlr=::Players.Get(iPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
if (fRemove)
|
||||
{
|
||||
|
@ -2757,9 +2757,9 @@ static C4Value FnGetPlrKnowledge_C4V(C4AulContext *cthr, C4Value* iPlr_C4V, C4Va
|
|||
DWORD dwCategory = dwCategory_C4V->getInt();
|
||||
if (!ValidPlr(iPlr)) return C4VBool(FALSE);
|
||||
// Search by id, check if available, return bool
|
||||
if (id) return C4VBool(Game.Players.Get(iPlr)->Knowledge.GetIDCount(id,1) != 0);
|
||||
if (id) return C4VBool(::Players.Get(iPlr)->Knowledge.GetIDCount(id,1) != 0);
|
||||
// Search indexed item of given category, return C4ID
|
||||
return C4VID(Game.Players.Get(iPlr)->Knowledge.GetID( ::Definitions, dwCategory, iIndex ));
|
||||
return C4VID(::Players.Get(iPlr)->Knowledge.GetID( ::Definitions, dwCategory, iIndex ));
|
||||
}
|
||||
|
||||
static C4ID FnGetDefinition(C4AulContext *cthr, long iIndex, long dwCategory)
|
||||
|
@ -2812,9 +2812,9 @@ static C4Value FnGetHomebaseMaterial_C4V(C4AulContext *cthr, C4Value* iPlr_C4V,
|
|||
|
||||
if (!ValidPlr(iPlr)) return C4VBool(FALSE);
|
||||
// Search by id, return available count
|
||||
if (id) return C4VInt(Game.Players.Get(iPlr)->HomeBaseMaterial.GetIDCount(id));
|
||||
if (id) return C4VInt(::Players.Get(iPlr)->HomeBaseMaterial.GetIDCount(id));
|
||||
// Search indexed item of given category, return C4ID
|
||||
return C4VID(Game.Players.Get(iPlr)->HomeBaseMaterial.GetID( ::Definitions, dwCategory, iIndex ));
|
||||
return C4VID(::Players.Get(iPlr)->HomeBaseMaterial.GetID( ::Definitions, dwCategory, iIndex ));
|
||||
}
|
||||
|
||||
static C4Value FnGetHomebaseProduction_C4V(C4AulContext *cthr, C4Value* iPlr_C4V, C4Value* id_C4V, C4Value* iIndex_C4V, C4Value* dwCategory_C4V)
|
||||
|
@ -2826,14 +2826,14 @@ static C4Value FnGetHomebaseProduction_C4V(C4AulContext *cthr, C4Value* iPlr_C4V
|
|||
|
||||
if (!ValidPlr(iPlr)) return C4VBool(FALSE);
|
||||
// Search by id, return available count
|
||||
if (id) return C4VInt(Game.Players.Get(iPlr)->HomeBaseProduction.GetIDCount(id));
|
||||
if (id) return C4VInt(::Players.Get(iPlr)->HomeBaseProduction.GetIDCount(id));
|
||||
// Search indexed item of given category, return C4ID
|
||||
return C4VID(Game.Players.Get(iPlr)->HomeBaseProduction.GetID( ::Definitions, dwCategory, iIndex ));
|
||||
return C4VID(::Players.Get(iPlr)->HomeBaseProduction.GetID( ::Definitions, dwCategory, iIndex ));
|
||||
}
|
||||
|
||||
static long FnSetPlrMagic(C4AulContext *cthr, long iPlr, C4ID id, bool fRemove)
|
||||
{
|
||||
C4Player *pPlr=Game.Players.Get(iPlr);
|
||||
C4Player *pPlr=::Players.Get(iPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
if (fRemove)
|
||||
{
|
||||
|
@ -2856,94 +2856,94 @@ static C4Value FnGetPlrMagic_C4V(C4AulContext *cthr, C4Value* iPlr_C4V, C4Value*
|
|||
|
||||
if (!ValidPlr(iPlr)) return C4VBool(FALSE);
|
||||
// Search by id, check if available, return bool
|
||||
if (id) return C4VBool(Game.Players.Get(iPlr)->Magic.GetIDCount(id,1) != 0);
|
||||
if (id) return C4VBool(::Players.Get(iPlr)->Magic.GetIDCount(id,1) != 0);
|
||||
// Search indexed item of given category, return C4ID
|
||||
return C4VID(Game.Players.Get(iPlr)->Magic.GetID( ::Definitions, C4D_Magic, iIndex ));
|
||||
return C4VID(::Players.Get(iPlr)->Magic.GetID( ::Definitions, C4D_Magic, iIndex ));
|
||||
}
|
||||
|
||||
static long FnGetWealth(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return 0;
|
||||
return Game.Players.Get(iPlr)->Wealth;
|
||||
return ::Players.Get(iPlr)->Wealth;
|
||||
}
|
||||
|
||||
static bool FnSetWealth(C4AulContext *cthr, long iPlr, long iValue)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return FALSE;
|
||||
Game.Players.Get(iPlr)->Wealth = BoundBy<long>(iValue,0,100000);
|
||||
::Players.Get(iPlr)->Wealth = BoundBy<long>(iValue,0,100000);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static long FnDoScore(C4AulContext *cthr, long iPlr, long iChange)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return FALSE;
|
||||
return Game.Players.Get(iPlr)->DoPoints(iChange);
|
||||
return ::Players.Get(iPlr)->DoPoints(iChange);
|
||||
}
|
||||
|
||||
static long FnGetPlrValue(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return 0;
|
||||
return Game.Players.Get(iPlr)->Value;
|
||||
return ::Players.Get(iPlr)->Value;
|
||||
}
|
||||
|
||||
static long FnGetPlrValueGain(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return 0;
|
||||
return Game.Players.Get(iPlr)->ValueGain;
|
||||
return ::Players.Get(iPlr)->ValueGain;
|
||||
}
|
||||
|
||||
static long FnGetScore(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return 0;
|
||||
return Game.Players.Get(iPlr)->Points;
|
||||
return ::Players.Get(iPlr)->Points;
|
||||
}
|
||||
|
||||
static C4Object *FnGetHiRank(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return FALSE;
|
||||
return Game.Players.Get(iPlr)->GetHiRankActiveCrew(false);
|
||||
return ::Players.Get(iPlr)->GetHiRankActiveCrew(false);
|
||||
}
|
||||
|
||||
static C4Object *FnGetCrew(C4AulContext *cthr, long iPlr, long index)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return FALSE;
|
||||
return Game.Players.Get(iPlr)->Crew.GetObject(index);
|
||||
return ::Players.Get(iPlr)->Crew.GetObject(index);
|
||||
}
|
||||
|
||||
static long FnGetCrewCount(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return 0;
|
||||
return Game.Players.Get(iPlr)->Crew.ObjectCount();
|
||||
return ::Players.Get(iPlr)->Crew.ObjectCount();
|
||||
}
|
||||
|
||||
static long FnGetPlayerCount(C4AulContext *cthr, long iType)
|
||||
{
|
||||
if (!iType)
|
||||
return Game.Players.GetCount();
|
||||
return ::Players.GetCount();
|
||||
else
|
||||
return Game.Players.GetCount((C4PlayerType) iType);
|
||||
return ::Players.GetCount((C4PlayerType) iType);
|
||||
}
|
||||
|
||||
static long FnGetPlayerByIndex(C4AulContext *cthr, long iIndex, long iType)
|
||||
{
|
||||
C4Player *pPlayer;
|
||||
if (iType)
|
||||
pPlayer = Game.Players.GetByIndex(iIndex, (C4PlayerType) iType);
|
||||
pPlayer = ::Players.GetByIndex(iIndex, (C4PlayerType) iType);
|
||||
else
|
||||
pPlayer = Game.Players.GetByIndex(iIndex);
|
||||
pPlayer = ::Players.GetByIndex(iIndex);
|
||||
if(!pPlayer) return NO_OWNER;
|
||||
return pPlayer->Number;
|
||||
}
|
||||
|
||||
static long FnEliminatePlayer(C4AulContext *cthr, long iPlr, bool fRemoveDirect)
|
||||
{
|
||||
C4Player *pPlr=Game.Players.Get(iPlr);
|
||||
C4Player *pPlr=::Players.Get(iPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
// direct removal?
|
||||
if (fRemoveDirect)
|
||||
{
|
||||
// do direct removal (no fate)
|
||||
return Game.Players.CtrlRemove(iPlr, false);
|
||||
return ::Players.CtrlRemove(iPlr, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2956,7 +2956,7 @@ static long FnEliminatePlayer(C4AulContext *cthr, long iPlr, bool fRemoveDirect)
|
|||
|
||||
static bool FnSurrenderPlayer(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
C4Player *pPlr=Game.Players.Get(iPlr);
|
||||
C4Player *pPlr=::Players.Get(iPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
if (pPlr->Eliminated) return FALSE;
|
||||
pPlr->Surrender();
|
||||
|
@ -3000,7 +3000,7 @@ static bool FnCreateScriptPlayer(C4AulContext *cthr, C4String *szName, long dwCo
|
|||
static C4Object *FnGetCursor(C4AulContext *cthr, long iPlr, long iIndex)
|
||||
{
|
||||
// get player
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
// invalid player?
|
||||
if (!pPlr) return NULL;
|
||||
// first index is always the cursor
|
||||
|
@ -3026,7 +3026,7 @@ static C4Object *FnGetCursor(C4AulContext *cthr, long iPlr, long iIndex)
|
|||
static C4Object *FnGetViewCursor(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
// get player
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
// get viewcursor
|
||||
return pPlr ? pPlr->ViewCursor : NULL;
|
||||
}
|
||||
|
@ -3034,12 +3034,12 @@ static C4Object *FnGetViewCursor(C4AulContext *cthr, long iPlr)
|
|||
static C4Object *FnGetCaptain(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return FALSE;
|
||||
return Game.Players.Get(iPlr)->Captain;
|
||||
return ::Players.Get(iPlr)->Captain;
|
||||
}
|
||||
|
||||
static bool FnSetCursor(C4AulContext *cthr, long iPlr, C4Object *pObj, bool fNoSelectMark, bool fNoSelectArrow, bool fNoSelectCrew)
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
if (!pPlr || (pObj && !pObj->Status)) return FALSE;
|
||||
pPlr->SetCursor(pObj, !fNoSelectMark, !fNoSelectArrow);
|
||||
if (!fNoSelectCrew) pPlr->SelectCrew(pObj, true);
|
||||
|
@ -3049,7 +3049,7 @@ static bool FnSetCursor(C4AulContext *cthr, long iPlr, C4Object *pObj, bool fNoS
|
|||
static bool FnSetViewCursor(C4AulContext *cthr, long iPlr, C4Object *pObj)
|
||||
{
|
||||
// get player
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
// invalid player?
|
||||
if (!pPlr) return FALSE;
|
||||
// set viewcursor
|
||||
|
@ -3059,7 +3059,7 @@ static bool FnSetViewCursor(C4AulContext *cthr, long iPlr, C4Object *pObj)
|
|||
|
||||
static bool FnSelectCrew(C4AulContext *cthr, long iPlr, C4Object *pObj, bool fSelect, bool fNoCursorAdjust)
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
if (!pPlr || !pObj) return FALSE;
|
||||
if (fNoCursorAdjust)
|
||||
{ if (fSelect) pObj->DoSelect(); else pObj->UnSelect(); }
|
||||
|
@ -3071,13 +3071,13 @@ static bool FnSelectCrew(C4AulContext *cthr, long iPlr, C4Object *pObj, bool fSe
|
|||
static long FnGetSelectCount(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return FALSE;
|
||||
return Game.Players.Get(iPlr)->SelectCount;
|
||||
return ::Players.Get(iPlr)->SelectCount;
|
||||
}
|
||||
|
||||
static long FnSetCrewStatus(C4AulContext *cthr, long iPlr, bool fInCrew, C4Object *pObj)
|
||||
{
|
||||
// validate player
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
// validate object / local call
|
||||
if (!pObj) if (!(pObj=cthr->Obj)) return FALSE;
|
||||
|
@ -3684,7 +3684,7 @@ static bool FnTestMessageBoard(C4AulContext *cthr, long iForPlr, bool fTestIfInU
|
|||
{
|
||||
// multi-query-MessageBoard is always available if the player is valid =)
|
||||
// (but it won't do anything in developer mode...)
|
||||
C4Player *pPlr = Game.Players.Get(iForPlr);
|
||||
C4Player *pPlr = ::Players.Get(iForPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
if (!fTestIfInUse) return TRUE;
|
||||
// single query only if no query is scheduled
|
||||
|
@ -3696,7 +3696,7 @@ static bool FnCallMessageBoard(C4AulContext *cthr, C4Object *pObj, bool fUpperCa
|
|||
if (!pObj) pObj=cthr->Obj;
|
||||
if (pObj && !pObj->Status) return FALSE;
|
||||
// check player
|
||||
C4Player *pPlr = Game.Players.Get(iForPlr);
|
||||
C4Player *pPlr = ::Players.Get(iForPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
// remove any previous
|
||||
pPlr->CallMessageBoard(pObj, StdStrBuf(FnStringPar(szQueryString)), !!fUpperCase);
|
||||
|
@ -3707,7 +3707,7 @@ static bool FnAbortMessageBoard(C4AulContext *cthr, C4Object *pObj, long iForPlr
|
|||
{
|
||||
if (!pObj) pObj=cthr->Obj;
|
||||
// check player
|
||||
C4Player *pPlr = Game.Players.Get(iForPlr);
|
||||
C4Player *pPlr = ::Players.Get(iForPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
// close TypeIn if active
|
||||
::MessageInput.AbortMsgBoardQuery(pObj, iForPlr);
|
||||
|
@ -3719,7 +3719,7 @@ static bool FnOnMessageBoardAnswer(C4AulContext *cthr, C4Object *pObj, long iFor
|
|||
{
|
||||
// remove query
|
||||
// fail if query doesn't exist to prevent any doubled answers
|
||||
C4Player *pPlr = Game.Players.Get(iForPlr);
|
||||
C4Player *pPlr = ::Players.Get(iForPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
if (!pPlr->RemoveMessageBoardQuery(pObj)) return FALSE;
|
||||
// if no answer string is provided, the user did not answer anything
|
||||
|
@ -3771,7 +3771,7 @@ static long FnGetColorDw(C4AulContext *cthr, C4Object *pObj)
|
|||
static long FnGetPlrColorDw(C4AulContext *cthr, long iPlr)
|
||||
{
|
||||
// get player
|
||||
C4Player *pPlr = Game.Players.Get(iPlr);
|
||||
C4Player *pPlr = ::Players.Get(iPlr);
|
||||
// safety
|
||||
if (!pPlr) return 0;
|
||||
// return player color
|
||||
|
@ -3792,7 +3792,7 @@ static long FnSetFoW(C4AulContext *cthr, bool fEnabled, long iPlr)
|
|||
// safety
|
||||
if (!ValidPlr(iPlr)) return FALSE;
|
||||
// set enabled
|
||||
Game.Players.Get(iPlr)->SetFoW(!!fEnabled);
|
||||
::Players.Get(iPlr)->SetFoW(!!fEnabled);
|
||||
// success
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3849,7 +3849,7 @@ static C4Object *FnBuy(C4AulContext *cthr, C4ID idBuyObj, long iForPlr, long iPa
|
|||
if (!ValidPlr(iForPlr) || !ValidPlr(iPayPlr)) return NULL;
|
||||
// buy
|
||||
C4Object *pThing;
|
||||
if (!(pThing=Game.Players.Get(iPayPlr)->Buy(idBuyObj, fShowErrors, iForPlr, pToBase ? pToBase : cthr->Obj))) return NULL;
|
||||
if (!(pThing=::Players.Get(iPayPlr)->Buy(idBuyObj, fShowErrors, iForPlr, pToBase ? pToBase : cthr->Obj))) return NULL;
|
||||
// enter object, if supplied
|
||||
if (pToBase)
|
||||
{
|
||||
|
@ -3870,7 +3870,7 @@ static long FnSell(C4AulContext *cthr, long iToPlr, C4Object *pObj)
|
|||
if (!pObj) pObj=cthr->Obj; if (!pObj) return 0;
|
||||
if (!ValidPlr(iToPlr)) return FALSE;
|
||||
// sell
|
||||
return Game.Players.Get(iToPlr)->Sell2Home(pObj);
|
||||
return ::Players.Get(iToPlr)->Sell2Home(pObj);
|
||||
}
|
||||
|
||||
// ** additional funcs for references/type info
|
||||
|
@ -4399,7 +4399,7 @@ static C4Value FnGetPlayerVal(C4AulContext* cthr, C4Value* strEntry_C4V, C4Value
|
|||
if(!ValidPlr(iPlr)) return C4Value();
|
||||
|
||||
// get player
|
||||
C4Player* pPlayer = Game.Players.Get(iPlr);
|
||||
C4Player* pPlayer = ::Players.Get(iPlr);
|
||||
|
||||
// get value
|
||||
return GetValByStdCompiler(strEntry, strSection, iEntryNr, mkNamingAdapt(*pPlayer, "Player"));
|
||||
|
@ -4416,7 +4416,7 @@ static C4Value FnGetPlayerInfoCoreVal(C4AulContext* cthr, C4Value* strEntry_C4V,
|
|||
if(!ValidPlr(iPlr)) return C4Value();
|
||||
|
||||
// get player
|
||||
C4Player* pPlayer = Game.Players.Get(iPlr);
|
||||
C4Player* pPlayer = ::Players.Get(iPlr);
|
||||
|
||||
// get plr info core
|
||||
C4PlayerInfoCore* pPlayerInfoCore = (C4PlayerInfoCore*) pPlayer;
|
||||
|
@ -4835,7 +4835,7 @@ static C4Value FnSetPlrExtraData(C4AulContext *cthr, C4Value *iPlayer_C4V, C4Val
|
|||
Data->GetType() != C4V_Bool &&
|
||||
Data->GetType() != C4V_C4ID) return C4VNull;
|
||||
// get pointer on player...
|
||||
C4Player* pPlayer = Game.Players.Get(iPlayer);
|
||||
C4Player* pPlayer = ::Players.Get(iPlayer);
|
||||
// no name list created yet?
|
||||
if(!pPlayer->ExtraData.pNames)
|
||||
// create name list
|
||||
|
@ -4863,7 +4863,7 @@ static C4Value FnGetPlrExtraData(C4AulContext *cthr, C4Value *iPlayer_C4V, C4Val
|
|||
// valid player?
|
||||
if(!ValidPlr(iPlayer)) return C4Value();
|
||||
// get pointer on player...
|
||||
C4Player* pPlayer = Game.Players.Get(iPlayer);
|
||||
C4Player* pPlayer = ::Players.Get(iPlayer);
|
||||
// no name list?
|
||||
if(!pPlayer->ExtraData.pNames) return C4Value();
|
||||
long ival;
|
||||
|
@ -4947,7 +4947,7 @@ static bool FnSetCrewEnabled(C4AulContext *cctx, bool fEnabled, C4Object *pObj)
|
|||
{
|
||||
pObj->Select=FALSE;
|
||||
C4Player *pOwner;
|
||||
if (pOwner=Game.Players.Get(pObj->Owner))
|
||||
if (pOwner=::Players.Get(pObj->Owner))
|
||||
{
|
||||
// if viewed player cursor gets deactivated and no new cursor is found, follow the old in target mode
|
||||
bool fWasCursorMode = (pOwner->ViewMode == C4PVM_Cursor);
|
||||
|
@ -4964,7 +4964,7 @@ static bool FnSetCrewEnabled(C4AulContext *cctx, bool fEnabled, C4Object *pObj)
|
|||
static bool FnUnselectCrew(C4AulContext *cctx, long iPlayer)
|
||||
{
|
||||
// get player
|
||||
C4Player *pPlr=Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr=::Players.Get(iPlayer);
|
||||
if (!pPlr) return FALSE;
|
||||
// unselect crew
|
||||
pPlr->UnselectCrew();
|
||||
|
@ -5974,14 +5974,14 @@ static bool FnSetPreSend(C4AulContext *cthr, long iToVal, C4String *pNewName)
|
|||
|
||||
static long FnGetPlayerID(C4AulContext *cthr, long iPlayer)
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
return pPlr ? pPlr->ID : 0;
|
||||
}
|
||||
|
||||
static long FnGetPlayerTeam(C4AulContext *cthr, long iPlayer)
|
||||
{
|
||||
// get player
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
if (!pPlr) return 0;
|
||||
// search team containing this player
|
||||
C4Team *pTeam = Game.Teams.GetTeamByPlayerID(pPlr->ID);
|
||||
|
@ -5997,7 +5997,7 @@ static bool FnSetPlayerTeam(C4AulContext *cthr, long iPlayer, long idNewTeam, bo
|
|||
// no team changing in league games
|
||||
if (Game.Parameters.isLeague()) return false;
|
||||
// get player
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
if (!pPlr) return false;
|
||||
C4PlayerInfo *pPlrInfo = pPlr->GetInfo();
|
||||
if (!pPlrInfo) return false;
|
||||
|
@ -6089,7 +6089,7 @@ static long FnGetTeamCount(C4AulContext *cthr)
|
|||
|
||||
static bool FnInitScenarioPlayer(C4AulContext *cthr, long iPlayer, long idTeam)
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
if (!pPlr) return false;
|
||||
return pPlr->ScenarioAndTeamInit(idTeam);
|
||||
}
|
||||
|
@ -6098,7 +6098,7 @@ static bool FnOnOwnerRemoved(C4AulContext *cthr)
|
|||
{
|
||||
// safety
|
||||
C4Object *pObj = cthr->Obj; if (!pObj) return false;
|
||||
C4Player *pPlr = Game.Players.Get(pObj->Owner); if (!pPlr) return false;
|
||||
C4Player *pPlr = ::Players.Get(pObj->Owner); if (!pPlr) return false;
|
||||
if (pPlr->Crew.IsContained(pObj))
|
||||
{
|
||||
// crew members: Those are removed later (AFTER the player has been removed, for backwards compatiblity with relaunch scripting)
|
||||
|
@ -6130,9 +6130,9 @@ static bool FnOnOwnerRemoved(C4AulContext *cthr)
|
|||
// if noone from the same team was found, try to find another non-hostile player
|
||||
// (necessary for cooperative rounds without teams)
|
||||
if (iNewOwner == NO_OWNER)
|
||||
for (C4Player *pOtherPlr = Game.Players.First; pOtherPlr; pOtherPlr = pOtherPlr->Next)
|
||||
for (C4Player *pOtherPlr = ::Players.First; pOtherPlr; pOtherPlr = pOtherPlr->Next)
|
||||
if (pOtherPlr != pPlr) if (!pOtherPlr->Eliminated)
|
||||
if (!Game.Players.Hostile(pOtherPlr->Number, pPlr->Number))
|
||||
if (!::Players.Hostile(pOtherPlr->Number, pPlr->Number))
|
||||
iNewOwner = pOtherPlr->Number;
|
||||
|
||||
// set this owner
|
||||
|
@ -6164,7 +6164,7 @@ static bool FnDoScoreboardShow(C4AulContext *cthr, long iChange, long iForPlr)
|
|||
{
|
||||
// abort if the specified player is not local - but always return if the player exists,
|
||||
// to ensure sync safety
|
||||
if (!(pPlr = Game.Players.Get(iForPlr-1))) return FALSE;
|
||||
if (!(pPlr = ::Players.Get(iForPlr-1))) return FALSE;
|
||||
if (!pPlr->LocalControl) return TRUE;
|
||||
}
|
||||
Game.Scoreboard.DoDlgShow(iChange, false);
|
||||
|
@ -6201,7 +6201,7 @@ static long FnGetUnusedOverlayID(C4AulContext *ctx, long iBaseIndex, C4Object *p
|
|||
static long FnActivateGameGoalMenu(C4AulContext *ctx, long iPlayer)
|
||||
{
|
||||
// get target player
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
if (!pPlr) return FALSE;
|
||||
// open menu
|
||||
return pPlr->Menu.ActivateGoals(pPlr->Number, pPlr->LocalControl && !Game.Control.isReplay());
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <C4Random.h>
|
||||
#include <C4Components.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
@ -76,7 +77,7 @@ void C4Team::AddPlayer(C4PlayerInfo &rInfo, bool fAdjustPlayer)
|
|||
// and in actual player, if it is joined already
|
||||
if (rInfo.IsJoined())
|
||||
{
|
||||
C4Player *pJoinedPlr = Game.Players.GetByInfoID(rInfo.GetID());
|
||||
C4Player *pJoinedPlr = ::Players.GetByInfoID(rInfo.GetID());
|
||||
assert(pJoinedPlr);
|
||||
if (pJoinedPlr)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <C4Player.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -218,7 +219,7 @@ bool C4Video::AdjustPosition()
|
|||
// Get source player & viewport
|
||||
C4Viewport *pViewport = ::GraphicsSystem.GetFirstViewport();
|
||||
if (!pViewport) return false;
|
||||
C4Player *pPlr = Game.Players.Get(pViewport->GetPlayer());
|
||||
C4Player *pPlr = ::Players.Get(pViewport->GetPlayer());
|
||||
if (!pPlr) return false;
|
||||
// Set camera position
|
||||
X = int32_t(pPlr->ViewX - pViewport->ViewX + pViewport->DrawX - Width/2);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Landscape.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4PlayerList.h>
|
||||
#endif
|
||||
|
||||
#include <StdGL.h>
|
||||
|
@ -894,7 +895,7 @@ void C4Viewport::DrawCursorInfo(C4TargetFacet &cgo)
|
|||
|
||||
// Get cursor
|
||||
C4Object *cursor, *realcursor;
|
||||
C4Player *pPlr = Game.Players.Get(Player);
|
||||
C4Player *pPlr = ::Players.Get(Player);
|
||||
if (!pPlr) return;
|
||||
realcursor = pPlr->Cursor;
|
||||
if (!(cursor=pPlr->ViewCursor))
|
||||
|
@ -908,8 +909,8 @@ void C4Viewport::DrawCursorInfo(C4TargetFacet &cgo)
|
|||
C4ST_STARTNEW(ObjInfStat, "C4Viewport::DrawCursorInfo: Object info")
|
||||
ccgo.Set(cgo.Surface,cgo.X+C4SymbolBorder,cgo.Y+C4SymbolBorder,3*C4SymbolSize,C4SymbolSize);
|
||||
cursor->Info->Draw( ccgo,
|
||||
Config.Graphics.ShowPortraits, // && Game.Players.Get(Player)->CursorFlash,
|
||||
(cursor == Game.Players.Get(Player)->Captain), cursor );
|
||||
Config.Graphics.ShowPortraits, // && ::Players.Get(Player)->CursorFlash,
|
||||
(cursor == ::Players.Get(Player)->Captain), cursor );
|
||||
C4ST_STOP(ObjInfStat)
|
||||
}
|
||||
|
||||
|
@ -975,7 +976,7 @@ void C4Viewport::DrawMenu(C4TargetFacet &cgo)
|
|||
{
|
||||
|
||||
// Get player
|
||||
C4Player *pPlr = Game.Players.Get(Player);
|
||||
C4Player *pPlr = ::Players.Get(Player);
|
||||
|
||||
// Player eliminated
|
||||
if (pPlr && pPlr->Eliminated)
|
||||
|
@ -1059,7 +1060,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo, bool fDrawOverlay)
|
|||
}
|
||||
|
||||
// landscape mod by FoW
|
||||
C4Player *pPlr=Game.Players.Get(Player);
|
||||
C4Player *pPlr=::Players.Get(Player);
|
||||
if (pPlr && pPlr->fFogOfWar)
|
||||
{
|
||||
ClrModMap.Reset(Game.C4S.Landscape.FoWRes, Game.C4S.Landscape.FoWRes, ViewWdt, ViewHgt, int(cgo.TargetX*Zoom), int(cgo.TargetY*Zoom), 0, cgo.X-BorderLeft, cgo.Y-BorderTop, Game.FoWColor, cgo.Surface);
|
||||
|
@ -1198,7 +1199,7 @@ void C4Viewport::AdjustPosition()
|
|||
// View position
|
||||
if (PlayerLock && ValidPlr(Player))
|
||||
{
|
||||
C4Player *pPlr = Game.Players.Get(Player);
|
||||
C4Player *pPlr = ::Players.Get(Player);
|
||||
float iScrollRange = Min(ViewWdt/(10*Zoom),ViewHgt/(10*Zoom));
|
||||
float iExtraBoundsX = 0, iExtraBoundsY = 0;
|
||||
if(pPlr->ViewMode == C4PVM_Scrolling)
|
||||
|
@ -1331,7 +1332,7 @@ void C4Viewport::DrawPlayerInfo(C4TargetFacet &cgo)
|
|||
if (!ValidPlr(Player)) return;
|
||||
|
||||
// Wealth
|
||||
if (Game.Players.Get(Player)->ViewWealth || Config.Graphics.ShowPlayerInfoAlways)
|
||||
if (::Players.Get(Player)->ViewWealth || Config.Graphics.ShowPlayerInfoAlways)
|
||||
{
|
||||
int32_t wdt = C4SymbolSize;
|
||||
int32_t hgt = C4SymbolSize/2;
|
||||
|
@ -1339,11 +1340,11 @@ void C4Viewport::DrawPlayerInfo(C4TargetFacet &cgo)
|
|||
cgo.X+cgo.Wdt-wdt-C4SymbolBorder,
|
||||
cgo.Y+C4SymbolBorder,
|
||||
wdt,hgt);
|
||||
::GraphicsResource.fctWealth.DrawValue(ccgo,Game.Players.Get(Player)->Wealth, 0, Config.Graphics.Currency);
|
||||
::GraphicsResource.fctWealth.DrawValue(ccgo,::Players.Get(Player)->Wealth, 0, Config.Graphics.Currency);
|
||||
}
|
||||
|
||||
// Value gain
|
||||
if ( (Game.C4S.Game.ValueGain && Game.Players.Get(Player)->ViewValue)
|
||||
if ( (Game.C4S.Game.ValueGain && ::Players.Get(Player)->ViewValue)
|
||||
|| Config.Graphics.ShowPlayerInfoAlways)
|
||||
{
|
||||
int32_t wdt = C4SymbolSize;
|
||||
|
@ -1352,7 +1353,7 @@ void C4Viewport::DrawPlayerInfo(C4TargetFacet &cgo)
|
|||
cgo.X+cgo.Wdt-2*wdt-2*C4SymbolBorder,
|
||||
cgo.Y+C4SymbolBorder,
|
||||
wdt,hgt);
|
||||
::GraphicsResource.fctScore.DrawValue(ccgo,Game.Players.Get(Player)->ValueGain);
|
||||
::GraphicsResource.fctScore.DrawValue(ccgo,::Players.Get(Player)->ValueGain);
|
||||
}
|
||||
|
||||
// Crew
|
||||
|
@ -1364,7 +1365,7 @@ void C4Viewport::DrawPlayerInfo(C4TargetFacet &cgo)
|
|||
cgo.X+cgo.Wdt-3*wdt-3*C4SymbolBorder,
|
||||
cgo.Y+C4SymbolBorder,
|
||||
wdt,hgt);
|
||||
::GraphicsResource.fctCrewClr.DrawValue2Clr(ccgo,Game.Players.Get(Player)->SelectCount,Game.Players.Get(Player)->ActiveCrewCount(),Game.Players.Get(Player)->ColorDw);
|
||||
::GraphicsResource.fctCrewClr.DrawValue2Clr(ccgo,::Players.Get(Player)->SelectCount,::Players.Get(Player)->ActiveCrewCount(),::Players.Get(Player)->ColorDw);
|
||||
}
|
||||
|
||||
// Controls
|
||||
|
@ -1394,7 +1395,7 @@ BOOL C4Viewport::Init(CStdWindow * pParent, CStdApp * pApp, int32_t iPlayer)
|
|||
fIsNoOwnerViewport = (Player == NO_OWNER);
|
||||
// Create window
|
||||
pWindow = new C4ViewportWindow(this);
|
||||
if (!pWindow->Init(pApp, (Player==NO_OWNER) ? LoadResStr("IDS_CNS_VIEWPORT") : Game.Players.Get(Player)->GetName(), pParent, false))
|
||||
if (!pWindow->Init(pApp, (Player==NO_OWNER) ? LoadResStr("IDS_CNS_VIEWPORT") : ::Players.Get(Player)->GetName(), pParent, false))
|
||||
return FALSE;
|
||||
// Position and size
|
||||
pWindow->RestorePosition(FormatString("Viewport%i", Player+1).getData(), Config.GetSubkeyPath("Console"));
|
||||
|
@ -1414,7 +1415,7 @@ BOOL C4Viewport::Init(CStdWindow * pParent, CStdApp * pApp, int32_t iPlayer)
|
|||
StdStrBuf PlrControlKeyName(int32_t iPlayer, int32_t iControl, bool fShort)
|
||||
{
|
||||
// determine player
|
||||
C4Player *pPlr = Game.Players.Get(iPlayer);
|
||||
C4Player *pPlr = ::Players.Get(iPlayer);
|
||||
// player control
|
||||
if (pPlr)
|
||||
{
|
||||
|
@ -1445,11 +1446,11 @@ StdStrBuf PlrControlKeyName(int32_t iPlayer, int32_t iControl, bool fShort)
|
|||
void C4Viewport::DrawPlayerControls(C4TargetFacet &cgo)
|
||||
{
|
||||
if (!ValidPlr(Player)) return;
|
||||
if (!Game.Players.Get(Player)->ShowControl) return;
|
||||
if (!::Players.Get(Player)->ShowControl) return;
|
||||
int32_t size = Min( cgo.Wdt/3, 7*cgo.Hgt/24 );
|
||||
int32_t tx;
|
||||
int32_t ty;
|
||||
switch (Game.Players.Get(Player)->ShowControlPos)
|
||||
switch (::Players.Get(Player)->ShowControlPos)
|
||||
{
|
||||
case 1: // Position 1: bottom right corner
|
||||
tx = cgo.X+cgo.Wdt*3/4-size/2;
|
||||
|
@ -1472,8 +1473,8 @@ void C4Viewport::DrawPlayerControls(C4TargetFacet &cgo)
|
|||
ty = cgo.Y+15;
|
||||
break;
|
||||
}
|
||||
int32_t iShowCtrl = Game.Players.Get(Player)->ShowControl;
|
||||
int32_t iLastCtrl = Com2Control(Game.Players.Get(Player)->LastCom);
|
||||
int32_t iShowCtrl = ::Players.Get(Player)->ShowControl;
|
||||
int32_t iLastCtrl = Com2Control(::Players.Get(Player)->LastCom);
|
||||
int32_t scwdt=size/3,schgt=size/4;
|
||||
BOOL showtext;
|
||||
|
||||
|
@ -1497,7 +1498,7 @@ extern int32_t DrawMessageOffset;
|
|||
void C4Viewport::DrawPlayerStartup(C4TargetFacet &cgo)
|
||||
{
|
||||
C4Player *pPlr;
|
||||
if (!(pPlr = Game.Players.Get(Player))) return;
|
||||
if (!(pPlr = ::Players.Get(Player))) return;
|
||||
if (!pPlr->LocalControl || !pPlr->ShowStartup) return;
|
||||
int32_t iNameHgtOff=0;
|
||||
|
||||
|
@ -1544,7 +1545,7 @@ void C4Viewport::SetOutputSize(int32_t iDrawX, int32_t iDrawY, int32_t iOutX, in
|
|||
ResetMenuPositions=TRUE;
|
||||
// player uses mouse control? then clip the cursor
|
||||
C4Player *pPlr;
|
||||
if (pPlr=Game.Players.Get(Player))
|
||||
if (pPlr=::Players.Get(Player))
|
||||
if (pPlr->MouseControl)
|
||||
{
|
||||
::MouseControl.UpdateClip();
|
||||
|
@ -1587,7 +1588,7 @@ void C4Viewport::DrawMouseButtons(C4TargetFacet &cgo)
|
|||
void C4Viewport::DrawPlayerFogOfWar(C4TargetFacet &cgo)
|
||||
{
|
||||
/*
|
||||
C4Player *pPlr=Game.Players.Get(Player);
|
||||
C4Player *pPlr=::Players.Get(Player);
|
||||
if (!pPlr || !pPlr->FogOfWar) return;
|
||||
pPlr->FogOfWar->Draw(cgo);*/ // now done by modulation
|
||||
}
|
||||
|
@ -1595,14 +1596,14 @@ void C4Viewport::DrawPlayerFogOfWar(C4TargetFacet &cgo)
|
|||
void C4Viewport::NextPlayer()
|
||||
{
|
||||
C4Player *pPlr; int32_t iPlr;
|
||||
if (!(pPlr = Game.Players.Get(Player)))
|
||||
if (!(pPlr = ::Players.Get(Player)))
|
||||
{
|
||||
if (!(pPlr = Game.Players.First)) return;
|
||||
if (!(pPlr = ::Players.First)) return;
|
||||
}
|
||||
else
|
||||
if (!(pPlr = pPlr->Next))
|
||||
if (Game.C4S.Head.Film && Game.C4S.Head.Replay)
|
||||
pPlr = Game.Players.First; // cycle to first in film mode only; in network obs mode allow NO_OWNER-view
|
||||
pPlr = ::Players.First; // cycle to first in film mode only; in network obs mode allow NO_OWNER-view
|
||||
if (pPlr) iPlr = pPlr->Number; else iPlr = NO_OWNER;
|
||||
if (iPlr != Player) Init(iPlr, true);
|
||||
}
|
||||
|
@ -1611,7 +1612,7 @@ bool C4Viewport::IsViewportMenu(class C4Menu *pMenu)
|
|||
{
|
||||
// check all associated menus
|
||||
// Get player
|
||||
C4Player *pPlr = Game.Players.Get(Player);
|
||||
C4Player *pPlr = ::Players.Get(Player);
|
||||
// Player eliminated: No menu
|
||||
if (pPlr && pPlr->Eliminated) return false;
|
||||
// Player cursor object menu
|
||||
|
|
Loading…
Reference in New Issue