[SOLVED][Bug Population] res_xxxxxxxxxxxx
3 posters
Page 1 of 1
[SOLVED][Bug Population] res_xxxxxxxxxxxx
Why some residences have 0 population ? For res_italian_oldapts, the min population is 350/680 (in gamesettings.xml)
[You must be registered and logged in to see this image.]
The currentPopulation in database is stored at 0.
After manually collecting, I get +60 for 2 of them and now the bot show :
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this image.]
The currentPopulation in database is stored at 0.
After manually collecting, I get +60 for 2 of them and now the bot show :
[You must be registered and logged in to see this image.]
Last edited by rlff38 on Thu Apr 26, 2012 6:56 pm; edited 1 time in total
rlff38- Posts : 120
Points : 126
Join date : 2011-12-27
Location : France
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
rlff38 wrote:Why some residences have 0 population ? For res_italian_oldapts, the min population is 350/680 (in gamesettings.xml)
[You must be registered and logged in to see this image.]
The currentPopulation in database is stored at 0.
After manually collecting, I get +60 for 2 of them and now the bot show :
[You must be registered and logged in to see this image.]
They don't really have 0 population.
Current population just does not get set until the first move in occurs. I have a fix. It will be included in the next release.
Little Todd- Posts : 409
Points : 425
Join date : 2012-02-23
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
Thx Todd
I think a new method xmlsOb::GetResidencesBasePopulation($name) will be welcome in ./codebase-php/GetSettingsFromXml.php
maybe this one :
Tested and works perfectly
I think a new method xmlsOb::GetResidencesBasePopulation($name) will be welcome in ./codebase-php/GetSettingsFromXml.php
maybe this one :
- Code:
function GetResidencesBasePopulation($name) {
foreach ($this->gsXML->items->item as $item) {
if ($item['name'] == $name) {
if (!isset($item->populationBase)) {
$res = $this->GetResidencesBasePopulation( (string)$item['derivesFrom'] ); //recursive callback
break;
}
$res = (string)$item->populationBase;
break;
}
}
return $res;
}
Tested and works perfectly
rlff38- Posts : 120
Points : 126
Join date : 2011-12-27
Location : France
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
rlff38 wrote:Thx Todd
I think a new method xmlsOb::GetResidencesBasePopulation($name) will be welcome in ./codebase-php/GetSettingsFromXml.php
maybe this one :
- Code:
function GetResidencesBasePopulation($name) {
foreach ($this->gsXML->items->item as $item) {
if ($item['name'] == $name) {
if (!isset($item->populationBase)) {
$res = $this->GetResidencesBasePopulation( (string)$item['derivesFrom'] ); //recursive callback
break;
}
$res = (string)$item->populationBase;
break;
}
}
return $res;
}
Tested and works perfectly
Yes, that function is required in GetSettingsFromXml.php, but a call to that function is needed in the buildings class file. Did you edit the class file also?
Little Todd- Posts : 409
Points : 425
Join date : 2012-02-23
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
Little Todd wrote:Yes, that function is required in GetSettingsFromXml.php, but a call to that function is needed in the buildings class file. Did you edit the class file also?
Yes, near line 357. in Buildings_class.php
- Code:
foreach ($resI as $id=>$item)
{
$obj = $this->ld->GetObjectById($id);
$pop = $obj["currentPopulation"]*10;
// -- [START] -- ADDED FOR BUG POPULATION
if($pop == 0)
$pop = $xmlsOb->GetResidencesBasePopulation($item)*10;
// -- [END] -- ADDED FOR BUG POPULATION
$popmax = $xmlsOb->GetResidencesMaxPopulation($item)*10;
$popstats = $pop." / ".$popmax;
if ($popmax - $pop == 0) {$full = "(FULL) ";} else {$full = "";}
$resIN .= '<option value="'.$id.'">'.$full.$item." ($id) : $popstats</option>";
}
foreach ($resN as $id=>$item)
{
$obj = $this->ld->GetObjectById($id);
$pop = $obj["currentPopulation"]*10;
// -- [START] -- ADDED FOR BUG POPULATION
if($pop == 0)
$pop = $xmlsOb->GetResidencesBasePopulation($item)*10; //
// -- [END] -- ADDED FOR BUG POPULATION
$popmax = $xmlsOb->GetResidencesMaxPopulation($item)*10;
$popstats = $pop." / ".$popmax;
if ($popmax - $pop == 0) {$full = "(FULL) ";} else {$full = "";}
$resNOT .= '<option value="'.$id.'">'.$full.$item." ($id) : $popstats</option>";
}
and near line 375, in Buildings-DownTown_class.php
- Code:
foreach ($resI as $id=>$item)
{
$obj = $this->ld->GetDTObjectById($id);
$pop = $obj["currentPopulation"]*10;
// -- [START] -- ADDED FOR BUG POPULATION
if($pop == 0)
$pop = $xmlsOb->GetResidencesBasePopulation($item)*10;
// -- [END] -- ADDED FOR BUG POPULATION
$popmax = $xmlsOb->GetResidencesMaxPopulation($item)*10;
$popstats = $pop." / ".$popmax;
if ($popmax - $pop == 0) {$full = "(FULL) ";} else {$full = "";}
$resIN .= '<option value="'.$id.'">'.$full.$item." ($id) : $popstats</option>";
}
foreach ($resN as $id=>$item)
{
$obj = $this->ld->GetDTObjectById($id);
$pop = $obj["currentPopulation"]*10;
// -- [START] -- ADDED FOR BUG POPULATION
if($pop == 0)
$pop = $xmlsOb->GetResidencesBasePopulation($item)*10;
// -- [END] -- ADDED FOR BUG POPULATION
$popmax = $xmlsOb->GetResidencesMaxPopulation($item)*10;
$popstats = $pop." / ".$popmax;
if ($popmax - $pop == 0) {$full = "(FULL) ";} else {$full = "";}
$resNOT .= '<option value="'.$id.'">'.$full.$item." ($id) : $popstats</option>";
}
But the problem is why the database store 0 if the residence's population = populationBase ?
Last edited by rlff38 on Thu Apr 26, 2012 8:22 pm; edited 1 time in total
rlff38- Posts : 120
Points : 126
Join date : 2011-12-27
Location : France
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
Problem fixed in v1.2
[PLUGIN] Buildings-DownTown v1.2 (26/04/2112)
[PLUGIN] Buildings-DownTown v1.2 (26/04/2112)
Little Todd- Posts : 409
Points : 425
Join date : 2012-02-23
RE: res
This fixes the residents in the boxes but not the custom houses and the skyscrapers
blwilli12- Posts : 15
Points : 25
Join date : 2011-10-09
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
blwilli12 wrote:This fixes the residents in the boxes but not the custom houses and the skyscrapers
Can you post a screen shot of the bot and one of the item in game showing the difference?
Thanks.
Little Todd- Posts : 409
Points : 425
Join date : 2012-02-23
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
Little Todd wrote:blwilli12 wrote:This fixes the residents in the boxes but not the custom houses and the skyscrapers
Can you post a screen shot of the bot and one of the item in game showing the difference?
Thanks.
[You must be registered and logged in to see this image.]
the wintercastle without the fix gave a 0 pop and with the fix the pop is show right as in the pic above but as you can see the second custom house and the japanese skyscraper is showing 0 pop as seen in the pic above. The pic shows the building in question are shown bellow.
[You must be registered and logged in to see this image.]
blwilli12- Posts : 15
Points : 25
Join date : 2011-10-09
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
blwilli12 wrote:Little Todd wrote:blwilli12 wrote:This fixes the residents in the boxes but not the custom houses and the skyscrapers
Can you post a screen shot of the bot and one of the item in game showing the difference?
Thanks.
[You must be registered and logged in to see this image.]
the wintercastle without the fix gave a 0 pop and with the fix the pop is show right as in the pic above but as you can see the second custom house and the japanese skyscraper is showing 0 pop as seen in the pic above. The pic shows the building in question are shown bellow.
[You must be registered and logged in to see this image.]
Thanks,
I will work on getting a fix.
Little Todd- Posts : 409
Points : 425
Join date : 2012-02-23
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
For CustomResidence:
in Buildings-DownTown_class.php,
~LINE 584 FIND:
For Skyscraper:
in Buildings-DownTown_class.php,
~LINE 673 FIND:
For testing, try adding a new CustomResidence & Skyscraper and run the bot (on plugin page, right click->refresh)
in Buildings-DownTown_class.php,
~LINE 584 FIND:
- Code:
$pop = $obj['currentPopulation']*10;
- Code:
if ($pop == 0) {$pop = $this->xmlsOb->GetResidencesBasePopulation($obj['itemName'])*10;}
For Skyscraper:
in Buildings-DownTown_class.php,
~LINE 673 FIND:
- Code:
$pop = $obj['currentPopulation']*10;
- Code:
if ($pop == 0) {$pop = $this->xmlsOb->GetResidencesBasePopulation($obj['itemName'])*10;}
For testing, try adding a new CustomResidence & Skyscraper and run the bot (on plugin page, right click->refresh)
Last edited by rlff38 on Thu May 03, 2012 7:45 am; edited 1 time in total
rlff38- Posts : 120
Points : 126
Join date : 2011-12-27
Location : France
Re:
got this error when putting line of code in for the skyscrapers
Fatal error: Call to a member function GetResidencesBasePopulation() on a non-object in C:\Program Files (x86)\CVBot - Project DEVIL\Plugins\Buildings\Buildings_class.php on line 562
Fatal error: Call to a member function GetResidencesBasePopulation() on a non-object in C:\Program Files (x86)\CVBot - Project DEVIL\Plugins\Buildings\Buildings_class.php on line 562
blwilli12- Posts : 15
Points : 25
Join date : 2011-10-09
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
blwilli12 wrote:got this error when putting line of code in for the skyscrapers
Fatal error: Call to a member function GetResidencesBasePopulation() on a non-object in C:\Program Files (x86)\CVBot - Project DEVIL\Plugins\Buildings\Buildings_class.php on line 562
It's for Buildings-DownTown_class.php, not Buildings_class.php
But if you want the same for building_class.php only, try to add this line if not exist :
- Code:
if($pop == 0) {$pop = $xmlsOb->GetResidencesBasePopulation($obj['itemName'])*10;}
rlff38- Posts : 120
Points : 126
Join date : 2011-12-27
Location : France
Re:
ok that line of code fix the problem.
Thank you
P.S the custom houses and skyscraper collection is only on the buildings plugin after the 1.5.6 update
Thank you
P.S the custom houses and skyscraper collection is only on the buildings plugin after the 1.5.6 update
blwilli12- Posts : 15
Points : 25
Join date : 2011-10-09
Re: [SOLVED][Bug Population] res_xxxxxxxxxxxx
blwilli12 wrote:ok that line of code fix the problem.
Thank you
P.S the custom houses and skyscraper collection is only on the buildings plugin after the 1.5.6 update
I don't think that, because the version 1.5.6 shows only what you have in downtown's plugin.
You can try to build a new custom residence and/or skyscraper in downtown.
rlff38- Posts : 120
Points : 126
Join date : 2011-12-27
Location : France
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Mon Apr 20, 2015 1:52 pm by ertyanna
» expansions cityville hack new 12/12/15
Sat Feb 14, 2015 9:52 pm by nico
» Biohazard Problem Expansion
Sat Nov 08, 2014 3:12 pm by CV FO LIFE
» CAN SOMEONE HELP ME?
Sat Nov 08, 2014 3:09 pm by CV FO LIFE
» hello friends i have new update of cv bot project devil 1.10 update (2.01)
Sat Nov 01, 2014 12:59 pm by Blue Angel
» [Resolved] codebase-php Error
Sun Oct 12, 2014 7:22 am by nico
» -_- Which bot is now working ????
Thu Oct 09, 2014 7:06 pm by lobobpf6
» bot 1.2 does nt work
Sun Aug 10, 2014 1:00 am by nathaliafariass
» COMO FUNCIONA
Sun Aug 10, 2014 12:38 am by nathaliafariass