beginning of new resource multiplier. Still work in progress but hopefully ready to test some things.
This commit is contained in:
parent
9d9fa0deeb
commit
2440d475b3
|
@ -36,6 +36,7 @@ private:
|
|||
string networkPlayerNames[GameConstants::maxPlayers];
|
||||
|
||||
ControlType factionControls[GameConstants::maxPlayers];
|
||||
float resourceMultiplier[GameConstants::maxPlayers];
|
||||
|
||||
int thisFactionIndex;
|
||||
int factionCount;
|
||||
|
@ -73,6 +74,7 @@ public:
|
|||
factionTypeNames[i] = "";
|
||||
networkPlayerNames[i] = "";
|
||||
factionControls[i] = ctClosed;
|
||||
resourceMultiplier[i] = 1.0f;
|
||||
teams[i] = 0;
|
||||
startLocationIndex[i] = i;
|
||||
}
|
||||
|
@ -100,6 +102,7 @@ public:
|
|||
return result;
|
||||
}
|
||||
ControlType getFactionControl(int factionIndex) const {return factionControls[factionIndex];}
|
||||
float getResourceMultiplier(int factionIndex) const {return resourceMultiplier[factionIndex];}
|
||||
|
||||
bool isNetworkGame() const {
|
||||
bool result = false;
|
||||
|
@ -140,6 +143,8 @@ public:
|
|||
void setFactionTypeName(int factionIndex, const string& factionTypeName) {this->factionTypeNames[factionIndex]= factionTypeName;}
|
||||
void setNetworkPlayerName(int factionIndex,const string& playername) {this->networkPlayerNames[factionIndex]= playername;}
|
||||
void setFactionControl(int factionIndex, ControlType controller) {this->factionControls[factionIndex]= controller;}
|
||||
void setResourceMultiplier(int factionIndex, float multiplier) {this->resourceMultiplier[factionIndex]= multiplier;}
|
||||
|
||||
void setThisFactionIndex(int thisFactionIndex) {this->thisFactionIndex= thisFactionIndex;}
|
||||
void setFactionCount(int factionCount) {this->factionCount= factionCount;}
|
||||
void setTeam(int factionIndex, int team) {this->teams[factionIndex]= team;}
|
||||
|
@ -175,6 +180,7 @@ public:
|
|||
result += "networkPlayerName = " + networkPlayerNames[idx] + "\n";
|
||||
|
||||
result += "factionControl = " + intToStr(factionControls[idx]) + "\n";
|
||||
result += "resourceMultiplier = " + intToStr(resourceMultiplier[idx]) + "\n";
|
||||
result += "team = " + intToStr(teams[idx]) + "\n";
|
||||
result += "startLocationIndex = " + intToStr(startLocationIndex[idx]) + "\n";
|
||||
}
|
||||
|
|
|
@ -68,6 +68,8 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
lastSetChangedGameSettings = time(NULL);
|
||||
showFullConsole=false;
|
||||
|
||||
rMultiplierOffset=0.5f;
|
||||
|
||||
currentFactionName="";
|
||||
currentMap="";
|
||||
settingsReceivedFromServer=false;
|
||||
|
@ -87,7 +89,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
enableFactionTexturePreview = config.getBool("FactionPreview","true");
|
||||
enableMapPreview = config.getBool("MapPreview","true");
|
||||
|
||||
vector<string> teamItems, controlItems, results;
|
||||
vector<string> teamItems, controlItems, results, rMultiplier;
|
||||
int setupPos=590;
|
||||
int mapHeadPos=330;
|
||||
int mapPos=mapHeadPos-30;
|
||||
|
@ -252,46 +254,54 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//list boxes
|
||||
xoffset=120;
|
||||
xoffset=100;
|
||||
int rowHeight=27;
|
||||
for(int i=0; i<GameConstants::maxPlayers; ++i){
|
||||
labelPlayers[i].registerGraphicComponent(containerName,"labelPlayers" + intToStr(i));
|
||||
labelPlayers[i].init(xoffset+50, setupPos-30-i*rowHeight);
|
||||
labelPlayers[i].init(xoffset+0, setupPos-30-i*rowHeight);
|
||||
labelPlayers[i].setEditable(false);
|
||||
|
||||
labelPlayerNames[i].registerGraphicComponent(containerName,"labelPlayerNames" + intToStr(i));
|
||||
labelPlayerNames[i].init(xoffset+100,setupPos-30-i*rowHeight);
|
||||
labelPlayerNames[i].init(xoffset+50,setupPos-30-i*rowHeight);
|
||||
|
||||
listBoxControls[i].registerGraphicComponent(containerName,"listBoxControls" + intToStr(i));
|
||||
listBoxControls[i].init(xoffset+200, setupPos-30-i*rowHeight);
|
||||
listBoxControls[i].init(xoffset+210, setupPos-30-i*rowHeight);
|
||||
listBoxControls[i].setEditable(false);
|
||||
|
||||
listBoxRMultiplier[i].registerGraphicComponent(containerName,"listBoxRMultiplier" + intToStr(i));
|
||||
listBoxRMultiplier[i].init(xoffset+350, setupPos-30-i*rowHeight,70);
|
||||
listBoxRMultiplier[i].setEditable(false);
|
||||
|
||||
listBoxFactions[i].registerGraphicComponent(containerName,"listBoxFactions" + intToStr(i));
|
||||
listBoxFactions[i].init(xoffset+350, setupPos-30-i*rowHeight);
|
||||
listBoxFactions[i].init(xoffset+430, setupPos-30-i*rowHeight);
|
||||
listBoxFactions[i].setEditable(false);
|
||||
|
||||
listBoxTeams[i].registerGraphicComponent(containerName,"listBoxTeams" + intToStr(i));
|
||||
listBoxTeams[i].init(xoffset+520, setupPos-30-i*rowHeight, 60);
|
||||
listBoxTeams[i].init(xoffset+590, setupPos-30-i*rowHeight, 60);
|
||||
listBoxTeams[i].setEditable(false);
|
||||
|
||||
labelNetStatus[i].registerGraphicComponent(containerName,"labelNetStatus" + intToStr(i));
|
||||
labelNetStatus[i].init(xoffset+600, setupPos-30-i*rowHeight, 60);
|
||||
labelNetStatus[i].init(xoffset+670, setupPos-30-i*rowHeight, 60);
|
||||
|
||||
grabSlotButton[i].registerGraphicComponent(containerName,"grabSlotButton" + intToStr(i));
|
||||
grabSlotButton[i].init(xoffset+600, setupPos-30-i*rowHeight, 30);
|
||||
grabSlotButton[i].init(xoffset+670, setupPos-30-i*rowHeight, 30);
|
||||
grabSlotButton[i].setText(">");
|
||||
}
|
||||
|
||||
labelControl.registerGraphicComponent(containerName,"labelControl");
|
||||
labelControl.init(xoffset+200, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||
labelControl.init(xoffset+210, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||
labelControl.setText(lang.get("Control"));
|
||||
|
||||
labelRMultiplier.registerGraphicComponent(containerName,"labelRMultiplier");
|
||||
labelRMultiplier.init(xoffset+350, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||
//labelRMultiplier.setText(lang.get("RMultiplier"));
|
||||
|
||||
labelFaction.registerGraphicComponent(containerName,"labelFaction");
|
||||
labelFaction.init(xoffset+350, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||
labelFaction.init(xoffset+430, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||
labelFaction.setText(lang.get("Faction"));
|
||||
|
||||
labelTeam.registerGraphicComponent(containerName,"labelTeam");
|
||||
labelTeam.init(xoffset+520, setupPos, 60, GraphicListBox::defH, true);
|
||||
labelTeam.init(xoffset+590, setupPos, 60, GraphicListBox::defH, true);
|
||||
labelTeam.setText(lang.get("Team"));
|
||||
|
||||
labelControl.setFont(CoreData::getInstance().getMenuFontBig());
|
||||
|
@ -310,6 +320,10 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
controlItems.push_back(lang.get("Network"));
|
||||
controlItems.push_back(lang.get("Human"));
|
||||
|
||||
for(int i=0; i<45; ++i){
|
||||
rMultiplier.push_back(floatToStr(rMultiplierOffset+0.1f*i));
|
||||
}
|
||||
|
||||
if(config.getBool("EnableNetworkCpu","false") == true) {
|
||||
controlItems.push_back(lang.get("NetworkCpuEasy"));
|
||||
controlItems.push_back(lang.get("NetworkCpu"));
|
||||
|
@ -331,6 +345,9 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
listBoxTeams[i].setItems(teamItems);
|
||||
listBoxTeams[i].setSelectedItemIndex(i);
|
||||
listBoxControls[i].setItems(controlItems);
|
||||
listBoxRMultiplier[i].setItems(rMultiplier);
|
||||
listBoxRMultiplier[i].setSelectedItemIndex(5);
|
||||
|
||||
labelNetStatus[i].setText("V");
|
||||
}
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@ -588,6 +605,7 @@ void MenuStateConnectedGame::render() {
|
|||
|
||||
renderer.renderListBox(&listBoxControls[i]);
|
||||
if(listBoxControls[i].getSelectedItemIndex()!=ctClosed){
|
||||
renderer.renderListBox(&listBoxRMultiplier[i]);
|
||||
renderer.renderListBox(&listBoxFactions[i]);
|
||||
renderer.renderListBox(&listBoxTeams[i]);
|
||||
//renderer.renderLabel(&labelNetStatus[i]);
|
||||
|
@ -619,6 +637,7 @@ void MenuStateConnectedGame::render() {
|
|||
renderer.renderLabel(&labelTileset);
|
||||
renderer.renderLabel(&labelTechTree);
|
||||
renderer.renderLabel(&labelControl);
|
||||
//renderer.renderLabel(&labelRMultiplier);
|
||||
renderer.renderLabel(&labelFaction);
|
||||
renderer.renderLabel(&labelTeam);
|
||||
renderer.renderLabel(&labelMapInfo);
|
||||
|
@ -987,6 +1006,7 @@ void MenuStateConnectedGame::update() {
|
|||
for(int i=0; i<gameSettings->getFactionCount(); ++i){
|
||||
int slot=gameSettings->getStartLocationIndex(i);
|
||||
listBoxControls[slot].setSelectedItemIndex(gameSettings->getFactionControl(i),errorOnMissingData);
|
||||
listBoxRMultiplier[slot].setSelectedItemIndex((gameSettings->getResourceMultiplier(i)-rMultiplierOffset)*10);
|
||||
listBoxTeams[slot].setSelectedItemIndex(gameSettings->getTeam(i),errorOnMissingData);
|
||||
//listBoxFactions[slot].setSelectedItem(formatString(gameSettings->getFactionTypeName(i)),errorOnMissingData);
|
||||
listBoxFactions[slot].setSelectedItem(formatString(gameSettings->getFactionTypeName(i)),false);
|
||||
|
|
|
@ -36,6 +36,7 @@ private:
|
|||
GraphicButton buttonDisconnect;
|
||||
GraphicButton buttonPlayNow;
|
||||
GraphicLabel labelControl;
|
||||
GraphicLabel labelRMultiplier;
|
||||
GraphicLabel labelFaction;
|
||||
GraphicLabel labelTeam;
|
||||
GraphicLabel labelMap;
|
||||
|
@ -79,6 +80,7 @@ private:
|
|||
GraphicLabel labelPlayers[GameConstants::maxPlayers];
|
||||
GraphicLabel labelPlayerNames[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxControls[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxRMultiplier[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxFactions[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxTeams[GameConstants::maxPlayers];
|
||||
GraphicLabel labelNetStatus[GameConstants::maxPlayers];
|
||||
|
@ -133,6 +135,7 @@ private:
|
|||
|
||||
std::vector<std::string> tileSets;
|
||||
|
||||
float rMultiplierOffset;
|
||||
public:
|
||||
|
||||
MenuStateConnectedGame(Program *program, MainMenu *mainMenu, JoinMenu joinMenuInfo=jmSimple, bool openNetworkSlots= false);
|
||||
|
|
|
@ -60,6 +60,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||
currentTechName_factionPreview="";
|
||||
currentFactionName_factionPreview="";
|
||||
mapPreviewTexture=NULL;
|
||||
|
||||
rMultiplierOffset=0.5f;
|
||||
|
||||
publishToMasterserverThread = NULL;
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
@ -111,7 +113,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||
lastNetworkPing = 0;
|
||||
soundConnectionCount=0;
|
||||
|
||||
vector<string> teamItems, controlItems, results;
|
||||
vector<string> teamItems, controlItems, results , rMultiplier;
|
||||
|
||||
//create
|
||||
buttonReturn.registerGraphicComponent(containerName,"buttonReturn");
|
||||
|
@ -349,41 +351,49 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||
|
||||
|
||||
//list boxes
|
||||
xoffset=120;
|
||||
xoffset=100;
|
||||
int rowHeight=27;
|
||||
for(int i=0; i<GameConstants::maxPlayers; ++i){
|
||||
labelPlayers[i].registerGraphicComponent(containerName,"labelPlayers" + intToStr(i));
|
||||
labelPlayers[i].init(xoffset+50, setupPos-30-i*rowHeight);
|
||||
labelPlayers[i].init(xoffset+0, setupPos-30-i*rowHeight);
|
||||
|
||||
labelPlayerNames[i].registerGraphicComponent(containerName,"labelPlayerNames" + intToStr(i));
|
||||
labelPlayerNames[i].init(xoffset+100,setupPos-30-i*rowHeight);
|
||||
|
||||
labelPlayerNames[i].init(xoffset+50,setupPos-30-i*rowHeight);
|
||||
|
||||
listBoxControls[i].registerGraphicComponent(containerName,"listBoxControls" + intToStr(i));
|
||||
listBoxControls[i].init(xoffset+200, setupPos-30-i*rowHeight);
|
||||
|
||||
listBoxControls[i].init(xoffset+210, setupPos-30-i*rowHeight);
|
||||
|
||||
listBoxRMultiplier[i].registerGraphicComponent(containerName,"listBoxRMultiplier" + intToStr(i));
|
||||
listBoxRMultiplier[i].init(xoffset+350, setupPos-30-i*rowHeight,70);
|
||||
|
||||
listBoxFactions[i].registerGraphicComponent(containerName,"listBoxFactions" + intToStr(i));
|
||||
listBoxFactions[i].init(xoffset+350, setupPos-30-i*rowHeight, 150);
|
||||
listBoxFactions[i].init(xoffset+430, setupPos-30-i*rowHeight, 150);
|
||||
|
||||
listBoxTeams[i].registerGraphicComponent(containerName,"listBoxTeams" + intToStr(i));
|
||||
listBoxTeams[i].init(xoffset+520, setupPos-30-i*rowHeight, 60);
|
||||
listBoxTeams[i].init(xoffset+590, setupPos-30-i*rowHeight, 60);
|
||||
|
||||
labelNetStatus[i].registerGraphicComponent(containerName,"labelNetStatus" + intToStr(i));
|
||||
labelNetStatus[i].init(xoffset+600, setupPos-30-i*rowHeight, 60);
|
||||
labelNetStatus[i].init(xoffset+670, setupPos-30-i*rowHeight, 60);
|
||||
}
|
||||
|
||||
labelControl.registerGraphicComponent(containerName,"labelControl");
|
||||
labelControl.init(xoffset+200, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||
labelControl.registerGraphicComponent(containerName,"labelControl");
|
||||
labelControl.init(xoffset+210, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||
labelControl.setText(lang.get("Control"));
|
||||
|
||||
labelRMultiplier.registerGraphicComponent(containerName,"labelRMultiplier");
|
||||
labelRMultiplier.init(xoffset+350, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||
//labelRMultiplier.setText(lang.get("RMultiplier"));
|
||||
|
||||
labelFaction.registerGraphicComponent(containerName,"labelFaction");
|
||||
labelFaction.init(xoffset+350, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||
labelFaction.init(xoffset+430, setupPos, GraphicListBox::defW, GraphicListBox::defH, true);
|
||||
labelFaction.setText(lang.get("Faction"));
|
||||
|
||||
labelTeam.registerGraphicComponent(containerName,"labelTeam");
|
||||
labelTeam.init(xoffset+520, setupPos, 50, GraphicListBox::defH, true);
|
||||
labelTeam.init(xoffset+590, setupPos, 50, GraphicListBox::defH, true);
|
||||
labelTeam.setText(lang.get("Team"));
|
||||
|
||||
labelControl.setFont(CoreData::getInstance().getMenuFontBig());
|
||||
labelRMultiplier.setFont(CoreData::getInstance().getMenuFontBig());
|
||||
labelFaction.setFont(CoreData::getInstance().getMenuFontBig());
|
||||
labelTeam.setFont(CoreData::getInstance().getMenuFontBig());
|
||||
|
||||
|
@ -399,7 +409,11 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||
controlItems.push_back(lang.get("CpuMega"));
|
||||
controlItems.push_back(lang.get("Network"));
|
||||
controlItems.push_back(lang.get("Human"));
|
||||
|
||||
|
||||
for(int i=0; i<45; ++i){
|
||||
rMultiplier.push_back(floatToStr(rMultiplierOffset+0.1f*i));
|
||||
}
|
||||
|
||||
if(config.getBool("EnableNetworkCpu","false") == true) {
|
||||
controlItems.push_back(lang.get("NetworkCpuEasy"));
|
||||
controlItems.push_back(lang.get("NetworkCpu"));
|
||||
|
@ -439,6 +453,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||
lastSelectedTeamIndex[i] = listBoxTeams[i].getSelectedItemIndex();
|
||||
|
||||
listBoxControls[i].setItems(controlItems);
|
||||
listBoxRMultiplier[i].setItems(rMultiplier);
|
||||
listBoxRMultiplier[i].setSelectedItemIndex(5);
|
||||
labelNetStatus[i].setText("");
|
||||
}
|
||||
|
||||
|
@ -778,6 +794,11 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
else {
|
||||
for(int i=0; i<mapInfo.players; ++i) {
|
||||
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||
|
||||
// set multiplier
|
||||
if(listBoxRMultiplier[i].mouseClick(x, y)) {
|
||||
}
|
||||
|
||||
//ensure thet only 1 human player is present
|
||||
if(listBoxControls[i].mouseClick(x, y)) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@ -1082,6 +1103,7 @@ void MenuStateCustomGame::mouseMove(int x, int y, const MouseState *ms){
|
|||
|
||||
bool editingPlayerName = false;
|
||||
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
||||
listBoxRMultiplier[i].mouseMove(x, y);
|
||||
listBoxControls[i].mouseMove(x, y);
|
||||
listBoxFactions[i].mouseMove(x, y);
|
||||
listBoxTeams[i].mouseMove(x, y);
|
||||
|
@ -1186,7 +1208,9 @@ void MenuStateCustomGame::render() {
|
|||
renderer.renderLabel(&labelPlayerNames[i]);
|
||||
|
||||
renderer.renderListBox(&listBoxControls[i]);
|
||||
|
||||
if(listBoxControls[i].getSelectedItemIndex()!=ctClosed){
|
||||
renderer.renderListBox(&listBoxRMultiplier[i]);
|
||||
renderer.renderListBox(&listBoxFactions[i]);
|
||||
renderer.renderListBox(&listBoxTeams[i]);
|
||||
renderer.renderLabel(&labelNetStatus[i]);
|
||||
|
@ -1210,6 +1234,7 @@ void MenuStateCustomGame::render() {
|
|||
renderer.renderLabel(&labelMapFilter);
|
||||
renderer.renderLabel(&labelTechTree);
|
||||
renderer.renderLabel(&labelControl);
|
||||
//renderer.renderLabel(&labelRMultiplier);
|
||||
renderer.renderLabel(&labelFaction);
|
||||
renderer.renderLabel(&labelTeam);
|
||||
renderer.renderLabel(&labelMapInfo);
|
||||
|
@ -1906,7 +1931,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings) {
|
|||
//labelPlayerNames[i].setText(getHumanPlayerName(i));
|
||||
//SetActivePlayerNameEditor();
|
||||
}
|
||||
|
||||
gameSettings->setResourceMultiplier(slotIndex, rMultiplierOffset+listBoxRMultiplier[i].getSelectedItemIndex()*0.1f);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] i = %d, factionFiles[listBoxFactions[i].getSelectedItemIndex()] [%s]\n",__FILE__,__FUNCTION__,__LINE__,i,factionFiles[listBoxFactions[i].getSelectedItemIndex()].c_str());
|
||||
gameSettings->setFactionTypeName(slotIndex, factionFiles[listBoxFactions[i].getSelectedItemIndex()]);
|
||||
if(factionFiles[listBoxFactions[i].getSelectedItemIndex()] == formatString(GameConstants::OBSERVER_SLOTNAME)) {
|
||||
|
@ -1973,6 +1998,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings) {
|
|||
gameSettings->setFactionControl(slotIndex, ct);
|
||||
gameSettings->setTeam(slotIndex, listBoxTeams[i].getSelectedItemIndex());
|
||||
gameSettings->setStartLocationIndex(slotIndex, i);
|
||||
gameSettings->setResourceMultiplier(slotIndex, 1.0f);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] i = %d, factionFiles[listBoxFactions[i].getSelectedItemIndex()] [%s]\n",__FILE__,__FUNCTION__,__LINE__,i,factionFiles[listBoxFactions[i].getSelectedItemIndex()].c_str());
|
||||
gameSettings->setFactionTypeName(slotIndex, factionFiles[listBoxFactions[i].getSelectedItemIndex()]);
|
||||
|
@ -2044,6 +2070,7 @@ void MenuStateCustomGame::saveGameSettingsToFile(std::string fileName) {
|
|||
int slotIndex = gameSettings.getStartLocationIndex(i);
|
||||
|
||||
saveGameFile << "FactionControlForIndex" << slotIndex << "=" << gameSettings.getFactionControl(i) << std::endl;
|
||||
saveGameFile << "ResourceMultiplier" << slotIndex << "=" << gameSettings.getResourceMultiplier(i) << std::endl;
|
||||
saveGameFile << "FactionTeamForIndex" << slotIndex << "=" << gameSettings.getTeam(i) << std::endl;
|
||||
saveGameFile << "FactionStartLocationForIndex" << slotIndex << "=" << gameSettings.getStartLocationIndex(i) << std::endl;
|
||||
saveGameFile << "FactionTypeNameForIndex" << slotIndex << "=" << gameSettings.getFactionTypeName(i) << std::endl;
|
||||
|
@ -2098,6 +2125,7 @@ GameSettings MenuStateCustomGame::loadGameSettingsFromFile(std::string fileName)
|
|||
//for(int i = 0; i < gameSettings.getFactionCount(); ++i) {
|
||||
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
||||
gameSettings.setFactionControl(i,(ControlType)properties.getInt(string("FactionControlForIndex") + intToStr(i),intToStr(ctClosed).c_str()) );
|
||||
gameSettings.setResourceMultiplier(i,properties.getFloat(string("ResourceMultiplier") + intToStr(i)));
|
||||
gameSettings.setTeam(i,properties.getInt(string("FactionTeamForIndex") + intToStr(i),"0") );
|
||||
gameSettings.setStartLocationIndex(i,properties.getInt(string("FactionStartLocationForIndex") + intToStr(i),intToStr(i).c_str()) );
|
||||
gameSettings.setFactionTypeName(i,properties.getString(string("FactionTypeNameForIndex") + intToStr(i),"?") );
|
||||
|
@ -2166,6 +2194,7 @@ GameSettings MenuStateCustomGame::loadGameSettingsFromFile(std::string fileName)
|
|||
//for(int i = 0; i < gameSettings.getFactionCount(); ++i) {
|
||||
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
||||
listBoxControls[i].setSelectedItemIndex(gameSettings.getFactionControl(i));
|
||||
listBoxRMultiplier[i].setSelectedItemIndex((gameSettings.getResourceMultiplier(i)-rMultiplierOffset)*10);
|
||||
listBoxTeams[i].setSelectedItemIndex(gameSettings.getTeam(i));
|
||||
lastSelectedTeamIndex[i] = listBoxTeams[i].getSelectedItemIndex();
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ private:
|
|||
GraphicButton buttonPlayNow;
|
||||
GraphicButton buttonRestoreLastSettings;
|
||||
GraphicLabel labelControl;
|
||||
GraphicLabel labelRMultiplier;
|
||||
GraphicLabel labelFaction;
|
||||
GraphicLabel labelTeam;
|
||||
GraphicLabel labelMap;
|
||||
|
@ -60,6 +61,7 @@ private:
|
|||
GraphicLabel labelPlayers[GameConstants::maxPlayers];
|
||||
GraphicLabel labelPlayerNames[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxControls[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxRMultiplier[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxFactions[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxTeams[GameConstants::maxPlayers];
|
||||
GraphicLabel labelNetStatus[GameConstants::maxPlayers];
|
||||
|
@ -138,6 +140,7 @@ private:
|
|||
|
||||
bool autostart;
|
||||
std::map<int,int> lastSelectedTeamIndex;
|
||||
float rMultiplierOffset;
|
||||
|
||||
public:
|
||||
MenuStateCustomGame(Program *program, MainMenu *mainMenu ,bool openNetworkSlots= false, bool parentMenuIsMasterserver=false, bool autostart=false);
|
||||
|
|
|
@ -237,6 +237,7 @@ NetworkMessageLaunch::NetworkMessageLaunch(const GameSettings *gameSettings,int8
|
|||
data.factionTypeNames[i]= gameSettings->getFactionTypeName(i);
|
||||
data.networkPlayerNames[i]= gameSettings->getNetworkPlayerName(i);
|
||||
data.factionControls[i]= gameSettings->getFactionControl(i);
|
||||
data.resourceMultiplier[i]= 10*(gameSettings->getResourceMultiplier(i));
|
||||
data.teams[i]= gameSettings->getTeam(i);
|
||||
data.startLocationIndex[i]= gameSettings->getStartLocationIndex(i);
|
||||
}
|
||||
|
@ -265,6 +266,7 @@ void NetworkMessageLaunch::buildGameSettings(GameSettings *gameSettings) const{
|
|||
gameSettings->setFactionTypeName(i, data.factionTypeNames[i].getString());
|
||||
gameSettings->setNetworkPlayerName(i,data.networkPlayerNames[i].getString());
|
||||
gameSettings->setFactionControl(i, static_cast<ControlType>(data.factionControls[i]));
|
||||
gameSettings->setResourceMultiplier(i,data.resourceMultiplier[i]*0.1f);
|
||||
gameSettings->setTeam(i, data.teams[i]);
|
||||
gameSettings->setStartLocationIndex(i, data.startLocationIndex[i]);
|
||||
}
|
||||
|
|
|
@ -195,6 +195,7 @@ private:
|
|||
NetworkString<maxSmallStringSize> networkPlayerNames[GameConstants::maxPlayers]; //networkPlayerNames
|
||||
|
||||
int8 factionControls[GameConstants::maxPlayers];
|
||||
int8 resourceMultiplier[GameConstants::maxPlayers];
|
||||
|
||||
int8 thisFactionIndex;
|
||||
int8 factionCount;
|
||||
|
|
|
@ -839,6 +839,7 @@ void UnitUpdater::updateHarvest(Unit *unit) {
|
|||
if(unit->getFaction()->getCpuMegaControl()){
|
||||
resourceAmount*= megaResourceFactor;
|
||||
}
|
||||
resourceAmount*=game->getGameSettings()->getResourceMultiplier(unit->getFaction()->getIndex());
|
||||
unit->getFaction()->incResourceAmount(unit->getLoadType(), resourceAmount);
|
||||
world->getStats()->harvest(unit->getFactionIndex(), resourceAmount);
|
||||
scriptManager->onResourceHarvested();
|
||||
|
|
Loading…
Reference in New Issue