Changeset e194c56e3c8fb485594d6b4ab1d8239616cc5b18
- Timestamp:
- 08/04/07 11:47:53
(1 year ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1186220873 +0200
- git-parent:
[2e92c6caca0010d3684c3fd237c135402f416a4d]
- git-author:
- Sebastian Gift <Madison@gt-knm.de> 1186220873 +0200
- Message:
HP's akzeptieren nur noch soviele Waren bis sie voll sind
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3fc9e5f |
re194c56 |
|
| 142 | 142 | |
|---|
| 143 | 143 | ResourceList reslist = this.kurse.getResourceList(); |
|---|
| | 144 | long freeSpace = posten.getTypeData().getCargo() - posten.getCargo().getMass(); |
|---|
| 144 | 145 | for( ResourceEntry res : reslist ) { |
|---|
| 145 | 146 | parameterNumber( res.getId()+"to" ); |
|---|
| … | … | |
| 149 | 150 | if( tmp > shipCargo.getResourceCount( res.getId() ) ) { |
|---|
| 150 | 151 | tmp = shipCargo.getResourceCount( res.getId() ); |
|---|
| | 152 | } |
|---|
| | 153 | |
|---|
| | 154 | long resourceMass = Cargo.getResourceMass(res.getId(), 1); |
|---|
| | 155 | |
|---|
| | 156 | //Nicht mehr ankaufen als Platz da ist |
|---|
| | 157 | if(tmp*resourceMass > freeSpace) |
|---|
| | 158 | { |
|---|
| | 159 | tmp = freeSpace/resourceMass; |
|---|
| 151 | 160 | } |
|---|
| 152 | 161 | |
|---|
| … | … | |
| 170 | 179 | statsCargo.addResource( res.getId(), tmp ); |
|---|
| 171 | 180 | tpcargo.addResource( res.getId(), tmp ); |
|---|
| | 181 | //Freien Platz korrigieren |
|---|
| | 182 | freeSpace -= tmp; |
|---|
| 172 | 183 | } |
|---|
| 173 | 184 | } |
|---|
| … | … | |
| 186 | 197 | |
|---|
| 187 | 198 | redirect(); |
|---|
| | 199 | } |
|---|
| | 200 | |
|---|
| | 201 | private boolean isFull() |
|---|
| | 202 | { |
|---|
| | 203 | return posten.getTypeData().getCargo() <= posten.getCargo().getMass(); |
|---|
| 188 | 204 | } |
|---|
| 189 | 205 | |
|---|
| … | … | |
| 199 | 215 | |
|---|
| 200 | 216 | ResourceList reslist = this.kurse.getResourceList(); |
|---|
| 201 | | for( ResourceEntry res : reslist ) { |
|---|
| 202 | | if( !this.shipCargo.hasResource( res.getId() ) ) { |
|---|
| 203 | | continue; |
|---|
| | 217 | |
|---|
| | 218 | if(!isFull()) |
|---|
| | 219 | { |
|---|
| | 220 | t.set_var("is.full", 0); |
|---|
| | 221 | for( ResourceEntry res : reslist ) { |
|---|
| | 222 | if( !this.shipCargo.hasResource( res.getId() ) ) { |
|---|
| | 223 | continue; |
|---|
| | 224 | } |
|---|
| | 225 | |
|---|
| | 226 | String preis = ""; |
|---|
| | 227 | if( res.getCount1() < 50) { |
|---|
| | 228 | preis = "Kein Bedarf"; |
|---|
| | 229 | } |
|---|
| | 230 | else { |
|---|
| | 231 | preis = Common.ln(res.getCount1()/1000d)+" RE"; |
|---|
| | 232 | } |
|---|
| | 233 | |
|---|
| | 234 | t.set_var( "res.img", res.getImage(), |
|---|
| | 235 | "res.id", res.getId(), |
|---|
| | 236 | "res.name", res.getName(), |
|---|
| | 237 | "res.cargo", this.shipCargo.getResourceCount( res.getId() ), |
|---|
| | 238 | "res.re", preis ); |
|---|
| | 239 | |
|---|
| | 240 | t.parse("res.list","res.listitem",true); |
|---|
| 204 | 241 | } |
|---|
| 205 | | |
|---|
| 206 | | String preis = ""; |
|---|
| 207 | | if( res.getCount1() < 50) { |
|---|
| 208 | | preis = "Kein Bedarf"; |
|---|
| 209 | | } |
|---|
| 210 | | else { |
|---|
| 211 | | preis = Common.ln(res.getCount1()/1000d)+" RE"; |
|---|
| 212 | | } |
|---|
| 213 | | |
|---|
| 214 | | t.set_var( "res.img", res.getImage(), |
|---|
| 215 | | "res.id", res.getId(), |
|---|
| 216 | | "res.name", res.getName(), |
|---|
| 217 | | "res.cargo", this.shipCargo.getResourceCount( res.getId() ), |
|---|
| 218 | | "res.re", preis ); |
|---|
| 219 | | |
|---|
| 220 | | t.parse("res.list","res.listitem",true); |
|---|
| | 242 | } |
|---|
| | 243 | else |
|---|
| | 244 | { |
|---|
| | 245 | |
|---|
| | 246 | t.set_var( "is.full", true, |
|---|
| | 247 | "res.msg", "Dieser Handelsposten ist voll. Bitte beehre uns zu einem spÀteren Zeitpunkt erneut."); |
|---|
| 221 | 248 | } |
|---|
| 222 | 249 | } |
|---|
| r3924571 |
re194c56 |
|
| 9 | 9 | <form action="./ds" method="post"> |
|---|
| 10 | 10 | <table class="noBorderX" cellpadding="2" width="100%"> |
|---|
| | 11 | {if ! is.full} |
|---|
| 11 | 12 | <tr> |
|---|
| 12 | 13 | <td colspan="4" class="noBorderX"> |
|---|
| … | … | |
| 14 | 15 | </td> |
|---|
| 15 | 16 | </tr> |
|---|
| | 17 | {/endif} |
|---|
| | 18 | {if is.full} |
|---|
| | 19 | <tr> |
|---|
| | 20 | <td class="noBorderX" colspan="4" align="center">{res.msg}</td> |
|---|
| | 21 | </tr> |
|---|
| | 22 | {/endif} |
|---|
| 16 | 23 | <!-- BEGIN res.listitem --> |
|---|
| 17 | 24 | <tr> |
|---|
| … | … | |
| 22 | 29 | </tr> |
|---|
| 23 | 30 | <!-- END res.listitem --> |
|---|
| | 31 | {if ! is.full} |
|---|
| 24 | 32 | <tr> |
|---|
| 25 | 33 | <td class="noBorderX" colspan="4"> |
|---|
| … | … | |
| 33 | 41 | </td> |
|---|
| 34 | 42 | </tr> |
|---|
| | 43 | {/endif} |
|---|
| 35 | 44 | </table> |
|---|
| 36 | 45 | </form> |
|---|