Skip to content

Commit

Permalink
Version 1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Freekers committed Apr 27, 2020
1 parent 158c1e3 commit cb49e98
Show file tree
Hide file tree
Showing 150 changed files with 8,099 additions and 10,386 deletions.
12 changes: 6 additions & 6 deletions AKAListEntry.cpp
Expand Up @@ -31,8 +31,8 @@ wxString AKAListEntry::SQLCreateTable()
"playerindex integer,"
"%s"
")",
SQLTableName().GetData(),
StatsgenDatabase::StringFieldDefinition("name","akaname",FIELD_WIDTH_PLAYER_NAME).GetData()
STRING_TO_CHAR(SQLTableName()),
STRING_TO_CHAR(StatsgenDatabase::StringFieldDefinition("name","akaname",FIELD_WIDTH_PLAYER_NAME))
);

return SQL;
Expand All @@ -54,18 +54,18 @@ bool AKAListEntry::WriteToDatabase()
"where "
"playerindex='%d' and "
"name='%s'",
SQLTableName().GetData(),
STRING_TO_CHAR(SQLTableName()),
actualPlayerIndex,
StatsgenDatabase::SafeForInsert(name).GetData());
STRING_TO_CHAR(StatsgenDatabase::SafeForInsert(name)));
globalStatistics.statsgenDatabase.SimpleExecute(SQL);

}
SQL.Printf("Insert into %s"
"(playerindex,name)"
"values('%d','%s')",
SQLTableName().GetData(),
STRING_TO_CHAR(SQLTableName()),
actualPlayerIndex,
StatsgenDatabase::SafeForInsert(name).GetData());
STRING_TO_CHAR(StatsgenDatabase::SafeForInsert(name)));

globalStatistics.statsgenDatabase.SimpleExecute(SQL);
return retVal;
Expand Down
4 changes: 2 additions & 2 deletions ActionData.cpp
Expand Up @@ -35,7 +35,7 @@ wxString ActionData::SQLCreateTable()
"playerteam integer,"
"action integer"
")",
SQLTableName().GetData());
STRING_TO_CHAR(SQLTableName()));

return SQL;
}
Expand All @@ -51,7 +51,7 @@ bool ActionData::WriteToDatabase(int roundIndex,int itemIndex)
SQL.Printf("Insert into %s"
"(roundindex,actionidx,playerindex,playerclass,playerteam,action)"
"values('%d','%d','%d','%d','%d','%d')",
SQLTableName().GetData(),
STRING_TO_CHAR(SQLTableName()),
roundIndex,
itemIndex,
player.actualPlayerIndex,
Expand Down
42 changes: 11 additions & 31 deletions AliasDialog.cpp
Expand Up @@ -22,16 +22,13 @@ AliasDialog::AliasDialog(wxWindow *parent,
style,
name)
{
panel=new AliasEditorPanel();
panel->Create(this,
-1,
wxDefaultPosition,
wxDefaultSize);
mPanel = new AliasEditorPanel();
mPanel->Create(this,wxID_ANY);
}

bool AliasDialog::DisplayDialog()
{
return (GenericOKCancelDialog::DisplayDialog((wxPanel *)panel));
return (GenericOKCancelDialog::DisplayDialog((wxPanel *)mPanel));
}

AliasDialog::~AliasDialog()
Expand All @@ -49,7 +46,7 @@ void AliasDialog::CreateDialog()
wxSize configItemsSize=wxDefaultSize;

STATSGEN_DEBUG_FUNCTION_START("AliasDialog","CreateDialog")
autoButton.Create(this,
mAutoButton.Create(this,
WINDOW_ID_BUTTON_AUTO,
_T(WINDOW_ID_BUTTON_AUTO_TEXT),
wxDefaultPosition);
Expand All @@ -58,30 +55,13 @@ void AliasDialog::CreateDialog()
STATSGEN_DEBUG_FUNCTION_END
}

void AliasDialog::OnResize(wxSizeEvent &event)
void AliasDialog::ControlsSizerPre()
{
wxString msg;
int saveWidth;
wxSize itemSize;

wxPoint itemPosition;
STATSGEN_DEBUG_FUNCTION_START("AliasDialog","OnResize")

GenericOKCancelDialog::OnResize(event);

STATSGEN_DEBUG(DEBUG_ALWAYS,"Generic Resize Done")
// Auto button
itemSize=quitButton.GetSize();
itemPosition=quitButton.GetPosition();
itemPosition.x+=(itemSize.GetWidth()+BUTTON_WIDTH_GAP);
STATSGEN_DEBUG_CODE(msg.Printf("AUTO POSITION X=[%d] Y=[%d]",itemPosition.x,itemPosition.y);)
STATSGEN_DEBUG(DEBUG_ALWAYS,msg);
itemSize=autoButton.GetSize();
STATSGEN_DEBUG_CODE(msg.Printf("AUTO SIZE=[%d] HEIGHT=[%d]",itemSize.GetWidth(),itemSize.GetWidth());)
STATSGEN_DEBUG(DEBUG_ALWAYS,msg);
autoButton.SetPosition(itemPosition);
mControlsSizer->Add(&mAutoButton);
}

STATSGEN_DEBUG_FUNCTION_END
void AliasDialog::ControlsSizerPost()
{
}

void AliasDialog::OnAuto(wxCommandEvent &event)
Expand All @@ -99,7 +79,7 @@ void AliasDialog::OnAuto(wxCommandEvent &event)
wxString childName;
AliasListEntry aliasEntry;

panel->GetShownPlayers(shownPlayers);
mPanel->GetShownPlayers(shownPlayers);
shownCount=shownPlayers.GetCount();
for (shownIndex=0;shownIndex<shownCount;shownIndex++)
{
Expand Down Expand Up @@ -132,7 +112,7 @@ void AliasDialog::OnAuto(wxCommandEvent &event)

}

panel->RefreshAliasTree();
mPanel->RefreshAliasTree();
// TEMP FOR TEST
//globalStatistics.WriteAliasList();
//globalStatistics.configData.CommitChanges();
Expand Down
7 changes: 4 additions & 3 deletions AliasDialog.h
Expand Up @@ -22,17 +22,18 @@ class AliasDialog : public GenericOKCancelDialog

virtual ~AliasDialog();

virtual void OnResize(wxSizeEvent& event);
virtual void OnAuto(wxCommandEvent& event);
virtual void OnSave(wxCommandEvent& event);
virtual void CreateDialog();
virtual bool DisplayDialog();
virtual void ControlsSizerPre();
virtual void ControlsSizerPost();

protected:

private:
AliasEditorPanel *panel;
wxButton autoButton;
AliasEditorPanel *mPanel;
wxButton mAutoButton;
DECLARE_EVENT_TABLE()
};

Expand Down
79 changes: 23 additions & 56 deletions AliasEditorPanel.cpp
Expand Up @@ -10,7 +10,6 @@
#include "StaticFunctions.h"

BEGIN_EVENT_TABLE(AliasEditorPanel, wxPanel)
EVT_SIZE(AliasEditorPanel::OnResize)
EVT_TREE_ITEM_RIGHT_CLICK(WINDOW_ID_ALIASTREE,
AliasEditorPanel::OnAliasRightClick)
EVT_LIST_ITEM_RIGHT_CLICK(WINDOW_ID_PLAYERCACHE,
Expand Down Expand Up @@ -53,70 +52,38 @@ wxPanel::Create( parent, id,
name);
playerCache=new PlayerCachePanel(dummyConfigKey,labelText);
playerCache->SetFilterType(PlayerCachePanel::FILTER_TYPE_NO_CASE);
playerCache->Create(this,
WINDOW_ID_PLAYERCACHE,
wxDefaultPosition,
wxDefaultSize);
playerCache->CreateScreen(this, WINDOW_ID_PLAYERCACHE);
aliasList=new wxTreeCtrl(this,
WINDOW_ID_ALIASTREE,
wxDefaultPosition,
wxDefaultSize,
treeCtrlStyle,
wxDefaultValidator);
aliasConfigs=new GroupedConfigItemsPanel("Alias");
aliasConfigs->Create(this,WINDOW_ID_TEXTCTRL_CONFIGVALUE,wxDefaultPosition,wxDefaultSize);
aliasConfigs=new GroupedConfigItemsPanel((char *)"Alias");
aliasConfigs->CreateDisplay(this,WINDOW_ID_TEXTCTRL_CONFIGVALUE);
configKey=globalStatistics.AutomaticAliasConfigKey();
aliasConfigs->AddBoolean("Use Automatic Aliasing During Log Processing",
aliasConfigs->AddBoolean((char *)"Use Automatic Aliasing During Log Processing",
configKey,
false);
configKey="/tmp/aliasfilter";
aliasConfigs->Add("Alias List Player Filter",
aliasConfigs->Add((char *)"Alias List Player Filter",
configKey,
"",
(char *)"",
-1);
playerCache->SetFilterCallBack(FilterNameCallBack);
RefreshAliasTree();

return (true);
}
mAliasListSizer = new wxBoxSizer(wxHORIZONTAL);
mAliasListSizer->Add(aliasList,1,wxEXPAND);
mAliasListSizer->Add(playerCache,2,wxEXPAND);

void AliasEditorPanel::OnResize(wxSizeEvent &event)
{
wxSize itemSize;
int playerCacheWidth;
int playerCacheHeight;
int panelWidth;
int panelHeight;
int aliasWidth;
int aliasHeight;
int aliasConfigsHeight;
int aliasConfigsWidth;
wxString msg;


itemSize=GetSize();
panelWidth=itemSize.GetWidth();
panelHeight=itemSize.GetHeight();
playerCacheWidth=(panelWidth*3)/5;
playerCacheHeight=panelHeight;
aliasWidth=panelWidth-playerCacheWidth;
aliasHeight=panelHeight;

if (aliasList!=NULL)
{
aliasConfigsHeight=20;
aliasConfigsWidth=panelWidth;
aliasConfigs->SetSize(0,0,aliasConfigsWidth,aliasConfigsHeight);
itemSize=aliasConfigs->GetSize();
aliasConfigsHeight=itemSize.GetHeight()+20;
aliasConfigsHeight=aliasConfigs->PreferredHeight();
aliasHeight-=aliasConfigsHeight;
playerCacheHeight-=aliasConfigsHeight;
aliasConfigs->SetSize(0,0,aliasConfigsWidth,aliasConfigsHeight);
aliasList->SetSize(0,aliasConfigsHeight,aliasWidth,aliasHeight);
playerCache->SetSize(aliasWidth,aliasConfigsHeight,playerCacheWidth,playerCacheHeight);
}
mMainSizer = new wxBoxSizer(wxVERTICAL);
mMainSizer->Add(aliasConfigs,0,wxEXPAND);
mMainSizer->Add(mAliasListSizer,1,wxEXPAND);

SetSizer(mMainSizer);
mMainSizer->SetSizeHints(this);
return (true);
}

wxTreeItemId AliasEditorPanel::AddPlayerToTree(
Expand All @@ -131,8 +98,8 @@ wxTreeItemId AliasEditorPanel::AddPlayerToTree(
bool found=false;

playerString.Printf("(%s) %s",
guid.GetData(),
name.GetData());
STRING_TO_CHAR(guid),
STRING_TO_CHAR(name));

found=false;

Expand Down Expand Up @@ -349,7 +316,7 @@ void AliasEditorPanel::AddAliasTree(wxTreeItemId &parentItem)
childItem=aliasList->GetFirstChild(parentItem,cookie);
while (childItem.IsOk())
{
STATSGEN_DEBUG(DEBUG_ALWAYS,"Adding alias to global area")
STATSGEN_DEBUG(DEBUG_ALWAYS,(char *)"Adding alias to global area")
AliasItemSplit(childItem,aliasEntry);
globalStatistics.AddAlias(aliasEntry);
childItem=aliasList->GetNextChild(parentItem,cookie);
Expand Down Expand Up @@ -387,7 +354,7 @@ void AliasEditorPanel::OnPopupMenu(wxCommandEvent &event)
switch (event.GetId())
{
case ALIAS_POPUP_DELETE_PARENT:
STATSGEN_DEBUG(DEBUG_ALWAYS,"Delete Parent")
STATSGEN_DEBUG(DEBUG_ALWAYS,(char *)"Delete Parent")
parentItem=selectedAlias;
childItem=aliasList->GetFirstChild(parentItem,cookie);
while (childItem.IsOk())
Expand All @@ -401,14 +368,14 @@ void AliasEditorPanel::OnPopupMenu(wxCommandEvent &event)
playerCache->ApplyFilter();
break;
case ALIAS_POPUP_DELETE_CHILD:
STATSGEN_DEBUG(DEBUG_ALWAYS,"Delete Child")
STATSGEN_DEBUG(DEBUG_ALWAYS,(char *)"Delete Child")
childItem=selectedAlias;
parentItem=aliasList->GetItemParent(childItem);
DeleteAlias(parentItem,childItem);
playerCache->ApplyFilter();
break;
case ALIAS_POPUP_REPARENT:
STATSGEN_DEBUG(DEBUG_ALWAYS,"Reparent")
STATSGEN_DEBUG(DEBUG_ALWAYS,(char *)"Reparent")
childItem=selectedAlias;
parentItem=aliasList->GetItemParent(childItem);

Expand All @@ -432,7 +399,7 @@ void AliasEditorPanel::OnPopupMenu(wxCommandEvent &event)
playerCache->ApplyFilter();
break;
case PLAYER_POPUP_NEW_ALIAS:
STATSGEN_DEBUG(DEBUG_ALWAYS,"New Alias")
STATSGEN_DEBUG(DEBUG_ALWAYS,(char *)"New Alias")
if (cacheCount>1)
{
// Need at least 2 entries selected to create a new alias
Expand All @@ -454,7 +421,7 @@ void AliasEditorPanel::OnPopupMenu(wxCommandEvent &event)
}
break;
case PLAYER_POPUP_ADD_ALIAS:
STATSGEN_DEBUG(DEBUG_ALWAYS,"Add Alias")
STATSGEN_DEBUG(DEBUG_ALWAYS,(char *)"Add Alias")
childItem=selectedAlias;
if (childItem.IsOk())
{
Expand Down
3 changes: 2 additions & 1 deletion AliasEditorPanel.h
Expand Up @@ -21,7 +21,6 @@ class AliasEditorPanel : public wxPanel
const wxSize &size=wxDefaultSize,
long style=wxTAB_TRAVERSAL,
const wxString &name="panel");
void OnResize(wxSizeEvent &event);
void OnAliasRightClick(wxTreeEvent &event);
void OnPlayerRightClick(wxListEvent &event);
void OnPopupMenu(wxCommandEvent &event);
Expand Down Expand Up @@ -59,6 +58,8 @@ static bool FilterNameCallBack(wxString &name);
wxTreeCtrl *aliasList;
GroupedConfigItemsPanel *aliasConfigs;
wxString aliasFilter;
wxBoxSizer *mMainSizer;
wxBoxSizer *mAliasListSizer;
DECLARE_EVENT_TABLE()
};

Expand Down
16 changes: 8 additions & 8 deletions AliasListEntry.cpp
Expand Up @@ -33,10 +33,10 @@ void AliasListEntry::ReadFromFile(wxTextFile *fp,int index)
void AliasListEntry::WriteToFile(FILE *fp)
{
fprintf(fp,"%s,%s\n%s,%s\n",
primaryGUID.GetData(),
primaryName.GetData(),
aliasGUID.GetData(),
aliasName.GetData());
STRING_TO_CHAR(primaryGUID),
STRING_TO_CHAR(primaryName),
STRING_TO_CHAR(aliasGUID),
STRING_TO_CHAR(aliasName));
}

int AliasListEntry::UpdateInDatabase()
Expand Down Expand Up @@ -140,10 +140,10 @@ int AliasListEntry::UpdateInDatabase()
tableName=tablesNeedingUpdate.Item(tableIndex);
fieldName=fieldsNeedingUpdate.Item(tableIndex);
sql.Printf("update %s set %s=%d where %s=%d",
tableName.GetData(),
fieldName.GetData(),
STRING_TO_CHAR(tableName),
STRING_TO_CHAR(fieldName),
primaryPlayer.actualPlayerIndex,
fieldName.GetData(),
STRING_TO_CHAR(fieldName),
secondaryPlayer.actualPlayerIndex);
globalStatistics.statsgenDatabase.SimpleExecute(sql);
}
Expand All @@ -161,7 +161,7 @@ int AliasListEntry::UpdateInDatabase()
// The secondary name is in the database - but no primary
// so all we have to do is update the name
sql.Printf("update player set name='%s' where playerindex='%d'",
StatsgenDatabase::SafeForInsert(primaryName).GetData(),
STRING_TO_CHAR(StatsgenDatabase::SafeForInsert(primaryName)),
secondaryPlayer.actualPlayerIndex);
globalStatistics.statsgenDatabase.SimpleExecute(sql);
}
Expand Down

0 comments on commit cb49e98

Please sign in to comment.