Bug adding modded commercial building (Memory Overwritten towgen2.cpp line 355 )[solved]

Discussions about modding and share your mods with other players in this forum.
Post Reply
Pietro
Mod Contributor
Mod Contributor
Posts: 59
Joined: Thu Sep 15, 2016 2:50 am

Bug adding modded commercial building (Memory Overwritten towgen2.cpp line 355 )[solved]

Post by Pietro »

hello,

I am encountering a problem when adding some buildings :
caplab error mem overwriten.jpg
caplab error mem overwriten.jpg (906.18 KiB) Viewed 1471 times
I have narrowed the circumstances to when the city generation would be placing one of the 3 commercial building i'm trying to add. ( If you are patient enough it sometimes launch without bug if you start with only 1 city and happen to have a city that has no commercial building like a (-100).).

Here is a link to a version of the mod that triggers the bug : https://ufile.io/ljn7156f ( valid only 30 days).

I am posting this as a bug because for some reason the game behaved fine with only the first 2 commercial building, it's adding the 3rd one which created problem.

The game also behave fine when the 3 commercial buildings are loaded alone !

Here is a link to a version with only the 3 commercial buildings : https://ufile.io/dnm71y8i ( valid only 30 days).
Here is a link to a version with the rest of the things but without commercial building : https://ufile.io/meat5iwr ( valid only 30 days).

both works fine alone as far as i tested.

Here is what the building.dbf look like, with the green line is where i split the mod in 2 to test, and the red line what i added which started problem.
caplab buildata.jpg
caplab buildata.jpg (241.71 KiB) Viewed 1471 times
To be precise if the last of the 3 commercial building is made "HQ" type, the game has no problem launching and utilizing the images.
The following pictures shows an City-placed commercial building at 24.47%, i placed others and the headquarters that when placed as commercial building create problem to illustrate previous sentence.
imagesseemook.jpg
imagesseemook.jpg (1.03 MiB) Viewed 1471 times
What did i do wrong ?

It used to be called MODCOM3 instead of MODCC1 i changed it to avoid this problem but it didn't work.

My first idea for a mod was to add Hemp due to Cannabis being legalised in more country now than in 1990. So you could grow hemp, to get fiber or pulp, to make paper or textile. but you could also get some various cannabis for medical or recreative use, and also use hemp oil for cosmetics and also make haschich to reduce freight cost in exporting instead of shipping bulk mariuana and why not food or bioplastic or even cars parts !!! I was just testing with products and added others drugs because i thought it would be funny to see the AI sell cocaine in toy store. Then i looked for a greenhouse building to add to my mod to grow the marijuana in and found some interesting building on the internet, mostly belonging to a game called Megapolis. I liked them and got side-tracked trying to add them in the game during which i encountered the problem.

Maybe this explain why i'm not too keen on publishing the mod as it's not my IP, the product/hemp part, there would be no problem i think to find open source pictures, or i could make some myself for some of the drugs that are not illegal but the sprites of the real world buildings it's different. It happens to be all mixed because of how i started it but i'm considering balancing out the hemp mod or druglord mod i'm not quite sure yet as a stand alone. I'm no graphist i'm learning how to use the tools so no way i can make nice buildings like those in the picture yet :D

that's the first time i'm mentionning those experiments and share, so if you need other file than just the .RES please let me know, i think i used the file from the mod_kit and an existing banner that i customized, very standard things. Test being done with only 1 DLC, the subsidiary one. Version 7.1.12. I will gladly receive all feedback and help ! :)
Last edited by Pietro on Fri Jan 14, 2022 4:38 am, edited 1 time in total.
Pietro
Mod Contributor
Mod Contributor
Posts: 59
Joined: Thu Sep 15, 2016 2:50 am

Re: Bug adding modded commercial building (Memory Overwritten towgen2.cpp line 355 )

Post by Pietro »

Maybe a better way to describe how to reproduce :

Try this mod : https://capitalism2.com/forum/viewtopic.php?f=39&t=3863&

I have the same error Memory del overwritten towngen2.cpp line 355.

I was reading the forum because maybe i missed some keyword to find information to help on that problem.

Then i noticed there was many different commercial buildings on this mod, so i thought i would try and i received the same error message.

Maybe something as changed recently ? because the mod seems like it was functionning at the time from reading the post.

Maybe it's my version of the game ? but 7.1.12 i used from few month or 7.1.15 are giving me the same error.
User avatar
David
Community and Marketing Manager at Enlight
Posts: 9356
Joined: Sat Jul 03, 2010 1:42 pm
Has thanked: 17 times
Been thanked: 48 times

Re: Bug adding modded commercial building (Memory Overwritten towgen2.cpp line 355 )

Post by David »

I've forwarded your files to the programmer and he will look into it and provide you with a solution soon.
Pietro
Mod Contributor
Mod Contributor
Posts: 59
Joined: Thu Sep 15, 2016 2:50 am

Re: Bug adding modded commercial building (Memory Overwritten towgen2.cpp line 355 )

Post by Pietro »

Good to hear, let me know if i can be of some help, by providing additionnal files or explanations if required !
Pietro
Mod Contributor
Mod Contributor
Posts: 59
Joined: Thu Sep 15, 2016 2:50 am

Re: Bug adding modded commercial building (Memory Overwritten towgen2.cpp line 355 )

Post by Pietro »

Hey i had some free time and tried to find a work around to add buildings without the error showing up.

I had semi success but i think it can be of some help to precise the problem.

Here is a picture in game :
success.png
success.png (1.5 MiB) Viewed 1398 times
Those are all commercial buildings that the city can place itself sometimes at start up. Or availble for the player too.

Now the limit/problem :
limit.png
limit.png (34.78 KiB) Viewed 1398 times
This is the building.dbf , i have attempted to find how many building it was possible to add in each category and i'm using the result here :https://capitalism2.com/forum/viewtopic.php?f=39&t=8661

20HQ 17RD 6FARM 10FACTORY 10APARTMEN 10COMMERCI and 14MANSION are added to the game. It's not the maximum but i know those numbers are ok with original images from the game.

For now most graphic are placeholder. But for every building, the picture at the max zoom is a custom picture.

The problem i think is in the red box. I cannot change the size and reduce to 2x2. But the images are made for 2x2. If i write of APCOM2 in cell B67 instead of APCOM3, and make size 2x2 it shows the error from original post.


One thing maybe i made wrong assumption is that height and width being equal means a square base. Maybe width only define size of the base and height define the vertical axis cropping for the sprite.
I tried making a non-square base building like the 2x1 commercial building COMM3 but i got some other familiar errors. This is why i assume it is always square base for modded building.

I'm still working on adding the others buildings :)
CapitalismLabStory
Community Contributor
Community Contributor
Posts: 74
Joined: Fri Dec 10, 2021 10:30 am

Re: Bug adding modded commercial building (Memory Overwritten towgen2.cpp line 355 )

Post by CapitalismLabStory »

I just want to say I would love to do an Escobar type game lol if you don't mind sharing it?
It will be fun after seeing all these naro series lol
Pietro
Mod Contributor
Mod Contributor
Posts: 59
Joined: Thu Sep 15, 2016 2:50 am

Re: Bug adding modded commercial building (Memory Overwritten towgen2.cpp line 355 )

Post by Pietro »

i don't mind sharing it but it's not in a state where the mod website can accept it, it's too unfinished.

I will send you a link to the actual version i'm using if you want to see for yourself and if you have suggestion.

I had plans on making snoop dog and bob marley amongst the influential person and why not competitors, will also consider escobar !
CapitalismLabStory
Community Contributor
Community Contributor
Posts: 74
Joined: Fri Dec 10, 2021 10:30 am

Re: Bug adding modded commercial building (Memory Overwritten towgen2.cpp line 355 )

Post by CapitalismLabStory »

lol sounds like a good fun game to play for fun lol
Post Reply