Commit Graph

83 Commits

Author SHA1 Message Date
rubidium c87722e428 (svn r11074) [0.5] -Backport from trunk (r11040):
- Fix: Removing CMD_AUTO from some commands could remotely trigger an assertion [FS#1179] (r11040)
2007-09-09 20:52:54 +00:00
rubidium 70d43a7b37 (svn r11073) [0.5] -Backport from trunk (r11039, r11029, r11027, r11024, r11021, r11020, r11018):
- Fix: Underflow that caused overflows in the performance rating [FS#1179] (r11039)
- Fix [Windows]: MIDI does not stop when closing openttd [FS#1164] (r11029)
- Fix: Do not unconditionally assume that a tile has a depot (r11027)
- Fix: Give a more correct error when building some things on tile 0 [FS#1173] (r11024)
- Fix: Do not display income/expenses when they do not belong to a "valid" tile, like the money cheat and giving money [FS#1175] (r11021)
- Fix: One could not give money when (s)he had too much money [FS#1174] (r11020)
- Fix: Disallow buying/selling shares in your own company or a bankrupt company [FS#1169] (r11018)
2007-09-09 20:36:15 +00:00
rubidium 2c6a0e46a9 (svn r9856) [0.5] -Backport from trunk (r9855):
- Fix: Do not perform any commands on MP_VOID tiles [FS#779] (r9855)
2007-05-16 08:21:16 +00:00
Darkvater 06367834c6 (svn r8174) -Backport from trunk (r8027, r8028, r8043, r8132):
- (FS#486) pause command issues with shift-pressed did not pause the game, interference with pause_on_join (r8027)
 - overflow of ticks was not handled properly, possibly resulting a non-reacting gameserver/gameclient (r8028, r8043)
 - The game could crash when the chat key (<ENTER>) is pressed too quickly during join (r8132)
2007-01-17 00:20:23 +00:00
Darkvater 73ca5faa2e (svn r7125) -Fix: Several errors/glitches related to multiplayer and bankrupcy, mainly such a
thing happening to a server, and non updated company-information. Also fixes FS#393.
2006-11-10 17:52:51 +00:00
Darkvater 6b6d908308 (svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
actual playable player (< MAX_PLAYERS) or not.
2006-10-14 22:31:18 +00:00
Darkvater dad5d5dd72 (svn r6774) -Codechange: Rename the badly named OWNER_SPECTATOR to PLAYER_SPECTATOR and
put it into player.h where it belongs (instead of map.h)
2006-10-14 15:49:43 +00:00
bjarni ea63050d5f (svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
Example: make a train transport iron ore from A to B, then it visits a depot and refits to steel
     It then transport steel back to A or near A if there is a factory and then it visits another depot to refit to iron ore again

   This is controlled in the orders. If a goto depot order is lightlighted, then "Unload" changes to "Refit"
   Control click "Refit" removes the refit part of the order (as the tooltip says)
   The player will still pay the normal refit costs

   Known issues:
      If a vehicle is not in a depot, then the refit window will fail to tell refitted cargo capacity
      Refit costs in the refit window can sometimes print 0 when it should not because the refit calculation is unaware that the vehicle will be refitted in between

   Warning: autoreplace got a protection against replacing something so you get a new cargo type, but it can fail here. In the iron ore/steel example, it can see that
      the vehicle carries iron ore and the new one can be refitted to iron ore, then it will replace. It will not check to see that it's valid for steel as well.
      This is something to look into in the future
2006-10-03 14:52:39 +00:00
bjarni 371f080182 (svn r6552) -Feature: [depot window] added a "autoreplace all vehicles in depot" button
Like the "sell all" button, this one lacks a sprite as well. We will hopefully get one shortly
2006-09-28 14:17:08 +00:00
peter1138 f469d3fe76 (svn r6544) - Codechange: Rename CmdReplaceVehicle to CmdSetAutoReplace, to reflect what it does. 2006-09-28 07:02:55 +00:00
bjarni 2579b68e34 (svn r6542) -Feature: [depot window] added a "sell all vehicles in depot" button
It's right below the sell button (sell whole chain button for trains)
   It's still missing a sprite. That one will be added as soon as anybody draws something we can use
   To make room for this button, all depots except train depots now opens with an additional row and can't be resized shorter than that
2006-09-27 22:44:39 +00:00
bjarni 1d554da2fc (svn r6515) -Feature: added "start all" and "stop all" buttons to the depot windows 2006-09-26 19:20:35 +00:00
truelight 10b842bddc (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin)
  - Load heightmaps (either BMP or PNG)
  - Progress dialog while generating worlds (no longer a 'hanging' screen)
  - New dialogs for NewGame, Create Scenario and Play Heightmap
    - Easier to configure your landscape
    - More things to configure (tree-placer, ..)
  - Speedup of world generation
  - New console command 'restart': restart the map EXACTLY as it was when you
      first started it (needs a game made after or with this commit)
  - New console command 'getseed': get the seed of your map and share it with
      others (of course only works with generated maps)
  - Many new, world generation related, things
  - Many internal cleanups and rewrites
  Many tnx to those people who helped making this:
     Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic)
  Many tnx to those who helped testing:
     Arnau, Bjarni, and tokai (alfabetic)
  And to all other people who helped testing and sending comments / bugs
  Stats: 673 lines changed, 3534 new lines, 79 new strings
2006-08-19 10:00:30 +00:00
tron 0a72639c2d (svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc. 2006-06-10 08:37:41 +00:00
peter1138 62dcad4e65 (svn r5192) - Stylechange: fix bjarni's tabs-instead-of-spaces alignment 2006-06-09 08:26:22 +00:00
peter1138 e679cfe802 (svn r5191) - NewGRF: add cargo refit support for road vehicles 2006-06-09 07:45:26 +00:00
tron 81e6d68f95 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
Remove DoCommandByTile(), because now it does the same as DoCommand()
2006-04-10 07:15:58 +00:00
celestar 3aa1e38be6 (svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE 2006-04-03 05:32:11 +00:00
tron 214b5eb42f (svn r3827) Remove the global variable _error_message_2, it's only used as local variable 2006-03-12 10:15:36 +00:00
tron 72b70fa042 (svn r3368) Fix the same type of off-by-one error when checking, if the passed coordinate is on the map, like in r3357, but this time in DoCommandP - *cough* code duplication *cough* 2006-01-05 21:50:09 +00:00
tron af70b49bf7 (svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
As side effect this is a
-Fix: The default AI tried to change the service intervals of vehicles via the CMD_CHANGE_TRAIN_SERVICE_INT command - regardless of the type of the vehicle - which of course failed for non-trains
2006-01-05 21:35:54 +00:00
tron 608e9a7203 (svn r3357) Fix an off-by-one error in checking if a coordinate passed to a command is on the map 2005-12-30 14:28:32 +00:00
Darkvater e744bbee59 (svn r3319) - Fix (regression): "Unnamed Competitors". A result of revision r3224 which allowed AI's for multiplayer. Old AI's didn't function correctly anymore. The update of last-built tile is moved back, but to a slightly different place so it is only executed when the command is actually successfully executed. This code shouldn't be neccessary, but alas, the old AI doesn't use DoCommandDP() functions. 2005-12-18 22:48:45 +00:00
tron b06b3e2ca2 (svn r3313) Remove GPMI related changes from trunk
Revisions in detail: 2542, 3226 (partial), 3229, 3231, 3232, 3238, 3242-3245, 3251, 3253, 3260, 3263, 3265, 3266, 3269, 3277, 3278, 3279, 3283 (partial), 3304, 3305, 3306
2005-12-18 12:10:46 +00:00
truelight f94da63a8d (svn r3304) -Add: allow AI-events to see the UID of the command
-Fix: improved the logic of the UID code for AIs
2005-12-14 14:38:23 +00:00
Darkvater 56998926e7 (svn r3294) - Fix: use INVALID_STRING_ID instead of -1.
- Fix: savegames only give back one message, show this by ignoring the first argument. Perhaps make the message more verbose in the future by adding STR_ equivalents next to the already existing debug messages.
2005-12-13 21:21:57 +00:00
truelight 0f2a0df165 (svn r3260) -Add: add events for AIs to check if a command execution failed or succeeded 2005-12-05 12:27:58 +00:00
truelight 31f218fdf9 (svn r3224) -Add: Allow the NewAI to work in Multiplayer Games (switchable via patch
settings, off by defaut). An other step to AIScripts.
      WARNING: this is still highly experimental and has known bugs!
2005-11-21 14:28:31 +00:00
tron 24f857ed5e (svn r3187) Simplify overly complicated ifs, especially if (foo) return false; else return true; is confusing 2005-11-15 09:47:25 +00:00
Darkvater 2131f68ae2 (svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
- Add IsLocalPlayer() which substitutes _local_player == _current_player
2005-09-14 18:03:38 +00:00
tron 2b4e85db0b (svn r2828) Only command.c needs to know about _docommand_recursive, so make it static. Tell me if there's a problem, because i removed it from network_server.c, but afaict it should be ok 2005-08-07 10:03:14 +00:00
bjarni 546c34f2e5 (svn r2764) -Feature: Clone vehicles
-This allows a player to clone an excisting vehicle of his own
  -[fix]: this uncovered an excisting bug in CmdBuildRailVehicle() where depots could build trains of the wrong track type. This is fixed
  -Thanks to Celestar for drawing the sprites and _luca_ for including them in openttd.grf
2005-07-31 13:08:08 +00:00
tron af9f55c977 (svn r2720) Remove unused declarations and definitions 2005-07-26 19:34:03 +00:00
tron a227065ab7 (svn r2701) Insert Id tags into all source files 2005-07-24 14:12:37 +00:00
tron 559babcdc9 (svn r2673) Include functions.h directly, not globally via openttd.h 2005-07-22 07:02:20 +00:00
tron 0762aa9ec9 (svn r2669) Shuffle some more stuff around to reduce dependencies 2005-07-21 22:15:02 +00:00
tron 61f6f07edd (svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY 2005-06-25 06:15:43 +00:00
celestar aa7334a3ec (svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer 2005-06-21 16:28:17 +00:00
Darkvater b438b1248c (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files. 2005-06-02 19:30:21 +00:00
Darkvater 00cf2eae38 (svn r2383) - Fix: Monkey-testing turned up some command crashes. 2005-05-30 14:45:36 +00:00
Darkvater 1c22cea02d (svn r2343) - Fix (regression): dedicated server caused desyncs with its commands, because the player sent over the network is OWNER_SPECTATOR as well, which on clients cannot execute anything. So *hack*hack* it into temporarily player 0. 2005-05-17 20:52:52 +00:00
Darkvater 54b7fb0203 (svn r2339) - Fix: on a dedicated server, after the joining of a player, the player was set to player 0 instead of remaining OWNER_SPECTATOR. Fix this, and allow the dedicated server to execute commands (so 'patch <value>') now works and not only when a client is connected. 2005-05-17 18:22:59 +00:00
tron fea5965679 (svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes. 2005-05-15 18:50:55 +00:00
Darkvater 2bf3d14dfc (svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
- CodeChange: move ValParamRailtype() to check rail type from command.h to vehicle.h where it is better suited.
2005-05-14 19:25:18 +00:00
Darkvater 5174d3adfe (svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks" 2005-05-14 12:36:16 +00:00
Darkvater 033995ec6e (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
- CodeChange: remove cmd-misuses CmdStartScenario() and CmdDestroyCompanyHQ()
- Fix (invisible): when parameter checking CmdRestoreOrderIndex() the vehicle did not have its orders yet, so it would fail. So move doing this until AFTER the orders have been added back in RestoreVehicleOrders()
2005-05-12 23:46:01 +00:00
Darkvater c626555f68 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
- CodeChange: renamed CmdTrainGotoDepot() to CmdSendTrainToDepot() to be consistent with other depot commands.
- CodeChange: 'newgame' console command now calls the unabused GenRandomNewGame(). For the server it still creates a new game, a client quits the game and continues in SP.
- CodeChange: in the game-difficulty window, setup the disabled buttons on window creation, not every redraw.
2005-05-12 00:18:30 +00:00
Darkvater 5e6923e936 (svn r2290) - CodeChange: protect the next batch of commands. This brings us to a total of 61, which is 53% :)
- CodeChange: To correctly accept engine-prototypes, the best-player checking has been moved to its own function, I hope it functions the same as before.
- CodeChange: Added symbolic types of PlayerID, OrderID and EngineID. For engines also added GetEngine() and IsEngineIndex(), similar to the other such functions.
- CodeChange: To correctly build industries, some tables have been moved to build_industry.h. The only way to find out currently if an industry is valid in a climate is by looping all industries and checking if it matches. Also to comply with the patch setting build_rawmaterial_industries, it is assumed that these industries do not accept any cargo of any type. This can and probably should changed in the future to some flag in their struct. Also use _opt_ptr instead of _opt.
- CodeChange: implemented the HQ checking code inspired by MarkR2 in "[ 1190944 ] Many commands not checked for security".  Unfortunately it is impossible to prevent only deleting a HQ by a modified client atm.
- CodeChange: For insert order and modify order their parameters are implicitely truncated to 8 bits, instead of the 16 bits said in the comments.
2005-05-11 00:00:27 +00:00
Darkvater ab954a934a (svn r2288) - CodeChange: protected the next batch of commands (41 so far, out of 115).
- CodeChange: changed the airport gui airport-type checking. Added function GetValidAirports() that returns bitmasked availibility, is also used for checking.
- CodeChange: to check tree-planting, 2 const arrays have been moved to table/tree_land.h (type and count)
- CodeChange: added IsTownIndex() in following of IsStationIndex(), etc.
- Fix (regression): road tunnels did not work anymore, forgot that their type was 0x200 (documented now)
2005-05-09 22:33:00 +00:00
Darkvater edd8c87502 (svn r2286) - CodeChange: paramcheck the next batch of commands.
- Fix (regression): fix up terraform land where every player can terraform land (towns, map generation), and player can terraform different corners; used for building tunnels
2005-05-09 16:37:40 +00:00