Dancing Hoskuld
Deity
In your Manufactured Resources mod you have
and similar for when a unit is created. This means that the __init__ function is run for each player every turn and every time a unit is created. I know because I put a trace print in there to make sure I was doing things correctly.
Would it not be better and faster to create one instance at the start and then reuse it through out?
and
Code:
def onBeginPlayerTurn(self, argsList):
'Called at the beginning of a players turn'
iGameTurn, iPlayer = argsList
## Manufactured Resources ##
ManufacturedResource.ManufacturedResource().addResource(iGameTurn, iPlayer)
## Manufactured Resources ##
Would it not be better and faster to create one instance at the start and then reuse it through out?
Code:
## Manufactured Resources ##
import ManufacturedResource
## Manufactured Resources ##
mr = ManufacturedResource.ManufacturedResource()
and
Code:
def onBeginPlayerTurn(self, argsList):
'Called at the beginning of a players turn'
iGameTurn, iPlayer = argsList
## Manufactured Resources ##
mr.addResource(iGameTurn, iPlayer)
## Manufactured Resources ##